[libvirt] [PATCH] phyp: Verify that domain XML contains at least one disk element

phypBuildLpar expects that at least one disk element is provided. --- src/phyp/phyp_driver.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index ab12392..0a7d6f9 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 \"<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"); -- 1.7.0.4

On 09/30/2010 01:18 PM, Matthias Bolte wrote:
phypBuildLpar expects that at least one disk element is provided. --- src/phyp/phyp_driver.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index ab12392..0a7d6f9 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 \"<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; + }
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2010/9/30 Eric Blake <eblake@redhat.com>:
On 09/30/2010 01:18 PM, Matthias Bolte wrote:
phypBuildLpar expects that at least one disk element is provided. --- src/phyp/phyp_driver.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index ab12392..0a7d6f9 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 \"<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; + }
ACK.
Thanks, pushed. Matthias
participants (2)
-
Eric Blake
-
Matthias Bolte