]> xenbits.xensource.com Git - libvirt.git/commitdiff
domain_conf: fix internal flag verification
authorEric Blake <eblake@redhat.com>
Mon, 25 Aug 2014 18:58:49 +0000 (12:58 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 27 Aug 2014 04:34:03 +0000 (22:34 -0600)
While working on virDomainBlockCopy, I noticed we had a verify()
concerning internal XML flags that was incomplete after several
recent flag additions; move that up higher in the code to make it
harder to forget to modify on the next flag addition.  Adjust
some formatting while at it.

* src/conf/domain_conf.c (verify): Move closer to internal flag
definitions.  Cover missing flags ALLOW_ROM and ALLOW_BOOT.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/conf/domain_conf.c

index dd512cafbff5c7e073b961e83b1484def872ab32..3b295ab3f93929ac5d29a6eab21bf531853e7905 100644 (file)
@@ -89,19 +89,33 @@ struct _virDomainXMLOption {
 
 
 /* Private flags used internally by virDomainSaveStatus and
- * virDomainLoadStatus. */
+ * virDomainLoadStatus, in addition to the public virDomainXMLFlags. */
 typedef enum {
    /* dump internal domain status information */
-   VIR_DOMAIN_XML_INTERNAL_STATUS = (1<<16),
+   VIR_DOMAIN_XML_INTERNAL_STATUS          = 1 << 16,
    /* dump/parse <actual> element */
-   VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET = (1<<17),
+   VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET      = 1 << 17,
    /* dump/parse original states of host PCI device */
-   VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES = (1<<18),
-   VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM = (1<<19),
-   VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT = (1<<20),
-   VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST = (1<<21),
+   VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES = 1 << 18,
+   VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM       = 1 << 19,
+   VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT      = 1 << 20,
+   VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST    = 1 << 21,
 } virDomainXMLInternalFlags;
 
+#define DUMPXML_FLAGS                           \
+    (VIR_DOMAIN_XML_SECURE |                    \
+     VIR_DOMAIN_XML_INACTIVE |                  \
+     VIR_DOMAIN_XML_UPDATE_CPU |                \
+     VIR_DOMAIN_XML_MIGRATABLE)
+
+verify(((VIR_DOMAIN_XML_INTERNAL_STATUS |
+         VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
+         VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
+         VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM |
+         VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT |
+         VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST)
+        & DUMPXML_FLAGS) == 0);
+
 VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
               "custom-argv",
               "custom-monitor",
@@ -10359,7 +10373,7 @@ virDomainDeviceDefParse(const char *xmlStr,
     }
 
     /* callback to fill driver specific device aspects */
-    if (virDomainDeviceDefPostParse(dev, def,  caps, xmlopt) < 0)
+    if (virDomainDeviceDefPostParse(dev, def, caps, xmlopt) < 0)
         goto error;
 
  cleanup:
@@ -17726,18 +17740,6 @@ virDomainHugepagesFormat(virBufferPtr buf,
 }
 
 
-#define DUMPXML_FLAGS                           \
-    (VIR_DOMAIN_XML_SECURE |                    \
-     VIR_DOMAIN_XML_INACTIVE |                  \
-     VIR_DOMAIN_XML_UPDATE_CPU |                \
-     VIR_DOMAIN_XML_MIGRATABLE)
-
-verify(((VIR_DOMAIN_XML_INTERNAL_STATUS |
-         VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
-         VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
-         VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST)
-        & DUMPXML_FLAGS) == 0);
-
 static bool
 virDomainDefHasCapabilitiesFeatures(virDomainDefPtr def)
 {