USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD...

27
USB Cloud Storage Gateway Intelligent Storage for Stupid Things David Disseldorp [email protected]

Transcript of USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD...

Page 1: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

USB Cloud Storage GatewayIntelligent Storage for Stupid Things

David Disseldorp [email protected]

Page 2: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

2

Agenda

• Project Introduction• Ceph• USB Storage• Demo!• Azure Blob Storage

• Linux I/O Target in Userspace• Future

Page 3: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

3

Hack Week

• What to hack on?‒ ARM board gathering dust

‒ Learn something new

‒ Storage is my day job

• I know...

Page 4: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

4

Project Idea

Page 5: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

5

Goals

• Access cloud storage from anything‒ Stereos, TVs, Phones, etc.

• Boot from cloud backed disk images‒ Ceph

‒ Azure

• Encryption• Simple device configuration

Page 6: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

6

Ceph

• Aggregate, manage and share storage resources• Highly available

‒ No single point of failure

• Self managing and self healing• Scalable

Page 7: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

7

Ceph

Page 8: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

8

Ceph RADOS Block Device

• Block device backed by RADOS objects• Thin provisioned• Resizeable• Supports snapshots and clones

• Linux kernel and user-space clients

Page 9: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

9

Hardware

Page 10: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

10

Hardware

• Mainline kernel support‒ sunxi community

• openSUSE Tumbleweed port• Relatively performant

‒ Multi-core ~1GHz CPU

‒ 512MB-2GB RAM

‒ USB2 and 100Mb-1Gb Ethernet

• Inexpensive

Page 11: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

11

USB Storage

• SCSI transport‒ Bulk-Only transport (BOT)

‒ USB Attached SCSI (UAS)‒ Faster: high-speed and super-speed specs

• Linux kernel USB gadget support‒ f_mass_storage.ko

‒ f_tcm.ko‒ Support for BOT and UAS

Page 12: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

12

USB Gateway

• Linux kernel does everything‒ Ceph RBD client

‒ USB device mode support

‒ Block device encryption (dm-crypt)

• Only need to handle configuration‒ Ceph credentials and image details

‒ dm-crypt key

‒ Perform RBD mapping and crypt setup once configured

Page 13: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

13

USB Gateway

Plug-inBootLinux

ProvisionConf-FS

AwaitEject

ConnectNetwork

CommitConf-FS

Fast Path

Map RBDImage

rbd-usb.confceph.conf

Ceph KeyringLUKS key

Encryption?Open LUKS

DeviceYes

ExposeVia USB

No

Page 14: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

Demo!

Page 15: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

15

Azure Blob Storage

• Public cloud storage‒ RESTful protocol

‒ Pay for what you use

• Page Blobs and Block Blobs‒ Page Blobs ideal for disk images

‒ Sparse object

‒ Accept 512-byte aligned I/Os at arbitrary offsets

‒ Premium accounts with QoS constraints

Page 16: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

16

●Linux I/O Target (LIO)

• In-kernel SCSI target‒ Pluggable transport and storage engine layers

‒ Transports: FC, iSCSI, loopback, USB, etc.

‒ Storage engines: file, block device, tcm-user (TCMU)

• TCMU‒ LIO storage engine in user-space

‒ SCSI pass-through

Page 17: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

17

●TCMU with Azure

• Elasto Cloud project‒ Azure Page Blob client written in C

‒ Also supports Azure File Service and Amazon S3 protocols

‒ POSIX like API

• TCMU Elasto handler‒ Maps SCSI I/O to Azure Page Blob REST requests

‒ Page Blobs accessible as regular block devices‒ Via supported LIO transports

Page 18: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

18

●Linux I/O Target with Azure

Elasto Client Library

Linux I/O Target

Filesystem

HTTP(S)

USB

SCSI

TCMU

USB Gadget

Page 19: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision
Page 20: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

20

Testing

• dummy_hcd on Linux‒ Re-route USB device traffic back to the local system

‒ USB high-speed and super-speed connection simulation

System

dummy_hcd.ko

USBDeviceDriver

USBGadget

AppUSB Host

Driver

Page 21: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

21

Future Challenges

• Concurrent image access‒ Currently must be manually avoided

• Use locking and snapshots?‒ Snapshot and lock on connect

‒ Subsequent connects expose snapshot

‒ Reference counting for cleanup

Page 22: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

22

Future Challenges

• Power‒ Battery to reduce reliance on USB supply

• f_tcm‒ Works in VM (loopback) but fails on board

‒ Needs super-speed support?

• Caching‒ Utilise on-board NAND

Page 23: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

23

Future Challenges

• Performance‒ Boot time critical

‒ Perform fast-path mapping in initramfs

‒ USB3+ and GbE/802.11ac‒ Price trade-off

‒ Not a priority for “stupid” devices

Page 24: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

24

Conclusion

• Ceph is great‒ Client availability limits adoption

• USB storage is accepted everywhere‒ A USB gateway can expose cloud storage to the masses

‒ Gateway encryption makes cloud storage use safer

• Cheap and portable hardware makes this viable‒ Mainline Linux support is a huge benefit

Page 25: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

Thank you.

Questions?

Page 26: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

Links:

github.com/ddiss/rbd-usbelastocloud.orggithub.com/open-iscsi/tcmu-runneren.opensuse.org/Portal:ARMlinux-sunxi.org

Page 27: USB Cloud Storage Gateway - FOSDEM · 2017-08-21 · •Demo! •Azure Blob ... ‒ Perform RBD mapping and crypt setup once configured. 13 USB Gateway Plug-in Boot Linux Provision

27

Have a Lot of Fun, and Join Us At:www.opensuse.org