incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edison Su <Edison...@citrix.com>
Subject RE: Detection of available Qemu emulators
Date Tue, 07 Aug 2012 18:26:19 GMT


> -----Original Message-----
> From: Wido den Hollander [mailto:wido@widodh.nl]
> Sent: Tuesday, August 07, 2012 7:35 AM
> To: cloudstack-dev@incubator.apache.org
> Subject: Detection of available Qemu emulators
> 
> 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?


Yah, don't need this hardcoded path anymore for Apache release.

> 
> 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?

Change LibvirtCapXMLParser, returns the correct hypervisor path, according to arch(x86_64)
and domain type is 'kvm'


> 
> Wido

Mime
View raw message