File: usage.rst

package info (click to toggle)
python-oslo.vmware 4.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,696 kB
  • sloc: python: 5,549; makefile: 22; sh: 2
file content (25 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
=======
 Usage
=======

Example usage of getting a handle to a vSphere session and retrieving all the
ESX hosts in a server::

    from oslo_vmware import api
    from oslo_vmware import vim_util

    # Get a handle to a vSphere API session
    session = api.VMwareAPISession(
        '10.1.2.3',      # vSphere host endpoint
        'administrator', # vSphere username
        'password',      # vSphere password
        10,              # Number of retries for connection failures in tasks
        0.1              # Poll interval for async tasks (in seconds)
    )

    # Example call to get all the managed objects of type "HostSystem"
    # on the server.
    result = session.invoke_api(
        vim_util,                           # Handle to VIM utility module
        'get_objects',                      # API method name to invoke
        session.vim, 'HostSystem', 100)     # Params to API method (*args)