'Move an existing file from a per-host directory into the ``unattached``
directory and release the loopback device backed by that file.'

def detach_volume(self, blockdevice_id):

    volume = get_blockdevice_volume(self, blockdevice_id)
    if (volume.attached_to is None):
        raise UnattachedVolume(blockdevice_id)
    if (self.get_device_path(blockdevice_id) is not None):
        check_output(['losetup', '--detach', self.get_device_path(blockdevice_id).path])
    filename = _backing_file_name(volume)
    volume_path = self._attached_directory.descendant([volume.attached_to.encode('ascii'), filename])
    new_path = self._unattached_directory.child(filename)
    volume_path.moveTo(new_path)
