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.bek...@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

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to