diff --git a/images/virtualization-artifact/pkg/controller/kvapi/kvapi.go b/images/virtualization-artifact/pkg/controller/kvapi/kvapi.go index 6e928c52f..359405864 100644 --- a/images/virtualization-artifact/pkg/controller/kvapi/kvapi.go +++ b/images/virtualization-artifact/pkg/controller/kvapi/kvapi.go @@ -191,9 +191,9 @@ func volumeNameExists(volume virtv1.Volume, volumeName string) bool { } func volumeSourceExists(volume virtv1.Volume, volumeName string) bool { + // Do not add ContainerDisk!!! return (volume.DataVolume != nil && volume.DataVolume.Name == volumeName) || - (volume.PersistentVolumeClaim != nil && volume.PersistentVolumeClaim.ClaimName == volumeName) || - (volume.ContainerDisk != nil && volume.ContainerDisk.Image != "") + (volume.PersistentVolumeClaim != nil && volume.PersistentVolumeClaim.ClaimName == volumeName) } func volumeHotpluggable(volume virtv1.Volume) bool { diff --git a/images/virtualization-artifact/pkg/controller/vmbda/internal/deletion.go b/images/virtualization-artifact/pkg/controller/vmbda/internal/deletion.go index ab353e0a7..7cd3eec2d 100644 --- a/images/virtualization-artifact/pkg/controller/vmbda/internal/deletion.go +++ b/images/virtualization-artifact/pkg/controller/vmbda/internal/deletion.go @@ -19,6 +19,7 @@ package internal import ( "context" "log/slog" + "strings" "k8s.io/apimachinery/pkg/types" virtv1 "kubevirt.io/api/core/v1" @@ -91,9 +92,11 @@ func (h *DeletionHandler) cleanUp(ctx context.Context, vmbda *virtv2.VirtualMach if h.unplug.CanUnplug(kvvm, diskName) { h.log.Info("Unplug Virtual Disk", slog.String("diskName", diskName), slog.String("vm", kvvm.Name)) if err = h.unplug.UnplugDisk(ctx, kvvm, diskName); err != nil { + if strings.Contains(err.Error(), "does not exist") { + return nil + } return err } } - return nil }