'Detach disk from VM by reconfiguration.'

def detach_disk_from_vm(self, vm_ref, instance, device, destroy_disk=False):

    instance_name = instance.name
    client_factory = self._session.vim.client.factory
    vmdk_detach_config_spec = vm_util.get_vmdk_detach_config_spec(client_factory, device, destroy_disk)
    disk_key = device.key
    LOG.debug('Reconfiguring    VM    instance    %(instance_name)s    to    detach    disk    %(disk_key)s', {'instance_name': instance_name, 'disk_key': disk_key}, instance=instance)
    vm_util.reconfigure_vm(self._session, vm_ref, vmdk_detach_config_spec)
    LOG.debug('Reconfigured    VM    instance    %(instance_name)s    to    detach    disk    %(disk_key)s', {'instance_name': instance_name, 'disk_key': disk_key}, instance=instance)
