def _create_snapshot(self, context, volume, name, description, force=False):
    check_policy(context, 'create_snapshot', volume)
    if ((not force) and (volume['status'] != 'available')):
        msg = _('must be available')
        raise exception.InvalidVolume(reason=msg)
    options = {'volume_id': volume['id'], 'user_id': context.user_id, 'project_id': context.project_id, 'status': 'creating', 'progress': '0%', 'volume_size': volume['size'], 'display_name': name, 'display_description': description}
    snapshot = self.db.snapshot_create(context, options)
    host = volume['host']
    rpc.cast(context, rpc.queue_get_for(context, FLAGS.volume_topic, host), {'method': 'create_snapshot', 'args': {'volume_id': volume['id'], 'snapshot_id': snapshot['id']}})
    return snapshot
def _create_snapshot(self, context, volume, name, description, force=False):
    check_policy(context, 'create_snapshot', volume)
    if ((not force) and (volume['status'] != 'available')):
        msg = _('must be available')
        raise exception.InvalidVolume(reason=msg)
    options = {'volume_id': volume['id'], 'user_id': context.user_id, 'project_id': context.project_id, 'status': 'creating', 'progress': '0%', 'volume_size': volume['size'], 'display_name': name, 'display_description': description}
    snapshot = self.db.snapshot_create(context, options)
    host = volume['host']
    rpc.cast(context, rpc.queue_get_for(context, FLAGS.volume_topic, host), {'method': 'create_snapshot', 'args': {'volume_id': volume['id'], 'snapshot_id': snapshot['id']}})
    return snapshot