'Detach volume storage to VM instance.'

def detach_volume(self, connection_info, instance_name, mountpoint):

    LOG.debug('Detach_volume:    %(instance_name)s,    %(mountpoint)s', {'instance_name': instance_name, 'mountpoint': mountpoint})
    vm_ref = vm_utils.vm_ref_or_raise(self._session, instance_name)
    device_number = volume_utils.get_device_number(mountpoint)
    vbd_ref = volume_utils.find_vbd_by_number(self._session, vm_ref, device_number)
    if (vbd_ref is None):
        LOG.warning('Skipping    detach    because    VBD    for    %s    was    not    found', instance_name)
    else:
        self._detach_vbds_and_srs(vm_ref, [vbd_ref])
        LOG.info('Mountpoint    %(mountpoint)s    detached    from    instance    %(instance_name)s', {'instance_name': instance_name, 'mountpoint': mountpoint})
