pyvmomi-community-samples icon indicating copy to clipboard operation
pyvmomi-community-samples copied to clipboard

How to create a VM with disk and NIC rather than add after create ?

Open ruiruige opened this issue 8 years ago • 11 comments

I carefully read some of the related samples. It has add_disk_to_vm.py and add_nic_to_vm.py

However, can I create a vm with a disk and a nic ?

in create_random_marvel_vms.py it does not say. It only says:

   vm_name = 'MARVEL-' + name
    datastore_path = '[' + datastore + '] ' + vm_name

    # bare minimum VM shell, no disks. Feel free to edit
    vmx_file = vim.vm.FileInfo(logDirectory=None,
                               snapshotDirectory=None,
                               suspendDirectory=None,
                               vmPathName=datastore_path)

    config = vim.vm.ConfigSpec(name=vm_name, memoryMB=128, numCPUs=1,
                               files=vmx_file, guestId='dosGuest',
                               version='vmx-07')

So, is there any method to create a VM with a disk?

ruiruige avatar Feb 07 '17 08:02 ruiruige