Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
6f6cc807
Commit
6f6cc807
authored
Sep 10, 2021
by
Francesc Guasch
Browse files
fix(backend): refresh volume list after remove
issue #1582
parent
a451b076
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/Ravada/Domain.pm
View file @
6f6cc807
...
...
@@ -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
';
...
...
t/vm/35_remove2.t
View file @
6f6cc807
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment