[pve-devel] [PATCH qemu-server 1/2] move checks to top
Dominik Csapak
d.csapak at proxmox.com
Tue Jun 13 16:11:19 CEST 2017
those checks do not depend on anything we do in the sub, so we can do
them at the beginning.
this fixes an issue, where we would try to parse_volume_id on
'none' or 'cdrom' which are not a valid volume id, but still correct
syntax for cdrom drives
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/QemuConfig.pm | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 3f59b4c..6f9bde9 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -71,6 +71,9 @@ sub get_replicatable_volumes {
my $test_volid = sub {
my ($volid, $attr) = @_;
+ return if $attr->{cdrom};
+ return if !$cleanup && !$attr->{replicate};
+
my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, $noerr);
return if !$storeid;
@@ -80,12 +83,8 @@ sub get_replicatable_volumes {
my ($path, $owner, $vtype) = PVE::Storage::path($storecfg, $volid);
return if !$owner || ($owner != $vmid);
- return if $attr->{cdrom};
-
die "unable to replicate volume '$volid', type '$vtype'\n" if $vtype ne 'images';
- return if !$cleanup && !$attr->{replicate};
-
if (!PVE::Storage::volume_has_feature($storecfg, 'replicate', $volid)) {
return if $cleanup || $noerr;
die "missing replicate feature on volume '$volid'\n";
--
2.11.0
More information about the pve-devel
mailing list