Skip to content

Commit

Permalink
wip: properly remove video by attr
Browse files Browse the repository at this point in the history
issue #2036
  • Loading branch information
frankiejol committed Mar 21, 2024
1 parent b388478 commit 08c5e42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/Ravada/Domain/KVM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2485,12 +2485,12 @@ sub _remove_all_video($devices, $attribute=undef, $value=undef) {
confess "Error: attribute '$attribute' value search must be defined"
if defined $attribute && !defined $value;

warn "Removing all video ".($attribute or 'any').'='.($value = '*');
for my $video ($devices->findnodes("video")) {
next if defined $attribute && $video->getAttribute($attribute)
&& $video->getAttribute($attribute) ne $value;
my ($model) = $video->findnodes('model');
next if defined $attribute
&& (!$model->getAttribute($attribute)
|| $model->getAttribute($attribute) ne $value);

warn "remove ".$video->toString();
$devices->removeChild($video);
}
}
Expand Down
3 changes: 1 addition & 2 deletions t/request/30_hardware.t
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ sub test_add_hardware_request($vm, $domain, $hardware, $data={}) {
}
_remove_usbs($domain,$hardware);
my $req;
diag("Adding $hardware ".($numero+1)."\n".Dumper($data));
eval {
$req = Ravada::Request->add_hardware(uid => $USER->id
, id_domain => $domain->id
Expand All @@ -270,7 +269,7 @@ sub test_add_hardware_request($vm, $domain, $hardware, $data={}) {
$USER->unread_messages();
ok($req, 'Request');
sleep 1 if !$TEST_TIMESTAMP;
wait_request(debug => 1);
wait_request(debug => 0);
is($req->status(),'done');
is($req->error(),'') or exit;
my $n = 1;
Expand Down

0 comments on commit 08c5e42

Please sign in to comment.