Revert "guest: Don't hardcode vcpus = 1"

This reverts commit 66fe00ddeee2e5c8add6cd6079518d24da4aa79b.

Turns out it's not that simple. Indeed libvirt sets the default
when no <vcpus> XML is present, but if you do --vcpus cpuset=X
libvirt will error that there's no vcpu value set. So for back
compat and generate safety let's keep setting it.
This commit is contained in:
Cole Robinson 2019-06-13 14:39:39 -04:00
parent 3cc42c2f24
commit 7ef20e26b0
36 changed files with 51 additions and 0 deletions

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="hd"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="aarch64" machine="virt">hvm</type>
<loader>CODE.fd</loader>
@ -46,6 +47,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="aarch64" machine="virt">hvm</type>
<loader>CODE.fd</loader>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="aarch64" machine="virt">hvm</type>
<kernel>/f19-arm.kernel</kernel>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="aarch64" machine="virt">hvm</type>
<kernel>/f19-arm.kernel</kernel>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="armv7l" machine="vexpress-a9">hvm</type>
<kernel>/f19-arm.kernel</kernel>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<loader secure="yes">/path/to/loader</loader>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<loader readonly="yes" type="pflash" secure="yes">/usr/share/ovmf/OVMF_CODE.secboot.fd</loader>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="cdrom"/>
@ -55,6 +56,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="hd"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="cdrom"/>
@ -47,6 +48,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="cdrom"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="network"/>
@ -49,6 +50,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="network"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc-i440fx-rhel7.0.0">hvm</type>
<boot dev="network"/>
@ -51,6 +52,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc-i440fx-rhel7.0.0">hvm</type>
<boot dev="network"/>

View File

@ -8,6 +8,7 @@
</metadata>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">exe</type>
<init>/bin/sh</init>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">exe</type>
<init>/bin/sh</init>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">exe</type>
<init>/sbin/init</init>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="network"/>
@ -80,6 +81,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="network"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<loader readonly="yes" type="pflash">/usr/share/edk2/ovmf-ia32/OVMF_CODE.fd</loader>
@ -60,6 +61,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<loader readonly="yes" type="pflash">/usr/share/edk2/ovmf-ia32/OVMF_CODE.fd</loader>

View File

@ -8,6 +8,7 @@
</metadata>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="network"/>
@ -73,6 +74,7 @@
</metadata>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="hd"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<kernel>/TESTSUITE_KERNEL_PATH</kernel>
@ -65,6 +66,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="cdrom"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">exe</type>
<init>/usr/bin/httpd</init>

View File

@ -2,6 +2,7 @@
<name>vm1</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<maxMemory slots="2">2097152</maxMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="network"/>
@ -66,6 +67,7 @@
<name>vm1</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<maxMemory slots="2">2097152</maxMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="network"/>

View File

@ -4,6 +4,7 @@
<maxMemory slots="1">409600</maxMemory>
<memory>307200</memory>
<currentMemory>102400</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="network"/>
@ -42,6 +43,7 @@
<maxMemory slots="1">409600</maxMemory>
<memory>307200</memory>
<currentMemory>102400</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="network"/>

View File

@ -8,6 +8,7 @@
</metadata>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="hd"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<boot dev="cdrom"/>
@ -70,6 +71,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<boot dev="hd"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="network"/>
@ -40,6 +41,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="network"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">exe</type>
<init>/sbin/init</init>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<loader readonly="yes" type="pflash">/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<loader readonly="yes" type="pflash">/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="xenpv">xen</type>
<boot dev="hd"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="xenfv">hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="cdrom"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>204800</memory>
<currentMemory>204800</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="hd"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="hd"/>

View File

@ -3,6 +3,7 @@
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="hd"/>

View File

@ -1,5 +1,6 @@
<domain type="test">
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
</os>

View File

@ -1,5 +1,6 @@
<domain type="test">
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<vcpu>1</vcpu>
<os>
<type arch="i686">hvm</type>
</os>

View File

@ -708,6 +708,9 @@ class Guest(XMLBuilder):
self.uuid = Guest.generate_uuid(self.conn)
self.sync_vcpus_topology()
if not self.vcpus:
self.vcpus = 1
self._set_default_machine()
self._set_default_uefi()