Skip to content

microVM: accept host paths with commas in --mount - #131

Merged
ppenna merged 2 commits into
mainfrom
fix/microvm-mount-host-path-commas-283
Oct 13, 2026
Merged

ppenna merged 2 commits into
mainfrom
fix/microvm-mount-host-path-commas-283

Conversation

@ppenna

@ppenna ppenna commented Oct 11, 2026 •

Copy link
Copy Markdown

This PR lets --mount share a host directory whose path contains commas, for microsoft/nvx#283.

Why

--mount GUEST_TARGET,HOST_PATH[,ro|rw] split its value at its first two commas, so a host path with a comma, such as C:\projects\alpha,beta or C:\reports\2026, final, lost its tail to the mode, which OpenVMM then rejected. Such paths are valid on Windows and Linux, and MXC's filesystem.readonlyPaths and filesystem.readwritePaths accept them. --mount-child already reads its mode after the last comma, so only --mount refused them.

Changes

Area Change
Command line --mount reads the guest target up to the first comma and, with another comma, the mode after the last one, so HOST_PATH may contain commas when the mode is given, as with --mount-child. A value with more than one comma must end in ro or rw. The error for another mode suggests ending the value with ,ro or ,rw if HOST_PATH contains commas.
Tests Command-line tests for host paths with commas, with a trailing comma, and ending in what looks like a mode, and for the error's hint. A resolver test checks that --mount and --mount-child share the exact comma-named directories, alpha,beta and 2026, final, with their modes and denied paths, rather than the sibling alpha that the text before the last comma names.
Guide The virtio-fs and CLI pages state the rule.
Commit Content
5a7aad12c The parser, its tests, and the Guide's virtio-fs and CLI pages.
1feb1f4a3 Review: the hint for an invalid mode is a condition, so it no longer reads as the cause of an error whose host path has no comma, and a test checks it.

Compatibility

Every --mount value that OpenVMM accepted keeps its meaning: with one comma, the host path is shared read-only, and with two, the value still needs a valid mode, so /mnt/share,host,write is still rejected. Only values with three or more commas, which OpenVMM rejected, are newly accepted, and only when they end in ro or rw. --mount-child, snapshots, and saved state are unchanged: snapshots already record canonical host paths as strings.

Validation

The branch sits on main at a5955855c. All results below are for this head, 1feb1f4a3. Its commits are the earlier f62a1126c and 71a528668 rebased onto that main: git range-diff pairs each with its original as identical, and the diffs differ only in the index line of the Guide's virtio-fs page, whose base now includes #132's row.

  • On Windows, cargo clippy --all-targets, cargo doc --no-deps, and cargo nextest run --profile agent for openvmm_entry: clean, with 197 tests passed. cargo xtask fmt reports no changes.

  • On Linux (prometheus30, bare metal, Azure Linux 3.0), the same nextest run for openvmm_entry: 230 passed.

  • filesystem: share host paths that contain commas microsoft/nvx#494, which pins this head, passed on bare-metal Linux/MSHV (prometheus30), Linux/KVM (prometheus32), and Windows/WHP (prometheus28), with OpenVMM built from this head:

    • the filesystem-comma-paths, filesystem-shares, filesystem-policy, denied-filesystem-paths, and filesystem-snapshot scenarios of test-microvm. filesystem-comma-paths shares a read-write alpha,beta and a read-only 2026, final directory through nvx.py run, each alone, as --mount, and both, as --mount-child children. It requires the exact directories, their modes, which hold even after guest root remounts the read-only share read-write, and their hidden denied subdirectories;
    • the aci_edge_sandboxes lifecycle tests, 16 of 16.

    Before the rebase, at 71a528668, it also passed the sandbox share smoke tests with the same two directories, one-shot alone and together, and managed.

The NVX CI covers KVM, MSHV, and WHP. Merge this PR before microsoft/nvx#494.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open findings
What changed in this PR

Enables --mount to accept host paths containing commas by parsing the guest target up to the first comma and the mode after the last comma, aligning behavior with --mount-child.

Changes:

  • Updated --mount parsing to use first-comma / last-comma splitting and improved error text for invalid modes in comma-containing paths.
  • Added unit/integration tests covering comma-containing host paths and edge cases.
  • Updated CLI and virtio-fs guide documentation to describe the new parsing rule.
