mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): avoid get openstack hostid panic
This commit is contained in:
@@ -202,6 +202,16 @@ func (region *SRegion) GetIVMById(id string) (cloudprovider.ICloudVM, error) {
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetInstance(%s)", id)
|
||||
}
|
||||
hosts, err := region.GetIHosts()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i := range hosts {
|
||||
host := hosts[i].(*SHypervisor)
|
||||
if instance.HypervisorHostname == host.HypervisorHostname {
|
||||
instance.host = host
|
||||
}
|
||||
}
|
||||
return instance, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user