pyVmomi

Automated addition of VMware VM to Host Affinity Rules

Automated addition of VMware VM to Host Affinity Rules

Bradley Bishop

6 minute read

Background VMware Affinity rules can solve many issues in a virtualized environment with out the need to create different clusters or datacenters to separate Virtual Machines. The specific need that we at Encore had for this was that when a vm is being cloned, if the VM was migrated to a different Host due to a vMotion, the custom spec with Kickstart files or Autounattended Syspreps would fail. This was a random error that would only happened when vCenter or a host was overloaded.

Automated addition of VMware Disks and Controllers

Automated addition of VMware Disks and Controllers

Bradley Bishop

8 minute read

When adding disks to VMware VM using Python we need to use the pyVmomi VMware SOAP API to communicate with vCenter. pyVmomi gives us a lot of very helpful features that take out a lot of the guess work in adding new disks to a VMware VM. You can install pyVmomi from pip into a virtualenv like the following: virtualenv ~/vmware source ~/vmware/bin/activate pip install pyvmomi VMware Connection pyVmomi makes it really easy to connect to the VMware vCenter environment to query information and perform all the necessary tasks needed.