]> xenbits.xensource.com Git - xen.git/commitdiff
xend: Only add cpuid and cpuid_check to sexpr once
authorOlaf Hering <olaf@aepfle.de>
Thu, 14 Feb 2013 17:18:56 +0000 (17:18 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 22 Feb 2013 16:35:28 +0000 (16:35 +0000)
tools/xend: Only add cpuid and cpuid_check to sexpr once

When converting a XendConfig object to sexpr, cpuid and cpuid_check
were being emitted twice in the resulting sexpr.  The first conversion
writes incorrect sexpr, causing parsing of the sexpr to fail when xend
is restarted and domain sexpr files in /var/lib/xend/domains/<dom-uuid>
are read and parsed.

This patch skips the first conversion, and uses only the custom
cpuid{_check} conversion methods called later.  It is not pretty, but
is the least invasive fix in this complex code.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
tools/python/xen/xend/XendConfig.py

index 497a5f4b113e11fc18baef7114a2cb519da0b31e..4a226a7155084b5496d9c80949d4fe7f818f96ae 100644 (file)
@@ -1124,6 +1124,10 @@ class XendConfig(dict):
         else:
             for name, typ in XENAPI_CFG_TYPES.items():
                 if name in self and self[name] not in (None, []):
+                    # Skip cpuid and cpuid_check.  Custom conversion
+                    # methods for these are called below.
+                    if name in ("cpuid", "cpuid_check"):
+                        continue
                     if typ == dict:
                         s = self[name].items()
                     elif typ == list: