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

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

 



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@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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;
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]