Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

change uuid of vmdk?

$
0
0

I have several workflows that add hardware snapped vmdks to VMs, sometimes multiple copies to the same VM.  When I try and add the second copy to the same VM, I get an error that the UUID of the VMDK is the same.  Does anyone know how I can generate a new UUID for the VMDK?

 

I'm adding the VMDKs in orchestrator by using VcVirtualDeviceConfigSpec with VcVirtualDeviceConnectInfo and VcVirtualDiskFlatVer2BackingInfo

 

Actual code I'm using is below:

var deviceConfigSpecs = new Array();


// see if we need to add a new SCSI bus
if (needNewSCSIBus)
{
  var deviceChange = new VcVirtualDeviceConfigSpec();  deviceChange.operation = VcVirtualDeviceConfigSpecOperation.add;  deviceChange.device = new VcParaVirtualSCSIController();  deviceChange.device.sharedBus = VcVirtualSCSISharing.noSharing;  deviceChange.device.busNumber = vmSCSIBusNumber;  deviceChange.device.key = -101;  deviceConfigSpecs.push(deviceChange);  scsiControllerKeyForDisk = -101;
}


// create the disk add spec
var deviceConfigSpec;
deviceConfigSpec = new VcVirtualDeviceConfigSpec();
deviceConfigSpec.operation = VcVirtualDeviceConfigSpecOperation.add; // damn, intellisense would be great.
deviceConfigSpec.device = new VcVirtualDisk();
deviceConfigSpec.device.key = -100 // yes, you actually need to set this
deviceConfigSpec.device.controllerKey = scsiControllerKeyForDisk;
deviceConfigSpec.device.unitNumber = diskNumberOnController;


// create the connectable stuff
deviceConfigSpec.device.connectable = new VcVirtualDeviceConnectInfo(); // yessh, someone got class happy
deviceConfigSpec.device.connectable.startConnected = true;
deviceConfigSpec.device.connectable.allowGuestControl = false;
deviceConfigSpec.device.connectable.connected = true;
// create the backing
deviceConfigSpec.device.backing = new VcVirtualDiskFlatVer2BackingInfo();
deviceConfigSpec.device.backing.fileName = allExistingVMDKs[0];
deviceConfigSpec.device.backing.diskMode = "persistent";


// add it to the list of changes
deviceConfigSpecs.push(deviceConfigSpec);


// create config spec
var configSpec = new VcVirtualMachineConfigSpec();
configSpec.deviceChange = deviceConfigSpecs;


// Launch the reconfigVM task
task = u_vm.reconfigVM_Task( configSpec );

Viewing all articles
Browse latest Browse all 6251

Trending Articles



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