Quantcast
Channel: VMware Communities : All Content - vRealize Automation Tools
Viewing all articles
Browse latest Browse all 9859

Add Existing VMDK to New Shared SCSI Controller

$
0
0

Hi

I am working to create a workflow which will created a new shared SCSI controller and will adds the the existing vmdk  to that. But Vcenter throws the following error.

 

"The device '0' is referring to a

nonexisting controller '1'."

comm1.PNG

comm2.PNG

 

------------

// To create shared scsi contoller

 

var configSpec = new VcVirtualMachineConfigSpec();

var deviceConfigSpecs = new Array();

var deviceConfigspec;

var ii=0;

 

 

deviceConfigspec = System.getModule("com.vmware.library.vc.vm.spec.config.device").createVirtualScsiControllerConfigSpec_1_ISCSISharing("LSI");

 

 

 

 

deviceConfigSpecs[ii++]=deviceConfigspec;

configSpec.deviceChange = deviceConfigSpecs;

task = vm.reconfigVM_Task(configSpec);

 

 

---------------

// To add existing disk

 

var backing = new VcVirtualDiskFlatVer2BackingInfo();

backing.fileName = '[Cloud_003] website/website_1.vmdk';

 

  backing.diskMode = "persistent";

  backing.thinProvisioned = true;

  backing.eagerlyScrub = false;

  backing.writeThrough = false;

  backing.split = false;

 

var connectable = new VcVirtualDeviceConnectInfo();

connectable.startConnected = true;

connectable.allowGuestControl = false;

connectable.connected = true;

var device = new VcVirtualDisk();

device.key = -100;

device.backing = backing;

device.connectable = connectable;

device.controllerKey = 1;

device.unitNumber = 1;

device.capacityInKB = 1*1024*1024;

 

 

var deviceChange = new VcVirtualDeviceConfigSpec();

deviceChange.operation = VcVirtualDeviceConfigSpecOperation.add;

deviceChange.device = device;

 

var dcArr = [];

dcArr.push(deviceChange);

 

var spec = new VcVirtualMachineConfigSpec();

spec.deviceChange = dcArr;

 

 

vm.reconfigVM_Task(spec);

 

 

-------------

Regards,

Deepak.


Viewing all articles
Browse latest Browse all 9859

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>