From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Wolfgang Bumiller <w.bumiller@proxmox.com>
Subject: [pve-devel] applied: [PATCH v2 storage] btrfs: check for btrfs in on_add_hook and activate
Date: Thu, 24 Jun 2021 11:21:47 +0200 [thread overview]
Message-ID: <45bc5b07-dfec-d715-e1cd-d4602ebe00df@proxmox.com> (raw)
In-Reply-To: <20210624084555.77018-1-w.bumiller@proxmox.com>
On 24.06.21 10:45, Wolfgang Bumiller wrote:
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
> Changes to v1:
> * Fabian's feedback:
> * removed on_add_hook since activate_storage is called anyway
> * moved btrfs check to after the DirPlugin checks
>
> PVE/Storage/BTRFSPlugin.pm | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
>
applied, thanks! I made a follow-up on top to avoid leaving over sub-directories
form the DirPlugin::activate_storage call in the case that assert_btrfs fails.
----8<----
diff --git a/PVE/Storage/BTRFSPlugin.pm b/PVE/Storage/BTRFSPlugin.pm
index dc5894a..5360dca 100644
--- a/PVE/Storage/BTRFSPlugin.pm
+++ b/PVE/Storage/BTRFSPlugin.pm
@@ -112,8 +112,21 @@ my sub assert_btrfs($) {
sub activate_storage {
my ($class, $storeid, $scfg, $cache) = @_;
- PVE::Storage::DirPlugin::activate_storage($class, $storeid, $scfg, $cache);
- assert_btrfs($scfg->{path});
+
+ my $path = $scfg->{path};
+ if (!defined($scfg->{mkdir}) || $scfg->{mkdir}) {
+ mkpath $path;
+ }
+
+ my $mp = PVE::Storage::DirPlugin::parse_is_mountpoint($scfg);
+ if (defined($mp) && !path_is_mounted($mp, $cache->{mountdata})) {
+ die "unable to activate storage '$storeid' - directory is expected to be a mount point but"
+ ." is not mounted: '$mp'\n";
+ }
+
+ assert_btrfs($path); # only assert this stuff now, ensures $path is there and better UX
+
+ $class->SUPER::activate_storage($storeid, $scfg, $cache);
}
sub status {
prev parent reply other threads:[~2021-06-24 9:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 8:45 [pve-devel] " Wolfgang Bumiller
2021-06-24 9:21 ` Thomas Lamprecht [this message]
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=45bc5b07-dfec-d715-e1cd-d4602ebe00df@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=w.bumiller@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