]> git.proxmox.com Git - pve-container.git/commitdiff
vm_start : attach loop devices for non rootfs mountpoint
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 18 Aug 2015 03:56:04 +0000 (05:56 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 18 Aug 2015 04:51:12 +0000 (06:51 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
src/PVE/API2/LXC.pm

index 7eb0afb1d7a4e75b11cfe53d874b594fd6f2466a..b395af317d4373ca5ddec17cb9e894240427b437 100644 (file)
@@ -1007,7 +1007,19 @@ __PACKAGE__->register_method({
 
                PVE::LXC::foreach_mountpoint($conf, sub {
                    my ($ms, $mountpoint) = @_;
-                   PVE::Storage::activate_volumes($storage_cfg, [$mountpoint->{volume}]);
+
+                   my $volid = $mountpoint->{volume};
+                   PVE::Storage::activate_volumes($storage_cfg, [$volid]);
+
+                   my ($storage, $volname) = PVE::Storage::parse_volume_id($volid);
+                   my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
+                   my ($vtype, undef, undef, undef, undef, $isBase, $format) =
+                       PVE::Storage::parse_volname($storage_cfg, $volid);
+
+                   if($ms ne 'rootfs' && $format ne 'subvol' && ($scfg->{type} eq 'dir' || $scfg->{type} eq 'nfs')) {
+                       my $path = PVE::Storage::path($storage_cfg, $volid);
+                       PVE::Tools::run_command(['losetup', '--find', '--show', $path]);
+                   }
                });
                
                PVE::LXC::update_lxc_config($storage_cfg, $vmid, $conf);