Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
Signed-off-by: yaroslavborbat <[email protected]>
  • Loading branch information
yaroslavborbat committed Dec 19, 2024
1 parent 2d71dd2 commit 65bdb85
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 9 additions & 9 deletions images/virt-artifact/patches/028-hotplug-container-disk.patch
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,10 @@ index 4fd325ba86..82fcaee0a3 100644
"//vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1:go_default_library",
],
diff --git a/pkg/virt-controller/watch/vmi.go b/pkg/virt-controller/watch/vmi.go
index 0c4bfca389..142f4400a6 100644
index fa4e86ee17..ebe718f90d 100644
--- a/pkg/virt-controller/watch/vmi.go
+++ b/pkg/virt-controller/watch/vmi.go
@@ -1816,6 +1816,10 @@ func (c *VMIController) handleHotplugVolumes(hotplugVolumes []*virtv1.Volume, ho
@@ -1836,6 +1836,10 @@ func (c *VMIController) handleHotplugVolumes(hotplugVolumes []*virtv1.Volume, ho
readyHotplugVolumes := make([]*virtv1.Volume, 0)
// Find all ready volumes
for _, volume := range hotplugVolumes {
Expand All @@ -471,7 +471,7 @@ index 0c4bfca389..142f4400a6 100644
var err error
ready, wffc, err := storagetypes.VolumeReadyToAttachToNode(vmi.Namespace, *volume, dataVolumes, c.dataVolumeIndexer, c.pvcIndexer)
if err != nil {
@@ -1864,7 +1868,15 @@ func (c *VMIController) handleHotplugVolumes(hotplugVolumes []*virtv1.Volume, ho
@@ -1884,7 +1888,15 @@ func (c *VMIController) handleHotplugVolumes(hotplugVolumes []*virtv1.Volume, ho

func (c *VMIController) podVolumesMatchesReadyVolumes(attachmentPod *k8sv1.Pod, volumes []*virtv1.Volume) bool {
// -2 for empty dir and token
Expand All @@ -488,7 +488,7 @@ index 0c4bfca389..142f4400a6 100644
return false
}
podVolumeMap := make(map[string]k8sv1.Volume)
@@ -1873,10 +1885,20 @@ func (c *VMIController) podVolumesMatchesReadyVolumes(attachmentPod *k8sv1.Pod,
@@ -1893,10 +1905,20 @@ func (c *VMIController) podVolumesMatchesReadyVolumes(attachmentPod *k8sv1.Pod,
podVolumeMap[volume.Name] = volume
}
}
Expand All @@ -510,7 +510,7 @@ index 0c4bfca389..142f4400a6 100644
}

func (c *VMIController) createAttachmentPod(vmi *virtv1.VirtualMachineInstance, virtLauncherPod *k8sv1.Pod, volumes []*virtv1.Volume) (*k8sv1.Pod, syncError) {
@@ -1987,7 +2009,17 @@ func (c *VMIController) createAttachmentPodTemplate(vmi *virtv1.VirtualMachineIn
@@ -2007,7 +2029,17 @@ func (c *VMIController) createAttachmentPodTemplate(vmi *virtv1.VirtualMachineIn
var pod *k8sv1.Pod
var err error

Expand All @@ -529,7 +529,7 @@ index 0c4bfca389..142f4400a6 100644
if err != nil {
return nil, fmt.Errorf("failed to get PVC map: %v", err)
}
@@ -2009,7 +2041,7 @@ func (c *VMIController) createAttachmentPodTemplate(vmi *virtv1.VirtualMachineIn
@@ -2029,7 +2061,7 @@ func (c *VMIController) createAttachmentPodTemplate(vmi *virtv1.VirtualMachineIn
}
}

Expand All @@ -538,7 +538,7 @@ index 0c4bfca389..142f4400a6 100644
pod, err = c.templateService.RenderHotplugAttachmentPodTemplate(volumes, virtlauncherPod, vmi, volumeNamesPVCMap)
}
return pod, err
@@ -2131,23 +2163,39 @@ func (c *VMIController) updateVolumeStatus(vmi *virtv1.VirtualMachineInstance, v
@@ -2151,23 +2183,39 @@ func (c *VMIController) updateVolumeStatus(vmi *virtv1.VirtualMachineInstance, v
ClaimName: volume.Name,
}
}
Expand Down Expand Up @@ -586,7 +586,7 @@ index 0c4bfca389..142f4400a6 100644
if c.canMoveToAttachedPhase(status.Phase) {
status.Phase = virtv1.HotplugVolumeAttachedToNode
status.Message = fmt.Sprintf("Created hotplug attachment pod %s, for volume %s", attachmentPod.Name, volume.Name)
@@ -2156,7 +2204,6 @@ func (c *VMIController) updateVolumeStatus(vmi *virtv1.VirtualMachineInstance, v
@@ -2176,7 +2224,6 @@ func (c *VMIController) updateVolumeStatus(vmi *virtv1.VirtualMachineInstance, v
}
}
}
Expand Down Expand Up @@ -1312,7 +1312,7 @@ index 4160212b7b..580b788acc 100644
// to handle mounts securely.
func UnsafeMountChroot(sourcePath, targetPath string, ro bool) *exec.Cmd {
diff --git a/pkg/virt-handler/vm.go b/pkg/virt-handler/vm.go
index cdc1f815c3..86c19138d8 100644
index 24352cf6e9..f1de8d1149 100644
--- a/pkg/virt-handler/vm.go
+++ b/pkg/virt-handler/vm.go
@@ -25,6 +25,7 @@ import (
Expand Down
4 changes: 4 additions & 0 deletions images/virt-artifact/patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,7 @@ How does it work?
2. When changing the affinity or nodeSelector in vmi, the vmi controller will set the `NodePlacementNotMatched` condition to True in vmi.
3. The workload-updater controller monitors the vmi and starts migration when there is a `NodePlacementNotMatched` conditions on the vmi.
4. When the migration is completed, virt-handler will remove the condition `NodePlacementNotMatched` from the vmi

#### `028-hotplug-container-disk.patch`

Hotplug container-disk volumes.

0 comments on commit 65bdb85

Please sign in to comment.