public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH container] lxc-pve-{prestart, poststop}-hook: initialize RESTEnvironment
@ 2022-05-03  9:42 Dominik Csapak
  2022-05-04  6:40 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2022-05-03  9:42 UTC (permalink / raw)
  To: pve-devel

else some operations will fail, e.g. using an guest disk on an
external ceph-cluster

Signed-off-by: Dominik Csapak <d.csapak@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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-04  6:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03  9:42 [pve-devel] [PATCH container] lxc-pve-{prestart, poststop}-hook: initialize RESTEnvironment Dominik Csapak
2022-05-04  6:40 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal