'Copy the content of a volume by dd command.'

def _copy_with_dd(self, src_ldev, dest_ldev, size):

    src_info = None
    dest_info = None
    properties = cinder_utils.brick_get_connector_properties(multipath=self.conf.use_multipath_for_image_xfer, enforce_multipath=self.conf.enforce_multipath_for_image_xfer)
    try:
        dest_info = self._attach_ldev(dest_ldev, properties)
        src_info = self._attach_ldev(src_ldev, properties)
        volume_utils.copy_volume(src_info['device']['path'], dest_info['device']['path'], (size * units.Ki), self.conf.volume_dd_blocksize)
    finally:
        if src_info:
            self._detach_ldev(src_info, src_ldev, properties)
        if dest_info:
            self._detach_ldev(dest_info, dest_ldev, properties)
    self.discard_zero_page({'provider_location': six.text_type(dest_ldev)})
