[pve-devel] [PATCH 2/4] update_lxc_config : remove foreach_mountpoint

Alexandre Derumier aderumier at odiso.com
Mon Aug 24 10:13:19 CEST 2015


- we only define rootfs.
- also add support for /dev/.. and directory as rootfs

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 src/PVE/LXC.pm | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 7d1886d..1f14146 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1000,21 +1000,17 @@ sub update_lxc_config {
     $raw .= "lxc.cgroup.cpu.shares = $shares\n";
 
     
-    PVE::LXC::foreach_mountpoint($conf, sub {
-	my ($ms, $mountpoint) = @_;
-
-	return if $ms ne 'rootfs';
-	my $volid = $mountpoint->{volume};
-	return if !$volid || $volid =~ m|^/dev/.+|;
-
-	my $path = volid_path ($volid, $storage_cfg);
+    my $mountpoint = parse_ct_mountpoint($conf->{rootfs});
+    my $volid = $mountpoint->{volume};
+    my $path = volid_path ($volid, $storage_cfg);
+    my ($storage, $volname) = PVE::Storage::parse_volume_id($volid, 1);
 
-	my ($storage, $volname) = PVE::Storage::parse_volume_id($volid);
+    if($storage) {
 	my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
 	$path = "loop:".$path if $scfg->{path};
+    }
 
-	$raw .= "lxc.rootfs = $path\n";
-    });
+    $raw .= "lxc.rootfs = $path\n";
 
     my $netcount = 0;
     foreach my $k (keys %$conf) {
-- 
2.1.4




More information about the pve-devel mailing list