How to determine vCenter Server from a HostSystem object?
Question: I am querying ESX hosts, some of which are managed by a vCenter server, and
some are not. I want to find out the name of the vCenter server that manages
this host, if it there is one.

I'm using the Python psphere module, but all I want is the types of objects
and attributes I should be looking in. This is the relevant excerpt from my
code:

    
    
    from psphere.client import Client
    import psphere.managedobjects
    
    items = []
    
    cl = Client( hostname, userid, password )
    dcs = psphere.managedobjects.Datacenter.all( cl )
    

I identify an ESX host vs. a vCenter server by checking the datacenters list:

    
    
    if len( dcs ) == 1 and dcs[0].name == 'ha-datacenter':
        hosts = psphere.managedobjects.HostSystem.all( cl )
    

Typically, hosts above will be a list of one element: the ESX host. I want to
know how to find out if there is a managing ESX server for this host. The
vSphere client does it, so there must be a way.

    
    
    else:   #  This is a vCenter server, so we can drill down to find the ESX servers
        for dc in dcs:
            items.extend( getEntities( dc, [hostname] ) )
    

getEntities() is my own function for collecting details about hosts and
vCenter servers.


Answer: I found the following property within the `HostSystem` object:
`.summary.managementServerIp`. Not all `HostSystem` objects will have this
property, so I check for it as follows:

    
    
    host = ... a HostSystem object, acquired as described in the question ...
    if 'managementServerIp' in host.summary:
        ... do something with the management server IP address ...
    