File Description
openvmm/​openvmm_entry/​src/​microvm/​filesystem.rs Adds a resolver-style test ensuring mounts and denied paths resolve to the intended comma-named directories.
openvmm/​openvmm_entry/​src/​cli_args/​microvm.rs Updates --mount parsing to support commas in host paths; adds parsing tests and updates CLI help text.
Guide/​src/​reference/​openvmm/​management/​cli.md Documents the first-comma / last-comma parsing rule for --mount.
Guide/​src/​reference/​devices/​virtio/​virtio-fs.md Documents the first-comma / last-comma parsing rule for virtio-fs --mount.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread openvmm/openvmm_entry/src/cli_args/microvm.rs
Comment thread openvmm/openvmm_entry/src/cli_args/microvm.rs Outdated
ppenna added a commit to microsoft/nvx that referenced this pull request Oct 11, 2026
71a528668 (fix/microvm-mount-host-path-commas-283 in nanvix/openvmm,
nanvix/openvmm#131) stacks on 2130f24b5, which dev already pins. It
lets --mount GUEST_TARGET,HOST_PATH[,ro|rw] share a host directory whose
path contains commas, such as C:\projects\alpha,beta or
C:\reports\2026, final.

The guest target ends at the first comma, and with another comma, the
mode follows the last one, so a host path may contain commas when the
mode is given, as --mount-child already allowed. A value with one comma
still shares its host path read-only, and one with two still needs a
valid mode, so every value that OpenVMM accepted keeps its meaning. A
value with more commas, which OpenVMM rejected, now shares the host
path between its first and last commas if it ends in ro or rw. The
error for another mode suggests ending the value with ,ro or ,rw if the
host path contains commas. --mount-child, snapshots, and saved state
are unchanged.

run and sandbox still reject host paths with commas; a following commit
accepts them.

Part of #283.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ppenna and others added 2 commits October 12, 2026 20:43
Part of microsoft/nvx#283.

--mount GUEST_TARGET,HOST_PATH[,ro|rw] split its value at its first two
commas, so a host path that contains a comma, such as
C:\projects\alpha,beta or C:\reports\2026, final, lost its tail to the
mode, which OpenVMM then rejected. --mount-child already reads its mode
after the last comma, so its host paths may contain commas.

Parse --mount the same way: the guest target ends at the first comma,
and with another comma, the mode follows the last one, so a host path
may contain commas when the mode is given. A value with one comma still
shares its host path read-only, and one with two still needs a valid
mode, so every value that OpenVMM accepted keeps its meaning, and so
does every value with fewer than three commas that it rejected. A value
with more commas, which OpenVMM rejected, now shares the host path
between its first and last commas if it ends in ro or rw. The error for
an invalid mode now says that a host path with commas requires the mode.

Add command-line tests for host paths with commas, with a trailing
comma, and ending in what looks like a mode, and a resolver test that
--mount and --mount-child share the exact comma-named directories with
their modes and denied paths. Update the command-line help and the
Guide's virtio-fs and CLI pages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Part of microsoft/nvx#283.

Address review feedback: the error for an invalid --mount mode said
that a host path that contains commas requires the mode, even for a
value such as /mnt/share,host,write, whose host path has none, which
read as the cause of the error. State the hint as a condition instead:
if HOST_PATH contains commas, end the value with ,ro or ,rw. A test
checks the error's mode and hint.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ppenna
ppenna force-pushed the fix/microvm-mount-host-path-commas-283 branch from 71a5286 to 1feb1f4 Compare October 13, 2026 00:06
ppenna added a commit to microsoft/nvx that referenced this pull request Oct 13, 2026
1feb1f4a3 (fix/microvm-mount-host-path-commas-283 in nanvix/openvmm,
nanvix/openvmm#131) stacks on a5955855c, which dev already pins. It
lets --mount GUEST_TARGET,HOST_PATH[,ro|rw] share a host directory whose
path contains commas, such as C:\projects\alpha,beta or
C:\reports\2026, final.

The guest target ends at the first comma, and with another comma, the
mode follows the last one, so a host path may contain commas when the
mode is given, as --mount-child already allowed. A value with one comma
still shares its host path read-only, and one with two still needs a
valid mode, so every value that OpenVMM accepted keeps its meaning. A
value with more commas, which OpenVMM rejected, now shares the host
path between its first and last commas if it ends in ro or rw. The
error for another mode suggests ending the value with ,ro or ,rw if the
host path contains commas. --mount-child, snapshots, and saved state
are unchanged.

run and sandbox still reject host paths with commas; a following commit
accepts them.

Part of #283.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ppenna added a commit to microsoft/nvx that referenced this pull request Oct 13, 2026
1feb1f4a3 (fix/microvm-mount-host-path-commas-283 in nanvix/openvmm,
nanvix/openvmm#131) stacks on a5955855c, which dev already pins. It
lets --mount GUEST_TARGET,HOST_PATH[,ro|rw] share a host directory whose
path contains commas, such as C:\projects\alpha,beta or
C:\reports\2026, final.

The guest target ends at the first comma, and with another comma, the
mode follows the last one, so a host path may contain commas when the
mode is given, as --mount-child already allowed. A value with one comma
still shares its host path read-only, and one with two still needs a
valid mode, so every value that OpenVMM accepted keeps its meaning. A
value with more commas, which OpenVMM rejected, now shares the host
path between its first and last commas if it ends in ro or rw. The
error for another mode suggests ending the value with ,ro or ,rw if the
host path contains commas. --mount-child, snapshots, and saved state
are unchanged.

run and sandbox still reject host paths with commas; a following commit
accepts them.

Part of #283.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ppenna
ppenna merged commit 1feb1f4 into main Oct 13, 2026
@ppenna
ppenna deleted the fix/microvm-mount-host-path-commas-283 branch October 13, 2026 10:23
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.

2 participants