ctyun get vm by id fix

This commit is contained in:
TangBin
2020-02-26 17:40:56 +08:00
parent b40be2608b
commit 7bec5e6f7e
+4
View File
@@ -265,6 +265,10 @@ func (self *SRegion) GetVMs() ([]SInstance, error) {
}
func (self *SRegion) GetVMById(vmId string) (*SInstance, error) {
if len(vmId) == 0 {
return nil, errors.Wrap(cloudprovider.ErrNotFound, "SRegion.GetVMById.EmptyVmID")
}
vms, err := self.getVMs(vmId)
if err != nil {
return nil, errors.Wrap(err, "SRegion.GetVMById")