From 8914a711eb85249156b199d48c38d013a4a9bcf5 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 19 Sep 2012 08:16:58 +0200 Subject: [PATCH] nexenta: use import_lu on rollback To avoid generation of new GUID. --- PVE/Storage/NexentaPlugin.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PVE/Storage/NexentaPlugin.pm b/PVE/Storage/NexentaPlugin.pm index a030e45..68658ed 100644 --- a/PVE/Storage/NexentaPlugin.pm +++ b/PVE/Storage/NexentaPlugin.pm @@ -70,6 +70,12 @@ sub nexenta_create_lu { nexenta_request($scfg, 'create_lu', 'scsidisk', "$scfg->{pool}/$zvol", {}); } +sub nexenta_import_lu { + my ($scfg, $zvol) = @_; + + nexenta_request($scfg, 'import_lu', 'scsidisk', "$scfg->{pool}/$zvol"); +} + sub nexenta_create_zvol { my ($scfg, $zvol, $size) = @_; @@ -196,7 +202,7 @@ sub alloc_image { die "unsupported format '$fmt'" if $fmt ne 'raw'; die "illegal name '$name' - sould be 'vm-$vmid-*'\n" - if $name && $name !~ m/^vm-$vmid-/; + if $name && $name !~ m/^vm-$vmid-/; my $nexentapool = $scfg->{'pool'}; @@ -205,7 +211,6 @@ sub alloc_image { die "unable de get zvol list" if !$volumes; for (my $i = 1; $i < 100; $i++) { - my $tn = "vm-$vmid-disk-$i"; if (!defined ($volumes->{$nexentapool}->{$tn})) { $name = $tn; @@ -248,7 +253,6 @@ sub list_images { my $volid = "$storeid:$volname"; - my $owner = $dat->{$volname}->{vmid}; if ($vollist) { my $found = grep { $_ eq $volid } @$vollist; @@ -325,7 +329,7 @@ sub volume_snapshot_rollback { nexenta_request($scfg, 'rollback', 'snapshot', "$scfg->{pool}/$volname\@$snap", ''); - nexenta_create_lu($scfg, $volname); + nexenta_import_lu($scfg, $volname); nexenta_add_lun_mapping_entry($scfg, $volname); }