]> git.proxmox.com Git - pve-container.git/commitdiff
remove tests for /dev/xxx and use get_vm_volumes
authorAlexandre Derumier <aderumier@odiso.com>
Mon, 24 Aug 2015 08:13:21 +0000 (10:13 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 26 Aug 2015 14:02:36 +0000 (16:02 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
src/PVE/LXC.pm
src/lxc-pve-prestart-hook

index fce6fd644e92d533c9709c64691aef9e24cbe77e..982db2d418c2faaa7a02d9d06afbed0fb4b2f586 100644 (file)
@@ -1257,17 +1257,8 @@ sub vm_stop_cleanup {
     eval {
        if (!$keepActive) {
 
-           my $vollist = [];
-           my $loopdevlist = [];
-
-           PVE::LXC::foreach_mountpoint($conf, sub {
-               my ($ms, $mountpoint) = @_;
-
-               my $volid = $mountpoint->{volume};
-               return if !$volid || $volid =~ m|^/dev/.+|;
-               push @$vollist, $volid;
-               push @$loopdevlist, $volid if $ms ne 'rootfs';
-           });
+            my $vollist = get_vm_volumes($conf);
+            my $loopdevlist = get_vm_volumes($conf, 'rootfs');
 
            PVE::LXC::dettach_loops($storage_cfg, $loopdevlist);
            PVE::Storage::deactivate_volumes($storage_cfg, $vollist);
index 8ff46721f5033a53966e360648a7073012b4996d..764cd2bf0d3832fd2569cfec8eb976461d345d92 100755 (executable)
@@ -78,17 +78,8 @@ __PACKAGE__->register_method ({
 
        my $storage_cfg = PVE::Storage::config();
 
-       my $vollist = [];
-       my $loopdevlist = [];
-
-       PVE::LXC::foreach_mountpoint($conf, sub {
-           my ($ms, $mountpoint) = @_;
-
-           my $volid = $mountpoint->{volume};
-           return if !$volid || $volid =~ m|^/dev/.+|;
-           push @$vollist, $volid;
-           push @$loopdevlist, $volid if $ms ne 'rootfs';
-       });
+       my $vollist = PVE::LXC::get_vm_volumes($conf);
+       my $loopdevlist = PVE::LXC::get_vm_volumes($conf, 'rootfs');
 
        PVE::Storage::activate_volumes($storage_cfg, $vollist);
        PVE::LXC::attach_loops($storage_cfg, $loopdevlist);