@wrap_check_policy
def copy_volume_to_image(self, context, volume, metadata, force):
    'Create a new image from the specified volume.'
    self._check_volume_availability(context, volume, force)
    recv_metadata = self.image_service.create(context, metadata)
    self.update(context, volume, {'status': 'uploading'})
    rpc.cast(context, rpc.queue_get_for(context, FLAGS.volume_topic, volume['host']), {'method': 'copy_volume_to_image', 'args': {'volume_id': volume['id'], 'image_id': recv_metadata['id']}})
    response = {'id': volume['id'], 'updated_at': volume['updated_at'], 'status': 'uploading', 'display_description': volume['display_description'], 'size': volume['size'], 'volume_type': volume['volume_type'], 'image_id': recv_metadata['id'], 'container_format': recv_metadata['container_format'], 'disk_format': recv_metadata['disk_format'], 'image_name': recv_metadata.get('name', None)}
    return response
Create a new image from the specified volume.
@wrap_check_policy
def copy_volume_to_image(self, context, volume, metadata, force):
    
    self._check_volume_availability(context, volume, force)
    recv_metadata = self.image_service.create(context, metadata)
    self.update(context, volume, {'status': 'uploading'})
    rpc.cast(context, rpc.queue_get_for(context, FLAGS.volume_topic, volume['host']), {'method': 'copy_volume_to_image', 'args': {'volume_id': volume['id'], 'image_id': recv_metadata['id']}})
    response = {'id': volume['id'], 'updated_at': volume['updated_at'], 'status': 'uploading', 'display_description': volume['display_description'], 'size': volume['size'], 'volume_type': volume['volume_type'], 'image_id': recv_metadata['id'], 'container_format': recv_metadata['container_format'], 'disk_format': recv_metadata['disk_format'], 'image_name': recv_metadata.get('name', None)}
    return response