From 2914ad9b1d577baede7f9ea13f2a8e63f9f12dec Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 18 Aug 2015 07:25:08 +0200 Subject: [PATCH] use standard code inside post stop hook --- src/lxc-pve-poststop-hook | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/lxc-pve-poststop-hook b/src/lxc-pve-poststop-hook index b42b780..f23237a 100755 --- a/src/lxc-pve-poststop-hook +++ b/src/lxc-pve-poststop-hook @@ -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; }}); -- 2.39.2