From 5c5875a04563ecd52cac67140723a596d39c8bbe Mon Sep 17 00:00:00 2001 From: yaroslavborbat Date: Wed, 4 Dec 2024 17:10:52 +0300 Subject: [PATCH] fix Signed-off-by: yaroslavborbat --- ...uto-migrate-if-nodeplacement-changed.patch | 44 +++++-------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/images/virt-artifact/patches/024-auto-migrate-if-nodeplacement-changed.patch b/images/virt-artifact/patches/024-auto-migrate-if-nodeplacement-changed.patch index a062aae5a..86a0e7200 100644 --- a/images/virt-artifact/patches/024-auto-migrate-if-nodeplacement-changed.patch +++ b/images/virt-artifact/patches/024-auto-migrate-if-nodeplacement-changed.patch @@ -418,41 +418,21 @@ index 0000000000..b16c2f365f + return false +} diff --git a/pkg/virt-controller/watch/vmi.go b/pkg/virt-controller/watch/vmi.go -index 0c4bfca389..b798743c61 100644 +index 0c4bfca389..6bd1ecf76a 100644 --- a/pkg/virt-controller/watch/vmi.go +++ b/pkg/virt-controller/watch/vmi.go -@@ -30,16 +30,20 @@ import ( - "strings" - "time" - +@@ -69,6 +69,10 @@ import ( + virtconfig "kubevirt.io/kubevirt/pkg/virt-config" + "kubevirt.io/kubevirt/pkg/virt-controller/services" + "kubevirt.io/kubevirt/pkg/virt-controller/watch/descheduler" ++ + "k8s.io/apimachinery/pkg/labels" - "k8s.io/utils/ptr" - + "kubevirt.io/kubevirt/pkg/indexers" - "kubevirt.io/kubevirt/pkg/virt-controller/network" - -+ networkv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" -+ + "kubevirt.io/kubevirt/pkg/util/affinity" -+ - "kubevirt.io/kubevirt/pkg/virt-controller/watch/topology" - - backendstorage "kubevirt.io/kubevirt/pkg/storage/backend-storage" + ) -- networkv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1" -- - k8sv1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/equality" - k8serrors "k8s.io/apimachinery/pkg/api/errors" -@@ -51,7 +55,6 @@ import ( - "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/workqueue" - "k8s.io/utils/trace" -- - virtv1 "kubevirt.io/api/core/v1" - "kubevirt.io/client-go/kubecli" - "kubevirt.io/client-go/log" -@@ -114,6 +117,10 @@ func NewVMIController(templateService services.TemplateService, + const ( +@@ -114,6 +118,10 @@ func NewVMIController(templateService services.TemplateService, backendStorage: backendstorage.NewBackendStorage(clientset, clusterConfig, storageClassInformer.GetStore(), storageProfileInformer.GetStore(), pvcInformer.GetIndexer()), } @@ -463,7 +443,7 @@ index 0c4bfca389..b798743c61 100644 c.hasSynced = func() bool { return vmInformer.HasSynced() && vmiInformer.HasSynced() && podInformer.HasSynced() && dataVolumeInformer.HasSynced() && cdiConfigInformer.HasSynced() && cdiInformer.HasSynced() && -@@ -208,6 +215,7 @@ type VMIController struct { +@@ -208,6 +216,7 @@ type VMIController struct { vmiIndexer cache.Indexer vmStore cache.Store podIndexer cache.Indexer @@ -471,7 +451,7 @@ index 0c4bfca389..b798743c61 100644 pvcIndexer cache.Indexer storageClassStore cache.Store topologyHinter topology.Hinter -@@ -691,6 +699,10 @@ func (c *VMIController) updateStatus(vmi *virtv1.VirtualMachineInstance, pod *k8 +@@ -691,6 +700,10 @@ func (c *VMIController) updateStatus(vmi *virtv1.VirtualMachineInstance, pod *k8 c.syncVolumesUpdate(vmiCopy) } @@ -482,7 +462,7 @@ index 0c4bfca389..b798743c61 100644 case vmi.IsScheduled(): if !vmiPodExists { vmiCopy.Status.Phase = virtv1.Failed -@@ -2416,6 +2428,166 @@ func (c *VMIController) syncVolumesUpdate(vmi *virtv1.VirtualMachineInstance) { +@@ -2416,6 +2429,166 @@ func (c *VMIController) syncVolumesUpdate(vmi *virtv1.VirtualMachineInstance) { vmiConditions.UpdateCondition(vmi, &condition) }