chg(podman/system): add `--format` support to `hyperv-prep --status` #29890
@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 I've added thestatusfield as per the issue (other keys are slightly modified to better represent the context). Tho I'm not really sure if thestatusfield 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
as noticed in https://github.com/podman-container-tools/container-libs/pull/1225#issuecomment-5980993413, please use your real email address
I am closing this PR in favor https://github.com/podman-container-tools/podman/pull/29881.
@RazCrimson, can you please review https://github.com/podman-container-tools/podman/pull/29881. Thanks!
@RazCrimson, I saw your comment in the issue.
Please use PodmanExitCleanly().
What are all the required Hyper-V vsock registry entries? The doStatusForRegistries() list Hyper-V vsock registry entries. May it be an array?
Status of what? I am not sure what it means. Also, I would match contend human readeble version with the machine-readable version.
Sorry for closing. I didnt check issue. I have some comments.
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
[NON-BLOCKING] Packit jobs failed. @podman-container-tools/packit-jobs please check. Everyone else, feel free to ignore.
[NON-BLOCKING] Packit jobs failed. @podman-container-tools/packit-jobs please check. Everyone else, feel free to ignore.
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.
Well then, status should be shown in a human-readable version. Also, please explain what that status means in the doc.
Honny1
RazCrimson
Add
--formatsupport (JSON and Go templates) topodman system hyperv-prep --status.currentUserIsHyperVAdmin,hasRequiredRegistryEntries, and an Enumstatus(applied,notApplied,partiallyApplied)--formatwhen used without--statusto 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 -->
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?
New CLI flag for windows users
<!--
Write
Noneif 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--formatWindows: Support
flag forpodman system hyperv-prep --status
``