Skip to content

Commit

Permalink
Merge pull request kubevirt#6879 from vasiliy-ul/fix-image-upload
Browse files Browse the repository at this point in the history
Fix image upload with force-bind flag
  • Loading branch information
kubevirt-bot authored Dec 1, 2021
2 parents 4b57b1d + 7af6234 commit 542fe4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/virtctl/imageupload/imageupload.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ func waitDvUploadScheduled(client kubecli.KubevirtClient, namespace, name string
return false, err
}

if dv.Status.Phase == cdiv1.WaitForFirstConsumer {
if dv.Status.Phase == cdiv1.WaitForFirstConsumer && !forceBind {
return false, fmt.Errorf("cannot upload to DataVolume in WaitForFirstConsumer state, make sure the PVC is Bound")
}
// TODO: can check Condition/Event here to provide user with some error messages
Expand Down
6 changes: 5 additions & 1 deletion tests/storage/imageupload.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ var _ = SIGDescribe("[Serial]ImageUpload", func() {

Context("Create upload volume with force-bind flag", func() {
DescribeTable("Should succeed", func(resource, targetName string, validateFunc func(string), deleteFunc func(string)) {
if !tests.HasBindingModeWaitForFirstConsumer() {
Skip("Skip no local wffc storage class available")
}
defer deleteFunc(targetName)

By("Upload image")
Expand All @@ -209,8 +212,9 @@ var _ = SIGDescribe("[Serial]ImageUpload", func() {
"--namespace", util.NamespaceTestDefault,
"--image-path", imagePath,
"--size", pvcSize,
"--storage-class", tests.Config.StorageClassLocal,
"--access-mode", "ReadWriteOnce",
"--force-bind",
"--block-volume",
"--insecure")

Expect(virtctlCmd()).To(Succeed())
Expand Down

0 comments on commit 542fe4b

Please sign in to comment.