nexenta : nexenta_list_zvol : parse base volumes

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier
2013-02-05 12:56:00 +01:00
committed by Dietmar Maurer
parent e7b2953b2f
commit 1a259abc18
2 changed files with 8 additions and 5 deletions

View File

@ -523,7 +523,6 @@ sub vdisk_free {
my ($vtype, $name, $vmid, undef, undef, $isBase) = my ($vtype, $name, $vmid, undef, undef, $isBase) =
$plugin->parse_volname($volname); $plugin->parse_volname($volname);
if ($isBase) { if ($isBase) {
my $vollist = $plugin->list_images($storeid, $scfg); my $vollist = $plugin->list_images($storeid, $scfg);
foreach my $info (@$vollist) { foreach my $info (@$vollist) {
@ -542,7 +541,6 @@ sub vdisk_free {
} }
} }
} }
my $cleanup_worker = $plugin->free_image($storeid, $scfg, $volname, $isBase); my $cleanup_worker = $plugin->free_image($storeid, $scfg, $volname, $isBase);
}); });

View File

@ -109,16 +109,21 @@ sub nexenta_list_zvol {
my $pool = $values[0]; my $pool = $values[0];
my $image = $values[1]; my $image = $values[1];
my $owner; my $owner;
if ($image =~ m/^(vm-(\d+)-\S+)$/) {
$owner = $2; if ($image =~ m/^((vm|base)-(\d+)-\S+)$/) {
$owner = $3;
} }
my $props = nexenta_get_zvol_props($scfg, $zvol); my $props = nexenta_get_zvol_props($scfg, $zvol);
my $parent = $props->{origin};
if($parent && $parent =~ m/^$scfg->{pool}\/(\S+)$/){
$parent = $1;
}
$list->{$pool}->{$image} = { $list->{$pool}->{$image} = {
name => $image, name => $image,
size => $props->{size_bytes}, size => $props->{size_bytes},
parent => $props->{origin}, parent => $parent,
format => 'raw', format => 'raw',
vmid => $owner vmid => $owner
}; };