Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/core/v1alpha2/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const (
// ReasonVMMigrated is event reason that VM is about to migrate.
ReasonVMMigrated = "Migrated"

// ReasonVMStartFailed is an event reason indicating that the start of the VM failed.
ReasonVMStartFailed = "Failed"

// ReasonVMLastAppliedSpecIsInvalid is event reason that JSON in last-applied-spec annotation is invalid.
ReasonVMLastAppliedSpecIsInvalid = "LastAppliedSpecIsInvalid"

Expand Down
15 changes: 15 additions & 0 deletions api/core/v1alpha2/virtual_machine_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ type VirtualMachineRestoreList struct {
}

type VirtualMachineRestoreSpec struct {
// Virtual machine restore mode:
//
// * Safe — in this mode, the virtual machine will not be restored if unresolvable conflicts are detected during the restoration process.
// * Forced — in this mode, the virtual machine configuration will be updated and all associated resources will be recreated. The virtual machine may malfunction if the recovery process fails. Use the mode when you need to restore the virtual machine despite conflicts.
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Enum=Safe;Forced
// +kubebuilder:default:=Safe
RestoreMode RestoreMode `json:"restoreMode,omitempty"`
// Snapshot name to restore a virtual machine from.
//
// +kubebuilder:validation:MinLength=1
Expand Down Expand Up @@ -103,3 +111,10 @@ const (
VirtualMachineRestorePhaseFailed VirtualMachineRestorePhase = "Failed"
VirtualMachineRestorePhaseTerminating VirtualMachineRestorePhase = "Terminating"
)

type RestoreMode string

const (
RestoreModeSafe RestoreMode = "Safe"
RestoreModeForced RestoreMode = "Forced"
)
6 changes: 5 additions & 1 deletion api/core/v1alpha2/vm-restore-condition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ type (
const (
// VirtualMachineSnapshotNotFound indicates that the specified virtual machine snapshot is absent.
VirtualMachineSnapshotNotFound VirtualMachineSnapshotReadyToUseReason = "VirtualMachineSnapshotNotFound"
// VirtualMachineSnapshotNotReady indicates that the specified virtual machine snapshot is not ready.
// VirtualMachineSnapshotNotReady indicates that the specified virtual machine snapshot is not ready, or resources, such as virtual images to be restored, are not present in the cluster.
VirtualMachineSnapshotNotReady VirtualMachineSnapshotReadyToUseReason = "VirtualMachineSnapshotNotReady"
// VirtualMachineSnapshotReadyToUse indicates that the specified virtual machine snapshot is ready to restore.
VirtualMachineSnapshotReadyToUse VirtualMachineSnapshotReadyToUseReason = "VirtualMachineSnapshotReadyToUse"

// VirtualMachineResourcesAreNotReady signifies that the virtual machine resources is not ready to the `force` restoration.
VirtualMachineResourcesAreNotReady VirtualMachineRestoreReadyReason = "VirtualMachineResourcesAreNotReady"
// VirtualMachineIsNotStopped signifies that the virtual machine is not ready to the `force` restoration.
VirtualMachineIsNotStopped VirtualMachineRestoreReadyReason = "VirtualMachineIsNotStopped"
// VirtualMachineSnapshotNotReadyToUse signifies that the virtual machine snapshot is not ready to use.
VirtualMachineSnapshotNotReadyToUse VirtualMachineRestoreReadyReason = "VirtualMachineSnapshotNotReadyToUse"
// VirtualMachineRestoreConflict signifies that the virtual machine cannot be restored as it's resources already exist.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crds/doc-ru-virtualmachinerestores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ spec:
properties:
spec:
properties:
restoreMode:
default: Safe
description: |-
Режим восстановления виртуальной машины:

* Safe — безопасный режим. В этом режиме виртуальная машина не будет восстановлена, если в процессе восстановления будут обнаружены неразрешимые конфликты.
* Forced — режим принудительного восстановления. В этом режиме конфигурация виртуальной машины будет обновлена, а все связанные ресурсы будут пересозданы. Работа виртуальной машины может быть нарушена, если процесс восстановления завершится неудачно. Используйте, когда необходимо восстановить виртуальную машину несмотря на конфликты.
type: string
nameReplacements:
description: Правила переименования ресурсов виртуальной машины.
items:
Expand Down
11 changes: 11 additions & 0 deletions crds/virtualmachinerestores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ spec:
- to
type: object
type: array
restoreMode:
default: Safe
description: |-
Virtual machine restore mode:

* Safe — in this mode, the virtual machine will not be restored if unresolvable conflicts are detected during the restoration process.
* Forced — in this mode, the virtual machine configuration will be updated and all associated resources will be recreated. The virtual machine may malfunction if the recovery process fails. Use the mode when you need to restore the virtual machine despite conflicts.
enum:
- Safe
- Forced
type: string
virtualMachineSnapshotName:
description: Snapshot name to restore a virtual machine from.
minLength: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ const (
AnnVMOPWorkloadUpdate = AnnAPIGroupV + "/workload-update"
AnnVMOPWorkloadUpdateImage = AnnAPIGroupV + "/workload-update-image"
AnnVMOPWorkloadUpdateNodePlacementSum = AnnAPIGroupV + "/workload-update-node-placement-sum"
// AnnVMRestore is an annotation on a resource that indicates it was created by the vmrestore controller; the value is the UID of the `VirtualMachineRestore` resource.
AnnVMRestore = AnnAPIGroupV + "/vmrestore"
// AnnVMOPEvacuation is an annotation on vmop that represents a vmop created by evacuation controller
AnnVMOPEvacuation = AnnAPIGroupV + "/evacuation"
// LabelsPrefix is a prefix for virtualization-controller labels.
Expand Down
Loading
Loading