Hi Vijaya,
Thanks again for you kind response.
I have this code and there are no issues when the VM recongures, but I could not see this newly controller in the Edit Settings-->Hardware Devices List in the vsphere client and hence I could not assure whether the controller is actually created or not.
Can you please correct me where I am wrong :
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
VirtualLsiLogicController scsiCtrl = new VirtualLsiLogicController();
VirtualDeviceConfigSpec scsiSpec = new VirtualDeviceConfigSpec();
scsiSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
// is it necessary for this line . If I have this it throws error on some backing info : Incompatible backing device. If I dont have no errors
//scsiSpec.setFileOperation(VirtualDeviceConfigSpecFileOperation.create);
scsiCtrl.setKey(1000); // also tried with different keys like -1, 1, 2
scsiCtrl.setBusNumber(0);
scsiCtrl.setControllerKey(1000);
scsiCtrl.setHotAddRemove(true);
Description des=new Description();
des.setLabel("SCSI Controller 1");
des.setSummary("Logic LSI SAS");
scsiCtrl.setDeviceInfo(des);
scsiCtrl.setSharedBus(VirtualSCSISharing.noSharing);
//Add the scsi controller to SCSi device
scsiSpec.setDevice(scsiCtrl);
VirtualDeviceConfigSpec [] vdiskSpecArray = {scsiSpec};
vmConfigSpec.setDeviceChange(vdiskSpecArray);
Task task = vMachine.reconfigVM_Task(vmConfigSpec);
String mapState = CommonAPI.waitForTask(task);
System.out.println("New controller key--->"+scsiCtrl.getKey());
Please let me know :
1. is there anything I am missing in the above code that results in the controller being not displayed in the devices list?
2. is it necessary to have scsiSpec.setFileOperation(VirtualDeviceConfigSpecFileOperation.create); and if so how to set the backing onfo. Any working sample piece of code would help me.
Thanks in advance.