vmware / vmware/pyvmomi

vmVnicNetworkResourcePoolKey property cannot be set to -1

Open
#938 0 comments 0 reactions 0 assignees View on GitHub

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

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.