From 0c8112653c9e593b55d46c691be683c9cff4ce53 Mon Sep 17 00:00:00 2001 From: Steve Trefethen Date: Sat, 10 Nov 2018 10:09:57 -0800 Subject: [PATCH] Create VM snippet --- samples/vsphere/vcenter/VM/create.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 samples/vsphere/vcenter/VM/create.py diff --git a/samples/vsphere/vcenter/VM/create.py b/samples/vsphere/vcenter/VM/create.py new file mode 100644 index 00000000..677b76fb --- /dev/null +++ b/samples/vsphere/vcenter/VM/create.py @@ -0,0 +1,23 @@ +guest_os = testbed.config['VM_GUESTOS'] + +boot_disk = Disk.CreateSpec(type=Disk.HostBusAdapterType.SCSI, + scsi=ScsiAddressSpec(bus=0, unit=0), + new_vmdk=Disk.VmdkCreateSpec()) +data_disk = Disk.CreateSpec(new_vmdk=Disk.VmdkCreateSpec()) + +nic = Ethernet.CreateSpec( + start_connected=True, + backing=Ethernet.BackingSpec( + type=Ethernet.BackingType.STANDARD_PORTGROUP, + network=standard_network)) + +boot_device_order = [ + BootDevice.EntryCreateSpec(BootDevice.Type.ETHERNET), + BootDevice.EntryCreateSpec(BootDevice.Type.DISK)] + +vm_create_spec = VM.CreateSpec(name=self.vm_name, + guest_os=guest_os, + placement=self.placement_spec, + disks=[boot_disk, data_disk], + nics=[nic], + boot_devices=boot_device_order)