]> git.proxmox.com Git - pve-container.git/commitdiff
volid_path: don't format $path with loop:/
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 21 Aug 2015 15:10:18 +0000 (17:10 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 21 Aug 2015 15:25:34 +0000 (17:25 +0200)
This is only used in lxc config and not a real path

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
src/PVE/LXC.pm
src/lxc-pve-mount-hook

index b90848b083aa992866363fb1c3a3bdbd292819d2..9d2ea4fc0ae0c40377307689349eec92c79531d8 100644 (file)
@@ -999,6 +999,7 @@ sub update_lxc_config {
     my $shares = $conf->{cpuunits} || 1024;
     $raw .= "lxc.cgroup.cpu.shares = $shares\n";
 
+    
     PVE::LXC::foreach_mountpoint($conf, sub {
        my ($ms, $mountpoint) = @_;
 
@@ -1006,7 +1007,12 @@ sub update_lxc_config {
        my $volid = $mountpoint->{volume};
        return if !$volid || $volid =~ m|^/dev/.+|;
 
-       my $path = volid_path ($volid, $ms, $storage_cfg);
+       my $path = volid_path ($volid, $storage_cfg);
+
+       my ($storage, $volname) = PVE::Storage::parse_volume_id($volid);
+       my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
+       $path = "loop:".$path if $scfg->{path};
+
        $raw .= "lxc.rootfs = $path\n";
     });
 
@@ -1834,7 +1840,7 @@ sub check_ct_modify_config_perm {
 
 
 sub volid_path {
-    my ($volid, $ms, $storage_cfg, $loopdevs) = @_;
+    my ($volid, $storage_cfg, $loopdevs) = @_;
 
         my ($storage, $volname) = PVE::Storage::parse_volume_id($volid);
         my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
@@ -1850,12 +1856,7 @@ sub volid_path {
         } elsif ($format eq 'raw') {
 
             if ($scfg->{path}) {
-               if ($ms eq 'rootfs') {
-                   $path = "loop:$path\n" if $ms eq 'rootfs';
-               } elsif ($loopdevs) {
-                   $path = PVE::LXC::find_loopdev($loopdevs, $path) if $loopdevs;
-               }
-               
+               $path = PVE::LXC::find_loopdev($loopdevs, $path) if $loopdevs;
             } elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'rbd') {
                #do nothing
             } else {
@@ -1938,7 +1939,7 @@ sub mountpoint_mount {
            return;
        }
 
-       my $path = PVE::LXC::volid_path($volid, $ms, $storage_cfg, $loopdevs);
+       my $path = PVE::LXC::volid_path($volid, $storage_cfg, $loopdevs);
 
        if ($path !~ m|^/dev/.+|) {
            PVE::Tools::run_command(['mount', '-o', 'bind', $path, $mount_path]);
index 0b99e68a8c2c6a638c4b2cd1a43cc99ed313acb1..2f8f2867762b03e8e1c00eba5e56311c492aec07 100755 (executable)
@@ -101,7 +101,7 @@ __PACKAGE__->register_method ({
            my $volid = $mountpoint->{volume};
            return if !$volid || $volid =~ m|^/dev/.+|;
 
-           my $path = PVE::LXC::volid_path($volid, $ms, $storage_cfg, $loopdevs);
+           my $path = PVE::LXC::volid_path($volid, $storage_cfg, $loopdevs);
 
            if (-l $path) {
                $path = readlink($path);