* [pve-devel] [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck
@ 2024-04-12 11:08 Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 1/3] mountpoint mount: activate PVE-managed volumes during preparation Fiona Ebner
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Fiona Ebner @ 2024-04-12 11:08 UTC (permalink / raw)
To: pve-devel
Changes in v2:
* specify snapname when activating volume for hotplug
* add missing activation call for fsck too
Otherwise those operations would be problematic with certain storages
like LVM after shutting down a container (which deactivates the
volumes).
Fiona Ebner (3):
mountpoint mount: activate PVE-managed volumes during preparation
pct: fsck: also unmap when fsck command failed
pct: fsck: add missing call to activate volume
src/PVE/CLI/pct.pm | 13 +++++++++++--
src/PVE/LXC.pm | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] [PATCH v2 container 1/3] mountpoint mount: activate PVE-managed volumes during preparation
2024-04-12 11:08 [pve-devel] [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fiona Ebner
@ 2024-04-12 11:08 ` Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 2/3] pct: fsck: also unmap when fsck command failed Fiona Ebner
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2024-04-12 11:08 UTC (permalink / raw)
To: pve-devel
Otherwise it was not possible to hotplug a volume that was previously
deactivated and requires activation, e.g. an LVM LV that was detached
after shutting down the container couldn't be hotplugged anymore
later.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Changes in v2:
* specify snapname when activating
src/PVE/LXC.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 0dda696..9681d74 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1849,6 +1849,7 @@ sub __mountpoint_mount {
my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
+ PVE::Storage::activate_volumes($storage_cfg, [$volid], $snapname);
my $path = PVE::Storage::map_volume($storage_cfg, $volid, $snapname);
$path = PVE::Storage::path($storage_cfg, $volid, $snapname) if !defined($path);
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] [PATCH v2 container 2/3] pct: fsck: also unmap when fsck command failed
2024-04-12 11:08 [pve-devel] [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 1/3] mountpoint mount: activate PVE-managed volumes during preparation Fiona Ebner
@ 2024-04-12 11:08 ` Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 3/3] pct: fsck: add missing call to activate volume Fiona Ebner
2024-04-12 12:09 ` [pve-devel] applied-series: [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fabian Grünbichler
3 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2024-04-12 11:08 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
New in v2.
src/PVE/CLI/pct.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 513bcba..13aa4c1 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -299,9 +299,13 @@ __PACKAGE__->register_method ({
}
push(@$command, $path);
- PVE::Tools::run_command($command);
+ eval { PVE::Tools::run_command($command); };
+ my $err = $@;
- PVE::Storage::unmap_volume($storage_cfg, $volid) if $storage_id;
+ eval { PVE::Storage::unmap_volume($storage_cfg, $volid) if $storage_id; };
+ warn $@ if $@;
+
+ die $err if $err;
};
PVE::LXC::Config->lock_config($vmid, $do_fsck);
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] [PATCH v2 container 3/3] pct: fsck: add missing call to activate volume
2024-04-12 11:08 [pve-devel] [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 1/3] mountpoint mount: activate PVE-managed volumes during preparation Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 2/3] pct: fsck: also unmap when fsck command failed Fiona Ebner
@ 2024-04-12 11:08 ` Fiona Ebner
2024-04-12 12:09 ` [pve-devel] applied-series: [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fabian Grünbichler
3 siblings, 0 replies; 5+ messages in thread
From: Fiona Ebner @ 2024-04-12 11:08 UTC (permalink / raw)
To: pve-devel
Otherwise, running pct fsck for e.g. an LVM volume after shutting down
a container would fail.
The container is not running, so the volume should be deactivated
afterwards.
Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
New in v2.
src/PVE/CLI/pct.pm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 13aa4c1..c48321d 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -287,6 +287,7 @@ __PACKAGE__->register_method ({
die "unable to run fsck for '$volid' (format == $format)\n"
if $format ne 'raw';
+ PVE::Storage::activate_volumes($storage_cfg, [$volid]);
$path = PVE::Storage::map_volume($storage_cfg, $volid);
} else {
@@ -302,8 +303,12 @@ __PACKAGE__->register_method ({
eval { PVE::Tools::run_command($command); };
my $err = $@;
- eval { PVE::Storage::unmap_volume($storage_cfg, $volid) if $storage_id; };
- warn $@ if $@;
+ if ($storage_id) {
+ eval { PVE::Storage::unmap_volume($storage_cfg, $volid); };
+ warn $@ if $@;
+ eval { PVE::Storage::deactivate_volumes($storage_cfg, [$volid]); };
+ warn $@ if $@;
+ }
die $err if $err;
};
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] applied-series: [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck
2024-04-12 11:08 [pve-devel] [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fiona Ebner
` (2 preceding siblings ...)
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 3/3] pct: fsck: add missing call to activate volume Fiona Ebner
@ 2024-04-12 12:09 ` Fabian Grünbichler
3 siblings, 0 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2024-04-12 12:09 UTC (permalink / raw)
To: Proxmox VE development discussion
thanks!
On April 12, 2024 1:08 pm, Fiona Ebner wrote:
> Changes in v2:
> * specify snapname when activating volume for hotplug
> * add missing activation call for fsck too
>
> Otherwise those operations would be problematic with certain storages
> like LVM after shutting down a container (which deactivates the
> volumes).
>
> Fiona Ebner (3):
> mountpoint mount: activate PVE-managed volumes during preparation
> pct: fsck: also unmap when fsck command failed
> pct: fsck: add missing call to activate volume
>
> src/PVE/CLI/pct.pm | 13 +++++++++++--
> src/PVE/LXC.pm | 1 +
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> --
> 2.39.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-12 12:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 11:08 [pve-devel] [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 1/3] mountpoint mount: activate PVE-managed volumes during preparation Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 2/3] pct: fsck: also unmap when fsck command failed Fiona Ebner
2024-04-12 11:08 ` [pve-devel] [PATCH v2 container 3/3] pct: fsck: add missing call to activate volume Fiona Ebner
2024-04-12 12:09 ` [pve-devel] applied-series: [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fabian Grünbichler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox