示例#1
0
    def create(self, **kwargs):
        # Name - full device name (google created link name)
        name = kwargs.get('name')
        if not name:
            raise storage.StorageError(
                'Device_name attribute should be non-empty')

        device = '/dev/disk/by-id/google-%s' % name
        if not os.path.exists(device):
            raise storage.StorageError("Device '%s' not found" % device)

        kwargs['device'] = device
        super(GceEphemeralVolumeProvider, self).create(**kwargs)
示例#2
0
    def destroy_snapshot(self, snap):
        try:
            connection = __node__['gce']['compute_connection']
            project_id = __node__['gce']['project_id']

            op = connection.snapshots().delete(project=project_id,
                                               snapshot=snap.name).execute()

            wait_for_operation_to_complete(connection, project_id, op['name'])
        except:
            e = sys.exc_info()[1]
            raise storage.StorageError('Failed to delete google disk snapshot.'
                                       ' Error: %s' % e)
示例#3
0
 def create_from_snapshot(self, **kwargs):
     raise storage.StorageError("Can't create from snapshot - attaching to "
                                "running instances is unsupported")
示例#4
0
 def create_from_snapshot(self, **kwargs):
     raise storage.StorageError("GCE ephemeral disks have no snapshots.")
示例#5
0
 def create_snapshot(self, vol, snap, **kwargs):
     raise storage.StorageError("Snapshotting is unsupported by GCE"
                                "ephemeral disks.")