'Copy data from src vdisk to dest vdisk.
To be able to copy data between vdisks, we must ensure that both
vdisks have been mapped to host. If vdisk has not been mapped,
it must be mapped firstly. When data copy completed, vdisk
should be restored to previous mapped or non-mapped status.'

def _copy_vdisk_data(self, src_vdisk_name, src_vdisk_id, dest_vdisk_name, dest_vdisk_id):

    LOG.debug('enter:    _copy_vdisk_data:    %(src)s    ->    %(dest)s.', {'src': src_vdisk_name, 'dest': dest_vdisk_name})
    connector = utils.brick_get_connector_properties()
    (src_map, src_lun_id) = self._is_vdisk_map(src_vdisk_name, connector)
    (dest_map, dest_lun_id) = self._is_vdisk_map(dest_vdisk_name, connector)
    src_map_device = None
    src_properties = None
    dest_map_device = None
    dest_properties = None
    try:
        if (not src_map):
            src_lun_id = self._map_vdisk_to_host(src_vdisk_name, connector)
        if (not dest_map):
            dest_lun_id = self._map_vdisk_to_host(dest_vdisk_name, connector)
        src_properties = self._get_vdisk_map_properties(connector, src_lun_id, src_vdisk_name, src_vdisk_id, self._get_vdisk_params(None))
        src_map_device = self._scan_device(src_properties)
        dest_properties = self._get_vdisk_map_properties(connector, dest_lun_id, dest_vdisk_name, dest_vdisk_id, self._get_vdisk_params(None))
        dest_map_device = self._scan_device(dest_properties)
        src_vdisk_attr = self._get_vdisk_attributes(src_vdisk_name)
        size_in_mb = (int(src_vdisk_attr['capacity']) / units.Mi)
        volume_utils.copy_volume(src_map_device['path'], dest_map_device['path'], size_in_mb, self.configuration.volume_dd_blocksize)
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.error('Failed    to    copy    %(src)s    to    %(dest)s.', {'src': src_vdisk_name, 'dest': dest_vdisk_name})
    finally:
        if (not dest_map):
            self._unmap_vdisk_from_host(dest_vdisk_name, connector)
            self._remove_device(dest_properties, dest_map_device)
        if (not src_map):
            self._unmap_vdisk_from_host(src_vdisk_name, connector)
            self._remove_device(src_properties, src_map_device)
    LOG.debug('leave:    _copy_vdisk_data:    %(src)s    ->    %(dest)s.', {'src': src_vdisk_name, 'dest': dest_vdisk_name})
