Jump to: navigation, search

Difference between revisions of "SnapshotVolume"

 
m (Text replace - "NovaSpec" to "NovaSpec")
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
+
 
* '''Launchpad Entry''': [[NovaSpec]]:snapshot-volume
+
* '''Launchpad Entry''': NovaSpec:snapshot-volume
 
* '''Created''': 2011-4-19
 
* '''Created''': 2011-4-19
 
* '''Contributors''': Kazutaka Morita
 
* '''Contributors''': Kazutaka Morita
Line 8: Line 8:
  
 
== Release Note ==
 
== Release Note ==
 +
This adds support for taking snapshots of volumes (EBS snapshot).
 +
The [[OpenStack]] API doesn't support a volume snapshot,
 +
so we start from implementing the feature with the EC2 API.
 +
 +
This only invokes a snapshot command of the backend block storage system.
 +
In future, we should backup the created volume snapshots to Swift
 +
as Amazon EBS backups the snapshots to S3.
  
 
== Rationale ==
 
== Rationale ==
 +
This is necessary to take a consistent image of a volume, which is used for backups or golden volume creation.
  
 
== User stories ==
 
== User stories ==
 +
* User takes snapshots to backup volumes
 +
* User creates golden volumes to provide services quickly
 +
 +
 +
<pre><nowiki>
 +
$ euca-create-volume -s 4 -z 0
 +
VOLUME  vol-00000001    4      creating (admin, None, None, None)      2011-04-19T20:18:10Z
 +
$ euca-create-snapshot vol-00000001
 +
SNAPSHOT        snap-00000001  vol-00000001    creating        2011-04-19T20:18:19Z    0% 
 +
</nowiki></pre>
  
 
== Assumptions ==
 
== Assumptions ==
 +
A backend storage of nova-volume must support instant snapshotting.
  
 
== Implementation ==
 
== Implementation ==
 +
This adds a new table 'snapshots' to the database
 +
 +
<pre><nowiki>
 +
snapshots = Table('snapshots', meta,
 +
        Column('created_at', DateTime(timezone=False)),
 +
        Column('updated_at', DateTime(timezone=False)),
 +
        Column('deleted_at', DateTime(timezone=False)),
 +
        Column('deleted', Boolean(create_constraint=True, name=None)),
 +
        Column('id', Integer(),  primary_key=True, nullable=False),
 +
        Column('volume_id', Integer(), nullable=False),
 +
        Column('user_id',
 +
              String(length=255, convert_unicode=False, assert_unicode=None,
 +
                      unicode_error=None, _warn_on_bytestring=False)),
 +
        Column('project_id',
 +
              String(length=255, convert_unicode=False, assert_unicode=None,
 +
                      unicode_error=None, _warn_on_bytestring=False)),
 +
        Column('status',
 +
              String(length=255, convert_unicode=False, assert_unicode=None,
 +
                      unicode_error=None, _warn_on_bytestring=False)),
 +
        Column('progress',
 +
              String(length=255, convert_unicode=False, assert_unicode=None,
 +
                      unicode_error=None, _warn_on_bytestring=False)),
 +
        Column('volume_size', Integer()),
 +
        Column('scheduled_at', DateTime(timezone=False)),
 +
        Column('display_name',
 +
              String(length=255, convert_unicode=False, assert_unicode=None,
 +
                      unicode_error=None, _warn_on_bytestring=False)),
 +
        Column('display_description',
 +
              String(length=255, convert_unicode=False, assert_unicode=None,
 +
                      unicode_error=None, _warn_on_bytestring=False))
 +
        )
 +
</nowiki></pre>
 +
 +
 +
and adds two interfaces in the volume driver
 +
 +
<pre><nowiki>
 +
class VolumeDriver(object):
 +
 +
    ...
 +
 +
    def create_snapshot(self, snapshot):
 +
        """Creates a snapshot."""
 +
        raise NotImplementedError()
 +
 +
    def delete_snapshot(self, snapshot):
 +
        """Deletes a snapshot."""
 +
        raise NotImplementedError()
 +
</nowiki></pre>
 +
  
 
----
 
----
 
[[Category:Spec]]
 
[[Category:Spec]]

Latest revision as of 23:31, 17 February 2013

  • Launchpad Entry: NovaSpec:snapshot-volume
  • Created: 2011-4-19
  • Contributors: Kazutaka Morita

Summary

Snapshot nova volumes with the EC2 api

Release Note

This adds support for taking snapshots of volumes (EBS snapshot). The OpenStack API doesn't support a volume snapshot, so we start from implementing the feature with the EC2 API.

This only invokes a snapshot command of the backend block storage system. In future, we should backup the created volume snapshots to Swift as Amazon EBS backups the snapshots to S3.

Rationale

This is necessary to take a consistent image of a volume, which is used for backups or golden volume creation.

User stories

  • User takes snapshots to backup volumes
  • User creates golden volumes to provide services quickly


$ euca-create-volume -s 4 -z 0
VOLUME  vol-00000001    4       creating (admin, None, None, None)      2011-04-19T20:18:10Z
$ euca-create-snapshot vol-00000001
SNAPSHOT        snap-00000001   vol-00000001    creating        2011-04-19T20:18:19Z    0%  

Assumptions

A backend storage of nova-volume must support instant snapshotting.

Implementation

This adds a new table 'snapshots' to the database

snapshots = Table('snapshots', meta,
        Column('created_at', DateTime(timezone=False)),
        Column('updated_at', DateTime(timezone=False)),
        Column('deleted_at', DateTime(timezone=False)),
        Column('deleted', Boolean(create_constraint=True, name=None)),
        Column('id', Integer(),  primary_key=True, nullable=False),
        Column('volume_id', Integer(), nullable=False),
        Column('user_id',
               String(length=255, convert_unicode=False, assert_unicode=None,
                      unicode_error=None, _warn_on_bytestring=False)),
        Column('project_id',
               String(length=255, convert_unicode=False, assert_unicode=None,
                      unicode_error=None, _warn_on_bytestring=False)),
        Column('status',
               String(length=255, convert_unicode=False, assert_unicode=None,
                      unicode_error=None, _warn_on_bytestring=False)),
        Column('progress',
               String(length=255, convert_unicode=False, assert_unicode=None,
                      unicode_error=None, _warn_on_bytestring=False)),
        Column('volume_size', Integer()),
        Column('scheduled_at', DateTime(timezone=False)),
        Column('display_name',
               String(length=255, convert_unicode=False, assert_unicode=None,
                      unicode_error=None, _warn_on_bytestring=False)),
        Column('display_description',
               String(length=255, convert_unicode=False, assert_unicode=None,
                      unicode_error=None, _warn_on_bytestring=False))
        )


and adds two interfaces in the volume driver

class VolumeDriver(object):

    ...

    def create_snapshot(self, snapshot):
        """Creates a snapshot."""
        raise NotImplementedError()

    def delete_snapshot(self, snapshot):
        """Deletes a snapshot."""
        raise NotImplementedError()