From: Fiona Ebner <f.ebner@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server] fix #4085: properly activate cicustom storage(s)
Date: Tue, 30 Jan 2024 15:34:59 +0100 [thread overview]
Message-ID: <c984445b-d944-4472-bdff-4ee4a4e71c9a@proxmox.com> (raw)
In-Reply-To: <20240125123312.363853-1-f.gruenbichler@proxmox.com>
Am 25.01.24 um 13:33 schrieb Fabian Grünbichler:
> PVE::Storage::path() neither activates the storage of the passed-in volume, nor
> does it ensure that the returned value is actually a file or block device, so
> this actually fixes two issues. PVE::Storage::abs_filesystem_path() actually
> takes care of both, while still calling path() under the hood (since $volid
> here is always a proper volid, unless we change the cicustom schema at some
> point in the future).
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> Tested by forcefully de-activating a storage only used for cicustom volumes
> right before starting the VM in question
>
> PVE/QemuServer/Cloudinit.pm | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
> index 7449993a..9a500f8a 100644
> --- a/PVE/QemuServer/Cloudinit.pm
> +++ b/PVE/QemuServer/Cloudinit.pm
> @@ -550,8 +550,11 @@ sub get_custom_cloudinit_files {
> sub read_cloudinit_snippets_file {
> my ($storage_conf, $volid) = @_;
>
> - my ($full_path, undef, $type) = PVE::Storage::path($storage_conf, $volid);
> - die "$volid is not in the snippets directory\n" if $type ne 'snippets';
> + my ($vtype, undef, undef, undef, undef, undef, undef) = PVE::Storage::parse_volname($storage_conf, $volid);
Style nit: line too long. Could be just
my ($vtype) = ...
> +
> + die "$volid is not in the snippets directory\n" if $vtype ne 'snippets';
> +
> + my $full_path = PVE::Storage::abs_filesystem_path($storage_conf, $volid, 1);
> return PVE::Tools::file_get_contents($full_path, 1 * 1024 * 1024);
> }
>
next prev parent reply other threads:[~2024-01-30 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 12:33 Fabian Grünbichler
2024-01-30 14:34 ` Fiona Ebner [this message]
2024-01-31 11:29 ` [pve-devel] applied: " 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=c984445b-d944-4472-bdff-4ee4a4e71c9a@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=f.gruenbichler@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