From b15c44923c9af9d42d04a508de0d9cc8744dc73e Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 16 Sep 2015 16:55:37 -0400 Subject: [PATCH] capabilities: Handle missing cpu_map.xml It shouldn't be a fatal issue. Hit on freebsd where they install libvirt bits into /usr/local https://www.redhat.com/archives/virt-tools-list/2015-September/msg00056.html --- virtinst/capabilities.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py index d789b7a73..3428518d0 100644 --- a/virtinst/capabilities.py +++ b/virtinst/capabilities.py @@ -19,6 +19,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. +import logging +import os import re from .cpu import CPU as DomainCPU @@ -55,7 +57,12 @@ class _CPUMapFileValues(XMLBuilder): _cpu_filename = "/usr/share/libvirt/cpu_map.xml" def __init__(self, conn): - xml = file(self._cpu_filename).read() + if os.path.exists(self._cpu_filename): + xml = file(self._cpu_filename).read() + else: + xml = None + logging.debug("CPU map file not found: %s", self._cpu_filename) + XMLBuilder.__init__(self, conn, parsexml=xml) self._archmap = {}