Skip to content

Commit e2d21b1

Browse files
init
Signed-off-by: Yaroslav Borbat <[email protected]>
1 parent 9b64c6f commit e2d21b1

File tree

92 files changed

+1568
-642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1568
-642
lines changed

api/core/v1alpha2/vdcondition/condition.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const (
3636
StorageClassReadyType Type = "StorageClassReady"
3737
// InUseType indicates whether the VirtualDisk is attached to a running VirtualMachine or is being used in a process of an image creation.
3838
InUseType Type = "InUse"
39+
// MigrationType indicates whether the VirtualDisk is being volume migrating.
40+
MigrationType Type = "Migration"
3941
)
4042

4143
type (
@@ -51,6 +53,8 @@ type (
5153
StorageClassReadyReason string
5254
// InUseReason represents the various reasons for the InUse condition type.
5355
InUseReason string
56+
// MigrationReason represents the various reasons for the Migration condition type.
57+
MigrationReason string
5458
)
5559

5660
func (s DatasourceReadyReason) String() string {
@@ -77,6 +81,10 @@ func (s InUseReason) String() string {
7781
return string(s)
7882
}
7983

84+
func (s MigrationReason) String() string {
85+
return string(s)
86+
}
87+
8088
const (
8189
// DatasourceReady indicates that the datasource is ready for use, allowing the import process to start.
8290
DatasourceReady DatasourceReadyReason = "DatasourceReady"
@@ -168,3 +176,8 @@ const (
168176
// NotInUse indicates that VirtualDisk free for use.
169177
NotInUse InUseReason = "NotInUse"
170178
)
179+
180+
const (
181+
MigratingReason MigrationReason = "Migrating"
182+
PendingMigratingReason MigrationReason = "Pending"
183+
)

api/core/v1alpha2/virtual_disk.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ type VirtualDiskStatus struct {
7979
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
8080
// Name of the StorageClass used by the PersistentVolumeClaim if `Kubernetes` storage type is used.
8181
StorageClassName string `json:"storageClassName,omitempty"`
82+
83+
// Migration information.
84+
MigrationInfo VirtualDiskMigrationInfo `json:"migrationInfo,omitempty"`
8285
}
8386

8487
// VirtualDisk statistics.
@@ -198,6 +201,7 @@ type VirtualDiskList struct {
198201
// * `PVCLost`: The child PVC of the resource is missing. The resource cannot be used.
199202
// * `Exporting`: The child PV of the resource is in the process of exporting.
200203
// * `Terminating`: The resource is being deleted.
204+
// * `Migrating`: The resource is being migrating.
201205
// +kubebuilder:validation:Enum:={Pending,Provisioning,WaitForUserUpload,WaitForFirstConsumer,Ready,Resizing,Failed,PVCLost,Exporting,Terminating}
202206
type DiskPhase string
203207

@@ -212,4 +216,17 @@ const (
212216
DiskLost DiskPhase = "PVCLost"
213217
DiskExporting DiskPhase = "Exporting"
214218
DiskTerminating DiskPhase = "Terminating"
219+
DiskMigrating DiskPhase = "Migrating"
215220
)
221+
222+
type VirtualDiskMigrationInfo struct {
223+
// Source PersistentVolumeClaim name.
224+
SourcePVC string `json:"sourcePVC,omitempty"`
225+
// Target PersistentVolumeClaim name.
226+
TargetPVC string `json:"targetPVC,omitempty"`
227+
Completed bool `json:"completed"`
228+
Failed bool `json:"failed"`
229+
Message string `json:"message,omitempty"`
230+
StartTimestamp metav1.Time `json:"startTimestamp,omitempty"`
231+
EndTimestamp metav1.Time `json:"endTimestamp,omitempty"`
232+
}

api/core/v1alpha2/vmcondition/condition.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,19 @@ const (
8282
ReasonRestartAwaitingVMClassChangesExist Reason = "RestartAwaitingVMClassChangesExist"
8383
ReasonRestartNoNeed Reason = "NoNeedRestart"
8484

85-
ReasonMigratable Reason = "VirtualMachineMigratable"
86-
ReasonNotMigratable Reason = "VirtualMachineNotMigratable"
85+
ReasonMigratable Reason = "VirtualMachineMigratable"
86+
ReasonNonMigratable Reason = "VirtualMachineNonMigratable"
87+
ReasonDisksNotMigratable Reason = "VirtualMachineDisksNotMigratable"
8788

88-
ReasonVmIsMigrating Reason = "VirtualMachineMigrating"
89-
ReasonVmIsNotMigrating Reason = "VirtualMachineNotMigrating"
89+
ReasonMigratingPending Reason = "Pending"
90+
ReasonReadyToMigrate Reason = "ReadyToMigrate"
91+
ReasonMigratingInProgress Reason = "InProgress"
9092
ReasonLastMigrationFinishedWithError Reason = "LastMigrationFinishedWithError"
93+
94+
ReasonVmIsNotRunning Reason = "VirtualMachineNotRunning"
95+
ReasonVmIsRunning Reason = "VirtualMachineRunning"
96+
ReasonInternalVirtualMachineError Reason = "InternalVirtualMachineError"
97+
ReasonPodNotStarted Reason = "PodNotStarted"
9198
ReasonVmIsNotRunning Reason = "VirtualMachineNotRunning"
9299
ReasonVmIsRunning Reason = "VirtualMachineRunning"
93100
ReasonInternalVirtualMachineError Reason = "InternalVirtualMachineError"

api/core/v1alpha2/vmopcondition/condition.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ const (
8383
// ReasonQuotaExceeded is a completed reason that indicates the project's quota has been exceeded and the migration has been paused.
8484
ReasonQuotaExceeded ReasonCompleted = "QuotaExceeded"
8585

86+
// ReasonWaitingForVirtualMachineToBeReadyToMigrate is a ReasonCompleted indicating that the virtual machine is not ready to be migrated.
87+
ReasonWaitingForVirtualMachineToBeReadyToMigrate ReasonCompleted = "WaitingForVirtualMachineToBeReadyToMigrate"
88+
8689
// ReasonOperationFailed is a ReasonCompleted indicating that operation has failed.
8790
ReasonOperationFailed ReasonCompleted = "OperationFailed"
8891

api/core/v1alpha2/zz_generated.deepcopy.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/pkg/apiserver/api/generated/openapi/zz_generated.openapi.go

Lines changed: 98 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crds/virtualdisks.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,31 @@ spec:
366366
the cluster.
367367
type: string
368368
type: object
369+
migrationInfo:
370+
description: Migration information.
371+
properties:
372+
completed:
373+
type: boolean
374+
endTimestamp:
375+
format: date-time
376+
type: string
377+
failed:
378+
type: boolean
379+
message:
380+
type: string
381+
sourcePVC:
382+
description: Source PersistentVolumeClaim name.
383+
type: string
384+
startTimestamp:
385+
format: date-time
386+
type: string
387+
targetPVC:
388+
description: Target PersistentVolumeClaim name.
389+
type: string
390+
required:
391+
- completed
392+
- failed
393+
type: object
369394
observedGeneration:
370395
description: Resource generation last processed by the controller.
371396
format: int64
@@ -383,6 +408,7 @@ spec:
383408
* `PVCLost`: The child PVC of the resource is missing. The resource cannot be used.
384409
* `Exporting`: The child PV of the resource is in the process of exporting.
385410
* `Terminating`: The resource is being deleted.
411+
* `Migrating`: The resource is being migrating.
386412
enum:
387413
- Pending
388414
- Provisioning

images/virtualization-artifact/pkg/apiserver/api/generated/openapi/zz_generated.openapi.go

Lines changed: 68 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)