Hello,
I'm working actually to brings actions for VM item for Customer needs
.
So i've followed the usual path --> Design / XaaS / Resource Actions / New (and publish...)
New action is quite simple : Connect an ISO to a CD-ROM into a VM so that users can install from sources they needs... (Windows features, SQL Sources, and so on...)
How to:
I've created a new action from VRO 7.1 "Mount CD-ROM"
I've also created a drop-down list of ISO available in a shared datastore as "filePath" and force "deviceType" as "Datastore ISO File" and hide it.
Customer have only choice on ISO images I've defined and made available from the Drop-down menu.
The thing is: this only works when VM is powered OFF!
Is there a way to create actions that allow users to "connect" or "disconnect" iso images from item list as "actions" without needs of POWERING OFF the VM ??
Really enjoy help on this topic!
Regards,
Jacques
Here is an example out of a workflow we use:
// get the cdrom device
cdromKey = -1;
for each (var device in u_vm.config.hardware.device)
{
if (device instanceof VcVirtualCdrom)
{
cdromKey = device.key;
ideControllerKey = device.controllerKey;
break;
}
}
if (cdromKey == -1)
{
throw "No CDROM device found";
}
// mount the iso
deviceChange = new Array();
deviceChange[0] = new VcVirtualDeviceConfigSpec();
deviceChange[0].operation = VcVirtualDeviceConfigSpecOperation.edit;
deviceChange[0].device = new VcVirtualCdrom();
deviceChange[0].device.key = cdromKey;
deviceChange[0].device.deviceInfo = new VcDescription();
deviceChange[0].device.deviceInfo.label = "CD/DVD drive 1";
deviceChange[0].device.deviceInfo.summary = "Remote ATAPI";
deviceChange[0].device.backing = new VcVirtualCdromIsoBackingInfo();
deviceChange[0].device.backing.fileName = u_isoPath;
deviceChange[0].device.connectable = new VcVirtualDeviceConnectInfo();
deviceChange[0].device.connectable.startConnected = true;
deviceChange[0].device.connectable.allowGuestControl = true;
deviceChange[0].device.connectable.connected = true;
deviceChange[0].device.connectable.status = "untried";
deviceChange[0].device.controllerKey = ideControllerKey;
deviceChange[0].device.unitNumber = 0;
var spec = new VcVirtualMachineConfigSpec();
spec.deviceChange = deviceChange;
task = u_vm.reconfigVM_Task(spec); // VirtualMachine
Hi,
AFAIK, if the VM is powered on, you cannot add a new CD ROM device.
Not sure if this is applicable to your use case, but what you can try is to add a CD ROM with device type client device or host device while the VM is powered off, and later use your actions to change the device type to datastore ISO file (this change may work even when the VM is powered on).
Hello,
Thanks for answering my initial question. I get the point.
vRO does not have Workflow for "connect" / "disconnect" ISO from datastore like VRMC console but only Mount a CD-ROM device.
Do you have clues on which action script I can create to allow a simple connect / disconnect option Like VMRC allow me to do ?
vRO use vmReconfiguration " task = vm.reconfigVM_Task( configSpec ); " at the end, and maybe I can use some part of the script to just "update" as you suggest the deviceType to datastore ISO.
Really appreciate your help on this topic!
Regards,
Here is an example out of a workflow we use:
// get the cdrom device
cdromKey = -1;
for each (var device in u_vm.config.hardware.device)
{
if (device instanceof VcVirtualCdrom)
{
cdromKey = device.key;
ideControllerKey = device.controllerKey;
break;
}
}
if (cdromKey == -1)
{
throw "No CDROM device found";
}
// mount the iso
deviceChange = new Array();
deviceChange[0] = new VcVirtualDeviceConfigSpec();
deviceChange[0].operation = VcVirtualDeviceConfigSpecOperation.edit;
deviceChange[0].device = new VcVirtualCdrom();
deviceChange[0].device.key = cdromKey;
deviceChange[0].device.deviceInfo = new VcDescription();
deviceChange[0].device.deviceInfo.label = "CD/DVD drive 1";
deviceChange[0].device.deviceInfo.summary = "Remote ATAPI";
deviceChange[0].device.backing = new VcVirtualCdromIsoBackingInfo();
deviceChange[0].device.backing.fileName = u_isoPath;
deviceChange[0].device.connectable = new VcVirtualDeviceConnectInfo();
deviceChange[0].device.connectable.startConnected = true;
deviceChange[0].device.connectable.allowGuestControl = true;
deviceChange[0].device.connectable.connected = true;
deviceChange[0].device.connectable.status = "untried";
deviceChange[0].device.controllerKey = ideControllerKey;
deviceChange[0].device.unitNumber = 0;
var spec = new VcVirtualMachineConfigSpec();
spec.deviceChange = deviceChange;
task = u_vm.reconfigVM_Task(spec); // VirtualMachine
I can confirm that the code snippet provided by jarushepic is pretty much the same what vSphere Client does when you open 'Edit Settings' dialog for a given virtual machine, select a CD ROM device, and select/deselect the checkbox 'Connected' in Device Status panel. I suppose VMRC also uses similar code.
I built the code using Onyx so that makes sense
Thanks for your help!
I'll try this ASAP. One last question as a n00b (not my job in fact...) in javascript & coding : What is Onyx?
Regards,
Jacques
Got my Answer : Onyx
Sorry
Onyx is the most wonderful unsupported VMware tool in the world. I do hope that VMware supports it in the new HTML5 client! It is life blood for so many vRO developers.