]> xenbits.xensource.com Git - libvirt.git/commitdiff
phyp: Verify that domain XML contains at least one disk element
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 30 Sep 2010 19:13:29 +0000 (21:13 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 1 Oct 2010 08:34:44 +0000 (10:34 +0200)
phypBuildLpar expects that at least one disk element is provided.

src/phyp/phyp_driver.c

index ab12392f27a6e5a9ec513af85d126b188a9c2a37..0a7d6f93b50165c43d8dfd12db0d1187cf9c2b6c 100644 (file)
@@ -3715,13 +3715,17 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
         goto err;
     }
 
-    if (def->ndisks > 0) {
-        if (!def->disks[0]->src) {
-            PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
-                    _("Field \"<src>\" under \"<disk>\" on the domain XML file is "
-                        "missing."));
-            goto err;
-        }
+    if (def->ndisks < 1) {
+        PHYP_ERROR(VIR_ERR_XML_ERROR, "%s",
+                   _("Domain XML must contain at least one \"<disk>\" element."));
+        goto err;
+    }
+
+    if (!def->disks[0]->src) {
+        PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
+                   _("Field \"<src>\" under \"<disk>\" on the domain XML file is "
+                     "missing."));
+        goto err;
     }
 
     virBufferAddLit(&buf, "mksyscfg");