vmware / pyvmomi-community-samples

A place for community contributed samples for the pyVmomi library.
Apache License 2.0
1.01k stars 922 forks source link

How to get the vm nic name,example eth0,or vm-nic-1 and so on #704

Open Aixleft723 opened 2 years ago

Aixleft723 commented 2 years ago

Describe the bug

I can not get the nic name

Reproduction steps

1. # Loop through all the VMs
    for child in children:
        # get all the vm name
        vmName = child.summary.config.name
        if vmName != "lanjing":
            continue
        for dev in child.config.hardware.device:
2.
3.
...

Expected behavior

Get the vm nic name

Additional context

No response

amdei commented 1 year ago

May be this line will help you to find an answer: https://github.com/vmware/pyvmomi-community-samples/pull/710/files#diff-b0253e78a2fcda842b484b0a78585928c1b7cdf3507871a87c4bfff6abc44823R76 ?