vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.19k stars 767 forks source link

Is there any documentation or forum? #982

Open Heiko-san opened 2 years ago

Heiko-san commented 2 years ago

Is your feature request related to a problem? Please describe.

I want to write a microservice for vsphere that regulary iterates over all vms an check if disks have an IOPs limit set and NICs have bandwidth limit ... if they don't , i want to set those (disk IOPs based on disk size).

The Problem I have:

Where could I get help about how to do such a thing with the python API?

Describe the solution you'd like

Link to some kind of docs or community forum, where you really get help. I think this should be standard for an enterprise software.

What I mean is: Did you ever have a look at e.g. boto3 (https://boto3.amazonaws.com/v1/documentation/api/latest/index.html)? These are docs a developer can really work with. Is there anything similar for pyvmomi?

Describe alternatives you've considered

No response

Additional context

No response

zicameau commented 2 years ago

Hello,

After doing some research myself, I was able to find this documentation that looks at the underlying layer that the pyvmomi library uses. Is this something that you were looking for? I found this helpful for myself as to where to start my research normally

https://vdc-repo.vmware.com/vmwb-repository/dcr-public/1ef6c336-7bef-477d-b9bb-caa1767d7e30/82521f49-9d9a-42b7-b19b-9e6cd9b30db1/index-mo_types.html

Heiko-san commented 2 years ago

I guess it's better then nothing. Although I don't know ho to find what I need in this "documentation". :( I was hoping for something more structured.

karaatanassov commented 1 year ago

Here is the link to the API reference doc https://developer.vmware.com/apis/1192/vsphere

We also have a guide with some major use cases explained https://developer.vmware.com/docs/17686/vsphere-web-services-sdk-programming-guide-8-0

In essence the API is composed of objects like VM, host, folder etc. Those we call Managed Objects. Managed Object also expose some data as Properties. You interact with those object via methods and those methods exchange data structures - data objects.

In the documentation the methods are listed along side the objects as the SOAP protocol is centered on methods.

The idea is you start off from the ServiceInstance and navigate the object graph. The graph starts from a root folder object. You can query and monitor changes in the graph using the PropertyCollector

You can use the managed object browser /mob on your vCenter to explore the API object graph interactively and find out how the data is presented.

FKouhai commented 1 year ago

It would still be incredibly helpful to have the library well documented, the most helpful stuff I was able to find was looking at examples but it's clearly not enough, the API spec is useful in the case we would want to use a custom http client. I have seen myself banging my head against a wall due to the lack of documentation for this library

chi-miel commented 1 year ago

Hello,

In Vsphere 7 , there "Developer Center" tab, with that you can generate some python script.

FKouhai commented 1 year ago

Vsphere 7 is not always deployed

KR

intgr commented 1 year ago

There is also a repository of code examples at https://github.com/vmware/pyvmomi-community-samples