From: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
Subject: [PATCH pve-container 2/2] mountpoint: allow changing rootfs properties at runtime
Date: Wed, 4 Nov 2026 10:29:39 +0100 [thread overview]
Message-ID: <20261104092939.123574-3-t.ellmenreich@proxmox.com> (raw)
In-Reply-To: <20261104092939.123574-1-t.ellmenreich@proxmox.com>
Just as has been implemented for mountpoints, properties like replicate
can now be applied at runtime for rootfs disks. If the change is
performed with any other non hot pluggable options, the whole changeset
is added as pending instead of mixing the two states.
Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
---
src/PVE/LXC/Config.pm | 2 +-
src/test/config_tests.pl | 65 ++++++++++++++++++++++++++++++++++++++--
2 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 60318b4..5c35750 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1737,7 +1737,7 @@ sub vmconfig_hotplug_pending {
if (!$hotplug_memory_done) { # don't call twice if both opts are passed
$hotplug_memory->($conf->{pending}->{memory}, $conf->{pending}->{swap});
}
- } elsif ($opt =~ m/^mp(\d+)$/) {
+ } elsif ($opt =~ m/^mp(\d+)$/ || $opt eq 'rootfs') {
$class->apply_pending_mountpoint($vmid, $conf, $opt, $storecfg, 1);
# apply_pending_mountpoint modifies the value if it creates a new disk
$value = $conf->{pending}->{$opt};
diff --git a/src/test/config_tests.pl b/src/test/config_tests.pl
index 43935a9..5c5e868 100755
--- a/src/test/config_tests.pl
+++ b/src/test/config_tests.pl
@@ -9,14 +9,19 @@ use Test::More;
use PVE::LXC::Config;
+# Creates new and old configurations based on the common core and just
+# the changes. The fourth parameter can change the kind of mountpoint it
+# is, instead of always using mp0.
my sub create_conf {
- my ($common, $new, $old) = @_;
+ my ($common, $new, $old, $mountpoint_name) = @_;
+
+ $mountpoint_name //= 'mp0';
my $new_str = defined($new) ? $common . ',' . $new : $common;
my $old_str = defined($old) ? $common . ',' . $old : $common;
return (
- PVE::LXC::Config->parse_volume('mp0', $new_str),
- PVE::LXC::Config->parse_volume('mp0', $old_str),
+ PVE::LXC::Config->parse_volume($mountpoint_name, $new_str),
+ PVE::LXC::Config->parse_volume($mountpoint_name, $old_str),
);
}
@@ -27,6 +32,14 @@ subtest 'same config can be applied' => sub {
ok($result, "can be hotplugged");
};
+subtest 'rootfs same config can be applied' => sub {
+ my ($new, $old) =
+ create_conf("local:100/vm-100-disk-1.raw,replicate=1", undef, undef, "rootfs");
+ my $result = PVE::LXC::Config->__mountpoint_config_fast_plug_safe("rootfs", $new, $old);
+
+ ok($result, "can be hotplugged");
+};
+
subtest 'config with only backup difference can be applied' => sub {
my ($new, $old) =
create_conf("local:100/vm-100-disk-1.raw,mp=/mnt", "backup=1", "backup=0");
@@ -35,6 +48,14 @@ subtest 'config with only backup difference can be applied' => sub {
ok($result, "can be hotplugged");
};
+subtest 'rootfs config with only backup difference can be applied' => sub {
+ my ($new, $old) =
+ create_conf("local:100/vm-100-disk-1.raw", "replicate=1", "replicate=0", "rootfs");
+ my $result = PVE::LXC::Config->__mountpoint_config_fast_plug_safe("rootfs", $new, $old);
+
+ ok($result, "can be hotplugged");
+};
+
subtest 'fast plug option also ignored if previously not present' => sub {
my ($new, $old) = create_conf("local:100/vm-100-disk-1.raw,mp=/mnt", "replicate=1", undef);
my $result = PVE::LXC::Config->__mountpoint_config_fast_plug_safe("mp0", $new, $old);
@@ -42,6 +63,14 @@ subtest 'fast plug option also ignored if previously not present' => sub {
ok($result, "can be hotplugged");
};
+subtest 'rootfs fast plug option also ignored if previously not present' => sub {
+ my ($new, $old) =
+ create_conf("local:100/vm-100-disk-1.raw", "replicate=1", undef, "rootfs");
+ my $result = PVE::LXC::Config->__mountpoint_config_fast_plug_safe("rootfs", $new, $old);
+
+ ok($result, "can be hotplugged");
+};
+
subtest 'difference in mountpoint cannot be applied' => sub {
my ($new, $old) =
create_conf("local:100/vm-100-disk-1.raw,replicate=1", "mp=/mnt/one", "mp=/mnt/two");
@@ -50,6 +79,15 @@ subtest 'difference in mountpoint cannot be applied' => sub {
ok(!$result, "cannot be hotplugged");
};
+subtest 'rootfs difference in acl cannot be applied' => sub {
+ my ($new, $old) = create_conf(
+ "local:100/vm-100-disk-1.raw,replicate=1", "acl=0", "acl=1", "rootfs",
+ );
+ my $result = PVE::LXC::Config->__mountpoint_config_fast_plug_safe("rootfs", $new, $old);
+
+ ok(!$result, "cannot be hotplugged");
+};
+
subtest 'changing fast pluggable and non fast pluggable cannot be applied' => sub {
my ($new, $old) =
create_conf("local:100/vm-100-disk-1.raw", "mp=/mnt/one", "mp=/mnt/two,replicate=1");
@@ -58,6 +96,15 @@ subtest 'changing fast pluggable and non fast pluggable cannot be applied' => su
ok(!$result, "cannot be hotplugged");
};
+subtest 'rootfs changing fast pluggable and non fast pluggable cannot be applied' => sub {
+ my ($new, $old) = create_conf(
+ "local:100/vm-100-disk-1.raw", "acl=0", "acl=1,replicate=1", "rootfs",
+ );
+ my $result = PVE::LXC::Config->__mountpoint_config_fast_plug_safe("rootfs", $new, $old);
+
+ ok(!$result, "cannot be hotplugged");
+};
+
subtest 'idmap array does not throw off comparison' => sub {
my ($new, $old) = create_conf(
"local:100/vm-100-disk-1.raw,mp=/mnt,idmap=u:0:100000:65536;g:0:100000:65536",
@@ -69,4 +116,16 @@ subtest 'idmap array does not throw off comparison' => sub {
ok($result, "can be hotplugged");
};
+subtest 'rootfs idmap array does not throw off comparison' => sub {
+ my ($new, $old) = create_conf(
+ "local:100/vm-100-disk-1.raw,idmap=u:0:100000:65536;g:0:100000:65536",
+ "replicate=1",
+ undef,
+ "rootfs",
+ );
+ my $result = PVE::LXC::Config->__mountpoint_config_fast_plug_safe("rootfs", $new, $old);
+
+ ok($result, "can be hotplugged");
+};
+
done_testing();
--
2.47.3
prev parent reply other threads:[~2026-11-04 9:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 9:29 [PATCH container 0/2] mountpoint: allow certain options to be hotplugged Thomas Ellmenreich
2026-11-04 9:29 ` [PATCH pve-container 1/2] mountpoint: allow changing mountpoint properties at runtime Thomas Ellmenreich
2026-11-04 9:29 ` Thomas Ellmenreich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261104092939.123574-3-t.ellmenreich@proxmox.com \
--to=t.ellmenreich@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.