Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
d87f51aa
Commit
d87f51aa
authored
Dec 01, 2016
by
Francesc Guasch
Browse files
[#71] first steps to check duplicated slots
parent
0f83af9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada/VM/KVM.pm
View file @
d87f51aa
...
...
@@ -440,8 +440,14 @@ sub _domain_create_from_base {
_xml_modify_video
(
$xml
);
$self
->
_xml_modify_usb
(
$xml
);
$self
->
_fix_slots
();
open
my
$out
,'
>
',"
/var/tmp/
$args
{name}.xml
"
or
die
$!
;
print
$out
$xml
->
toString
();
close
$out
;
my
$dom
=
$self
->
vm
->
define_domain
(
$xml
->
toString
());
$dom
->
create
;
$dom
->
create
()
;
my
$domain
=
Ravada::Domain::
KVM
->
new
(
domain
=>
$dom
,
storage
=>
$self
->
storage_pool
,
_vm
=>
$self
);
...
...
@@ -697,10 +703,29 @@ sub _xml_modify_network {
}
}
sub
_fix_slots
{
my
$self
=
shift
;
my
$doc
=
shift
;
my
%slot
;
for
my
$item
(
$doc
->
findnodes
('
/domain/devices/*
'))
{
for
my
$node
(
$item
->
childNodes
())
{
next
if
$node
->
nodeName
ne
'
address
';
my
$slot
=
$node
->
getAttribute
('
slot
');
my
$function
=
$node
->
getAttribute
('
slot
');
if
(
$slot
{
$slot
}
->
{
$function
})
{
die
"
Conflict of slot
";
}
}
}
return
%slot
;
}
sub
_xml_modify_usb
{
my
$self
=
shift
;
my
$doc
=
shift
;
for
my
$ctrl
(
$doc
->
findnodes
('
/domain/devices/controller
'))
{
next
if
$ctrl
->
getAttribute
('
type
')
ne
'
usb
';
$ctrl
->
setAttribute
(
model
=>
'
ich9-ehci1
');
...
...
@@ -735,6 +760,7 @@ sub _xml_add_usb_redirect {
sub
_xml_add_usb_uhci1
{
my
$self
=
shift
;
my
$devices
=
shift
;
# USB uhci1
my
$controller
=
$devices
->
addNewChild
(
undef
,"
controller
");
$controller
->
setAttribute
(
type
=>
'
usb
');
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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