[pve-devel] [PATCH 2/2] change var name to prevent side effects.
Wolfgang Link
w.link at proxmox.com
Mon Feb 16 10:14:50 CET 2015
Signed-off-by: Wolfgang Link <w.link at proxmox.com>
---
PVE/Storage/ZFSPoolPlugin.pm | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 5cbd1b2..b9b3bf0 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -179,16 +179,18 @@ sub alloc_image {
die "illegal name '$name' - sould be 'vm-$vmid-*'\n"
if $name && $name !~ m/^vm-$vmid-/;
- $name = $class->zfs_find_free_diskname($storeid, $scfg, $vmid) if !$name;
-
- $class->zfs_create_zvol($scfg, $name, $size);
+ my $volname = $name;
+
+ $volname = $class->zfs_find_free_diskname($storeid, $scfg, $vmid) if !$volname;
- my $devname = "/dev/zvol/$scfg->{pool}/$name";
+ $class->zfs_create_zvol($scfg, $volname, $size);
+
+ my $devname = "/dev/zvol/$scfg->{pool}/$volname";
run_command("udevadm trigger --subsystem-match block");
system("udevadm settle --timeout 10 --exit-if-exists=${devname}");
- return $name;
+ return $volname;
}
sub free_image {
--
1.7.10.4
More information about the pve-devel
mailing list