Skip to content

Commit

Permalink
Clean error message for not migratable VMI
Browse files Browse the repository at this point in the history
Signed-off-by: Bartosz Rybacki <[email protected]>
  • Loading branch information
brybacki committed Jan 20, 2021
1 parent d8e3b67 commit f902324
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/virt-handler/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ func (d *VirtualMachineController) checkVolumesForMigration(vmi *v1.VirtualMachi
return blockMigrate, err
}
if !shared {
return true, fmt.Errorf("cannot migrate VMI with non-shared PVCs")
return true, fmt.Errorf("cannot migrate VMI: PVC %v is not shared, live migration requires that all PVCs must be shared (using ReadWriteMany access mode)", volName)
}
} else if volSrc.HostDisk != nil {
shared := volSrc.HostDisk.Shared != nil && *volSrc.HostDisk.Shared
Expand Down
4 changes: 2 additions & 2 deletions pkg/virt-handler/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ var _ = Describe("VirtualMachineInstance", func() {
virtClient.CoreV1().PersistentVolumeClaims(vmi.Namespace).Create(testBlockPvc)
blockMigrate, err := controller.checkVolumesForMigration(vmi)
Expect(blockMigrate).To(BeTrue())
Expect(err).To(Equal(fmt.Errorf("cannot migrate VMI with non-shared PVCs")))
Expect(err).To(Equal(fmt.Errorf("cannot migrate VMI: PVC testblock is not shared, live migration requires that all PVCs must be shared (using ReadWriteMany access mode)")))
})
It("should fail migration for non-shared data volume PVCs", func() {

Expand Down Expand Up @@ -1703,7 +1703,7 @@ var _ = Describe("VirtualMachineInstance", func() {
virtClient.CoreV1().PersistentVolumeClaims(vmi.Namespace).Create(testBlockPvc)
blockMigrate, err := controller.checkVolumesForMigration(vmi)
Expect(blockMigrate).To(BeTrue())
Expect(err).To(Equal(fmt.Errorf("cannot migrate VMI with non-shared PVCs")))
Expect(err).To(Equal(fmt.Errorf("cannot migrate VMI: PVC testblock is not shared, live migration requires that all PVCs must be shared (using ReadWriteMany access mode)")))
})
It("should be allowed to migrate a mix of shared and non-shared disks", func() {

Expand Down

0 comments on commit f902324

Please sign in to comment.