Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ebe084c140192657f9094e135a84202c > files > 38

libvirt-0.8.2-29.el5.src.rpm

From f9d3dd2c2958049c4abfc86a75af3c6e4035de34 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Mon, 17 Oct 2011 10:52:40 -0600
Subject: [PATCH] Fix order of disks and controllers
To: libvir-list@redhat.com

https://bugzilla.redhat.com/show_bug.cgi?id=719435

Commit 2d6adabd53c8f1858191d521dc9b4948d1205955 replaced qsorting disk
and controller devices with inserting them at the right position. That
was to fix unnecessary reordering of devices. However, when parsing
domain XML devices are just taken in the order in which they appear in
the XML since. Use the correct insertion algorithm to honor device
target.
(cherry picked from commit c1a98d88255197a8446d08c0b1589861660e9064)

Conflicts:

	tests/qemuxml2argvdata/qemuxml2argv-boot-order.args - commit e182ba8 not backported, so skip the test
	tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml - commit e182ba8 not backported, so skip the test
	tests/xmconfigdata/test-escape-paths.cfg - commit 21108d3 not backported, so skip the test changes
	tests/xmconfigdata/test-escape-paths.xml - commit 21108d3 not backported, so skip the test changes

Signed-off-by: Daniel Veillard <veillard@redhat.com>
---
 src/conf/domain_conf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cfc2f6d..5cc7998 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4427,7 +4427,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         if (!disk)
             goto error;
 
-        def->disks[def->ndisks++] = disk;
+        virDomainDiskInsertPreAlloced(def, disk);
     }
     VIR_FREE(nodes);
 
@@ -4445,7 +4445,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         if (!controller)
             goto error;
 
-        def->controllers[def->ncontrollers++] = controller;
+        virDomainControllerInsertPreAlloced(def, controller);
     }
     VIR_FREE(nodes);
 
-- 
1.7.4.4