* [pve-devel] [PATCH container] use monitor commands to freeze on pure-v2 setups
@ 2021-01-25 11:05 Wolfgang Bumiller
2021-01-25 13:22 ` Stoiko Ivanov
2021-01-26 17:26 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 2 replies; 3+ messages in thread
From: Wolfgang Bumiller @ 2021-01-25 11:05 UTC (permalink / raw)
To: pve-devel
even an explicit query for the 'unified' cgroup hierarchy
does not work on lxc when run in a pure v2 environment via
the kernel options
systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all
so let's use the freeze commands provided by lxc we already
have code for...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
See-also: https://forum.proxmox.com/threads/short-read-on-command-socket-error-when-running-backup-of-lxc-containers.82978/
---
src/PVE/LXC.pm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index e7a6951..7e84a0e 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2463,12 +2463,20 @@ sub get_lxc_version() {
sub freeze($) {
my ($vmid) = @_;
- PVE::LXC::CGroup->new($vmid)->freeze_thaw(1);
+ if (PVE::CGroup::cgroup_mode() == 2) {
+ PVE::LXC::Command::freeze($vmid, 30);
+ } else {
+ PVE::LXC::CGroup->new($vmid)->freeze_thaw(1);
+ }
}
sub thaw($) {
my ($vmid) = @_;
- PVE::LXC::CGroup->new($vmid)->freeze_thaw(0);
+ if (PVE::CGroup::cgroup_mode() == 2) {
+ PVE::LXC::Command::unfreeze($vmid, 30);
+ } else {
+ PVE::LXC::CGroup->new($vmid)->freeze_thaw(0);
+ }
}
1;
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] [PATCH container] use monitor commands to freeze on pure-v2 setups
2021-01-25 11:05 [pve-devel] [PATCH container] use monitor commands to freeze on pure-v2 setups Wolfgang Bumiller
@ 2021-01-25 13:22 ` Stoiko Ivanov
2021-01-26 17:26 ` [pve-devel] applied: " Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2021-01-25 13:22 UTC (permalink / raw)
To: Wolfgang Bumiller; +Cc: pve-devel
Gave the patch a spin on a v2-only system.
* it fixes the issue as described
we had a short chat off-list with Wolfgang - and considered restructuring
the code a bit (currently the patch makes parts of PVE::CGroup dead code)
but for alleviating the immediate issue:
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
On Mon, 25 Jan 2021 12:05:32 +0100
Wolfgang Bumiller <w.bumiller@proxmox.com> wrote:
> even an explicit query for the 'unified' cgroup hierarchy
> does not work on lxc when run in a pure v2 environment via
> the kernel options
>
> systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all
>
> so let's use the freeze commands provided by lxc we already
> have code for...
>
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> See-also: https://forum.proxmox.com/threads/short-read-on-command-socket-error-when-running-backup-of-lxc-containers.82978/
> ---
> src/PVE/LXC.pm | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index e7a6951..7e84a0e 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -2463,12 +2463,20 @@ sub get_lxc_version() {
>
> sub freeze($) {
> my ($vmid) = @_;
> - PVE::LXC::CGroup->new($vmid)->freeze_thaw(1);
> + if (PVE::CGroup::cgroup_mode() == 2) {
> + PVE::LXC::Command::freeze($vmid, 30);
> + } else {
> + PVE::LXC::CGroup->new($vmid)->freeze_thaw(1);
> + }
> }
>
> sub thaw($) {
> my ($vmid) = @_;
> - PVE::LXC::CGroup->new($vmid)->freeze_thaw(0);
> + if (PVE::CGroup::cgroup_mode() == 2) {
> + PVE::LXC::Command::unfreeze($vmid, 30);
> + } else {
> + PVE::LXC::CGroup->new($vmid)->freeze_thaw(0);
> + }
> }
>
> 1;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied: [PATCH container] use monitor commands to freeze on pure-v2 setups
2021-01-25 11:05 [pve-devel] [PATCH container] use monitor commands to freeze on pure-v2 setups Wolfgang Bumiller
2021-01-25 13:22 ` Stoiko Ivanov
@ 2021-01-26 17:26 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2021-01-26 17:26 UTC (permalink / raw)
To: Proxmox VE development discussion, Wolfgang Bumiller
On 25.01.21 12:05, Wolfgang Bumiller wrote:
> even an explicit query for the 'unified' cgroup hierarchy
> does not work on lxc when run in a pure v2 environment via
> the kernel options
>
> systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all
>
> so let's use the freeze commands provided by lxc we already
> have code for...
>
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> See-also: https://forum.proxmox.com/threads/short-read-on-command-socket-error-when-running-backup-of-lxc-containers.82978/
> ---
> src/PVE/LXC.pm | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
>
applied, with Stoiko's R-b and T-b, thanks to both!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-26 17:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 11:05 [pve-devel] [PATCH container] use monitor commands to freeze on pure-v2 setups Wolfgang Bumiller
2021-01-25 13:22 ` Stoiko Ivanov
2021-01-26 17:26 ` [pve-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal