def create_controller_spec(client_factory, key, adapter_type=constants.DEFAULT_ADAPTER_TYPE, bus_number=0):
 virtual_device_config = client_factory.create('ns0:VirtualDeviceConfigSpec')
 virtual_device_config.operation = 'add'
 if (adapter_type == constants.ADAPTER_TYPE_BUSLOGIC):
  virtual_controller = client_factory.create('ns0:VirtualBusLogicController')
 elif (adapter_type == constants.ADAPTER_TYPE_LSILOGICSAS):
  virtual_controller = client_factory.create('ns0:VirtualLsiLogicSASController')
 elif (adapter_type == constants.ADAPTER_TYPE_PARAVIRTUAL):
  virtual_controller = client_factory.create('ns0:ParaVirtualSCSIController')
 else:
  virtual_controller = client_factory.create('ns0:VirtualLsiLogicController')
 virtual_controller.key = key
 virtual_controller.busNumber = bus_number
 virtual_controller.sharedBus = 'noSharing'
 virtual_device_config.device = virtual_controller
 return virtual_device_config

def create_controller_spec ( client_factory , key , adapter_type = constants . DEFAULT_ADAPTER_TYPE , bus_number = 0 ) : virtual_device_config = client_factory . create ( 'ns0:VirtualDeviceConfigSpec' ) virtual_device_config . operation = 'add' if ( adapter_type == constants . ADAPTER_TYPE_BUSLOGIC ) : virtual_controller = client_factory . create ( 'ns0:VirtualBusLogicController' ) elif ( adapter_type == constants . ADAPTER_TYPE_LSILOGICSAS ) : virtual_controller = client_factory . create ( 'ns0:VirtualLsiLogicSASController' ) elif ( adapter_type == constants . ADAPTER_TYPE_PARAVIRTUAL ) : virtual_controller = client_factory . create ( 'ns0:ParaVirtualSCSIController' ) else : virtual_controller = client_factory . create ( 'ns0:VirtualLsiLogicController' ) virtual_controller . key = key virtual_controller . busNumber = bus_number virtual_controller . sharedBus = 'noSharing' virtual_device_config . device = virtual_controller return virtual_device_config
builds a config spec for the lsi or bus logic controllers addition which acts as the controller for the virtual hard disk to be attached to the vm .