def detach_virtual_disk_spec(client_factory, device, destroy_disk=False):
 virtual_device_config = client_factory.create('ns0:VirtualDeviceConfigSpec')
 virtual_device_config.operation = 'remove'
 if destroy_disk:
  virtual_device_config.fileOperation = 'destroy'
 virtual_device_config.device = device
 return virtual_device_config

def detach_virtual_disk_spec ( client_factory , device , destroy_disk = False ) : virtual_device_config = client_factory . create ( 'ns0:VirtualDeviceConfigSpec' ) virtual_device_config . operation = 'remove' if destroy_disk : virtual_device_config . fileOperation = 'destroy' virtual_device_config . device = device return virtual_device_config
builds spec for the detach of an already existing virtual disk from vm .