Skip to content

feat: Add privileged_client support to VirtualMachineInstance#2648

Draft
rnetser wants to merge 1 commit intomainfrom
vm_priv_property
Draft

feat: Add privileged_client support to VirtualMachineInstance#2648
rnetser wants to merge 1 commit intomainfrom
vm_priv_property

Conversation

@rnetser
Copy link
Collaborator

@rnetser rnetser commented Feb 13, 2026

Summary

Add explicit privileged_client parameter support across VirtualMachineInstance methods to enable proper RBAC-aware client usage, replacing implicit reliance on self.client for privileged operations.

New public methods (replacing deprecated properties)

  • get_virt_launcher_pod(privileged_client=...) — replaces virt_launcher_pod
  • get_virt_handler_pod(privileged_client=...) — replaces virt_handler_pod
  • get_node(privileged_client=...) — replaces node
  • get_xml_dict(privileged_client=...) — replaces xml_dict

Modified methods with privileged_client parameter

  • pause, unpause, reset
  • get_xml, execute_virsh_command
  • get_dommemstat, get_domstate
  • wait_until_running
  • api_request

New private helpers

  • _get_pod_user_uid — extract runAsUser UID from pod security context
  • _is_pod_root — check if pod runs as root
  • _get_hypervisor_connection_uri — build hypervisor socket URI
  • _build_virsh_cmd — construct virsh command list
  • _resolve_privileged_client — resolve client with FutureWarning fallback
  • _get_subresource_api_url — build subresource API URL with optional client

Deprecation strategy

  • FutureWarning when privileged_client is omitted (falls back to self.client)
  • DeprecationWarning on old property-based access (virt_launcher_pod, virt_handler_pod, node, xml_dict, etc.)

Consumer PR

Introduce explicit privileged_client parameter across VirtualMachineInstance
methods to support proper RBAC-aware client usage.

New public methods replacing deprecated properties:
- get_virt_launcher_pod, get_virt_handler_pod, get_node, get_xml_dict

Modified methods with privileged_client parameter:
- pause, unpause, reset, get_xml, execute_virsh_command
- get_dommemstat, get_domstate, wait_until_running, api_request

New private helpers:
- _get_pod_user_uid, _is_pod_root
- _get_hypervisor_connection_uri, _build_virsh_cmd
- _resolve_privileged_client, _get_subresource_api_url

Warning strategy:
- FutureWarning when privileged_client is omitted
- DeprecationWarning on old property-based access
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch vm_priv_property

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant