def _get_allocated_vnc_ports(session):
    # TODO(rgerganov): bug #1256944
    # The VNC port should be unique per host, not per vCenter
    vnc_ports = set()
    result = session._call_method(vim_util, "get_objects",
                                  "VirtualMachine", [VNC_CONFIG_KEY])
    while result:
        for obj in result.objects:
            if not hasattr(obj, 'propSet'):
                continue
            dynamic_prop = obj.propSet[0]
            option_value = dynamic_prop.val
            vnc_port = option_value.value
            vnc_ports.add(int(vnc_port))
        result = session._call_method(vutil, 'continue_retrieval',
                                      result)
    return vnc_ports
Return an integer set of all allocated VNC ports.
dataset/ETHPy150Open openstack/nova/nova/virt/vmwareapi/vm_util.py/_get_allocated_vnc_ports