installer: Rework how we alter install and final XML

The Guest object passed in by the user is no longer altered in place,
instead we act on copies of the original XML. We need to rework how
unattended/cloudinit device altering works a bit to handle this.

There's some XML churn because working on parsexml gives different
output ordering, but this is expected.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2022-03-01 11:47:09 -05:00
parent 08d3068340
commit 51663a2c8c
44 changed files with 241 additions and 248 deletions

View File

@ -15,40 +15,40 @@
</os>
<cpu mode="host-passthrough"/>
<clock offset="utc"/>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<controller type="usb" model="qemu-xhci" ports="15"/>
<controller type="pci" model="pcie-root"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<interface type="bridge">
<source bridge="testsuitebr0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<controller type="usb" model="qemu-xhci" ports="15"/>
<controller type="pci" model="pcie-root"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<interface type="bridge">
<source bridge="testsuitebr0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
</domain>
<domain type="kvm">
<name>fedora30</name>

View File

@ -10,23 +10,23 @@
<boot dev="network"/>
</os>
<clock offset="utc"/>
<devices>
<emulator>bhyve</emulator>
<interface type="bridge">
<source bridge="testsuitebr0"/>
<mac address="00:11:22:33:44:55"/>
<model type="e1000"/>
</interface>
<console type="nmdm">
<source master="/dev/nmdm00000000-1111-2222-3333-444444444444A" slave="/dev/nmdm00000000-1111-2222-3333-444444444444B"/>
</console>
<input type="tablet" bus="usb"/>
<graphics type="vnc" port="-1"/>
<video>
<model type="vga"/>
</video>
</devices>
<on_reboot>destroy</on_reboot>
<devices>
<emulator>bhyve</emulator>
<interface type="bridge">
<source bridge="testsuitebr0"/>
<mac address="00:11:22:33:44:55"/>
<model type="e1000"/>
</interface>
<console type="nmdm">
<source master="/dev/nmdm00000000-1111-2222-3333-444444444444A" slave="/dev/nmdm00000000-1111-2222-3333-444444444444B"/>
</console>
<input type="tablet" bus="usb"/>
<graphics type="vnc" port="-1"/>
<video>
<model type="vga"/>
</video>
</devices>
</domain>
<domain type="bhyve">
<name>foobhyve</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -77,6 +76,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>centos6.5</name>

View File

@ -13,7 +13,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -50,6 +49,7 @@
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>vm1</name>

View File

@ -12,7 +12,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -42,6 +41,7 @@
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>vm1</name>

View File

@ -16,7 +16,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -27,11 +26,6 @@
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
</disk>
<disk type="file" device="cdrom">
<source file="/VIRTINST-TESTSUITE/cloudinit.iso"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
@ -47,7 +41,13 @@
<model type="e1000"/>
</interface>
<console type="pty"/>
<disk type="file" device="cdrom">
<source file="/VIRTINST-TESTSUITE/cloudinit.iso"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>fedora28</name>
@ -78,10 +78,6 @@
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
</disk>
<disk type="file" device="cdrom">
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
@ -97,5 +93,9 @@
<model type="e1000"/>
</interface>
<console type="pty"/>
<disk type="file" device="cdrom">
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
</devices>
</domain>

View File

@ -16,7 +16,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -27,11 +26,6 @@
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
</disk>
<disk type="file" device="cdrom">
<source file="/VIRTINST-TESTSUITE/cloudinit.iso"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
@ -47,7 +41,13 @@
<model type="e1000"/>
</interface>
<console type="pty"/>
<disk type="file" device="cdrom">
<source file="/VIRTINST-TESTSUITE/cloudinit.iso"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>fedora28</name>
@ -78,10 +78,6 @@
<source file="/pool-dir/testvol1.img"/>
<target dev="hda" bus="ide"/>
</disk>
<disk type="file" device="cdrom">
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
@ -97,5 +93,9 @@
<model type="e1000"/>
</interface>
<console type="pty"/>
<disk type="file" device="cdrom">
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
</devices>
</domain>

View File

@ -19,7 +19,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -42,6 +41,7 @@
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>rhel6.0</name>

View File

@ -14,7 +14,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -37,6 +36,7 @@
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>vm1</name>

View File

@ -19,7 +19,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -42,6 +41,7 @@
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>fedora17</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -66,6 +65,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>centos7.0</name>

View File

@ -27,7 +27,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -67,6 +66,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>rhel7.0</name>

View File

@ -11,9 +11,9 @@
<vcpu>2</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<cmdline>console=ttyS0</cmdline>
<kernel>/VIRTINST-TESTSUITE/vmlinuz</kernel>
<initrd>/VIRTINST-TESTSUITE/initrd.img</initrd>
<cmdline>console=ttyS0</cmdline>
</os>
<features>
<acpi/>
@ -26,7 +26,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -71,6 +70,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora</name>

