From: Matthias Bolte Date: Thu, 30 Sep 2010 19:13:29 +0000 (+0200) Subject: phyp: Verify that domain XML contains at least one disk element X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=53a2f725adda6d69753a707d1f444ab682c78d7f;p=libvirt.git phyp: Verify that domain XML contains at least one disk element phypBuildLpar expects that at least one disk element is provided. --- diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index ab12392f27..0a7d6f93b5 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -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 \"\" under \"\" 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 \"\" element.")); + goto err; + } + + if (!def->disks[0]->src) { + PHYP_ERROR(VIR_ERR_XML_ERROR,"%s", + _("Field \"\" under \"\" on the domain XML file is " + "missing.")); + goto err; } virBufferAddLit(&buf, "mksyscfg");