Comment 1 for bug 1322702

Revision history for this message
Marwan AKIKI (marwan-akiki) wrote :

I have bypassed it by adding 2 lines of code to driver.py

    def get_host_capabilities(self):
        """Returns an instance of config.LibvirtConfigCaps representing
           the capabilities of the host.
        """
        if not self._caps:
            xmlstr = self._conn.getCapabilities()
            self._caps = vconfig.LibvirtConfigCaps()
            self._caps.parse_str(xmlstr)
            if hasattr(libvirt, 'VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES'):
                try:
                    features = self._conn.baselineCPU(
                        [self._caps.host.cpu.to_xml()],
                        libvirt.VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES)

                    # Add Code to remove duplicate Features (Marwan AKIKI)
                    for f in self._caps.host.cpu.features:
                        features=features.replace(" <feature policy='require' name='" + f.name + "'/>\n", '')

                    # FIXME(wangpan): the return value of baselineCPU should be
                    # None or xml string, but libvirt has a bug
                    # of it from 1.1.2 which is fixed in 1.2.0,
                    # this -1 checking should be removed later.
                    if features and features != -1:
                        self._caps.host.cpu.parse_str(features)
                except libvirt.VIR_ERR_NO_SUPPORT:
                    # Note(yjiang5): ignore if libvirt has no support
                    pass
        return self._caps