From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container] lxc-pve-{prestart, poststop}-hook: initialize RESTEnvironment
Date: Tue, 3 May 2022 11:42:26 +0200 [thread overview]
Message-ID: <20220503094226.1755739-1-d.csapak@proxmox.com> (raw)
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
next reply other threads:[~2022-05-03 9:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 9:42 Dominik Csapak [this message]
2022-05-04 6:40 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220503094226.1755739-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox