Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: yaroslavborbat <[email protected]>
  • Loading branch information
yaroslavborbat committed Jan 18, 2025
1 parent ac8aed3 commit e548ada
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions images/virtualization-artifact/pkg/controller/kvapi/kvapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package internal
import (
"context"
"log/slog"
"strings"

"k8s.io/apimachinery/pkg/types"
virtv1 "kubevirt.io/api/core/v1"
Expand Down Expand Up @@ -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
}

0 comments on commit e548ada

Please sign in to comment.