Comment 15 for bug 1031063

Revision history for this message
shedoh (shedoh) wrote :

@ Serge

I write down the process I have tried to solve this issue...

First the nova-compute.log show an ERROR as follow...

2013-05-21 16:19:11.230 ERROR nova.compute.manager [req-0e30e53b-8d93-4a0b-b378-672a02d6eb417c0d5d8e458f4580972e14af22e8a6ca 8d6292b82686470bb5a46d3c1a565c03] [instance: 71c40047-8422-4623-aaf0-f06353dfcb75] Error: ['Traceback (most recent call last):\n', ' File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 834, in _run_instance\n set_access_ip=set_access_ip)\n', ' File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1093, in _spawn\n LOG.exception(_(\'Instance failed to spawn\'), instance=instance)\n', ' File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__\n self.gen.next()\n', ' File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1089, in _spawn\n block_device_info)\n', ' File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 1520, in spawn\n block_device_info)\n', ' File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 2435, in _create_domain_and_network\n domain = self._create_domain(xml, instance=instance)\n', ' File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 2395, in _create_domain\n domain = self._conn.defineXML(xml)\n', ' File "/usr/lib/python2.7/dist-packages/eventlet/tpool.py", line 187, in doit\n result = proxy_call(self._autowrap, f, *args, **kwargs)\n', ' File "/usr/lib/python2.7/dist-packages/eventlet/tpool.py", line 147, in proxy_call\n rv = execute(f,*args,**kwargs)\n', ' File "/usr/lib/python2.7/dist-packages/eventlet/tpool.py", line 76, in tworker\n rv = meth(*args,**kwargs)\n', ' File "/usr/lib/python2.7/dist-packages/libvirt.py", line 2760, in defineXML\n if ret is None:raise libvirtError(\'virDomainDefineXML() failed\', conn=self)\n', "libvirtError: internal error no supported architecture for os type 'hvm'\n"]

Then I check the "/usr/lib/python2.7/dist-packages/libvirt.py" at line 2760, it is a function in class virConnect

    def defineXML(self, xml):
        ret = libvirtmod.virDomainDefineXML(self._o, xml)
        if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
        __tmp = virDomain(self,_obj=ret)
        return __tmp

To output the xml I add some code as follow and restart nova-compute service

    def defineXML(self, xml):
        # save xml files to a temporary location
        import __builtin__ as bu
        f = bu.open("/tmp/libvirt.xml", "w")
        f.write(xml) # Write a string to a file
        f.close()

        ret = libvirtmod.virDomainDefineXML(self._o, xml)
        if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
        __tmp = virDomain(self,_obj=ret)
        return __tmp

When re-create a vm use OpenStack Dashboard, I got the /tmp/libvirt.xml as follow

 <domain type="kvm">
  <uuid>563fab12-f8b3-4689-b9b6-b3ba89c98246</uuid>
  <name>instance-00000007</name>
  <memory>524288</memory>
  <vcpu>1</vcpu>
  <sysinfo type="smbios">
    <system>
      <entry name="manufacturer">OpenStack Foundation</entry>
      <entry name="product">OpenStack Nova</entry>
      <entry name="version">2013.1</entry>
      <entry name="serial">c56740d8-bfbc-db37-fe43-75ba7c50cdb8</entry>
      <entry name="uuid">563fab12-f8b3-4689-b9b6-b3ba89c98246</entry>
    </system>
  </sysinfo>
  <os>
    <type>hvm</type>
    <boot dev="hd"/>
    <smbios mode="sysinfo"/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <clock offset="utc">
    <timer name="pit" tickpolicy="delay"/>
    <timer name="rtc" tickpolicy="catchup"/>
  </clock>
  <cpu mode="host-model" match="exact"/>
  <devices>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2" cache="none"/>
      <source file="/var/lib/nova/instances/563fab12-f8b3-4689-b9b6-b3ba89c98246/disk"/>
      <target bus="virtio" dev="vda"/>
    </disk>
    <interface type="bridge">
      <mac address="fa:16:3e:dd:b1:94"/>
      <model type="virtio"/>
      <source bridge="br-int"/>
      <target dev="tapcd5492b6-18"/>
      <virtualport type="openvswitch">
        <parameters interfaceid="cd5492b6-1835-464a-b705-d5fed0766237"/>
      </virtualport>
    </interface>
    <serial type="file">
      <source path="/var/lib/nova/instances/563fab12-f8b3-4689-b9b6-b3ba89c98246/console.log"/>
    </serial>
    <serial type="pty"/>
    <input type="tablet" bus="usb"/>
    <graphics type="vnc" autoport="yes" keymap="en-us" listen="0.0.0.0"/>
  </devices>
</domain>

One can find the first line (<domain type="kvm">) that it still specify to use KVM rather than Qemu, though I already specify "libvirt_type=qemu" in nova.conf. According to #3 @Jamie's post, I found two possible way to solve it.
1. change the first line to <domain type="qemu">
2. change the line 16 to <type arch='x86_64'>hvm</type>

For testing, I have added some code in /usr/lib/python2.7/dist-packages/libvirt.py to change the xml (ex. xml = xml.replace('type="kvm"', 'type="qemu"',1)). Both method works fine.

So I still do not sure is it the bug of libvirt of Nova?