Commit acc19caf authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #49231 from dims/tolerate-flavor-info-keys

Automatic merge from submit-queue Tolerate Flavor information for computing instance type **What this PR does / why we need it**: Current devstack seems to return "id", and an upcoming change using nova's microversion will be returning "original_name": https://blueprints.launchpad.net/nova/+spec/instance-flavor-api So let's just inspect what is present and use that to figure out the instance type. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents de71cc50 c197e623
......@@ -188,19 +188,17 @@ func (i *Instances) InstanceType(name types.NodeName) (string, error) {
}
func srvInstanceType(srv *servers.Server) (string, error) {
val, ok := srv.Flavor["name"]
if !ok {
return "", fmt.Errorf("flavor name not present in server info")
}
flavor, ok := val.(string)
if !ok {
return "", fmt.Errorf("flavor name is not a string")
keys := []string{"name", "id", "original_name"}
for _, key := range keys {
val, found := srv.Flavor[key]
if found {
flavor, ok := val.(string)
if ok {
return flavor, nil
}
}
}
return flavor, nil
return "", fmt.Errorf("flavor name/id not found")
}
func instanceIDFromProviderID(providerID string) (instanceID string, err error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment