8000 chore: update when field for podman machine editable properties by SoniaSandler · Pull Request #12939 · podman-desktop/podman-desktop · GitHub
[go: up one dir, main page]

Skip to content

Conversation

SoniaSandler
Copy link
Contributor
@SoniaSandler SoniaSandler commented Jun 23, 2025

Signed-off-by: Sonia Sandler ssandler@redhat.com

What does this PR do?

Right now, editing a podman machine is only possible on macOS. However, as part of #12781, the rootful status is also editable on both macOS and Windows, so we need to indicate which properties are editable only on macOS.
On HyperV, CPU and memory should be editable, and on macOS, all 3 properties are editable

Screenshot / video of UI

What issues does this PR fix or reference?

Related to #12781
Closes #12943

How to test this PR?

  • Tests are covering the bug fix or the new feature

@SoniaSandler SoniaSandler requested review from benoitf and a team as code owners June 23, 2025 14:18
@SoniaSandler SoniaSandler requested review from cdrage and feloy and removed request for a team June 23, 2025 14:18
Copy link
codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Copy link
Contributor
@axel7083 axel7083 left a comment

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious to know if this is really only working on Mac, or would work for windows HyperV (I know it is not working for WSL, but not sure abotu hyperV)

cc @jeffmaury

@jeffmaury
Copy link
Contributor

Curious to know if this is really only working on Mac, or would work for windows HyperV (I know it is not working for WSL, but not sure abotu hyperV)

cc @jeffmaury

CPU and memory should be exposed for HyperV

@SoniaSandler
Copy link
Contributor Author

@axel7083 @jeffmaury right now the podman machine editing option is only registered for macOS

@jeffmaury
Copy link
Contributor

@axel7083 @jeffmaury right now the podman machine editing option is only registered for macOS

So we should create a follow up issue as I would guess HyperV support was added after edit and that was missed

Copy link
Collaborator
@benoitf benoitf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not add isMac as we know it's a limited factor

for example we can have a property dedicated set in the code

let say for example podman.machine.editCpu

and then in the code if macOS we set this property to true (or if Hyper-V)
it'll avoid to change the properties in package.json later

also it's easier to have the logic in the code rather in the package.json as it's easier to provide unit tests

@SoniaSandler SoniaSandler marked this pull request as draft June 27, 2025 16:07
Copy link
Contributor
coderabbitai bot commented Jun 30, 2025
📝 Walkthrough

"""

Walkthrough

The changes update the Podman extension to conditionally support editing machine resource settings—CPUs, memory, and disk size—based on the operating system and virtualization capabilities. New exported context keys (PODMAN_MACHINE_EDIT_CPU, PODMAN_MACHINE_EDIT_MEMORY, PODMAN_MACHINE_EDIT_DISK_SIZE) are introduced and set according to platform detection, including Hyper-V status on Windows. The provider registration logic and extension configuration use these flags to control the visibility and availability of editing features. The lifecycle's edit method is extended to support macOS and Windows Hyper-V for CPU and memory editing, while disk size editing remains macOS-only. Corresponding tests are enhanced to verify correct context key settings and edit capability detection across macOS, Windows (with and without Hyper-V), and Linux. No other public API changes were made.

Estimated code review effort

2 (~20 minutes)

Suggested labels

qe/testing-required

Suggested reviewers

  • jeffmaury
  • axel7083
  • benoitf
    """

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

extensions/podman/packages/extension/src/extension.ts

Oops! Something went wrong! :(

ESLint: 9.30.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'svelte-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccc48cf and 67abd5a.

📒 Files selected for processing (1)
  • extensions/podman/packages/extension/src/extension.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • extensions/podman/packages/extension/src/extension.ts
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@SoniaSandler SoniaSandler marked this pull request as ready for review June 30, 2025 17:39
@SoniaSandler SoniaSandler requested review from benoitf and axel7083 June 30, 2025 17:40
Copy link
Contributor
@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SoniaSandler - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@SoniaSandler SoniaSandler changed the title chore: add isMac to package.json for editing a machine chore: update when field for podman machine editable properties Jun 30, 2025
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
extensions/podman/packages/extension/package.json (2)

80-90: Same validation needed for Memory edit flag

podman.podmanMachineEditMemorySupported must follow the same life-cycle guarantees as the CPU flag (definition, initialisation, refresh).
Duplicating the verification logic will avoid drift between the two capabilities.


98-107: Confirm disk-size edit gating aligns with platform policy

The disk-size field is now hidden unless podman.podmanMachineEditDiskSizeSupported is true.
Because disk resizing is macOS-only, be certain that:

  • The flag returns true only on macOS.
  • Windows & Linux paths explicitly set it to false to prevent stale context state after an OS switch in dev environments.

Minor: for consistency, consider shortening the flag names (podmanMachineEditDiskSupported vs podmanMachineEditDiskSizeSupported) or documenting the naming rationale.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 85879ae and 1512952.

📒 Files selected for processing (3)
  • extensions/podman/packages/extension/package.json (3 hunks)
  • extensions/podman/packages/extension/src/extension.spec.ts (4 hunks)
  • extensions/podman/packages/extension/src/extension.ts (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
extensions/podman/packages/extension/src/extension.spec.ts (1)
packages/extension-api/src/extension-api.d.ts (3)
  • RunResult (4382-4397)
  • ContainerProviderConnection (391-404)
  • Disposable (90-118)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: unit tests / windows-2022
  • GitHub Check: smoke e2e tests (production)
  • GitHub Check: unit tests / macos-15
  • GitHub Check: smoke e2e tests (development)
  • GitHub Check: typecheck
  • GitHub Check: unit tests / ubuntu-24.04
  • GitHub Check: macOS
  • GitHub Check: linter, formatters
  • GitHub Check: build website
  • GitHub Check: Linux
  • GitHub Check: Windows
🔇 Additional comments (7)
extensions/podman/packages/extension/package.json (1)

63-72: Ensure podman.podmanMachineEditCPUSupported is refreshed on config changes

The context key itself is correctly declared and set:

  • Constant at extensions/podman/packages/extension/src/extension.ts:1148
    export const PODMAN_MACHINE_EDIT_CPU = 'podman.podmanMachineEditCPUSupported';
  • Runtime assignment at line 865:
    extensionApi.context.setValue(PODMAN_MACHINE_EDIT_CPU, isEditCPUSupported);
    where
    • isEditCPUSupported = env.isMac || (env.isWindows && await isHyperVEnabled())
    • covers all OS paths (false on Linux/WSL or Windows without Hyper-V).

What’s missing is a listener to re-evaluate this key when the environment/configuration changes (e.g. Hyper-V toggled mid-session). No onDidChangeConfiguration handler exists in extension.ts, so users may see stale UI state until a provider refresh.

• Add a workspace.onDidChangeConfiguration (or equivalent with extensionApi) to recompute and re-set PODMAN_MACHINE_EDIT_CPU when relevant settings/OS capabilities change.
• Alternatively, confirm that your provider’s lifecycle refresh re-invokes the same context logic on config reloads.

extensions/podman/packages/extension/src/extension.spec.ts (4)

1469-1471: LGTM! Proper testing of macOS edit capabilities.

The assertions correctly verify that all machine editing context keys are set to true on macOS, which aligns with the platform support expectations.


1499-1518: Excellent test coverage for non-HyperV Windows scenario.

This test correctly verifies that machine editing capabilities are disabled on Windows when HyperV is not available, ensuring the edit lifecycle method is undefined and all context keys are set to false.


1520-1554: Well-implemented test for HyperV Windows scenario.

The test effectively mocks HyperV detection using PowerShell commands and correctly verifies that CPU and memory editing are supported while disk size editing is restricted on Windows with HyperV.


1572-1574: Appropriate test coverage for Linux platform.

The assertions correctly verify that machine editing capabilities are disabled on Linux, with all context keys set to false, completing the comprehensive platform coverage.

extensions/podman/packages/extension/src/extension.ts (2)

1148-1150: LGTM: Well-defined context keys for machine edit capabilities.

The exported constants follow consistent naming conventions and clearly indicate their purpose for controlling machine edit functionality visibility.


893-893: LGTM: Correct platform restriction for disk size editing.

The macOS-only restriction for disk size editing aligns with the context key setting and the PR objectives. This correctly ensures disk size editing is only available where supported.

@SoniaSandler
Copy link
Contributor Author

@axel7083 @cdrage @feloy Could you PTAL at this PR? thanks!

Signed-off-by: Sonia Sandler <ssandler@redhat.com>
Signed-off-by: Sonia Sandler <ssandler@redhat.com>
Signed-off-by: Sonia Sandler <ssandler@redhat.com>
Signed-off-by: Sonia Sandler <ssandler@redhat.com>
Signed-off-by: Sonia Sandler <ssandler@redhat.com>
Signed-off-by: Sonia Sandler <ssandler@redhat.com>
@SoniaSandler SoniaSandler force-pushed the isMac-podman-package branch from ae5704c to 41f92cb Compare July 10, 2025 15:53
@SoniaSandler SoniaSandler requested a review from feloy July 10, 2025 15:53
Copy link
Contributor
@feloy feloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm code-wise

6D40

Signed-off-by: Sonia Sandler <ssandler@redhat.com>
Copy link
Contributor
@jeffmaury jeffmaury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Sonia Sandler <ssandler@redhat.com>
@SoniaSandler SoniaSandler merged commit 05b413c into podman-desktop:main Jul 23, 2025
21 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.21.0 milestone Jul 23, 2025
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.

Add Podman machine editing option to HyperV machines
6 participants
0