[pve-devel] [PATCH container] fix #5666: fix quota regression due to device passthrough

Filip Schauer f.schauer at proxmox.com
Tue Aug 27 13:46:43 CEST 2024


This commit fixes a regression introduced by
commit ce1976b85361 ("Add device passthrough")

Prior to the addition of device passthrough, the `lxc-pve-autodev-hook`
would invoke `PVE::LXC::Tools::for_current_devices` only once. If the
device list was empty, `exit 0` would be called and the
`lxc-pve-autodev-hook` would exit.

However, with the new device passthrough logic, when no devices were
passed through, the `exit` call would be encountered prematurely.
This would prevent the subsequent iteration over passthrough mounts from
occurring.

This commit resolves the issue by replacing the premature `exit` call
with a `return` statement, ensuring the `lxc-pve-autodev-hook` continues
executing and processes the passthrough mounts as expected.

Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
---
 src/PVE/LXC/Tools.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Tools.pm b/src/PVE/LXC/Tools.pm
index 7e3e530..3380c62 100644
--- a/src/PVE/LXC/Tools.pm
+++ b/src/PVE/LXC/Tools.pm
@@ -89,7 +89,7 @@ sub for_devices {
     my $fd;
 
     if (! open $fd, '<', $devlist_file) {
-	exit 0 if $!{ENOENT}; # If the list is empty the file might not exist.
+	return if $!{ENOENT}; # If the list is empty the file might not exist.
 	die "failed to open device list: $!\n";
     }
 
-- 
2.39.2





More information about the pve-devel mailing list