#NEWLINE# def run( self , vm_id , vm_name , controller_type , scsi_sharing ) : #NEWLINE# #INDENT# checkinputs . one_of_two_strings ( vm_id , vm_name , 'ID or Name' ) #NEWLINE# vm = inventory . get_virtualmachine ( self . si_content , vm_id , vm_name ) #NEWLINE# configspec = vim . vm . ConfigSpec ( ) #NEWLINE# scsictrl = vim . vm . device . VirtualDeviceSpec ( ) #NEWLINE# scsictrl . operation = vim . vm . device . VirtualDeviceSpec . Operation . add #NEWLINE# if ( controller_type == 'ParaVirtual' ) : #NEWLINE# #INDENT# scsictrl . device = vim . vm . device . ParaVirtualSCSIController ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( controller_type == 'BusLogic' ) : #NEWLINE# #INDENT# scsictrl . device = vim . vm . device . VirtualBusLogicController ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( controller_type == 'LSILogic' ) : #NEWLINE# #INDENT# scsictrl . device = vim . vm . device . VirtualLsiLogicController ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( controller_type == 'LSILogicSAS' ) : #NEWLINE# #INDENT# scsictrl . device = vim . vm . device . VirtualLsiLogicSASController ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( scsi_sharing == 'None' ) : #NEWLINE# #INDENT# scsictrl . device . sharedBus = 'noSharing' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( scsi_sharing == 'Physical' ) : #NEWLINE# #INDENT# scsictrl . device . sharedBus = 'physicalSharing' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( scsi_sharing == 'Virtual' ) : #NEWLINE# #INDENT# scsictrl . device . sharedBus = 'virtualSharing' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# configspec . deviceChange = [ scsictrl ] #NEWLINE# add_ctrl_task = vm . ReconfigVM_Task ( configspec ) #NEWLINE# successfully_added_ctrl = self . _wait_for_task ( add_ctrl_task ) #NEWLINE# return { #NEWLINE# #INDENT# 'state' : successfully_added_ctrl , #NEWLINE# #UNINDENT# }