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
d21701f8
Commit
d21701f8
authored
Jul 20, 2021
by
Francesc Guasch
Browse files
fix: USB drives in KVM
parent
51a1999f
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Ravada/Domain.pm
View file @
d21701f8
...
...
@@ -355,7 +355,9 @@ sub _around_start($orig, $self, @arg) {
last
if
!
$error
;
warn
"
WARNING:
$error
"
.
$self
->
_vm
->
name
.
"
"
.
$self
->
_vm
->
enabled
if
$error
;
next
if
$error
&&
ref
(
$error
)
&&
$error
->
code
==
1
;
# pool has asynchronous jobs running.
;
# pool has asynchronous jobs running.
next
if
$error
&&
ref
(
$error
)
&&
$error
->
code
==
1
&&
$error
!~
/internal error.*unexpected address/
;
if
(
$error
&&
$self
->
id_base
&&
!
$self
->
is_local
&&
$self
->
_vm
->
enabled
)
{
$self
->
_request_set_base
();
...
...
lib/Ravada/Domain/KVM.pm
View file @
d21701f8
...
...
@@ -2522,7 +2522,6 @@ sub _change_hardware_disk_bus($self, $index, $bus) {
return
if
$target
->
getAttribute
('
bus
')
eq
$bus
;
$target
->
setAttribute
(
bus
=>
$bus
);
$self
->
_change_xml_address
(
$doc
,
$address
,
$bus
);
}
confess
"
Error: disk
$index
not found in
"
.
$self
->
name
if
!
$changed
;
...
...
@@ -2624,6 +2623,25 @@ sub _change_hardware_network($self, $index, $data) {
sub
reload_config
($self, $doc) {
my
$in
=
$doc
->
toString
();
my
(
$out
,
$err
);
run3
(["
virt-xml-validate
","
-
"],
\
$in
,
\
$out
,
\
$err
);
if
(
$?
){
warn
$out
if
$out
;
my
$file_out
=
"
/var/tmp/
"
.
$self
->
name
()
.
"
.xml
";
open
my
$out1
,"
>
",
$file_out
or
die
$!
;
print
$out1
$self
->
xml_description
();
close
$out1
;
open
my
$out2
,"
>
","
/var/tmp/
"
.
$self
->
name
()
.
"
.new.xml
"
or
die
$!
;
my
$doc_string
=
$doc
->
toString
();
$doc_string
=~
s/^<.xml.*//
;
$doc_string
=~
s/"/'/g
;
print
$out2
$doc_string
;
close
$out2
;
confess
"
\$
?=$?
$err
\n
check
$file_out
"
if
$?
;
}
my
$new_domain
=
$self
->
_vm
->
vm
->
define_domain
(
$doc
->
toString
);
$self
->
domain
(
$new_domain
);
}
...
...
@@ -2660,12 +2678,21 @@ sub _change_xml_address_usb($self, $address) {
for
(
keys
%attribute
)
{
$address
->
setAttribute
(
$_
=>
$attribute
{
$_
});
}
for
(
qw(controller unit target domain slot function)
)
{
$address
->
removeAttribute
(
$_
);
}
=pod
$address->setAttribute(unit => $self->_new_address_xml(
match => 'usb'
,attribute => 'port'
)
);
=cut
}
sub
_change_xml_address_ide
($self, $doc, $address, $max_bus=2, $max_unit=9) {
...
...
t/kvm/65_dom_settings_req.t
View file @
d21701f8
...
...
@@ -76,7 +76,7 @@ sub test_drivers_id {
);
rvd_back
->
_process_requests_dont_fork
();
is
(
$req
->
status
,'
done
')
or
next
;
is
(
$req
->
error
,'')
or
n
ext
;
is
(
$req
->
error
,'')
or
ex
i
t
;
ok
(
!
$@
,"
Expecting no error, got :
"
.
(
$@
or
''));
my
$value
=
$domain
->
get_driver
(
$type
);
...
...
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