Skip to content

Commit

Permalink
feat(vm): notify user if the virtual machine cannot be restarted imme…
Browse files Browse the repository at this point in the history
…diately

Signed-off-by: Isteb4k <[email protected]>
  • Loading branch information
Isteb4k authored Oct 30, 2024
1 parent c1b2e78 commit 7efe3d9
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 191 deletions.
46 changes: 5 additions & 41 deletions api/core/v1alpha2/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,6 @@ limitations under the License.
package v1alpha2

const (
// ReasonErrUnknownState is event reason that VMI has unexpected state
ReasonErrUnknownState = "UnknownState"

// ReasonErrWrongPVCSize is event reason that PVC has wrong size
ReasonErrWrongPVCSize = "WrongPVCSize"

// ReasonErrImportFailed is event reason that importer/uploader Pod is failed
ReasonErrImportFailed = "ImportFailed"

// ReasonErrGetProgressFailed is event reason about the failure of getting progress.
ReasonErrGetProgressFailed = "GetProgressFailed"

// ReasonIpAddressNotAvailable is event reason that VM cannot use defined ip address.
ReasonIpAddressNotAvailable = "IpAddressNotAvailable"

// ReasonIpAddressNotAssigned is event reason that Ip address is not assigned in the guest VM.
ReasonIpAddressNotAssigned = "IpAddressNotAssigned"

// ReasonCPUModelNotFound is event reason that defined cpu model not found.
ReasonCPUModelNotFound = "CPUModelNotFound"

// ReasonImportSucceeded is event reason that the import is successfully completed
ReasonImportSucceeded = "ImportSucceeded"

// ReasonImportSucceededToPVC is event reason that the import is successfully completed to PVC
ReasonImportSucceededToPVC = "ImportSucceededToPVC"

// ReasonHotplugPostponed is event reason that disk hotplug is not possible at the moment.
ReasonHotplugPostponed = "HotplugPostponed"

// ReasonVMWaitForBlockDevices is event reason that block devices used by VM are not ready yet.
ReasonVMWaitForBlockDevices = "WaitForBlockDevices"

// ReasonUnknownHotPluggedVolume is event reason that volume was hot plugged to VirtualMachineInstance, but it is not a VirtualDisk.
ReasonUnknownHotPluggedVolume = "UnknownHotPluggedVolume"

// ReasonVDAlreadyInUse is event reason that VirtualDisk was not attached to VirtualMachine, because VirtualDisk attached to another VirtualMachine.
ReasonVDAlreadyInUse = "VirtualDiskAlreadyInUse"
// ReasonVMChangesApplied is event reason that changes applied from VM to underlying KVVM.
Expand All @@ -64,14 +28,14 @@ const (
// ReasonVMLastAppliedSpecInvalid is event reason that JSON in last-applied-spec annotation is invalid.
ReasonVMLastAppliedSpecInvalid = "VMLastAppliedSpecInvalid"

// ReasonErrUploaderWaitDurationExpired is event reason that uploading time expired.
ReasonErrUploaderWaitDurationExpired = "UploaderWaitDurationExpired"

// ReasonErrVmNotSynced is event reason that vm is not synced.
ReasonErrVmNotSynced = "VirtualMachineNotSynced"

// ReasonErrVMOPNotPermitted is event reason that vmop is not permitted.
ReasonErrVMOPNotPermitted = "VirtualMachineOperationNotPermitted"
// ReasonErrVmSynced is event reason that vm is synced.
ReasonErrVmSynced = "VirtualMachineSynced"

// ReasonErrRestartAwaitingChanges is event reason indicating that the vm has pending changes requiring a restart.
ReasonErrRestartAwaitingChanges = "RestartAwaitingChanges"

// ReasonErrVMOPFailed is event reason that operation is failed
ReasonErrVMOPFailed = "VirtualMachineOperationFailed"
Expand Down
10 changes: 5 additions & 5 deletions api/core/v1alpha2/vmcondition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ const (
ReasonProvisioningReady Reason = "ProvisioningReady"
ReasonProvisioningNotReady Reason = "ProvisioningNotReady"

ReasonConfigurationApplied Reason = "ConfigurationApplied"
ReasonConfigurationNotApplied Reason = "ConfigurationNotApplied"
ReasonRestartAwaitingChangesExist Reason = "RestartAwaitingChangesExist"
ReasonRestartAwaitingChangesNotExist Reason = "RestartAwaitingChangesNotExist"
ReasonRestartNoNeed Reason = "NoNeedRestart"
ReasonConfigurationApplied Reason = "ConfigurationApplied"
ReasonConfigurationNotApplied Reason = "ConfigurationNotApplied"

ReasonRestartAwaitingChangesExist Reason = "RestartAwaitingChangesExist"
ReasonRestartNoNeed Reason = "NoNeedRestart"

ReasonPodStarted Reason = "PodStarted"
ReasonPodNotFound Reason = "PodNotFound"
Expand Down
4 changes: 2 additions & 2 deletions images/dvcr-artifact/pkg/retry/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ func Retry(ctx context.Context, f Fn) error {
return ExponentialBackoff(ctx, f, defaultBackoff)
}

// Sleep for 1 then 3 seconds. This should cover networking blips.
// Sleep for 3^0 then 3^1, 3^2 , ..., 3^7 seconds. This should cover networking blips.
var defaultBackoff = Backoff{
Duration: time.Second,
Factor: 3.0,
Jitter: 0.1,
Steps: 3,
Steps: 9,
}
Loading

0 comments on commit 7efe3d9

Please sign in to comment.