Merge pull request #10130 from ioito/hotfix/qx-kvm-disk-create

fix(hostman): fix kvm create disk failed error
This commit is contained in:
Zexi Li
2021-02-03 20:38:12 +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]