Skip to content

Commit

Permalink
Merge pull request #1177 from ioito/automated-cherry-pick-of-#1176-up…
Browse files Browse the repository at this point in the history
…stream-release-3.11

Automated cherry pick of #1176: fix(esxi): skip not found host by storage
  • Loading branch information
ioito authored Feb 12, 2025
2 parents 129188b + 61d2631 commit 8e46641
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 8e46641

Please sign in to comment.