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
545
votes
15 answers

Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6

I am writing scripts in Python2.6 with use of pyVmomi and while using one of the connection methods: service_instance = connect.SmartConnect(host=args.ip, user=args.user, …
Patryk
  • 22,602
  • 44
  • 128
  • 244
20
votes
4 answers

What is the Difference between PySphere and PyVmomi?

I need to write python scripts to automate time configuration of Virtual Machines running on a ESX/ESXi host. I don't know which API to use. I am able to find to python bindings for VMWare APIs viz. PySphere and PyVmomi. Could anyone please explain…
anukalp
  • 2,780
  • 5
  • 15
  • 24
13
votes
2 answers

PyVmomi add NIC with unconnected dvs ('config.distributedVirtualSwitch' is Unset)

I am using the code below in order to add a NIC configured with DistributedVirtualSwitch to an existing VM (via pyVmomi): def __AddNIC(si, vmconf_dict, network_name): vm = __get_vm(si, vmconf_dict) print " Network label : " + network_name …
Vano
  • 1,416
  • 1
  • 13
  • 26
5
votes
2 answers

Getting an instance's actual used (allocated) disk space in vmware with pyvmomi

I've recently started using pyvmomi to get a detailed inventory of vmware servers prior to migrating instances into AWS. In the vcenter web interface, or vsphere client, I can inspect an instance and see its disks, and it'll tell me the disk size…
Argais
  • 233
  • 4
  • 7
5
votes
0 answers

How do I modify an existing vm template's only ethernet adapter's IP address with pyvmomi

Below is the code I think should be used to modify the network adapter IP of an ethernet adapter for a windows VM while cloning a VM from a template using pyvmomi and virtual center. It doesn't work, the VM clones but the network adapter is not…
Derek Chadwell
  • 696
  • 1
  • 8
  • 22
5
votes
1 answer

Is there a way to delete a guest vm using the pyvmomi API?

I've been pouring through the documents and example for the official VMWare pyvmomi API and for the life of me I cannot find an obvious way to just nuke a VM off of an ESXi server. Can anyone provide an example or point me to someone who has…
synthesizerpatel
  • 27,321
  • 5
  • 74
  • 91
4
votes
3 answers

Error while importing pyVim.connect

I am attempting to run the following code which I received from samples here from __future__ import print_function import atexit from pyVim.connect import SmartConnectNoSSL, Disconnect from pyVmomi import vim from tools import cli I am receiving…
Trevor Jordy
  • 598
  • 1
  • 7
  • 27
4
votes
1 answer

Understand vim in pyvmomi

I would like to understand vim in pyvmomi. I understand that vim is imported like this: from pyvmomi import vim I tried to find where vim is defined in pyvmomi, but I have not found it yet. I tried the following steps: >>>…
tocode
  • 115
  • 1
  • 10
4
votes
1 answer

Purpose of pyVim within pyVmomi

I'm trying to get used to Python and VMware vSphere API Python Bindings (pyVmomi). I try to understand the purpose of each component. What's the purpose of pyVim within pyVmomi? From what I understand, pyVim is used for connection handling…
4
votes
1 answer

Unsupported operation leading to lease error in pyvmomi

I am trying to deploy OVF to vSphere 5.5 by a python script using pyvmomi due to an error The operation is not supported on the object. The deepest I could get into this error was by printing ImportVApp.error which has this…
Gursimran Singh
  • 303
  • 2
  • 10
4
votes
2 answers

pyvmomi - Listing of all VMs

I have a lot of VM (dispatch with 2 hosts) and I would like to list all of them. TO do that, i use this: atexit.register(connect.Disconnect, self.si) content = self.si.RetrieveContent() children = content.rootFolder.childEntity for child in…
Anthony
  • 177
  • 1
  • 4
  • 14
3
votes
0 answers

pyvmomi and SmartConnect function

I have a few questions about SmartConnect and pyvmomi please. 1) Where can I find good explanation to the use of smartconnect? 2) What does this function do: "RetrieveContent" after connecting to a VM: def enable_ssh(vc_ip,…
Ofer
  • 25
  • 1
  • 1
  • 7
3
votes
2 answers

How to get filtered VM list on vcenter with python

I'm trying to get a list of registered virtual machines - by their name - in my vcenter. The problem that I have many vms (~5K), and I am doing it a lot of times (O(1000)/hour). The SDKs I'm using causing it a lot of traffic…
eplaut
  • 666
  • 1
  • 7
  • 26
3
votes
1 answer

Need python interface for moving a machine to another folder

I am trying to find a code support in python for moving a machine between Datacenter's folders without success, I saw in pysphere that you can define the folder just in the clone stage and not after machine already cloned. This seems as a solution…
JavaSa
  • 5,813
  • 16
  • 71
  • 121
3
votes
0 answers

Pyvmomi , query tasks between certain time frame in the last 24 hours

Hi I am using pyvmomi against vSphere 6.0 to query tasks ,but TaskManager managed object (ManagedObjectReference:TaskManager) only lists recent tasks, is it possbile to go back and get a list of all tasks for a particular day or for specific time…
jramacha
  • 117
  • 2
  • 13
1
2 3
12 13