VMware {code} Community
rodaj
Contributor
Contributor

How do I programmatically connect cdrom device on virtual machine in vmware server 2

The problem: Automate loading of multiple iso image "product" onto a virtual machine.

Searching I've found that changing the iso image for a cdrom virtual drive in a virtual machine seems to be a common problem, but seldom is there any solution.

I've found references to vmware-cmd disconnectdevice/connectdevice. I've also found "legacy" script APIs that can essentially perform the same thing. However, seems this isn't available for vmware server 2 (only ESX and GSX server...). I've found that vmrun is replacement for vmware-cmd, with the exception that there are some things vmware-cmd could do that doesn't appear as an option in any documentation I can find with vmrun. The same goes for the VIX APIs. Again nothing found that helps with the connection issue.

I've already figured out how to use the writeVariable option with vmrun to modify the iso pointed to for the virtual cdrom. The only step missing in automation is the automatic re-connecting of the virtual cdrom. If I manually start a console and click on the cdrom icon in the bottom and select connect, everything works. Problem is, I want to have that accomplished programatically and prefereably not through some gui automator.

Is this just a limitation of vmware server 2 product? i.e. I need to get ESX instead? I guess an alternative is to make a giant iso so no switching is required, but that just postpones the problem. Is installation of software via iso images just so unpopular on linux that its not a frequent enough problem to address? Maybe I've just been searching too long and developed "tunnel vision". Any help/advice anyone can provide would be greatly appreciated.

vmware server 2.01 on SLES 10 SP2 with guest also containing SLES 10 SP2 on x86-64 hardware.

Reply
0 Kudos
1 Reply
rodaj
Contributor
Contributor

One of my collegues managed to figure out a way to perform the connection through the use of a sequence of vmware-vim-cmd invocations. First a list of vms is gotten grepping on the known name of the vm. Then a list of devices is gotten for that specific vm instance grepping on the cdrom. Lastly the device id for the cdrom is then used to perform the final command to connect the cdrom device.

vmware-vim-cmd vmsvc/device.connection <vmid> <device id> true

Note that the iso file name needs to be correct (really exists) or the device will still not connect.

Reply
0 Kudos