-
Notifications
You must be signed in to change notification settings - Fork 175
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
6-10-List failure on VC #4203
Comments
This test was testing the trailing slash specifically, but it had the exact same error without the trailing slash in the previous test also. |
Possible workaround: try with a path instead of just the name, for example:
|
It's likely that the problem relates to the following:
We are identifying the compute path as an absolute inventory path when it is not, due to it having a prefix matching the specified datacenter. if strings.HasPrefix(path, v.DatacenterPath) {
log.Debugf("Path is treated as absolute given datacenter prefix %q", v.DatacenterPath)
return path
} |
Verified @dougm 's workaround:
|
Adding a datacenter qualifier to target also works. I've not been able to figure out a small change that allows us to construct a functional inventory path that we can pass to finder without knowing the datacenter. I've been using this patch to sidestep the treating as abs path issue, and to avoid requiring the user specifying a trailing / index 568b52a..4dfcb2c 100644
--- a/lib/install/validate/compute.go
+++ b/lib/install/validate/compute.go
@@ -93,6 +93,11 @@ func (v *Validator) ResourcePoolHelper(ctx context.Context, path string) (*objec
ipath := v.computePathToInventoryPath(path)
log.Debugf("Converted original path %q to %q", path, ipath)
+ // ensure there's a trailing "/"
+ if !strings.HasSuffix(path, "/") {
+ path += "/"
+ }
+
// first try the path directly without any processing
pools, err := v.Session.Finder.ResourcePoolList(ctx, path)
if err != nil {
@@ -103,7 +108,7 @@ func (v *Validator) ResourcePoolHelper(ctx context.Context, path string) (*objec
}
// if it starts with datacenter then we know it's absolute and invalid
- if strings.HasPrefix(path, "/"+v.Session.DatacenterPath) {
+ if v.Session.DatacenterPath != "" && strings.HasPrefix(path, "/"+v.Session.DatacenterPath) {
v.suggestComputeResource(path)
return nil, err
}
diff --git a/lib/install/validate/validator.go b/lib/install/validate/validator.go
index 5c0e6fb..cd83116 100644
--- a/lib/install/validate/validator.go
+++ b/lib/install/validate/validator.go
@@ -596,7 +596,7 @@ func (v *Validator) computePathToInventoryPath(path string) string {
defer trace.End(trace.Begin(path))
// if it opens with the datacenter prefix the assume it's an absolute
- if strings.HasPrefix(path, v.DatacenterPath) {
+ if v.DatacenterPath != "" && strings.HasPrefix(path, v.DatacenterPath) {
log.Debugf("Path is treated as absolute given datacenter prefix %q", v.DatacenterPath)
return path
}
@@ -619,6 +619,10 @@ func (v *Validator) computePathToInventoryPath(path string) string {
}
if len(pElem) > 1 {
parts = append(parts, pElem[1])
+ } else {
+ // ensure there's a trailing slash after the components are joined
+ // seems to be needed for govmomi finder
+ parts = append(parts, "")
}
} else if path != "" {
// for ESX, first element is a pool
@@ -632,7 +636,7 @@ func (v *Validator) inventoryPathToComputePath(path string) string {
defer trace.End(trace.Begin(path))
// sanity check datacenter
- if !strings.HasPrefix(path, v.DatacenterPath) {
+ if v.DatacenterPath != "" && !strings.HasPrefix(path, v.DatacenterPath) {
log.Debugf("Expected path to be within target datacenter %q: %q", v.DatacenterPath, path)
v.NoteIssue(errors.New("inventory path was not in datacenter scope"))
return ""
|
TIL github has a Anyway I'm more than happy to implement a regression test for this issue while putting in your fix @hickeng -- it also strikes me as something that it might be helpful to break into a helper function so that if we need to find all occurrences of this test in the future we can use I think the bit that you added that ensures there's a trailing slash will also resolve #3975 |
We will prioritize this for future sprints. thanks. |
@gigawhitlocks the diff I supplied DOESN'T handle cluster style paths such as The datacenter should be required for create/delete/inspect as it's the toplevel namespace. It's only |
Added the following to the release notes:
@mhagen-vmware does this describe the issue accurately? |
@stuclem lgtm |
Thanks @mhagen-vmware. Removing kind/note. |
@dougm I have a working solution that I don't think is particularly ideal, as it apparently should not work. :) I spoke with @hickeng and he mentioned that your govmomi changes should drastically simplify the suggestions code. I was going to wait for your merge (which I suspect will happen soon) before deciding whether or not I should put up a PR yet. Judging by what I'm seeing/hearing, I should probably try to incorporate your finder changes to get a solution that functions as expected. |
@jzt ok Finder change is merged, ls change is in review. Lemme know if I can help with this one. |
- Support vic-machine create targeting Datacenter within an inventory folder. - Remove code around compute-resource suggestions and simplify using govmomi Finder enhancements. The removed code did not work when clusters/hosts were within inventory folders. - Add vcsim based tests for vic-machine validation against multiple resources of all types, within inventory folders. These tests also cover most of the error paths. - Add LicenseManager support to vcsim Fixes vmware#4203
- Support vic-machine create targeting Datacenter within an inventory folder. - Remove code around compute-resource suggestions and simplify using govmomi Finder enhancements. The removed code did not work when clusters/hosts were within inventory folders. - Add vcsim based tests for vic-machine validation against multiple resources of all types, within inventory folders. These tests also cover most of the error paths. - Add LicenseManager support to vcsim Fixes vmware#4203
- Support vic-machine create targeting Datacenter within an inventory folder. - Simplify compute-resource suggestions. Removes quite a bit of code, which also did not work when clusters/hosts were within inventory folders. Some of the removed code was working around the old govmomi Finder "list mode" limitations. - Add vcsim based tests for vic-machine validation against multiple resources of all types, within inventory folders. These tests also cover most of the error paths. - Add LicenseManager support to vcsim Fixes vmware#4203
- Support vic-machine create targeting Datacenter within an inventory folder. - Simplify compute-resource suggestions. Removes quite a bit of code, which also did not work when clusters/hosts were within inventory folders. Some of the removed code was working around the old govmomi Finder "list mode" limitations. - Add vcsim based tests for vic-machine validation against multiple resources of all types, within inventory folders. These tests also cover most of the error paths. - Add LicenseManager support to vcsim Fixes vmware#4203
- Support vic-machine create targeting Datacenter within an inventory folder. - Simplify compute-resource suggestions. Removes quite a bit of code, which also did not work when clusters/hosts were within inventory folders. Some of the removed code was working around the old govmomi Finder "list mode" limitations. - Add vcsim based tests for vic-machine validation against multiple resources of all types, within inventory folders. These tests also cover most of the error paths. - Add LicenseManager support to vcsim Fixes vmware#4203
- Support vic-machine create targeting Datacenter within an inventory folder. - Simplify compute-resource suggestions. Removes quite a bit of code, which also did not work when clusters/hosts were within inventory folders. Some of the removed code was working around the old govmomi Finder "list mode" limitations. - Add vcsim based tests for vic-machine validation against multiple resources of all types, within inventory folders. These tests also cover most of the error paths. - Add LicenseManager support to vcsim Fixes vmware#4203
- Support vic-machine create targeting Datacenter within an inventory folder. - Simplify compute-resource suggestions. Removes quite a bit of code, which also did not work when clusters/hosts were within inventory folders. Some of the removed code was working around the old govmomi Finder "list mode" limitations. - Add vcsim based tests for vic-machine validation against multiple resources of all types, within inventory folders. These tests also cover most of the error paths. - Add LicenseManager support to vcsim Fixes vmware#4203
- Support vic-machine create targeting Datacenter within an inventory folder. - Simplify compute-resource suggestions. Removes quite a bit of code, which also did not work when clusters/hosts were within inventory folders. Some of the removed code was working around the old govmomi Finder "list mode" limitations. - Add vcsim based tests for vic-machine validation against multiple resources of all types, within inventory folders. These tests also cover most of the error paths. - Add LicenseManager support to vcsim Fixes vmware#4203
If user specified a ResourcePool as the compute-resource and it resolves to multiple instances, suggest those pools that match. - Make sure Session ClusterPath and PoolPath are properly set in all cases - Set ResourcePool.Owner field in simulator Issue vmware#4203
If user specified a ResourcePool as the compute-resource and it resolves to multiple instances, suggest those pools that match. - Make sure Session ClusterPath and PoolPath are properly set in all cases - Set ResourcePool.Owner field in simulator Issue vmware#4203
If user specified a ResourcePool as the compute-resource and it resolves to multiple instances, suggest those pools that match. - Make sure Session ClusterPath and PoolPath are properly set in all cases - Set ResourcePool.Owner field in simulator Issue vmware#4203
If user specified a ResourcePool as the compute-resource and it resolves to multiple instances, suggest those pools that match. - Make sure Session ClusterPath and PoolPath are properly set in all cases - Set ResourcePool.Owner field in simulator Issue vmware#4203
Ran the command:
bin/vic-machine-linux ls --target xxxx.xxx.vmware.com/ --thumbprint=xxx --user xxx --password=xxx --compute-resource cls
Weird error, it suggests cls, but at the same time indicates cls is not valid, only difference being single quotes vs double quotes?
The text was updated successfully, but these errors were encountered: