-
Notifications
You must be signed in to change notification settings - Fork 76
Storage: add VirtualMachineBackup and VirtualMachineBackupTracker resources #2745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dalia-frank
wants to merge
3
commits into
RedHatQE:main
Choose a base branch
from
dalia-frank:add-cbt-backup-resources
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+148
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md | ||
|
|
||
|
|
||
| from typing import Any | ||
|
|
||
| from ocp_resources.exceptions import MissingRequiredArgumentError | ||
| from ocp_resources.resource import NamespacedResource | ||
|
|
||
|
|
||
| class VirtualMachineBackup(NamespacedResource): | ||
| """ | ||
| VirtualMachineBackup defines the operation of backing up a VM | ||
| """ | ||
|
|
||
| api_group: str = NamespacedResource.ApiGroup.BACKUP_KUBEVIRT_IO | ||
|
|
||
| def __init__( | ||
| self, | ||
| force_full_backup: bool | None = None, | ||
| mode: str | None = None, | ||
| pvc_name: str | None = None, | ||
| skip_quiesce: bool | None = None, | ||
| source: dict[str, Any] | None = None, | ||
| token_secret_ref: str | None = None, | ||
| ttl_duration: str | None = None, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| r""" | ||
| Args: | ||
| force_full_backup (bool): ForceFullBackup indicates that a full backup is desired | ||
|
|
||
| mode (str): Mode specifies the way the backup output will be recieved | ||
|
|
||
| pvc_name (str): PvcName required in push mode. Specifies the name of the PVC where the | ||
| backup output will be stored | ||
|
|
||
| skip_quiesce (bool): SkipQuiesce indicates whether the VM's filesystem shoule not be | ||
| quiesced before the backup | ||
|
|
||
| source (dict[str, Any]): Source specifies the backup source - either a VirtualMachine or a | ||
| VirtualMachineBackupTracker. When Kind is VirtualMachine: performs | ||
| a backup of the specified VM. When Kind is | ||
| VirtualMachineBackupTracker: uses the tracker to get the source VM | ||
| and the base checkpoint for incremental backup. The tracker will | ||
| be updated with the new checkpoint after backup completion. | ||
|
|
||
| token_secret_ref (str): TokenSecretRef is the name of the secret that will be used to pull the | ||
| backup from an associated endpoint | ||
|
|
||
| ttl_duration (str): TtlDuration limits the lifetime of a pull mode backup and its export | ||
| If this field is set, after this duration has passed from counting | ||
| from CreationTimestamp, the backup is eligible to be automatically | ||
| considered as complete. If this field is omitted, a reasonable | ||
| default is applied. | ||
|
|
||
| """ | ||
| super().__init__(**kwargs) | ||
|
|
||
| self.force_full_backup = force_full_backup | ||
| self.mode = mode | ||
| self.pvc_name = pvc_name | ||
| self.skip_quiesce = skip_quiesce | ||
| self.source = source | ||
| self.token_secret_ref = token_secret_ref | ||
| self.ttl_duration = ttl_duration | ||
|
|
||
| def to_dict(self) -> None: | ||
|
|
||
| super().to_dict() | ||
|
|
||
| if not self.kind_dict and not self.yaml_file: | ||
| if self.source is None: | ||
| raise MissingRequiredArgumentError(argument="self.source") | ||
|
|
||
| self.res["spec"] = {} | ||
| _spec = self.res["spec"] | ||
|
|
||
| _spec["source"] = self.source | ||
|
|
||
| if self.force_full_backup is not None: | ||
| _spec["forceFullBackup"] = self.force_full_backup | ||
|
|
||
| if self.mode is not None: | ||
| _spec["mode"] = self.mode | ||
|
|
||
| if self.pvc_name is not None: | ||
| _spec["pvcName"] = self.pvc_name | ||
|
|
||
| if self.skip_quiesce is not None: | ||
| _spec["skipQuiesce"] = self.skip_quiesce | ||
|
|
||
| if self.token_secret_ref is not None: | ||
| _spec["tokenSecretRef"] = self.token_secret_ref | ||
|
|
||
| if self.ttl_duration is not None: | ||
| _spec["ttlDuration"] = self.ttl_duration | ||
|
|
||
| # End of generated code | ||
|
|
||
| class Mode: | ||
| PUSH: str = "Push" | ||
| PULL: str = "Pull" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md | ||
|
|
||
|
|
||
| from typing import Any | ||
|
|
||
| from ocp_resources.exceptions import MissingRequiredArgumentError | ||
| from ocp_resources.resource import NamespacedResource | ||
|
|
||
|
|
||
| class VirtualMachineBackupTracker(NamespacedResource): | ||
| """ | ||
| VirtualMachineBackupTracker defines the way to track the latest checkpoint of | ||
| a backup solution for a vm | ||
| """ | ||
|
|
||
| api_group: str = NamespacedResource.ApiGroup.BACKUP_KUBEVIRT_IO | ||
|
|
||
| def __init__( | ||
| self, | ||
| source: dict[str, Any] | None = None, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| r""" | ||
| Args: | ||
| source (dict[str, Any]): Source specifies the VM that this backupTracker is associated with | ||
|
|
||
| """ | ||
| super().__init__(**kwargs) | ||
|
|
||
| self.source = source | ||
|
|
||
| def to_dict(self) -> None: | ||
|
|
||
| super().to_dict() | ||
|
|
||
| if not self.kind_dict and not self.yaml_file: | ||
| if self.source is None: | ||
| raise MissingRequiredArgumentError(argument="self.source") | ||
|
|
||
| self.res["spec"] = {} | ||
| _spec = self.res["spec"] | ||
|
|
||
| _spec["source"] = self.source | ||
|
|
||
| # End of generated code |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please regenerate the resources, this has chnaged in #2750