Commit 6f6cc807 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

fix(backend): refresh volume list after remove

issue #1582
parent a451b076
......@@ -719,6 +719,7 @@ sub _around_remove_volume {
." WHERE id_domain=? AND file=?"
);
$sth->execute($self->id, $file);
$self->list_volumes();
return $ok;
}
......@@ -4758,6 +4759,7 @@ sub _post_remove_hardware($self, $hardware, $index, $data=undef) {
if ($hardware eq 'disk' && ( defined $index || $data ) && $self->is_known() ) {
my $sth = $$CONNECTOR->dbh->prepare("DELETE FROM volumes WHERE id_domain=?");
$sth->execute($self->id);
$self->list_volumes_info();
}
$self->needs_restart(1) if $self->is_known && $self->_data('status') eq 'active';
......
......@@ -103,6 +103,23 @@ sub _remove_domain(@domain) {
}
}
sub test_remove_volume($vm) {
my $domain = create_domain($vm);
my @volumes = $domain->list_volumes();
my $sth = connector->dbh->prepare("SELECT count(*) FROM volumes WHERE id_domain=?");
$sth->execute($domain->id);
my ($n_volumes) = $sth->fetchrow();
is($n_volumes,scalar(@volumes));
$domain->remove_controller('disk',1);
$sth->execute($domain->id);
($n_volumes) = $sth->fetchrow();
is($n_volumes,1);
$domain->remove(user_admin);
}
##############################################################################
clean();
......@@ -126,6 +143,7 @@ for my $vm_name ( vm_names() ) {
diag("Testing remove on $vm_name");
test_remove_volume($vm);
test_remove_rename($vm);
test_remove_domain($vm);
test_remove_domain_volumes_already_gone($vm);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment