'Create snapshot from volume.'

def create_snapshot(self, snapshot):

    LOG.debug('enter:    create_snapshot:    create    %(snap)s    from    %(vol)s.', {'snap': snapshot['name'], 'vol': snapshot['volume']['name']})
    status = snapshot['volume']['status']
    if (status not in ['available', 'in-use']):
        msg = (_('create_snapshot:    Volume    status    must    be    "available"    or    "in-use"    for    snapshot.    The    invalid    status    is    %s.') % status)
        raise exception.InvalidVolume(msg)
    self._create_and_copy_vdisk_data(snapshot['volume']['name'], snapshot['volume']['id'], snapshot['name'], snapshot['id'])
    LOG.debug('leave:    create_snapshot:    create    %(snap)s    from    %(vol)s.', {'snap': snapshot['name'], 'vol': snapshot['volume']['name']})
