Skip to content

Commit

Permalink
fix(esxi): skip not found host by storage
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito committed Feb 12, 2025
1 parent ced892b commit f2daa70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/multicloud/esxi/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ func (self *SDatastore) getAttachedHosts() ([]cloudprovider.ICloudHost, error) {
idstr := moRefId(moStore.Host[i].Key)
host, err := self.datacenter.GetIHostByMoId(idstr)
if err != nil {
if errors.Cause(err) == cloudprovider.ErrNotFound {
continue
}
return nil, err
}
ihosts = append(ihosts, host)
Expand Down
2 changes: 2 additions & 0 deletions pkg/multicloud/esxi/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (t *SVMTemplate) GetGlobalId() string {
func (t *SVMTemplate) GetStatus() string {
ihosts, err := t.cache.datastore.GetAttachedHosts()
if err != nil {
log.Errorf("GetAttachedHosts for image %s error: %v", t.GetName(), err)
return api.CACHED_IMAGE_STATUS_CACHE_FAILED
}
for _, ihost := range ihosts {
Expand All @@ -88,6 +89,7 @@ func (t *SVMTemplate) GetStatus() string {
return api.CACHED_IMAGE_STATUS_CACHE_FAILED
}
}
log.Errorf("empty host attached for image %s", t.GetName())
return api.CACHED_IMAGE_STATUS_CACHE_FAILED
}

Expand Down

0 comments on commit f2daa70

Please sign in to comment.