View File

@ -20,7 +20,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -60,6 +59,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>vm-i686</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -67,6 +66,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>rhel5.4</name>

View File

@ -26,7 +26,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -72,6 +71,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>rhel6.4</name>

View File

@ -26,7 +26,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -66,6 +65,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>rhel7.0</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -71,6 +70,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora21</name>

View File

@ -31,7 +31,6 @@
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -73,6 +72,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>win10</name>

View File

@ -31,7 +31,6 @@
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -70,6 +69,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>win2k3</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -81,6 +80,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>linux2020</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -76,6 +75,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora17</name>

View File

@ -20,7 +20,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -63,6 +62,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>vm1</name>

View File

@ -28,7 +28,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -124,6 +123,7 @@
</target>
</memory>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -63,6 +62,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>silverblue29</name>

View File

@ -22,29 +22,29 @@
</hyperv>
</features>
<clock offset="localtime"/>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
<model type="e1000"/>
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
<model type="e1000"/>
</interface>
<console type="pty"/>
</devices>
</domain>
<domain type="test">
<name>win7</name>

View File

@ -19,7 +19,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -42,6 +41,7 @@
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>rhel6.0</name>

View File

@ -24,7 +24,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -67,6 +66,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>debian10</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -69,6 +68,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora26</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -57,6 +56,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora17</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -63,6 +62,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora26</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -73,6 +72,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora27</name>

View File

@ -25,7 +25,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -63,6 +62,7 @@
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora26</name>

View File

@ -29,7 +29,6 @@
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -42,52 +41,53 @@
<target dev="sda" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" model="ich9-uhci3">
<master startport="4"/>
</controller>
<controller type="pci" model="pcie-root"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<interface type="bridge">
<source bridge="testsuitebr0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
</rng>
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source file="/VIRTINST-TESTSUITE/unattended.iso"/>
<target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" model="ich9-uhci3">
<master startport="4"/>
</controller>
<controller type="pci" model="pcie-root"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<controller type="pci" model="pcie-root-port"/>
<interface type="bridge">
<source bridge="testsuitebr0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>win7</name>
@ -132,10 +132,6 @@
<target dev="sda" bus="sata"/>
<readonly/>
</disk>
<disk type="file" device="cdrom">
<target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
@ -175,5 +171,9 @@
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
</rng>
<disk type="file" device="cdrom">
<target dev="sdb" bus="sata"/>
<readonly/>
</disk>
</devices>
</domain>

View File

@ -19,7 +19,6 @@
<vmport state="off"/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -59,6 +58,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>fedora26</name>

View File

@ -20,7 +20,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -83,6 +82,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>vm1</name>

View File

@ -13,7 +13,6 @@
<pae/>
</features>
<clock offset="utc"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -44,6 +43,7 @@
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>vm1</name>

View File

@ -12,29 +12,29 @@
<pae/>
</features>
<clock offset="utc"/>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
<model type="e1000"/>
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
<model type="e1000"/>
</interface>
<console type="pty"/>
</devices>
</domain>
<domain type="test">
<name>vm1</name>

View File

@ -11,9 +11,9 @@
<vcpu cpuset="1,3-5">2</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<smbios mode="emulate"/>
<boot dev="network"/>
<boot dev="hd"/>
<smbios mode="emulate"/>
</os>
<features>
<acpi/>
@ -32,7 +32,6 @@
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -97,6 +96,7 @@
</vsock>
</devices>
<seclabel type="dynamic" model="selinux"/>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>fedora</name>

View File

@ -22,7 +22,6 @@
</hyperv>
</features>
<clock offset="localtime"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -34,27 +33,28 @@
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
<model type="e1000"/>
</interface>
<console type="pty"/>
<disk type="file" device="cdrom">
<source file="/VIRTINST-TESTSUITE/unattended.iso"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
<model type="e1000"/>
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>win7</name>
@ -91,10 +91,6 @@
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<disk type="file" device="cdrom">
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<controller type="usb" model="ich9-ehci1"/>
<controller type="usb" model="ich9-uhci1">
<master startport="0"/>
@ -110,5 +106,9 @@
<model type="e1000"/>
</interface>
<console type="pty"/>
<disk type="file" device="cdrom">
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
</devices>
</domain>

View File

@ -26,7 +26,6 @@
<topology sockets="1" dies="1" cores="4" threads="1"/>
</cpu>
<clock offset="localtime"/>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -49,6 +48,7 @@
</interface>
<console type="pty"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="test">
<name>win2k3</name>

View File

@ -33,7 +33,6 @@
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
@ -99,6 +98,7 @@
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="kvm">
<name>win7</name>

View File

