Questions tagged [pyvmomi]

pyVmomi is the Python SDK for the VMware vSphere API that allows you to manage ESX, ESXi, and vCenter.

pyVmomi is the Python SDK for the VMware vSphere API that allows you to manage ESX, ESXi, and vCenter.

https://github.com/vmware/pyvmomi

183 questions
1
vote
1 answer

How to get the vm sub-folder object using pyvmomi to deploy virtual machine

A sample datacenter ("DC1") hierarchy structure is given below, under DC1 there are two parent folders "Parent1" and "Parent2". Under them there are sub-folders containing VMs. I have to deploy the ovf under the correct sub-folder under the given…
Ibrahim Quraish
  • 3,889
  • 2
  • 31
  • 39
1
vote
0 answers

Getting virtual machine's virtual disk usage in vmware with pyvmomi

I've recently started using pyvmomi to get a detailed inventory of vmware servers.I want to get the virtual disk usage of the virtual machine. I can find the capacity(total amount) of each virtual disk in vim.vm.device.VirtualDisk, and i can find…
Zhang.L
  • 11
  • 1
1
vote
0 answers

How to restart network Interfaces on virtual machine instead of complete machine reboot/reset using pyvmomi API

I am working on a application which cloned virtual machines from a running machine on a specific event in poweredon state. The machines later communicate each other based on event and I have to fetch out (sniff) the network packets through netmon…
Shashank
  • 462
  • 1
  • 8
  • 26
1
vote
0 answers

How to get details of CPU/RAM/Storage from ESXi Server using pyVmomi?

I want to extract the CPU/RAM/Storage details of hosts from a vcenter using pyvmomi.
Udit
  • 11
  • 1
1
vote
1 answer

How to retrieve the list of all storage adapters on an ESXi host using pyvmomi?

I recently started using pyvmomi to automate few tasks. I need to retrieve the list of storage adapters using pyvmomi. However, I did not find examples or APIs.
Tejaswi
  • 264
  • 1
  • 10
1
vote
0 answers

get VM files using PyVmomi

Is there a way where we can get the VM files (vmdks, vmx, etc) and copy to some other location ? I looked at the community samples, but could not find anything. Really appreciate any pointers here! TIA.
1
vote
1 answer

Whan can I wait for after rebooting a VmWare VM in Ansible vsphere to ensure the state is booted?

I deploy some low supported OS like Debian 9, Debian 8, Rehhat 6,7, Centos 7. The IP configuration is unsupported at boot time, so I add only the VLAN/virtual network interface, then I use vmware_vm_shell to configure the OS step by step. What I'm…
1
vote
1 answer

How do I put a ESXi host into maintenance mode using pyvmomi?

I was asked to write some python code that would put an VMWare ESXi host into maintenance mode. I was given the name of a virtual center, test-vc, and the hostname of an ESXi host, test-esxi-host and this link…
Red Cricket
  • 9,762
  • 21
  • 81
  • 166
1
vote
1 answer

python vsphere DRS group

I am working on a python script to add a VM to a DRS group. Here is a powershell script that is doing the job. How to translate it to py? $spec = New-Object VMware.Vim.ClusterConfigSpecEx $spec.groupSpec = New-Object VMware.Vim.ClusterGroupSpec[]…
tofu
  • 25
  • 6
1
vote
1 answer

pyvmomi perfManager - Get all stats

While a am a noob in python and pyvmomi, thru the help of stackoverflow and the pyvmomi sample I have been able to get most of the information I need from ESXi servers. I want to get all the stats at the lowest level they are keeped from…
Bruce C
  • 11
  • 3
1
vote
0 answers

VMWare python API : How to access cpu load average?

I'm trying to get the load average of my ESX, using python script et pyVmomi. I cannot find the numbers 1.71, 1.72, 1.72 from the API, as described in the commands below. Any clues ? # ssh my-esx [root@my-esx:~] uptime 12:07:54 up 8 days, 21:02:09,…
Stéphane
  • 2,068
  • 22
  • 28
1
vote
1 answer

Should I be concerned about return "(str) ['item1', 'item2' ]"

I'm trying to return a list in one of my methods for interacting with vmware via pyvmomi. active_list = self.vss.spec.policy.nicTeaming.nicOrder.activeNic when I do return active_list I get: (str) [ 'vmnic0', …
MMT
  • 1,931
  • 3
  • 19
  • 35
1
vote
1 answer

What is the pyvmomi equivalent of invoke-vmscript in powercli?

I'm looking into moving an existing powercli deployment script to python/pyvmomi, to get multi-threading (it deploys a LOT of VMs). The original script makes fairly heavy use of Invoke-VMScript to push powershell fragments to each guest via the…
AnotherHowie
  • 818
  • 1
  • 11
  • 28
1
vote
1 answer

Excecute command in vSphere Guest machine with Ansible

I am trying to change the IP of a Windows Server 2012R2 vmware guest machine with the vmware_vm_shell module. So far I have been able to clone the VM from a template with the vsphere_guest module without problems, but when I try the following task…
amosti
  • 75
  • 1
  • 6
1
vote
1 answer

How can I run Pyvmomi scripts based on vSphere alarms on the VCSA

I need to trigger a script through vsphere for specific events, say if an ESXi host crashed. Wanted to do it using pyvmomi, prefer not to poll the vcenter and rather have an alarm trigger a…
jramacha
  • 117
  • 2
  • 13