public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Matthias Heiserer <m.heiserer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server v2] fix 3886: QEMU restore: verify storage allows images before writing
Date: Wed, 23 Feb 2022 12:15:58 +0100	[thread overview]
Message-ID: <20220223111558.369945-1-m.heiserer@proxmox.com> (raw)

When restoring a backup and the storage the disks would be created on
doesn't allow 'images', the process errors without cleanup.
This is the same behaviour we currently have when the storage is
disabled.

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
 PVE/QemuServer.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index a99f1a5..aaada7a 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6243,6 +6243,9 @@ my $parse_backup_hints = sub {
 	    } elsif (!$storeid) {
 		$storeid = 'local';
 	    }
+	    my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
+	    die "Content type 'images' is not available on storage '$storeid'\n"
+		if !$scfg->{content}->{images};
 	    $format = 'raw' if !$format;
 	    $devinfo->{$devname}->{devname} = $devname;
 	    $devinfo->{$devname}->{virtdev} = $virtdev;
@@ -6264,6 +6267,8 @@ my $parse_backup_hints = sub {
 		$storeid = $options->{storage} if defined ($options->{storage});
 		my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
 		my $format = qemu_img_format($scfg, $volname); # has 'raw' fallback
+		die "Content type 'images' is not available on storage '$storeid'\n"
+		    if !$scfg->{content}->{images};
 
 		$virtdev_hash->{$virtdev} = {
 		    format => $format,
-- 
2.30.2





             reply	other threads:[~2022-02-23 11:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 11:15 Matthias Heiserer [this message]
2022-02-24  7:52 ` Fabian Ebner

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=20220223111558.369945-1-m.heiserer@proxmox.com \
    --to=m.heiserer@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal