From c08f35b9f8539bc5e6a1b04b4bfb4f3df849f3a5 Mon Sep 17 00:00:00 2001 From: TangBin Date: Wed, 26 Feb 2020 11:16:42 +0800 Subject: [PATCH] ctyun get vm by id fix --- pkg/multicloud/ctyun/host.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/multicloud/ctyun/host.go b/pkg/multicloud/ctyun/host.go index 5627646113..b1ebbd21ec 100644 --- a/pkg/multicloud/ctyun/host.go +++ b/pkg/multicloud/ctyun/host.go @@ -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")