pyvmomi-community-samples
pyvmomi-community-samples copied to clipboard
Created VMs don't have harddrives, CD-Roms, ...
Hi, I'm trying for quite a while now to set up a WORKING VM using python with pyVmomi, but all I can do is to set up a VM, that lacks important stuff like harddrive, CDRom, USB-Controller, ...
I found some pieces of code, wich should be able to solve at least some of the problems, but I can't get them to work.
It would be great, if it would be possible to set up drives and controllers in the creation process, but that seems to be impossible, since detection of backening Controller rely on an already existing VM.
However to set them up after creation also doesn't work. E.g. when I try to add a (virtual) CDRom, I search in the host storageDeviceInfo for a CDRom scsiLun, but all I get in host.configManager.storageSystem.storageDeviceInfo.scsiLun
is a disk
type. But since it is possible to set up a CDRom based on the host drive in the Webclient, it actually should be somewhere to find.
I've read dozens of code snippets, but either they lack important dependencies, aren't working on my machine or are designed for a different purpose. I actually only want to create "simple vms" like they can be generated with only a few clicks in the Webclient, but since the webclient itself has some serious issues it would be great to get this running via script.
Is there any possibilty to provide deviceSpecs to a not yet created VM? Is there somewhere a comprehensible, solely working example of how to create a fully working VM, not just one that has RAM and CPU but nothing else?
I'd really appreciate your help
Best regards