vmVnicNetworkResourcePoolKey property cannot be set to -1
Open
Nobody has claimed this yet.
needs verification
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 763
- PR merge metrics
- No merged PRs in 30d
Description
def add_dvPort_group(si, dv_switch, pg_name, pg_vlan_id):
dv_pg_spec = vim.dvs.DistributedVirtualPortgroup.ConfigSpec()
dv_pg_spec.configVersion = '0'
dv_pg_spec.name = pg_name
dv_pg_spec.numPorts = 8
dv_pg_spec.type = vim.dvs.DistributedVirtualPortgroup.PortgroupType.earlyBinding
dv_pg_spec.vmVnicNetworkResourcePoolKey = '-1'
dv_pg_spec.defaultPortConfig = vim.dvs.VmwareDistributedVirtualSwitch.VmwarePortConfigPolicy()
dv_pg_spec.defaultPortConfig.securityPolicy = vim.dvs.VmwareDistributedVirtualSwitch.SecurityPolicy()
dv_pg_spec.defaultPortConfig.vlan = vim.dvs.VmwareDistributedVirtualSwitch.VlanIdSpec()
dv_pg_spec.defaultPortConfig.vlan.vlanId = pg_vlan_id
dv_pg_spec.defaultPortConfig.securityPolicy.allowPromiscuous = vim.BoolPolicy(value=False)
dv_pg_spec.defaultPortConfig.securityPolicy.forgedTransmits = vim.BoolPolicy(value=False)
dv_pg_spec.defaultPortConfig.vlan.inherited = False
dv_pg_spec.defaultPortConfig.securityPolicy.inherited = True
dv_pg_spec.defaultPortConfig.securityPolicy.allowPromiscuous = vim.BoolPolicy(inherited=True)
dv_pg_spec.defaultPortConfig.securityPolicy.macChanges = vim.BoolPolicy(inherited=True)
dv_pg_spec.defaultPortConfig.securityPolicy.forgedTransmits = vim.BoolPolicy(inherited=True)
task = dv_switch.AddDVPortgroup_Task([dv_pg_spec])
wait_for_task(task, si)
Running this code the vmVnicNetworkResourcePoolKey property is not set in the vCenter and the config version is set to 1 instead of 0

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduced add_dvPort_group example and the vim.dvs.DistributedVirtualPortgroup.ConfigSpec fields, especially vmVnicNetworkResourcePoolKey and configVersion. Run the AddDVPortgroup_Task flow against vCenter and compare the requested values with the resulting configuration; done means the reported behavior is explained or corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100