[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Check disk target collision when parsing domain xml



The current domain xml parsing doesn't check if disks
are specified with duplicate targets ("hda" etc.). The
attached patch adds a check for this.

Thanks,
Cole

commit 27df1653474738a2ce83c89e7bdb2c4f7327f9b6
Author: Cole Robinson <crobinso dhcp-100-19-219 bos redhat com>
Date:   Thu Aug 21 14:58:04 2008 -0400

    Check for duplicate disk targets when parsing domain xml.

diff --git a/src/domain_conf.c b/src/domain_conf.c
index 6b23474..ed6cc8b 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -1955,6 +1955,12 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
         } else {
             virDomainDiskDefPtr ptr = def->disks;
             while (ptr) {
+                if (ptr->next && STREQ(disk->dst, ptr->next->dst)) {
+                    virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                                         _("duplicate disk target '%s'"),
+                                         disk->dst);
+                    goto error;
+                }
                 if (!ptr->next || virDomainDiskCompare(disk, ptr->next) < 0) {
                     disk->next = ptr->next;
                     ptr->next = disk;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]