[pve-devel] [PATCH 40/48] nexenta: add volume_rename
Alexandre Derumier
aderumier at odiso.com
Tue Jan 29 17:14:22 CET 2013
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Storage/NexentaPlugin.pm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/PVE/Storage/NexentaPlugin.pm b/PVE/Storage/NexentaPlugin.pm
index 77a6173..8dc8917 100644
--- a/PVE/Storage/NexentaPlugin.pm
+++ b/PVE/Storage/NexentaPlugin.pm
@@ -423,4 +423,21 @@ sub volume_clone {
return "$volname/$volnamedst";
}
+sub volume_rename {
+ my ($class, $scfg, $storeid, $volname, $vmiddest, $type) = @_;
+
+ my $targetvolname = $class->find_free_volname($storeid, $scfg, $vmiddest, undef, $type);
+
+ #we can't rename a nexenta volume, so clone it to a new volname
+ my $snapname = 'base';
+ nexenta_request($scfg, 'create_snapshot', 'zvol', "$scfg->{pool}/$volname", $snapname, '');
+
+ nexenta_request($scfg, 'clone', 'zvol', "$scfg->{pool}/$volname\@$snapname", "$scfg->{pool}/$targetvolname");
+ nexenta_create_lu($scfg, $targetvolname);
+ nexenta_add_lun_mapping_entry($scfg, $targetvolname);
+
+ return $targetvolname;
+
+}
+
1;
--
1.7.10.4
More information about the pve-devel
mailing list