Skip to content

Commit b32f955

Browse files
authored
chore(vm): more messages about cpu and memory hotplug fails (#2406)
* chore(vm): more messages about cpu and memory hotplug fails - Do not start live migration to apply cpu or memory changes with hotplug if VM is NonMigratable. - Fix sync_kvvm_test: fill PrintableStatus for kvvm as it is required to detect if disruptive changes may be applied. - Add test for Upgrade*ChangesToRestart mutators. Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
1 parent d101ce7 commit b32f955

7 files changed

Lines changed: 223 additions & 85 deletions

File tree

images/virtualization-artifact/pkg/controller/vm/internal/sync_kvvm.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ func (h *SyncKvvmHandler) Handle(ctx context.Context, s state.VirtualMachineStat
157157
if kvvmiErr == nil && hasNonHotpluggableVolumes(kvvmi) {
158158
changes.UpgradeBlockDeviceChangesToRestart()
159159
}
160+
// Require restart for CPU and memory changes if VM is non migratable.
161+
if h.isVMNonMigratable(current) {
162+
changes.UpgradeHotplugComputeChangesToRestart()
163+
}
160164
allChanges.Add(changes.GetAll()...)
161165
}
162166
if class != nil {
@@ -824,6 +828,13 @@ func (h *SyncKvvmHandler) isVMUnschedulable(
824828
return false
825829
}
826830

831+
func (h *SyncKvvmHandler) isVMNonMigratable(
832+
vm *v1alpha2.VirtualMachine,
833+
) bool {
834+
vmMigratable, has := conditions.GetCondition(vmcondition.TypeMigratable, vm.Status.Conditions)
835+
return has && vmMigratable.Status == metav1.ConditionFalse
836+
}
837+
827838
func (h *SyncKvvmHandler) networksOutOfSync(ctx context.Context, s state.VirtualMachineState, kvvm *virtv1.VirtualMachine) (bool, error) {
828839
if kvvm == nil {
829840
return false, nil

0 commit comments

Comments
 (0)