← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1933097] Re: libivrt machine types are case sensitive but we do not validate them in nova

 

Reviewed:  https://review.opendev.org/c/openstack/nova/+/847126
Committed: https://opendev.org/openstack/nova/commit/7b9312ef8e3064932107daec8b823d7031a89ae6
Submitter: "Zuul (22348)"
Branch:    master

commit 7b9312ef8e3064932107daec8b823d7031a89ae6
Author: Amit Uniyal <auniyal@xxxxxxxxxx>
Date:   Tue Jun 21 20:23:47 2022 +0000

    Adds validation for hw machine type in host caps
    
    Added function '_check_machine_type' which accept host
    capabilities (caps) and machine type as param and look
    for machine type in host caps object, if machine type
    is not found raises exception InvalidMachineType
    
    Closes-Bug: #1933097
    Change-Id: I59d22c0342d6b0f3c0398ce62ec177dae39b5677


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1933097

Title:
  libivrt machine types are case sensitive but we do not validate them
  in nova

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  as seen in http://paste.openstack.org/show/806818/ if we use machine type "Q35" instead of "q35" we fail to boot the vm. This is because the machine type name in libvirt are case sensitvie.
  however due to the way libvirt validates the xml it retruns a "No PCI buses available" error instead of a "incorrect machine type error" or similar that would be more intunitve.

  021-06-20 02:37:39.795 7 ERROR nova.virt.libvirt.guest [req-04cb6169-bee4-407d-aef1-2e22abfccf97 329bf2535969456cb83fbc8e338ecb4c 5f3ea501afce4858b43186166d4d7afb - default default] Error defining a guest with XML: <domain type="kvm">
    <uuid>e2f47fae-7684-4f23-9f3e-39a6b133f929</uuid>
    <name>instance-00000006</name>
    <memory>4194304</memory>
    <vcpu>4</vcpu>
    <metadata>
      <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.1";>
        <nova:package version="23.0.2"/>
        <nova:name>test</nova:name>
        <nova:creationTime>2021-06-20 02:37:39</nova:creationTime>
        <nova:flavor name="test">
          <nova:memory>4096</nova:memory>
          <nova:disk>10</nova:disk>
          <nova:swap>0</nova:swap>
          <nova:ephemeral>0</nova:ephemeral>
          <nova:vcpus>4</nova:vcpus>
        </nova:flavor>
        <nova:owner>
          <nova:user uuid="329bf2535969456cb83fbc8e338ecb4c">sean</nova:user>
          <nova:project uuid="5f3ea501afce4858b43186166d4d7afb">sean</nova:project>
        </nova:owner>
        <nova:root type="image" uuid="33269e7a-5bec-48cb-aab6-a84f3bbb2155"/>
        <nova:ports>
          <nova:port uuid="48be4df9-d089-4a10-93ac-ea1113c88331">
            <nova:ip type="fixed" address="172.20.1.152" ipVersion="4"/>
          </nova:port>
        </nova:ports>
      </nova:instance>
    </metadata>
    <sysinfo type="smbios">
      <system>
        <entry name="manufacturer">OpenStack Foundation</entry>
        <entry name="product">OpenStack Nova</entry>
        <entry name="version">23.0.2</entry>
        <entry name="serial">e2f47fae-7684-4f23-9f3e-39a6b133f929</entry>
        <entry name="uuid">e2f47fae-7684-4f23-9f3e-39a6b133f929</entry>
        <entry name="family">Virtual Machine</entry>
      </system>
    </sysinfo>
    <os>
      <type machine="Q35">hvm</type>
      <boot dev="hd"/>
      <smbios mode="sysinfo"/>
    </os>
    <features>
      <acpi/>
      <apic/>
    </features>
    <cputune>
      <shares>4096</shares>
    </cputune>
    <clock offset="utc">
      <timer name="pit" tickpolicy="delay"/>
      <timer name="rtc" tickpolicy="catchup"/>
      <timer name="hpet" present="no"/>
    </clock>
    <cpu mode="host-model" match="exact">
      <topology sockets="4" cores="1" threads="1"/>
    </cpu>
    <devices>
      <disk type="network" device="disk">
        <driver type="raw" cache="writeback" discard="unmap"/>
        <source protocol="rbd" name="vms/e2f47fae-7684-4f23-9f3e-39a6b133f929_disk">
          <host name="192.168.1.10" port="6789"/>
        </source>
        <auth username="nova">
          <secret type="ceph" uuid="d580b7e4-db45-4f97-a140-098200428934"/>
        </auth>
        <target dev="sda" bus="scsi"/>
        <address type="drive" controller="0" unit="0"/>
      </disk>
      <controller type="scsi" index="0" model="virtio-scsi"/>
      <interface type="bridge">
        <mac address="fa:16:3e:79:b5:12"/>
        <model type="virtio"/>
        <source bridge="br-int"/>
        <mtu size="2018"/>
        <target dev="tap48be4df9-d0"/>
        <virtualport type="openvswitch">
          <parameters interfaceid="48be4df9-d089-4a10-93ac-ea1113c88331"/>
        </virtualport>
      </interface>
      <serial type="pty">
        <log file="/var/lib/nova/instances/e2f47fae-7684-4f23-9f3e-39a6b133f929/console.log" append="off"/>
      </serial>
      <graphics type="vnc" autoport="yes" listen="192.168.1.250"/>
      <video>
        <model type="virtio"/>
      </video>
      <input type="tablet" bus="usb"/>
      <rng model="virtio">
        <backend model="random">/dev/urandom</backend>
      </rng>
      <controller type="usb" index="0"/>
      <memballoon model="virtio">
        <stats period="10"/>
      </memballoon>
    </devices>
  </domain>
  : libvirt.libvirtError: XML error: No PCI buses available

  
  since the libvirt machine types are case sensitive we cannot assume we can just lowercase teh users input but we should still be able to normalise the machine types in the following way.

  
  on startup we call virsh capablites to retrive info from libvirt regarding the capablities of the host.from that api we can retrieve the set of supported machine types.
  we can then construct a dictionary of lower-case machine type name to correct case machine type names.

  when booting a vm we should lowercase the user input and lookup the
  correct case form this dictonary. this will allow nova to continue to
  treat the input as case insensitive but still  pass the correct value
  to libvirt.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1933097/+subscriptions



References