← Back to Pull requests

chg(podman/system): add `--format` support to `hyperv-prep --status` #29890

Open
RazCrimson opened this pull request with 214 lines diff across 3 files
View on GitHub
RazCrimson RazCrimson commented on Oct 02, 2026 20:55 UTC
Author

Add --format support (JSON and Go templates) to podman system hyperv-prep --status.

  • Outputs booleanscurrentUserIsHyperVAdmin, hasRequiredRegistryEntries, and an Enum status (applied, notApplied, partiallyApplied)

  • Reject --format when used without --status to prevent unintended side-effects.
  • Fixes #29860

    Tests are LLM-generated and human reviewed. Please let me know if you find them to be too verbose, I can clean them up (Tho I do think they are just extensive and cover many combinations / cases).

    <!-- Thanks for sending a pull request! -->

    Checklist

    Ensure you have completed the following checklist for your pull request to be reviewed:
    <!-- Use [x] to mark as done, or click the checkbox after opening PR -->

  • I have read and understood our contributing guidelines and will not have more than two open PRs as a new contributor.

  • PR description, commit message, and GitHub comments are human-written, per LLM Policy

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all

  • commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)

  • Tests have been added/updated (or no tests are needed)

  • Documentation has been updated (or no documentation changes are needed)

  • All commits pass make validatepr (format/lint checks)

  • Release note entered in the section below (or None if no user-facing changes)
  • Does this PR introduce a user-facing change?


    New CLI flag for windows users

    <!--
    Write None if there are no user-facing changes, otherwise enter your release note below.
    Include "action required" if users need to take action when upgrading.
    -->

    ``release-note
    Windows: Support
    --format flag for podman system hyperv-prep --status
    ``

    Diff: 214 lines (+214 / -0) across 3 files Reviewer: Honny1 Review duration: 6951m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.43) × (1 − Review Confidence (0.91)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 214 lines diff across 3 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 5 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    90%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.321
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    15 items
    RazCrimson RazCrimson commented on Oct 02, 2026 21:19 UTC
    Author

    @gastoner I've added the status field as per the issue (other keys are slightly modified to better represent the context). Tho I'm not really sure if the status field provides any extra value as all the required info is present in the other fields.

    Also I'm not sure if the existing behavior for status should be modified (it doesn't show any warnings for missing registry entries and doesn't consider membership changes that haven't taken effect - user added to group but needs to relogin for it to work). Any thoughts on this?

    gastoner gastoner commented on Oct 05, 2026 08:50 UTC
    Contributor

    @gastoner I've added the status field as per the issue (other keys are slightly modified to better represent the context). Tho I'm not really sure if the status field provides any extra value as all the required info is present in the other fields.

    > Also I'm not sure if the existing behavior for status should be modified (it doesn't show any warnings for missing registry entries and doesn't consider membership changes that haven't taken effect - user added to group but needs to relogin for it to work). Any thoughts on this?

    Hey, the idea for this issue was to have easily parsable output from the command. I think that changing the behaviour of status is an another thing. But it would be nice to detect that the membership hasn't taken effect yet. But not sure how the Podman team feels about this. As an user here I would appriciate this

    giuseppe giuseppe commented on Oct 05, 2026 09:31 UTC
    Contributor
    Honny1 Honny1 commented on Oct 05, 2026 09:48 UTC
    Contributor
    Honny1 Honny1 commented on Oct 05, 2026 11:55 UTC
    Contributor

    @RazCrimson, I saw your comment in the issue.

    Honny1 Honny1 commented on code on Oct 05, 2026 11:57 UTC
    Code Review
    test/e2e/system_hyperv_prep_test.go:1
    @@ -75,6 +96,115 @@ var _ = Describe("podman system hyperv-prep", func() {
     		Expect(session).Should(ExitCleanly())
     		Expect(session.OutputToString()).To(ContainSubstring("Successfully removed"))
     	})
    +
    +	It("outputs status with --format (JSON and Go template)", func() {
    +		type statusReport struct {
    +			CurrentUserIsHyperVAdmin   bool   `json:"currentUserIsHyperVAdmin"`
    +			HasRequiredRegistryEntries bool   `json:"hasRequiredRegistryEntries"`
    +			Status                     string `json:"status"`
    +		}
    +
    +		// 1. Test --format=json (equals syntax)
    +		session := podmanTest.Podman([]string{"system", "hyperv-prep", "--status", "--format=json"})

    Please use PodmanExitCleanly().

    Honny1 Honny1 commented on code on Oct 05, 2026 12:05 UTC
    Code Review
    docs/source/markdown/podman-system-hyperv-prep.1.md:1
    @@ -40,6 +40,16 @@ Hyper-V Administrators group. Prompts for confirmation before each action unless
     Show the list of VSock registry entries and the current user's Hyper-V
     Administrators group membership status.
     
    +#### **--format**=*format*
    +
    +Format the status output to JSON or a Go template. Valid only when used with **--status**.
    +
    +| **Placeholder**                 | **Description**                                                         |
    +| ------------------------------- | ----------------------------------------------------------------------- |
    +| .CurrentUserIsHyperVAdmin       | Whether the current user is a member of the Hyper-V Administrators group|
    +| .HasRequiredRegistryEntries     | Whether all required Hyper-V vsock registry entries exist               |

    What are all the required Hyper-V vsock registry entries? The doStatusForRegistries() list Hyper-V vsock registry entries. May it be an array?

    Honny1 Honny1 commented on code on Oct 05, 2026 12:08 UTC
    Code Review
    docs/source/markdown/podman-system-hyperv-prep.1.md:1
    @@ -40,6 +40,16 @@ Hyper-V Administrators group. Prompts for confirmation before each action unless
     Show the list of VSock registry entries and the current user's Hyper-V
     Administrators group membership status.
     
    +#### **--format**=*format*
    +
    +Format the status output to JSON or a Go template. Valid only when used with **--status**.
    +
    +| **Placeholder**                 | **Description**                                                         |
    +| ------------------------------- | ----------------------------------------------------------------------- |
    +| .CurrentUserIsHyperVAdmin       | Whether the current user is a member of the Hyper-V Administrators group|
    +| .HasRequiredRegistryEntries     | Whether all required Hyper-V vsock registry entries exist               |
    +| .Status                         | Overall status (`applied`, `notApplied`, `partiallyApplied`)            |

    Status of what? I am not sure what it means. Also, I would match contend human readeble version with the machine-readable version.

    Honny1 Honny1 requested changes on Oct 05, 2026 12:09 UTC
    Changes Requested Reviewer

    Sorry for closing. I didnt check issue. I have some comments.

    Honny1 Honny1 commented on Oct 05, 2026 12:10 UTC
    Contributor

    D:/a/podman/podman/test/e2e/system_hyperv_prep_test.go:18
      updates formatted status through prep and reset lifecycle
      D:/a/podman/podman/test/e2e/system_hyperv_prep_test.go:145
      > Enter [BeforeEach] TOP-LEVEL - D:/a/podman/podman/test/e2e/common_windows_test.go:36 @ 10/05/26 12:09:26.373
      < Exit [BeforeEach] TOP-LEVEL - D:/a/podman/podman/test/e2e/common_windows_test.go:36 @ 10/05/26 12:09:26.373 (1ms)
      > Enter [It] updates formatted status through prep and reset lifecycle - D:/a/podman/podman/test/e2e/system_hyperv_prep_test.go:145 @ 10/05/26 12:09:26.373
      Running: D:\a\podman\podman\bin\windows\podman.exe system hyperv-prep --status --format=json
      {
           "currentUserIsHyperVAdmin": false,
           "hasRequiredRegistryEntries": false,
           "status": "notApplied"
      }
      Running: D:\a\podman\podman\bin\windows\podman.exe system hyperv-prep
      Successfully created registry entries for:
        - Network (port 50601)
        - Events (port 50602)
        - Fileserver (port 50603)
        - Fileserver (port 50604)
      These entries will persist even when all machines are removed.
    
      Added user runnervmfi6oq\runneradmin to the Hyper-V Administrators group
      Note: You may need to log out and log back in for the new group membership to take effect.
      Running: D:\a\podman\podman\bin\windows\podman.exe system hyperv-prep --status --format=json
      {
           "currentUserIsHyperVAdmin": false,
           "hasRequiredRegistryEntries": true,
           "status": "partiallyApplied"
      }
      [FAILED] Expected
          <bool>: false
      to be true
      In [It] at: D:/a/podman/podman/test/e2e/system_hyperv_prep_test.go:185 @ 10/05/26 12:09:26.796
    
    

    packit-as-a-service[bot] packit-as-a-service[bot] commented on Oct 05, 2026 13:53 UTC
    Bot

    [NON-BLOCKING] Packit jobs failed. @podman-container-tools/packit-jobs please check. Everyone else, feel free to ignore.

    packit-as-a-service[bot] packit-as-a-service[bot] commented on Oct 05, 2026 13:53 UTC
    Bot

    [NON-BLOCKING] Packit jobs failed. @podman-container-tools/packit-jobs please check. Everyone else, feel free to ignore.

    RazCrimson RazCrimson commented on code on Oct 05, 2026 14:03 UTC
    Code Review
    docs/source/markdown/podman-system-hyperv-prep.1.md:1
    @@ -40,6 +40,16 @@ Hyper-V Administrators group. Prompts for confirmation before each action unless
     Show the list of VSock registry entries and the current user's Hyper-V
     Administrators group membership status.
     
    +#### **--format**=*format*
    +
    +Format the status output to JSON or a Go template. Valid only when used with **--status**.
    +
    +| **Placeholder**                 | **Description**                                                         |
    +| ------------------------------- | ----------------------------------------------------------------------- |
    +| .CurrentUserIsHyperVAdmin       | Whether the current user is a member of the Hyper-V Administrators group|
    +| .HasRequiredRegistryEntries     | Whether all required Hyper-V vsock registry entries exist               |
    +| .Status                         | Overall status (`applied`, `notApplied`, `partiallyApplied`)            |

    Status of hyperv-prep in the host machine. Right now just a combined 3 state enum based on the other 2 fields, so redundant ig, but I kept it since it felt clean to have one final field that indicates the status.

    If we are going to display a list of registryEntries (instead of the current boolean) keeping it makes more sense imo.

    Honny1 Honny1 commented on code on Oct 05, 2026 14:07 UTC
    Code Review
    docs/source/markdown/podman-system-hyperv-prep.1.md:1
    @@ -40,6 +40,16 @@ Hyper-V Administrators group. Prompts for confirmation before each action unless
     Show the list of VSock registry entries and the current user's Hyper-V
     Administrators group membership status.
     
    +#### **--format**=*format*
    +
    +Format the status output to JSON or a Go template. Valid only when used with **--status**.
    +
    +| **Placeholder**                 | **Description**                                                         |
    +| ------------------------------- | ----------------------------------------------------------------------- |
    +| .CurrentUserIsHyperVAdmin       | Whether the current user is a member of the Hyper-V Administrators group|
    +| .HasRequiredRegistryEntries     | Whether all required Hyper-V vsock registry entries exist               |
    +| .Status                         | Overall status (`applied`, `notApplied`, `partiallyApplied`)            |

    Well then, status should be shown in a human-readable version. Also, please explain what that status means in the doc.

    Reviewers
    Assignees
    RazCrimson RazCrimson
    Labels
    risk: low confidence: 90.6% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43% (MEDIUM) · Higher = larger blast radius
    43%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 90.6% · Lower = rushed or shallow review
    90.6%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 4% · Safe to merge
    4%