Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcsim: DistributedVirtualPortgroup does not have Portkeys #979

Closed
Akasurde opened this issue Dec 29, 2017 · 0 comments
Closed

vcsim: DistributedVirtualPortgroup does not have Portkeys #979

Akasurde opened this issue Dec 29, 2017 · 0 comments

Comments

@Akasurde
Copy link
Contributor

As $title, DVPG created by vcsim does not have 'PortKeys' as mentioned in documentation.

Here is reproducer -

from pyVim.connect import SmartConnect, Disconnect
import ssl
import atexit
from pyVmomi import vim

def connect():
    context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
    context.verify_mode = ssl.CERT_NONE

    si = SmartConnect(host='0.0.0.0', user='user', pwd='pass', port=443, sslContext=context)
    atexit.register(Disconnect, si)
    content = si.RetrieveContent()
    return content

def get_obj(content, vimtype, name):
    """
    Return an object by name, if name is None the
    first found object is returned
    """
    obj = None
    container = content.viewManager.CreateContainerView(
        content.rootFolder, vimtype, True)
    for c in container.view:
        if name:
            if c.name == name:
                obj = c
                break
        else:
            obj = c
            break

    container.Destroy()
    return obj

content = connect()

dvpg = get_obj(content, [vim.dvs.DistributedVirtualPortgroup], 'DC0_DVPG0')
print dvpg.config
print dvpg.portKeys

Traceback -

python portgroup.py
(vim.dvs.DistributedVirtualPortgroup.ConfigInfo) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) [],
   key = 'dvportgroup-14',
   name = 'DC0_DVPG0',
   numPorts = 0,
   distributedVirtualSwitch = 'vim.DistributedVirtualSwitch:distributedvirtualswitch-10',
   defaultPortConfig = <unset>,
   description = <unset>,
   type = '',
   policy = <unset>,
   portNameFormat = <unset>,
   scope = (vim.ManagedEntity) [],
   vendorSpecificConfig = (vim.dvs.KeyedOpaqueBlob) [],
   configVersion = <unset>,
   autoExpand = <unset>,
   vmVnicNetworkResourcePoolKey = <unset>,
   uplink = <unset>
}
Traceback (most recent call last):
  File "portgroup.py", line 39, in <module>
    print dvpg.portKeys
  File "/Volumes/data/src/ansible/venv4/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 574, in __call__
    return self.f(*args, **kwargs)
  File "/Volumes/data/src/ansible/venv4/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 394, in _InvokeAccessor
    return self._stub.InvokeAccessor(self, info)
  File "/Volumes/data/src/ansible/venv4/lib/python2.7/site-packages/pyVmomi/StubAdapterAccessorImpl.py", line 43, in InvokeAccessor
    objectContent = result.objects[0]
IndexError: list index out of range
@Akasurde Akasurde changed the title vcsim: DistributedVirtulaPortgroup does not have Portkeys vcsim: DistributedVirtualPortgroup does not have Portkeys Jan 4, 2018
@anfernee anfernee self-assigned this Feb 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants