Skip to content
Open
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
7 changes: 7 additions & 0 deletions ocp_resources/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Plan(NamespacedResource):
should be added to the target VM resource.
target_affinity (dict, optional): Affinity rules for the target VM. Specifies which affinity
rules should be applied to the target VM resource.
enable_nested_virtualization (bool, optional): Whether to enable nested virtualization on migrated VMs.
When False, CPU features vmx/svm are disabled on the target VM.
"""

api_group = NamespacedResource.ApiGroup.FORKLIFT_KONVEYOR_IO
Expand Down Expand Up @@ -75,6 +77,7 @@ def __init__(
target_node_selector: dict[str, str] | None = None,
target_labels: dict[str, str] | None = None,
target_affinity: dict[str, Any] | None = None,
enable_nested_virtualization: bool | None = None,
**kwargs: Any,
) -> None:
super().__init__(**kwargs)
Expand Down Expand Up @@ -108,6 +111,7 @@ def __init__(
self.target_node_selector = target_node_selector
self.target_labels = target_labels
self.target_affinity = target_affinity
self.enable_nested_virtualization = enable_nested_virtualization

if self.pre_hook_name and self.pre_hook_namespace:
self.hooks_array.append(
Expand Down Expand Up @@ -207,6 +211,9 @@ def to_dict(self) -> None:
if self.target_affinity is not None:
spec["targetAffinity"] = self.target_affinity

if self.enable_nested_virtualization is not None:
spec["enableNestedVirtualization"] = self.enable_nested_virtualization

def _generate_hook_spec(self, hook_name: str, hook_namespace: str, hook_type: str) -> dict[str, Any]:
return {
"hook": {
Expand Down