diff --git a/ocp_resources/plan.py b/ocp_resources/plan.py index aa0ffe4839..948f39c446 100644 --- a/ocp_resources/plan.py +++ b/ocp_resources/plan.py @@ -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 @@ -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) @@ -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( @@ -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": {