Snapshot clone-boot-presentation-final

2,550 views

Published on

Published in: Technology, Business
  • Be the first to comment

Snapshot clone-boot-presentation-final

  1. 1. Snapshot, Clone, and Boot from volumeKazutaka Morita: NTT Cyber Space Labs. <morita.kazutaka@lab.ntt.co.jp>Isaku Yamahata: VA Linux Systems Japan K.K <yamahata@valinux.co.jp> <yamahata@private.email.ne.jp>Openstack design summit: April 28, 2011
  2. 2. Snapshot and Clone● Snapshot ● Create a self-consistent image of the volume ● You can use snapshots to take backups  $ ec2­create­snapshot volume_id  $ ec2­create­snapshot volume_id● Clone ● Create a new volume from the snapshot ● You can create lots of same volumes from one golden snapshot  $ ec2­create­volume –snapshot snapshot_id ­z zone  $ ec2­create­volume –snapshot snapshot_id ­z zone 2
  3. 3. ImplementationUser ISCSIDriver euca­create­snapshot AOEDriver SheepdogDriver RBDDriverEC2 API OpenStack API SanDriver Call create_snapshot nova-api nova-volume rpc 3
  4. 4. New methods to volume driverclass VolumeDriver(object):class VolumeDriver(object):    ...    ...    def create_snapshot(self, snapshot):    def create_snapshot(self, snapshot):        """Creates a snapshot."""        """Creates a snapshot."""        raise NotImplementedError()        raise NotImplementedError()    def delete_snapshot(self, snapshot):    def delete_snapshot(self, snapshot):        """Deletes a snapshot."""        """Deletes a snapshot."""        raise NotImplementedError()        raise NotImplementedError()    def create_volume_from_snapshot(self, volume, snapshot):    def create_volume_from_snapshot(self, volume, snapshot):      """Creates a volume from a snapshot."""      """Creates a volume from a snapshot."""        raise NotImplementedError()        raise NotImplementedError() 4
  5. 5. DB schema changes (1)● Create new table Snapshot snapshots = Table(snapshots, meta, snapshots = Table(snapshots, meta,         Column(created_at, DateTime()),         Column(created_at, DateTime()),         Column(updated_at, DateTime()),         Column(updated_at, DateTime()),         Column(deleted_at, DateTime()),         Column(deleted_at, DateTime()),         Column(deleted, Boolean()),         Column(deleted, Boolean()),         Column(id, Integer(),  primary_key=True),         Column(id, Integer(),  primary_key=True),         Column(volume_id, Integer()),         Column(volume_id, Integer()),         Column(user_id, String()),         Column(user_id, String()),         Column(project_id, String()),         Column(project_id, String()),         Column(status, String()),         Column(status, String()),         Column(progress, String()),         Column(progress, String()),         Column(volume_size, Integer()),         Column(volume_size, Integer()),         Column(scheduled_at, DateTime()),         Column(scheduled_at, DateTime()),         Column(display_name, String()),         Column(display_name, String()),         Column(display_description, String())         Column(display_description, String())         ) 5         )
  6. 6. DB schema changes (2)● adds a new column snapshot_id to the table volumes snapshot_id = Column(snapshot_id, Integer()) snapshot_id = Column(snapshot_id, Integer()) 6
  7. 7. Where to store snapshots● Amazon EC2 stores EBS snapshots to S3● Where should Nova store volume snapshots? ● To Swift? ● To Glance? ● To nothing? (only stored in nova-volume) 7
  8. 8. Snapshot/clone with Linux LVM2 ● Linux LVM2 doesnt support snapshot of snapshot. ● If deleting the origin volume, the dependent snapshots will also be deleted ● EC2 allows delete volume/snapshot independently: abandon this feature for now Create snapshot Clone volumeOpenstack Volume snapshot VolumeVolumeLinux LVM2 LogicalVolume LV snapshot LogicalVolume lvcrate --snapshot Create new LV and copy
  9. 9. Boot from volume(EBS boot) Block Device Mapping <device>=<id>:<size(GiB)>:<DeleteOnTerminate> To orverride machine image e.g. /dev/sda=snap-00000003:10:false From command line Passing down BDM argument to compute node Block device mapping in db Machine euca-run-instances running Image launching euca-stop-instanceCreate volume from snapshot stopping stopped euca-start-instance Instance pending Data flow euca-termintate-instance Delete volumes running Green: what Ive implemented terminating Red: to be implemented
  10. 10. Machine Image changes● +Machine Image Type: S3 or EBS● +Block device mapping ● +Snapshot id or volume id or virtual device – EC2 allows only snapshot id block device mapping ● +Volume Size ● +DeteleteOnTerminate● +Root Device Instance id metadata data● ec2-create-image Machine image● ec2-register Image Service
  11. 11. DB schema changes● Volume Table ● +DeleteOnTerminate● +BlockDeviceMapping Table ● +instance id ● +Device Name(device name in guest) ● +Mapped device – +Virtual device(ephemeral0...) local storage which isnt persistent – +Volume ● Snapshot id or Volume id ● Volume Size in GiB ● DeleteOnTerminate: bool – +No Device
  12. 12. start/stop Instance● start/stop instance ● Mostly same to run/terminate instance except db manipulation● New status ● Stopping/stopped/pending

×