@ -14,7 +14,6 @@
<kernel>/VIRTINST-TESTSUITE/vmlinuz</kernel>
<initrd>/VIRTINST-TESTSUITE/initrd.img</initrd>
</os>
<on_reboot>destroy</on_reboot>
<devices>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
@ -30,6 +29,7 @@
<input type="mouse" bus="xen"/>
<graphics type="vnc" port="-1"/>
</devices>
<on_reboot>destroy</on_reboot>
</domain>
<domain type="xen">
<name>fedora17</name>

View File

@ -15,6 +15,7 @@ from .installertreemedia import InstallerTreeMedia
from .installerinject import perform_cdrom_injections
from ..domain import DomainOs
from ..devices import DeviceDisk
from ..guest import Guest
from ..osdict import OSDB
from ..logger import log
from .. import progress
@ -183,8 +184,8 @@ class Installer(object):
dev = self._make_cdrom_device(location)
dev.set_defaults(guest)
self._unattended_install_cdrom_device = dev
guest.add_device(self._unattended_install_cdrom_device)
self._unattended_install_cdrom_device = dev.target
guest.add_device(dev)
if self.conn.in_testsuite():
# Hack to set just the XML path differently for the test suite.
@ -192,12 +193,13 @@ class Installer(object):
dev.source.file = _make_testsuite_path(location)
def _remove_unattended_install_cdrom_device(self, guest):
dummy = guest
if not self._unattended_install_cdrom_device:
return
self._unattended_install_cdrom_device.set_source_path(None)
self._unattended_install_cdrom_device.sync_path_props()
disk = [d for d in guest.devices.disk if
d.target == self._unattended_install_cdrom_device][0]
disk.set_source_path(None)
disk.sync_path_props()
def _build_boot_order(self, guest, bootdev):
bootorder = [bootdev]
@ -562,37 +564,23 @@ class Installer(object):
# guest install handling #
##########################
def _prepare_get_initial_xml(self, guest):
# We do a shallow copy of the OS block here, so that we can
# set the install time properties but not permanently overwrite
# any config the user explicitly requested.
data = (guest.os.bootorder, guest.os.kernel, guest.os.initrd,
guest.os.kernel_args, guest.on_reboot, guest.currentMemory,
guest.memory)
return data
def _build_postboot_xml(self, final_xml, meter):
initial_guest = Guest(self.conn, parsexml=final_xml)
self._alter_bootconfig(initial_guest)
self._alter_install_resources(initial_guest, meter)
def _finish_get_initial_xml(self, guest, data):
(guest.os.bootorder, guest.os.kernel, guest.os.initrd,
guest.os.kernel_args, guest.on_reboot, guest.currentMemory,
guest.memory) = data
final_guest = Guest(self.conn, parsexml=final_xml)
self._remove_install_cdrom_media(final_guest)
self._remove_unattended_install_cdrom_device(final_guest)
def _get_initial_xml(self, guest, meter):
data = self._prepare_get_initial_xml(guest)
try:
self._alter_bootconfig(guest)
self._alter_install_resources(guest, meter)
ret = guest.get_xml()
return ret
finally:
self._remove_install_cdrom_media(guest)
self._remove_unattended_install_cdrom_device(guest)
self._finish_get_initial_xml(guest, data)
return initial_guest.get_xml(), final_guest.get_xml()
def _build_xml(self, guest, meter):
initial_xml = None
final_xml = guest.get_xml()
if self._requires_postboot_xml_changes():
initial_xml = self._get_initial_xml(guest, meter)
final_xml = self._pre_reinstall_xml or guest.get_xml()
initial_xml, final_xml = self._build_postboot_xml(final_xml, meter)
final_xml = self._pre_reinstall_xml or final_xml
log.debug("Generated initial_xml: %s",
(initial_xml and ("\n" + initial_xml) or "None required"))
@ -673,7 +661,7 @@ class Installer(object):
# Public install API #
######################
def start_install(self, guest, meter=None,
def start_install(self, user_guest, meter=None,
dry=False, return_xml=False,
doboot=True, transient=False):
"""
@ -683,14 +671,19 @@ class Installer(object):
:param return_xml: Don't create the guest, just return generated XML
"""
if not self._is_reinstall and not return_xml:
guest.validate_name(guest.conn, guest.name)
self.set_install_defaults(guest)
Guest.validate_name(self.conn, user_guest.name)
self.set_install_defaults(user_guest)
disks = user_guest.devices.disk[:]
# All installer XML alterations are made on this guest instance,
# so the user_guest instance is left intact
guest = Guest(self.conn, parsexml=user_guest.get_xml())
try:
self._prepare(guest, meter)
if not dry and not self._is_reinstall:
for dev in guest.devices.disk:
for dev in disks:
dev.build_storage(meter)
initial_xml, final_xml = self._build_xml(guest, meter)