def volume_snapshot_create(self, context, instance, volume_id, create_info):
    "Create snapshots of a Cinder volume via libvirt.\n\n        :param instance: VM instance object reference\n        :param volume_id: id of volume being snapshotted\n        :param create_info: dict of information used to create snapshots\n                     - snapshot_id : ID of snapshot\n                     - type : qcow2 / <other>\n                     - new_file : qcow2 file created by Cinder which\n                     becomes the VM's active image after\n                     the snapshot is complete\n        "
    LOG.debug('volume_snapshot_create: create_info: %(c_info)s', {'c_info': create_info}, instance=instance)
    try:
        virt_dom = self._lookup_by_name(instance.name)
    except exception.InstanceNotFound:
        raise exception.InstanceNotRunning(instance_id=instance.uuid)
    if (create_info['type'] != 'qcow2'):
        raise exception.NovaException((_('Unknown type: %s') % create_info['type']))
    snapshot_id = create_info.get('snapshot_id', None)
    if (snapshot_id is None):
        raise exception.NovaException(_('snapshot_id required in create_info'))
    try:
        self._volume_snapshot_create(context, instance, virt_dom, volume_id, snapshot_id, create_info['new_file'])
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception(_LE('Error occurred during volume_snapshot_create, sending error status to Cinder.'))
            self._volume_snapshot_update_status(context, snapshot_id, 'error')
    self._volume_snapshot_update_status(context, snapshot_id, 'creating')

    def _wait_for_snapshot():
        snapshot = self._volume_api.get_snapshot(context, snapshot_id)
        if (snapshot.get('status') != 'creating'):
            self._volume_refresh_connection_info(context, instance, volume_id)
            raise loopingcall.LoopingCallDone()
    timer = loopingcall.FixedIntervalLoopingCall(_wait_for_snapshot)
    timer.start(interval=0.5).wait()
Create snapshots of a Cinder volume via libvirt.

:param instance: VM instance object reference
:param volume_id: id of volume being snapshotted
:param create_info: dict of information used to create snapshots
             - snapshot_id : ID of snapshot
             - type : qcow2 / <other>
             - new_file : qcow2 file created by Cinder which
             becomes the VM's active image after
             the snapshot is complete
def volume_snapshot_create(self, context, instance, volume_id, create_info):
    "Create snapshots of a Cinder volume via libvirt.\n\n        :param instance: VM instance object reference\n        :param volume_id: id of volume being snapshotted\n        :param create_info: dict of information used to create snapshots\n                     - snapshot_id : ID of snapshot\n                     - type : qcow2 / <other>\n                     - new_file : qcow2 file created by Cinder which\n                     becomes the VM's active image after\n                     the snapshot is complete\n        "
    LOG.debug('volume_snapshot_create: create_info: %(c_info)s', {'c_info': create_info}, instance=instance)
    try:
        virt_dom = self._lookup_by_name(instance.name)
    except exception.InstanceNotFound:
        raise exception.InstanceNotRunning(instance_id=instance.uuid)
    if (create_info['type'] != 'qcow2'):
        raise exception.NovaException((_('Unknown type: %s') % create_info['type']))
    snapshot_id = create_info.get('snapshot_id', None)
    if (snapshot_id is None):
        raise exception.NovaException(_('snapshot_id required in create_info'))
    try:
        self._volume_snapshot_create(context, instance, virt_dom, volume_id, snapshot_id, create_info['new_file'])
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception(_LE('Error occurred during volume_snapshot_create, sending error status to Cinder.'))
            self._volume_snapshot_update_status(context, snapshot_id, 'error')
    self._volume_snapshot_update_status(context, snapshot_id, 'creating')

    def _wait_for_snapshot():
        snapshot = self._volume_api.get_snapshot(context, snapshot_id)
        if (snapshot.get('status') != 'creating'):
            self._volume_refresh_connection_info(context, instance, volume_id)
            raise loopingcall.LoopingCallDone()
    timer = loopingcall.FixedIntervalLoopingCall(_wait_for_snapshot)
    timer.start(interval=0.5).wait()