Skip to content

Commit

Permalink
fix panic on storage failed get host (#7390)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanyaoqi committed Jul 31, 2020
1 parent 0deb908 commit d6fdf33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/compute/models/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4970,7 +4970,7 @@ func (host *SHost) switchWithBackup(ctx context.Context, userCred mcclient.Token
guests2 := host.GetGuestsBackupOnThisHost()
for i := 0; i < len(guests2); i++ {
if guests2[i].isInReconcile(userCred) {
log.Warningf("guest %s is in reconcile", guests[i].GetName())
log.Warningf("guest %s is in reconcile", guests2[i].GetName())
continue
}
data := jsonutils.NewDict()
Expand Down
3 changes: 3 additions & 0 deletions pkg/compute/storagedrivers/rbd.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ func (self *SRbdStorageDriver) RequestCreateSnapshot(ctx context.Context, snapsh
func (self *SRbdStorageDriver) RequestDeleteSnapshot(ctx context.Context, snapshot *models.SSnapshot, task taskman.ITask) error {
storage := snapshot.GetStorage()
host := storage.GetMasterHost()
if host == nil {
return errors.Errorf("storage %s can't get master host", storage.Id)
}
url := fmt.Sprintf("%s/disks/%s/delete-snapshot/%s", host.ManagerUri, storage.Id, snapshot.DiskId)
header := task.GetTaskRequestHeader()
params := jsonutils.NewDict()
Expand Down

0 comments on commit d6fdf33

Please sign in to comment.