VMware Cloud Community
Aristizabal
Enthusiast
Enthusiast
Jump to solution

Attaching ISO file to VM

Hello,

I have this workflow to mount a CDROM (ISO file in Datastore) on a VM; the code finds the CD device and changes the path to the specified file with no issues. But the the option to Connect the CDROM never works. After the workflow executes I can see the device pointing to the ISO but it is never connected.

cdrom.backing = new VcVirtualCdromIsoBackingInfo();

cdrom.backing.fileName = isoFile;

cdrom.connectable.startConnected = false;

cdrom.connectable.connected = true;

var deviceChange = new VcVirtualDeviceConfigSpec();

deviceChange.device = cdrom;

deviceChange.operation = VcVirtualDeviceConfigSpecOperation.edit;

var spec = new VcVirtualMachineConfigSpec();

var changes = new Array();

changes.push(deviceChange);

spec.deviceChange = changes;

task = vm.reconfigVM_Task(spec);

Any clue why is this happening?

Thanks,

Juan.

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
Aristizabal
Enthusiast
Enthusiast
Jump to solution

I found the problem. I was pointing to a file that didn't exist anymore (somebody moved it to a different folder), so the operation succeeds but it obviously cannot be connected.   I might just add some error checking and verify the existence of the file before attempting to mount it.

View solution in original post

Reply
0 Kudos
1 Reply
Aristizabal
Enthusiast
Enthusiast
Jump to solution

I found the problem. I was pointing to a file that didn't exist anymore (somebody moved it to a different folder), so the operation succeeds but it obviously cannot be connected.   I might just add some error checking and verify the existence of the file before attempting to mount it.

Reply
0 Kudos