Skip to content

Commit

Permalink
Merge pull request kubevirt#9918 from ShellyKa13/kubevirt-with-popula…
Browse files Browse the repository at this point in the history
…tors

Fix for hotplug with WFFC and CDI populators + test fixes
  • Loading branch information
kubevirt-bot authored Jun 16, 2023
2 parents a67a8b6 + 844e69b commit 3fad00e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/virt-controller/watch/vmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,7 @@ func (c *VMIController) createAttachmentPodTemplate(vmi *virtv1.VirtualMachineIn
}
for volumeName, pvc := range volumeNamesPVCMap {
//Verify the PVC is ready to be used.
populated, err := cdiv1.IsPopulated(pvc, func(name, namespace string) (*cdiv1.DataVolume, error) {
populated, err := cdiv1.IsSucceededOrPendingPopulation(pvc, func(name, namespace string) (*cdiv1.DataVolume, error) {
dv, exists, _ := c.dataVolumeInformer.GetStore().GetByKey(fmt.Sprintf("%s/%s", namespace, name))
if !exists {
return nil, fmt.Errorf("unable to find datavolume %s/%s", namespace, name)
Expand Down
4 changes: 2 additions & 2 deletions tests/storage/datavolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ var _ = SIGDescribe("DataVolume Integration", func() {

// This will only work on storage with binding mode WaitForFirstConsumer,
if libstorage.IsStorageClassBindingModeWaitForFirstConsumer(libstorage.Config.StorageRWOFileSystem) {
Eventually(ThisDV(dataVolume), 40).Should(BeInPhase(cdiv1.WaitForFirstConsumer))
Eventually(ThisDV(dataVolume), 40).Should(Or(BeInPhase(cdiv1.WaitForFirstConsumer), BeInPhase(cdiv1.PendingPopulation)))
}
num := 2
By("Starting and stopping the VirtualMachineInstance a number of times")
Expand Down Expand Up @@ -324,7 +324,7 @@ var _ = SIGDescribe("DataVolume Integration", func() {
Expect(err).ToNot(HaveOccurred())
// This will only work on storage with binding mode WaitForFirstConsumer,
if libstorage.IsStorageClassBindingModeWaitForFirstConsumer(libstorage.Config.StorageRWOFileSystem) {
Eventually(ThisDV(dataVolume), 40).Should(BeInPhase(cdiv1.WaitForFirstConsumer))
Eventually(ThisDV(dataVolume), 40).Should(Or(BeInPhase(cdiv1.WaitForFirstConsumer), BeInPhase(cdiv1.PendingPopulation)))
}
// with WFFC the run actually starts the import and then runs VM, so the timeout has to include both
// import and start
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ var _ = SIGDescribe("Storage", func() {
Expect(err).ToNot(HaveOccurred())
By("Waiting until the DataVolume is ready")
if libstorage.IsStorageClassBindingModeWaitForFirstConsumer(libstorage.Config.StorageRWOFileSystem) {
Eventually(ThisDV(dataVolume), 30).Should(BeInPhase(cdiv1.WaitForFirstConsumer))
Eventually(ThisDV(dataVolume), 30).Should(Or(BeInPhase(cdiv1.WaitForFirstConsumer), BeInPhase(cdiv1.PendingPopulation)))
}

virtiofsMountPath := fmt.Sprintf("/mnt/virtiofs_%s", dataVolume.Name)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ func NewRandomVirtualMachineInstanceWithDisk(imageUrl, namespace, sc string, acc
var err error
dv, err = virtCli.CdiClient().CdiV1beta1().DataVolumes(namespace).Create(context.Background(), dv, metav1.CreateOptions{})
Expect(err).ToNot(HaveOccurred())
libstorage.EventuallyDV(dv, 240, Or(HaveSucceeded(), BeInPhase(cdiv1.WaitForFirstConsumer)))
libstorage.EventuallyDV(dv, 240, Or(HaveSucceeded(), BeInPhase(cdiv1.WaitForFirstConsumer), BeInPhase(cdiv1.PendingPopulation)))
return NewRandomVMIWithDataVolume(dv.Name), dv
}

Expand Down
2 changes: 1 addition & 1 deletion tests/virtiofs/datavolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ var _ = Describe("[sig-storage] virtiofs", decorators.SigStorage, func() {
Expect(err).ToNot(HaveOccurred())
By("Waiting until the DataVolume is ready")
if libstorage.IsStorageClassBindingModeWaitForFirstConsumer(libstorage.Config.StorageRWOFileSystem) {
Eventually(ThisDV(dataVolume), 30).Should(BeInPhase(cdiv1.WaitForFirstConsumer))
Eventually(ThisDV(dataVolume), 30).Should(Or(BeInPhase(cdiv1.WaitForFirstConsumer), BeInPhase(cdiv1.PendingPopulation)))
}

virtiofsMountPath := fmt.Sprintf("/mnt/virtiofs_%s", dataVolume.Name)
Expand Down

0 comments on commit 3fad00e

Please sign in to comment.