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

govc: support raw object references in import.ova NetworkMapping #1997

Merged
merged 2 commits into from
May 29, 2020

Conversation

dougm
Copy link
Member

@dougm dougm commented May 28, 2020

vCenter doesn't allow duplicate port group names within the network folder when creating via the UI
or the AddDVPortgroupTask() API. However, NSXt 3.0 can do so via other (unknown) means. With this
condition, govc would fail to map the given network name to its managed object reference.
To workaround this, a raw MO ref can now be used in the NetworkMapping, instead of the Network name
or inventory path.

Related history:
223168f * Add NetworkMapping section to importx options.
e3c3cd0 * Populate network mapping from ovf envelope (#546)

Fixes #1996

@dougm
Copy link
Member Author

dougm commented May 28, 2020

@jtarchie can you review?

@jtarchie
Copy link

I don't know enough to review the code. We are going test it against a live env to see if it resolves our issue.

@datianshi
Copy link
Contributor

So user has to find the raw MO first? Is that possible this can be done by reference "distributed_switch/port_group_name" Only port group name is unique, while the distributed switch is unique

@dougm
Copy link
Member Author

dougm commented May 29, 2020

@datianshi yes, see examples in #1996

In general, the inventory paths used by govmomi/govc are generic to the vCenter inventory hierarchy (https://blogs.vmware.com/vsphere/2012/05/introduction-to-the-vsphere-api-part-3-inventory-hierarchy.html)

The paths are composed using parent/child relationships, regardless of type. The catch here is that switches and port groups are siblings in the vCenter inventory. It is possible we could make "distributed_switch/port_group_name" work in the long term, but the fallback to moref in this PR is more straightforward for the short term.

@dougm
Copy link
Member Author

dougm commented May 29, 2020

@datianshi @jtarchie looking at this closer, I think we can make "distributed_switch/port_group_name" work without too much trouble. The native vSphere SearchIndex and ContainerView APIs don't support inventory paths with this structure, but I think govmomi's Finder can adapt to this cleanly. Trying it out now and will update soon.

dougm added 2 commits May 29, 2020 05:23
vCenter doesn't allow duplicate port group names within the network folder when creating via the UI
or the AddDVPortgroupTask() API. However, NSXt 3.0 can do so via other (unknown) means. With this
condition, govc would fail to map the given network name to its managed object reference.
To workaround this, a raw MO ref can now be used in the NetworkMapping, instead of the Network name
or inventory path.

Related history:
223168f * Add NetworkMapping section to importx options.
e3c3cd0 * Populate network mapping from ovf envelope (vmware#546)

Fixes vmware#1996
While the native vSphere SearchIndex and ContainerView APIs don't support
inventory paths with this structure, it is useful for use with NSXt3 where
portgroup may not be unique within the same network inventory folder.
@dougm
Copy link
Member Author

dougm commented May 29, 2020

Added a new commit to support "distributed_switch/port_group_name". Using raw moref is still an option, but not required when switch name is included.

@dougm dougm merged commit 770fcba into vmware:master May 29, 2020
@dougm dougm deleted the issue-1996 branch May 29, 2020 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

import.ova does not work with NSXT 3.0 and [distribute switch name] / [port group name]
4 participants