installer: Add smbios serial ds=nocloud for --cloud-init
This is a hint to cloud-init that we are passing in a nocloud data source. This should typically just be an optimization, but Ubuntu -kvm-disk cloud images since at least 20.04 need this to work with -M q35: https://bugs.launchpad.net/cloud-init/+bug/1940791 Fixes: https://github.com/virt-manager/virt-manager/issues/359 Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
51663a2c8c
commit
d77efa1586
|
@ -11,6 +11,7 @@
|
||||||
<vcpu>2</vcpu>
|
<vcpu>2</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch="i686">hvm</type>
|
<type arch="i686">hvm</type>
|
||||||
|
<smbios mode="sysinfo"/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<pae/>
|
<pae/>
|
||||||
|
@ -47,6 +48,11 @@
|
||||||
<readonly/>
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
</devices>
|
</devices>
|
||||||
|
<sysinfo type="smbios">
|
||||||
|
<system>
|
||||||
|
<entry name="serial">ds=nocloud</entry>
|
||||||
|
</system>
|
||||||
|
</sysinfo>
|
||||||
<on_reboot>destroy</on_reboot>
|
<on_reboot>destroy</on_reboot>
|
||||||
</domain>
|
</domain>
|
||||||
<domain type="test">
|
<domain type="test">
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<vcpu>2</vcpu>
|
<vcpu>2</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch="i686">hvm</type>
|
<type arch="i686">hvm</type>
|
||||||
|
<smbios mode="sysinfo"/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<pae/>
|
<pae/>
|
||||||
|
@ -47,6 +48,11 @@
|
||||||
<readonly/>
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
</devices>
|
</devices>
|
||||||
|
<sysinfo type="smbios">
|
||||||
|
<system>
|
||||||
|
<entry name="serial">ds=nocloud</entry>
|
||||||
|
</system>
|
||||||
|
</sysinfo>
|
||||||
<on_reboot>destroy</on_reboot>
|
<on_reboot>destroy</on_reboot>
|
||||||
</domain>
|
</domain>
|
||||||
<domain type="test">
|
<domain type="test">
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
<domain type="test">
|
||||||
|
<name>fedora28</name>
|
||||||
|
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||||
|
<metadata>
|
||||||
|
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||||
|
<libosinfo:os id="http://fedoraproject.org/fedora/28"/>
|
||||||
|
</libosinfo:libosinfo>
|
||||||
|
</metadata>
|
||||||
|
<memory>65536</memory>
|
||||||
|
<currentMemory>65536</currentMemory>
|
||||||
|
<vcpu>2</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch="i686">hvm</type>
|
||||||
|
<smbios mode="none"/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<pae/>
|
||||||
|
</features>
|
||||||
|
<clock offset="utc"/>
|
||||||
|
<pm>
|
||||||
|
<suspend-to-mem enabled="no"/>
|
||||||
|
<suspend-to-disk enabled="no"/>
|
||||||
|
</pm>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/test-hv</emulator>
|
||||||
|
<disk type="file" device="disk">
|
||||||
|
<source file="/pool-dir/testvol1.img"/>
|
||||||
|
<target dev="hda" bus="ide"/>
|
||||||
|
</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/cloudinit.iso"/>
|
||||||
|
<target dev="hdb" bus="ide"/>
|
||||||
|
<readonly/>
|
||||||
|
</disk>
|
||||||
|
</devices>
|
||||||
|
<on_reboot>destroy</on_reboot>
|
||||||
|
</domain>
|
||||||
|
<domain type="test">
|
||||||
|
<name>fedora28</name>
|
||||||
|
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||||
|
<metadata>
|
||||||
|
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||||
|
<libosinfo:os id="http://fedoraproject.org/fedora/28"/>
|
||||||
|
</libosinfo:libosinfo>
|
||||||
|
</metadata>
|
||||||
|
<memory>65536</memory>
|
||||||
|
<currentMemory>65536</currentMemory>
|
||||||
|
<vcpu>2</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch="i686">hvm</type>
|
||||||
|
<boot dev="hd"/>
|
||||||
|
<smbios mode="none"/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<pae/>
|
||||||
|
</features>
|
||||||
|
<clock offset="utc"/>
|
||||||
|
<pm>
|
||||||
|
<suspend-to-mem enabled="no"/>
|
||||||
|
<suspend-to-disk enabled="no"/>
|
||||||
|
</pm>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/test-hv</emulator>
|
||||||
|
<disk type="file" device="disk">
|
||||||
|
<source file="/pool-dir/testvol1.img"/>
|
||||||
|
<target dev="hda" bus="ide"/>
|
||||||
|
</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">
|
||||||
|
<target dev="hdb" bus="ide"/>
|
||||||
|
<readonly/>
|
||||||
|
</disk>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
|
@ -0,0 +1,113 @@
|
||||||
|
<domain type="test">
|
||||||
|
<name>fedora28</name>
|
||||||
|
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||||
|
<metadata>
|
||||||
|
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||||
|
<libosinfo:os id="http://fedoraproject.org/fedora/28"/>
|
||||||
|
</libosinfo:libosinfo>
|
||||||
|
</metadata>
|
||||||
|
<memory>65536</memory>
|
||||||
|
<currentMemory>65536</currentMemory>
|
||||||
|
<vcpu>2</vcpu>
|
||||||
|
<sysinfo type="smbios">
|
||||||
|
<system>
|
||||||
|
<entry name="serial">foobar</entry>
|
||||||
|
</system>
|
||||||
|
</sysinfo>
|
||||||
|
<os>
|
||||||
|
<type arch="i686">hvm</type>
|
||||||
|
<smbios mode="sysinfo"/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<pae/>
|
||||||
|
</features>
|
||||||
|
<clock offset="utc"/>
|
||||||
|
<pm>
|
||||||
|
<suspend-to-mem enabled="no"/>
|
||||||
|
<suspend-to-disk enabled="no"/>
|
||||||
|
</pm>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/test-hv</emulator>
|
||||||
|
<disk type="file" device="disk">
|
||||||
|
<source file="/pool-dir/testvol1.img"/>
|
||||||
|
<target dev="hda" bus="ide"/>
|
||||||
|
</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/cloudinit.iso"/>
|
||||||
|
<target dev="hdb" bus="ide"/>
|
||||||
|
<readonly/>
|
||||||
|
</disk>
|
||||||
|
</devices>
|
||||||
|
<on_reboot>destroy</on_reboot>
|
||||||
|
</domain>
|
||||||
|
<domain type="test">
|
||||||
|
<name>fedora28</name>
|
||||||
|
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||||
|
<metadata>
|
||||||
|
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||||
|
<libosinfo:os id="http://fedoraproject.org/fedora/28"/>
|
||||||
|
</libosinfo:libosinfo>
|
||||||
|
</metadata>
|
||||||
|
<memory>65536</memory>
|
||||||
|
<currentMemory>65536</currentMemory>
|
||||||
|
<vcpu>2</vcpu>
|
||||||
|
<sysinfo type="smbios">
|
||||||
|
<system>
|
||||||
|
<entry name="serial">foobar</entry>
|
||||||
|
</system>
|
||||||
|
</sysinfo>
|
||||||
|
<os>
|
||||||
|
<type arch="i686">hvm</type>
|
||||||
|
<boot dev="hd"/>
|
||||||
|
<smbios mode="sysinfo"/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<pae/>
|
||||||
|
</features>
|
||||||
|
<clock offset="utc"/>
|
||||||
|
<pm>
|
||||||
|
<suspend-to-mem enabled="no"/>
|
||||||
|
<suspend-to-disk enabled="no"/>
|
||||||
|
</pm>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/test-hv</emulator>
|
||||||
|
<disk type="file" device="disk">
|
||||||
|
<source file="/pool-dir/testvol1.img"/>
|
||||||
|
<target dev="hda" bus="ide"/>
|
||||||
|
</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">
|
||||||
|
<target dev="hdb" bus="ide"/>
|
||||||
|
<readonly/>
|
||||||
|
</disk>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
|
@ -1016,6 +1016,8 @@ c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-pass
|
||||||
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init ssh-key=%(XMLDIR)s/cloudinit/ssh-key.txt", "cloud-init-options") # --cloud-init ssh-key
|
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init ssh-key=%(XMLDIR)s/cloudinit/ssh-key.txt", "cloud-init-options") # --cloud-init ssh-key
|
||||||
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init user-data=%(XMLDIR)s/cloudinit/user-data.txt,meta-data=%(XMLDIR)s/cloudinit/meta-data.txt", "cloud-init-options") # --cloud-init user-data=,meta-data=
|
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init user-data=%(XMLDIR)s/cloudinit/user-data.txt,meta-data=%(XMLDIR)s/cloudinit/meta-data.txt", "cloud-init-options") # --cloud-init user-data=,meta-data=
|
||||||
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init user-data=%(XMLDIR)s/cloudinit/user-data.txt,meta-data=%(XMLDIR)s/cloudinit/meta-data.txt,network-config=%(XMLDIR)s/cloudinit/network-config.txt", "cloud-init-options") # --cloud-init user-data=,meta-data=,network-config=
|
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init user-data=%(XMLDIR)s/cloudinit/user-data.txt,meta-data=%(XMLDIR)s/cloudinit/meta-data.txt,network-config=%(XMLDIR)s/cloudinit/network-config.txt", "cloud-init-options") # --cloud-init user-data=,meta-data=,network-config=
|
||||||
|
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init --sysinfo system.serial=foobar", "cloud-init-smbios-skip") # skip if a serial is already specified
|
||||||
|
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init --boot smbios.mode=none", "cloud-init-smbios-none") # skip if a serial is already specified
|
||||||
c.add_valid("--panic help --disk=? --check=help", grep="path_in_use") # Make sure introspection doesn't blow up
|
c.add_valid("--panic help --disk=? --check=help", grep="path_in_use") # Make sure introspection doesn't blow up
|
||||||
c.add_valid("--connect test:///default --test-stub-command", use_default_args=False) # --test-stub-command
|
c.add_valid("--connect test:///default --test-stub-command", use_default_args=False) # --test-stub-command
|
||||||
c.add_valid("--nodisks --pxe --osinfo generic", grep="VM performance may suffer") # os variant warning
|
c.add_valid("--nodisks --pxe --osinfo generic", grep="VM performance may suffer") # os variant warning
|
||||||
|
|
|
@ -711,6 +711,27 @@ class Guest(XMLBuilder):
|
||||||
raise Exception("Don't know how to refresh machine type '%s'" %
|
raise Exception("Don't know how to refresh machine type '%s'" %
|
||||||
original_machine_type)
|
original_machine_type)
|
||||||
|
|
||||||
|
def set_smbios_serial_cloudinit(self):
|
||||||
|
if (not self.conn.is_qemu() and
|
||||||
|
not self.conn.is_test()):
|
||||||
|
return # pragma: no cover
|
||||||
|
if (not self.os.is_x86() and
|
||||||
|
not self.os.is_arm_machvirt()):
|
||||||
|
return # pragma: no cover
|
||||||
|
if self.os.smbios_mode not in [None, "sysinfo"]:
|
||||||
|
return
|
||||||
|
|
||||||
|
sysinfos = [s for s in self.sysinfo if s.type == "smbios"]
|
||||||
|
if not sysinfos:
|
||||||
|
sysinfos = [self.sysinfo.add_new()]
|
||||||
|
sysinfo = sysinfos[0]
|
||||||
|
|
||||||
|
if sysinfo.system_serial:
|
||||||
|
return
|
||||||
|
self.os.smbios_mode = "sysinfo"
|
||||||
|
sysinfo.type = "smbios"
|
||||||
|
sysinfo.system_serial = "ds=nocloud"
|
||||||
|
|
||||||
def sync_vcpus_topology(self, defCPUs):
|
def sync_vcpus_topology(self, defCPUs):
|
||||||
"""
|
"""
|
||||||
<cpu> topology count and <vcpus> always need to match. Handle
|
<cpu> topology count and <vcpus> always need to match. Handle
|
||||||
|
|
|
@ -568,6 +568,8 @@ class Installer(object):
|
||||||
initial_guest = Guest(self.conn, parsexml=final_xml)
|
initial_guest = Guest(self.conn, parsexml=final_xml)
|
||||||
self._alter_bootconfig(initial_guest)
|
self._alter_bootconfig(initial_guest)
|
||||||
self._alter_install_resources(initial_guest, meter)
|
self._alter_install_resources(initial_guest, meter)
|
||||||
|
if self.has_cloudinit():
|
||||||
|
initial_guest.set_smbios_serial_cloudinit()
|
||||||
|
|
||||||
final_guest = Guest(self.conn, parsexml=final_xml)
|
final_guest = Guest(self.conn, parsexml=final_xml)
|
||||||
self._remove_install_cdrom_media(final_guest)
|
self._remove_install_cdrom_media(final_guest)
|
||||||
|
|
Loading…
Reference in New Issue