all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 container 3/3] pct: fsck: add missing call to activate volume
Date: Fri, 12 Apr 2024 13:08:14 +0200	[thread overview]
Message-ID: <20240412110814.46684-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20240412110814.46684-1-f.ebner@proxmox.com>

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





  parent reply	other threads:[~2024-04-12 11:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-04-12 12:09 ` [pve-devel] applied-series: [PATCH-SERIES v2 container] add missing volume activation for hotplug and fsck Fabian Grünbichler

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=20240412110814.46684-4-f.ebner@proxmox.com \
    --to=f.ebner@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 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