Merge pull request #10131 from ioito/automated-cherry-pick-of-#10130-upstream-release-3.7

Automated cherry pick of #10130: fix(hostman): fix kvm create disk failed error
This commit is contained in:
Zexi Li
2021-02-03 20:38:35 +08:00
committed by GitHub
@@ -227,10 +227,15 @@ func perfomrDiskActions(ctx context.Context, w http.ResponseWriter, r *http.Requ
return
}
disk, err := storage.GetDiskById(diskId)
if err != nil {
hostutils.Response(ctx, w, httperrors.NewGeneralError(errors.Wrapf(err, "GetDiskById(%s)", diskId)))
return
var disk storageman.IDisk
var err error
if action != "create" {
disk, err = storage.GetDiskById(diskId)
if err != nil {
hostutils.Response(ctx, w, httperrors.NewGeneralError(errors.Wrapf(err, "GetDiskById(%s)", diskId)))
return
}
}
f, ok := actionFuncs[action]