[pve-devel] [PATCH v3 container] fix #2820: don't hotplug over existing mpX

Oguz Bektas o.bektas at proxmox.com
Thu Jul 2 12:10:23 CEST 2020


check if the given mpX already exists in the config.  if it does, then
skip hotplugging and write the changes to [pve:pending] for the next
reboot of CT.

after rebooting the CT, the preexisting mpX will be added as unused and
the mpX will be mounted.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 src/PVE/LXC/Config.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 0a28380..4981dc5 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1248,6 +1248,10 @@ sub vmconfig_hotplug_pending {
 		    die "skip\n";
 		}
 
+		if (exists($conf->{$opt})) {
+		    die "skip\n"; # don't try to hotplug over existing mp
+		}
+
 		$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};
-- 
2.20.1




More information about the pve-devel mailing list