-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add support for using unique identifiers to select a network connection in environments where names can be ambiguous. #237
Comments
|
|
FWIW: I can't seem to hit on the right set of arguments to make any of these alternate unique identifiers work with |
At a minimum, you'll need to download the source, and from the source tree run: go get http://github.com/vmware/govmomi
go mod tidy
go build Then copy the binary to your I've spoken with the maintainer about us updating to |
PR #240 for |
|
@tenthirtyam I saw that earlier today. Unfortunately, this plugin still doesn't seem to be able to find a network by a unique identifier other than its name. Using the Segment ID:
Using the MOID:
I imagine the issue is somewhere in here: packer-plugin-vsphere/builder/vsphere/driver/network.go Lines 23 to 47 in a0992c7
Does this plugin need to pass some additional information to govmomi What kind of additional information can I provide that will help running this down? |
Based on a quick review it looks like the plugin should call |
It looks to me like the This raises some additional questions:
That last question comes up because I can't get the search to work with |
It may be a good idea to open a GitHub Discussion item on
|
Are you able to find the network with govc using: % govc find / -type g -config.segmentId /infra/segments/seg_6e9bdde0-f9bf-4ee6-ac36-493627b6db32_0
/folder-WCP_DC/WCP_DC/network/seg-domain-c9:a97676f3-cf6d-42d7-875b-ae0bd0016e32-test-gc-e2e-demo-ns-0 If so and you add the % govc find -i / -type g -config.segmentId /infra/segments/seg_6e9bdde0-f9bf-4ee6-ac36-493627b6db32_0
DistributedVirtualPortgroup:dvportgroup-71 Does using the MOID work with the plugin? |
@dougm this query has the same issue as searching by name, that is to say it returns multiple results.
With the
|
My understanding based on the KB was that % govc find -i / -type g -config.segmentId /infra/segments/b8f015a1-c281-4dfd-abbc-df0c88c5b2a4 | xargs -n1 govc object.collect -o -json The error message in this comment is "not found":
Based on your govc output, I'd expect the error to be "multiple" found. So I also wonder if the plugin here has govmomi w/ the |
The error message observed in the previous comment when using MOID
|
I may be incorrect, but it might be because packer-plugin-vsphere/builder/vsphere/driver/vm.go Lines 948 to 953 in 324d9eb
packer-plugin-vsphere/builder/vsphere/driver/vm.go Lines 977 to 987 in 324d9eb
packer-plugin-vsphere/builder/vsphere/driver/network.go Lines 34 to 47 in 324d9eb
|
Yes, looks like that is the issue. We can change govmomi's |
Thanks Doug - appreciate the assist here. I'll work with the maintainer and get a fix in for this in the plugin to use the |
I'm setup to test new plugin builds, if you guys can get me some PoC code. |
I take it this is still backlogged ? |
I revisited this one this evening and did some tests on latest (v1.2.7) and didn't have any issues using the MOIDs for port groups (e.g. " ==> vsphere-iso.linux-photon: error creating virtual machine: path 'DHCP' resolves to multiple networks. please provide a host to match or the network full path When using the MOIDs, the build is placed on the correct port group or distributed port groups without issue. I've not verified this with an NSX segment yet, but it should have the same results. I was going to add the failback, as seen below, but it appears not to be needed... func (d *VCenterDriver) FindNetworks(name string) ([]*Network, error) {
ns, err := d.finder.NetworkList(d.ctx, name)
if err != nil || len(ns) == 0 {
n, err := d.finder.Network(d.ctx, name)
if err != nil {
return nil, err
}
return []*Network{
{
network: n,
driver: d,
},
}, nil
}
var networks []*Network
for _, n := range ns {
networks = append(networks, &Network{
network: n,
driver: d,
})
}
return networks, nil
} Why, because of vmware/govmomi#2626 (@dougm is awesome! 🎉 ) added the failback (see vmware/govmomi@bb4f739) that was included in v0.31.0 of I'm going to close this issue, however, I will add a PR to update the duplicate networks error message to instead suggest using the ID or path of the network instead of only "a host to match or full path". Ryan |
- Updates the error messages when more than one network with the same name resolves to more than one network. - Updated the documentation for `network` in `vsphere-iso` and `vsphere-clone` builders. Ref: #237 Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam I'd feel a lot better about this if it was tested with a NSX segment before closing this. I'll see if I can get a test in later today or on Monday. To clarify: I'm @taylor-madeak, just created a separate GitHub account for work stuff (which this issue relates to). |
I've successfully tested this with the both the segment id and logical switch uuid using release v1.2.7 on VMware Cloud Foundation 5.1.1 BOM. Ryan Johnson |
@tenthirtyam I'm still having some trouble getting a successful test for this in our VCF environment, where I'm not guaranteed to land on any one specific VM host in the cluster. Can you share which vsphere-iso source properties you're specifying when you test this feature? I'd like to verify that it's not just a template configuration issue on my part. |
Is your use case to always use the same host and a specific network on that host? |
The opposite, actually. My current template specifies server, datacenter, and cluster. I'd like to continue not caring which host I end up on and still be able to get a network. I'm not an expert with NSX, but it appears that the overlays end up being associated with VM hosts in vCenter. So, by not specifying a host to build on, the distributed portgroup MOID or segment ID I specify isn't found by Packer. |
- Updates the error messages when more than one network with the same name resolves to more than one network. - Updated the documentation for `network` in `vsphere-iso` and `vsphere-clone` builders. Ref: #237 Signed-off-by: Ryan Johnson <[email protected]>
Hey! If you'd like to take a look at this live let me know. You can email me [email protected] and we can schedule some time to look at this. Ryan Johnson |
@taylor-madeak - wanted to check in and see if you've had an opportunity to test with the latest. Please feel free to reach out at Ryan |
Community Note
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Description
NSX allows for creating port groups with the same name, even on the same virtual distributed switch. This plugin has a long history of issues with trying to create VMs on a vSphere cluster with such virtual distributed port groups managed by NSX overlays. VMware resolved this in govmomi 0.27 by allowing finder to use other unique identifiers to select a network:
To leverage this, I request the following:
I'm not a GoLang developer, so I'm probably not a great judge of how heavy a lift this would be, but it appears that this may be as simple as just changing the version of govmomi this plugin is built with. The plugin itself looks like it just passes the context and argument straight through to
govmomi.Finder
.Use Case(s)
Allow builder to be used in large vSphere environments that provide networking with NSX for scalability and mobility between clusters.
The text was updated successfully, but these errors were encountered: