Skip to content

Commit

Permalink
fix(vm): add value of the guest os info
Browse files Browse the repository at this point in the history
- fix adding value of the guest os info from VMI to VM
- fix bug with sticking 'Message' in 'Status' for VM

Signed-off-by: Dmitry Lopatin <[email protected]>
  • Loading branch information
LopatinDmitr authored May 16, 2024
1 parent 0b21bab commit 1ffcab7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions crds/virtualmachine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ spec:
properties:
guestOSInfo:
type: object
x-kubernetes-preserve-unknown-fields: true
description: |
Guest OS information obtained from the QEMU Guest Agent. The agent must be pre-installed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"os"
"reflect"
"strings"
"time"

Expand Down Expand Up @@ -96,7 +97,7 @@ func (r *VMReconciler) SetupController(_ context.Context, mgr manager.Manager, c
UpdateFunc: func(e event.UpdateEvent) bool {
oldVM := e.ObjectOld.(*virtv1.VirtualMachineInstance)
newVM := e.ObjectNew.(*virtv1.VirtualMachineInstance)
return oldVM.Status.Phase != newVM.Status.Phase
return !reflect.DeepEqual(oldVM.Status, newVM.Status)
},
},
); err != nil {
Expand Down Expand Up @@ -319,7 +320,6 @@ func (r *VMReconciler) UpdateStatus(_ context.Context, _ reconcile.Request, stat
case state.vmIsStarting():
state.VM.Changed().Status.Phase = virtv2.MachineStarting
case state.vmIsRunning():
// TODO We need to rerun this block because KVVMI status fields may be updated with a delay.
state.VM.Changed().Status.Phase = virtv2.MachineRunning
state.VM.Changed().Status.GuestOSInfo = state.KVVMI.Status.GuestOSInfo
state.VM.Changed().Status.Node = state.KVVMI.Status.NodeName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ func (state *VMReconcilerState) Reload(ctx context.Context, req reconcile.Reques
state.VMDByName = vmdByName
state.VMIByName = vmiByName
state.CVMIByName = cvmiByName
state.StatusMessage = state.VM.Current().Status.Message
state.RestartAwaitingChanges = state.VM.Current().Status.RestartAwaitingChanges

return nil
Expand Down

0 comments on commit 1ffcab7

Please sign in to comment.