Hi,

I recently upgraded to libvirt 0.10-rc1 and stumbled upon the problem that my Instances won't start, somehow the Agent is trying to use /usr/bin/qemu-system-s390x as the emulator.

I dove in the code to find out why this is happening:

LibvirtComputingResource does a libvirt.getCapabilities() which returns and XML which is thrown in a XML parser.

I ran "virsh capabilities" on the command line and it returns a big XML, with the last entry:

<capabilities>
  ..
  ..
  ..

  <guest>
    <os_type>hvm</os_type>
    <arch name='s390x'>
      <wordsize>64</wordsize>
      <emulator>/usr/bin/qemu-system-s390x</emulator>
      <machine>s390-virtio</machine>
      <machine canonical='s390-virtio'>s390</machine>
      <domain type='qemu'>
      </domain>
      <domain type='kvm'>
        <emulator>/usr/bin/qemu-system-s390x</emulator>
      </domain>
    </arch>
  </guest>

</capabilities>

All available emulators are thrown in a StringBuffer upon Agent boot and whenever deploying a Instance the last emulator is picked from this StringBuffer (LibvirtCapXMLParser):

    public String getEmulator() {
        return _emulator.toString();
    }


In LibvirtComputingResource this happends:

    private String getHypervisorPath(Connect conn) {
        File f = new File("/usr/bin/cloud-qemu-kvm");
        if (f.exists()) {
            return "/usr/bin/cloud-qemu-kvm";
        } else {
            f = new File("/usr/libexec/cloud-qemu-kvm");
            if (f.exists()) {
                return "/usr/libexec/cloud-qemu-kvm";
            }

            LibvirtCapXMLParser parser = new LibvirtCapXMLParser();
            try {
                parser.parseCapabilitiesXML(conn.getCapabilities());
            } catch (LibvirtException e) {

            }
            return parser.getEmulator();
        }
    }

Do we also still need these hardcoded hypervisor paths in there? Isn't that legacy from when CloudStack shipped it's own version of Qemu?

Anyway, the problem is, I'm getting a wrong emulator returned which causes my x86_64 instance to be booted with a s390 emulator.

One of the ideas I had was parsing the XML every time you try to start a Instance and match for an emulator with the correct "arch" and "wordsize"?

The getCapabilities() call from Libvirt is rather heavy and slow, so running that should be prevented though.

Any suggestions?

Wido

Reply via email to