[pve-devel] [PATCH] rbd, zfs, sheepdog: bugfix : fix alloc_image if name is specified
Alexandre Derumier
aderumier at odiso.com
Thu Nov 20 16:01:44 CET 2014
Currently vmstate snapshot with rbd have wrong name,
because rbd alloc_image don't care if $name is provided
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Storage/RBDPlugin.pm | 2 +-
PVE/Storage/SheepdogPlugin.pm | 2 +-
PVE/Storage/ZFSPlugin.pm | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 1026d81..2c1f615 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -382,7 +382,7 @@ sub alloc_image {
die "illegal name '$name' - sould be 'vm-$vmid-*'\n"
if $name && $name !~ m/^vm-$vmid-/;
- $name = &$find_free_diskname($storeid, $scfg, $vmid);
+ $name = &$find_free_diskname($storeid, $scfg, $vmid) if !$name;
my $cmd = &$rbd_cmd($scfg, $storeid, 'create', '--image-format' , 2, '--size', int(($size+1023)/1024), $name);
run_rbd_command($cmd, errmsg => "rbd create $name' error");
diff --git a/PVE/Storage/SheepdogPlugin.pm b/PVE/Storage/SheepdogPlugin.pm
index 8e1ca0c..3e2c126 100644
--- a/PVE/Storage/SheepdogPlugin.pm
+++ b/PVE/Storage/SheepdogPlugin.pm
@@ -242,7 +242,7 @@ sub alloc_image {
die "illegal name '$name' - sould be 'vm-$vmid-*'\n"
if $name && $name !~ m/^vm-$vmid-/;
- $name = &$find_free_diskname($storeid, $scfg, $vmid);
+ $name = &$find_free_diskname($storeid, $scfg, $vmid) if !$name;
my $cmd = &$collie_cmd($scfg, 'vdi', 'create', $name , "${size}k");
diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index b47f814..44a8ccb 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -478,7 +478,7 @@ sub alloc_image {
die "illegal name '$name' - sould be 'vm-$vmid-*'\n"
if $name && $name !~ m/^vm-$vmid-/;
- $name = &$find_free_diskname($storeid, $scfg, $vmid);
+ $name = &$find_free_diskname($storeid, $scfg, $vmid) if !$name;
zfs_create_zvol($scfg, $name, $size);
my $guid = zfs_create_lu($scfg, $name);
--
1.7.10.4
More information about the pve-devel
mailing list