rbd: purge snapshots before delete volume

we can't delete a rbd volume if snapshots exist

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier
2012-10-31 11:24:53 +01:00
committed by Dietmar Maurer
parent 45c2ee3526
commit c30470a35e

View File

@ -214,7 +214,10 @@ sub alloc_image {
sub free_image {
my ($class, $storeid, $scfg, $volname) = @_;
my $cmd = &$rbd_cmd($scfg, $storeid, 'rm', $volname);
my $cmd = &$rbd_cmd($scfg, $storeid, 'snap', 'purge', $volname);
run_command($cmd, errmsg => "rbd snap purge $volname' error", outfunc => sub {}, errfunc => sub {});
$cmd = &$rbd_cmd($scfg, $storeid, 'rm', $volname);
run_command($cmd, errmsg => "rbd rm $volname' error", outfunc => sub {}, errfunc => sub {});
return undef;