die "could not find lun_number for guid $guid" if !$guid;
- return $class->zfs_request($scfg, undef, 'list_view', $guid);
+ if ($class->zfs_request($scfg, undef, 'list_view', $guid) =~ /^(\d+)$/) {
+ return $1;
+ }
+
+ die "lun_number for guid $guid is not a number";
}
# Configuration
die "unsupported format '$fmt'" if $fmt ne 'raw';
- die "illegal name '$name' - sould be 'vm-$vmid-*'\n"
+ die "illegal name '$name' - should be 'vm-$vmid-*'\n"
if $name && $name !~ m/^vm-$vmid-/;
my $volname = $name;
- $volname = $class->zfs_find_free_diskname($storeid, $scfg, $vmid, $fmt) if !$volname;
+ $volname = $class->find_free_diskname($storeid, $scfg, $vmid, $fmt) if !$volname;
$class->zfs_create_zvol($scfg, $volname, $size);