mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
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 ```
This commit is contained in:
commit
acc19cafa4
@ -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")
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flavor, ok := val.(string)
|
||||
|
||||
if !ok {
|
||||
return "", fmt.Errorf("flavor name is not a string")
|
||||
}
|
||||
|
||||
return flavor, nil
|
||||
return "", fmt.Errorf("flavor name/id not found")
|
||||
}
|
||||
|
||||
func instanceIDFromProviderID(providerID string) (instanceID string, err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user