Jump to: navigation, search

Difference between revisions of "Cinder/VMwareVmdkDriver/snapshot-force"

(Description)
(Description)
Line 43: Line 43:
  
 
The following image summarizes the above 5 steps for a simpler workflow of snapshotting an attached volume. We have VM instance and VOL volume that is attached to the VM.
 
The following image summarizes the above 5 steps for a simpler workflow of snapshotting an attached volume. We have VM instance and VOL volume that is attached to the VM.
 +
 
[[Image:work-flow-1.jpg]]
 
[[Image:work-flow-1.jpg]]

Revision as of 09:16, 29 November 2013

Description

Support forceful snapshot of an attached volume

The VMDK driver in Havana would simply fail the operation when user tries to snapshot a volume that is attached to an instance with --force=True. This blueprint is to support and allow user to be able to perform snapshot of the volume when it is attached to an instance.

The snapshot of volume can be achieved using the following pseudo-code:

def create_snapshot(self, snapshot):
        volume = snapshot['volume']
        if volume['status'] == 'available':
            // Simply call vsphere API to snapshot
            self._create_snapshot_of_non_attached_volume(snapshot)
        elif volume['status'] == 'in-use':
            self._create_snapshot_of_attached_volume(snapshot)
        else:
            raise CinderException("Not supported")

def create_snapshot_of_attached_volume(self, snapshot):
    """Create snapshot of an attached volume.

        The method works in 5 steps as follows:
        1. Consolidate volume chains in-case it has moved.
        2. Snapshot the instance VM.
        3. Snapshot the volume backing.
        4. Delete the VMDK version that is attached to the volume backing
           and add the VMDK version that is with the instance VM to the
           volume backing.
        5. Delete the instance VM snapshot taken in point 2.
            retaining the disk chain.
    """
    volume = snapshot['volume']
    backing = volumeops.get_backing(volume['name'])
    instance = volumeops.get_backing(volume['instance_uuid'])
    1. self.consolidate_backing(volume, instance)
    2. volumeops.create_snapshot(instance, snapshot['name'])
    3. volumeops.create_snapshot(volume, snapshot['name'])
    4. volumeops.delete_vmdk(backing)
       volume_vmdk = volumeops.get_volume_vmdk(instance, volume)
       volumeops.add_vmdk(backing, volume_vmdk)
    5. volumeops.delete_snapshot(instance, consolidate=False)

The following image summarizes the above 5 steps for a simpler workflow of snapshotting an attached volume. We have VM instance and VOL volume that is attached to the VM.

Work-flow-1.jpg