[pve-devel] [PATCH container] lxc-pve-{prestart, poststop}-hook: initialize RESTEnvironment
Dominik Csapak
d.csapak at proxmox.com
Tue May 3 11:42:26 CEST 2022
else some operations will fail, e.g. using an guest disk on an
external ceph-cluster
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/lxc-pve-poststop-hook | 3 +++
src/lxc-pve-prestart-hook | 3 +++
2 files changed, 6 insertions(+)
diff --git a/src/lxc-pve-poststop-hook b/src/lxc-pve-poststop-hook
index 0fdd49e..2fe97ec 100755
--- a/src/lxc-pve-poststop-hook
+++ b/src/lxc-pve-poststop-hook
@@ -12,6 +12,7 @@ use PVE::LXC::Config;
use PVE::LXC::Tools;
use PVE::LXC;
use PVE::Network;
+use PVE::RESTEnvironment;
use PVE::Storage;
use PVE::Tools;
@@ -20,6 +21,8 @@ PVE::LXC::Tools::lxc_hook('post-stop', 'lxc', sub {
return undef if ! -f PVE::LXC::Config->config_file($vmid);
+ PVE::RESTEnvironment->setup_default_cli_env();
+
my $conf = PVE::LXC::Config->load_config($vmid);
my $storage_cfg = PVE::Storage::config();
diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook
index 0a76aee..2911e1b 100755
--- a/src/lxc-pve-prestart-hook
+++ b/src/lxc-pve-prestart-hook
@@ -15,6 +15,7 @@ use PVE::LXC::Config;
use PVE::LXC::Setup;
use PVE::LXC::Tools;
use PVE::LXC;
+use PVE::RESTEnvironment;
use PVE::SafeSyslog;
use PVE::Storage;
use PVE::Syscall qw(:fsmount);
@@ -39,6 +40,8 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub {
PVE::Cluster::check_cfs_quorum(); # only start if we have quorum
+ PVE::RESTEnvironment->setup_default_cli_env();
+
return undef if ! -f PVE::LXC::Config->config_file($vmid);
my $conf = PVE::LXC::Config->load_config($vmid);
--
2.30.2
More information about the pve-devel
mailing list