From: Alexandre Derumier Date: Tue, 5 Feb 2013 11:56:02 +0000 (+0100) Subject: nexenta : create_base X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1c0097dd51bd5db1a9a5be756f6973b9c883d252;p=pve-storage.git nexenta : create_base Signed-off-by: Alexandre Derumier --- diff --git a/PVE/Storage/NexentaPlugin.pm b/PVE/Storage/NexentaPlugin.pm index a39faf4..93cfc8b 100644 --- a/PVE/Storage/NexentaPlugin.pm +++ b/PVE/Storage/NexentaPlugin.pm @@ -241,7 +241,32 @@ my $find_free_diskname = sub { sub create_base { my ($class, $storeid, $scfg, $volname) = @_; - die "not implemented"; + my $snap = '__base__'; + + my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) = + $class->parse_volname($volname); + + die "create_base not possible with base image\n" if $isBase; + +# die "volname '$volname' contains wrong information about parent $parent $basename\n" +# if $basename && (!$parent || $parent ne $basename."@".$snap); + + my $newname = $name; + $newname =~ s/^vm-/base-/; + + my $newvolname = $basename ? "$basename/$newname" : "$newname"; + + #we can't rename a nexenta volume, so clone it to a new volname + nexenta_request($scfg, 'create_snapshot', 'zvol', "$scfg->{pool}/$name", $snap, ''); + nexenta_request($scfg, 'clone', 'zvol', "$scfg->{pool}/$name\@$snap", "$scfg->{pool}/$newname"); + nexenta_create_lu($scfg, $newname); + nexenta_add_lun_mapping_entry($scfg, $newname); + + my $running = undef; #fixme : is create_base always offline ? + + $class->volume_snapshot($scfg, $storeid, $newname, $snap, $running); + + return $newvolname; } sub clone_image {