'Create volume from snapshot'

def create_volume_from_snapshot(self, volume, snapshot):

    bvol_name = self._translate_volume_name(snapshot['name'])
    cvol_name = self._translate_volume_name(volume['name'])
    if (volume['size'] < snapshot['volume_size']):
        err_msg = (_('Cloned    volume    size    invalid.    Clone    size:    %(cloned_size)s.    Src    volume    size:    %(volume_size)s.') % {'cloned_size': volume['size'], 'volume_size': snapshot['volume_size']})
        raise exception.VolumeDriverException(message=err_msg)
    else:
        volume_size = float((volume['size'] * units.Mi))
    try:
        self._cloned_volume(cvol_name, bvol_name, volume_size, zte_pub.ZTE_SNAPSHOT)
    except Exception:
        self._delete_clone_relation_by_volname(bvol_name, False)
        self._cloned_volume(cvol_name, bvol_name, volume_size, zte_pub.ZTE_SNAPSHOT)
