]> git.proxmox.com Git - pve-container.git/commitdiff
use standard code inside post stop hook
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 18 Aug 2015 05:25:08 +0000 (07:25 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 18 Aug 2015 05:25:08 +0000 (07:25 +0200)
src/lxc-pve-poststop-hook

index b42b780a6e503f4364e3980a0ce670bfc8c99a10..f23237a13a9e83da4af5fb004cc0cf1b00dbf9b1 100755 (executable)
@@ -61,25 +61,15 @@ __PACKAGE__->register_method ({
 
        return undef if $param->{name} !~ m/^\d+$/;
 
-       # Note: PVE::INotify::nodename() returns wrong value when run
-       # inside container mount hook, so we cannot simply 
-       # use PVE::LXC::load_conf().
+       my $vmid = $param->{name};
 
-       my $config_filename = "/etc/pve/lxc/$param->{name}.conf";
-
-       return undef if ! -f $config_filename;
+       return undef if ! -f PVE::LXC::config_file($vmid);
        
-       my $raw = PVE::Tools::file_get_contents($config_filename);
-       my $conf = PVE::LXC::parse_pct_config($config_filename, $raw);
-
-       my $storagecfg_filename = "/etc/pve/storage.cfg";
-
-       return undef if ! -f $storagecfg_filename;
+       my $conf = PVE::LXC::load_config($vmid);
 
-       my $storage_raw = PVE::Tools::file_get_contents($storagecfg_filename);
-       my $storage_cfg = PVE::Storage::Plugin->parse_config($storagecfg_filename, $storage_raw);
+       my $storage_cfg = PVE::Storage::config();
 
-        PVE::LXC::vm_stop_cleanup($storage_cfg, $param->{name}, $conf);
+        PVE::LXC::vm_stop_cleanup($storage_cfg, $vmid, $conf);
        
        return undef;
     }});