Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,14 @@ func ApplyVirtualMachineSpec(

switch {
case device.PVCName != "":
pvcName := device.PVCName
if kind == v1alpha2.DiskDevice {
if vd := vdByName[name]; vd != nil && vd.Status.Target.PersistentVolumeClaim != "" {
pvcName = vd.Status.Target.PersistentVolumeClaim
}
}
if err := kvvm.SetDisk(device.VolumeName, SetDiskOptions{
PersistentVolumeClaim: pointer.GetPointer(device.PVCName),
PersistentVolumeClaim: pointer.GetPointer(pvcName),
IsHotplugged: true,
Serial: GenerateSerialFromObject(obj),
}); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ func (v *StorageClassValidator) validateTargetStorageClassForVolumeMigration(ctx
return fmt.Errorf("storage class cannot be changed unless the VirtualDisk is mounted to a running virtual machine")
}

for _, bd := range vm.Status.BlockDeviceRefs {
if bd.Hotplugged {
return fmt.Errorf("for now, changing the storage class is not allowed if the virtual machine has hot-plugged block devices")
}
}

currentStorageClassName := newVD.Status.StorageClassName
currentStorageClass, err := v.scService.GetStorageClass(ctx, currentStorageClassName)
if err != nil {
Expand Down
Loading