]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix disk ordering and add target duplication checking when parsing domain xml.
authorCole Robinson <crobinso@redhat.com>
Wed, 3 Sep 2008 14:30:24 +0000 (14:30 +0000)
committerCole Robinson <crobinso@redhat.com>
Wed, 3 Sep 2008 14:30:24 +0000 (14:30 +0000)
ChangeLog
src/domain_conf.c
tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr
tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr

index 6570f8886ee1be7cefcf640205d231c70553f431..32cdeb956409b9713bb41573df9dee472e1b036d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,9 @@
-Wed Sep  3 14:51:03 CEST 2008 Daniel Veillard <veillard@redhat.com>
+Wed Sep  3 09:58:00 EST 2008 Cole Robinson <crobinso@redhat.com>
 
-       * src/qemu_driver.c: patch from Cole Robinson to avoid a segfault
-         on KVM CD eject
+       * src/domain_conf.c: fix disk device ordering when parsing domain
+         xml. check for disk target duplicates as well.
+       * tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr: fix for disk ordering
+       * tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr: fix for disk ordering
 
 Wed Sep  3 14:37:06 CEST 2008 Daniel Veillard <veillard@redhat.com>
 
index 6b2347400ba609a00d0c3a7adc614394c0e1b22d..3c61039350873d4a490fa32c81adc8eced887678 100644 (file)
@@ -1949,19 +1949,27 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
             goto error;
 
         /* Maintain list in sorted order according to target device name */
-        if (def->disks == NULL) {
-            disk->next = def->disks;
-            def->disks = disk;
-        } else {
-            virDomainDiskDefPtr ptr = def->disks;
-            while (ptr) {
-                if (!ptr->next || virDomainDiskCompare(disk, ptr->next) < 0) {
-                    disk->next = ptr->next;
-                    ptr->next = disk;
-                    break;
-                }
-                ptr = ptr->next;
+        virDomainDiskDefPtr ptr = def->disks;
+        virDomainDiskDefPtr *prev = &(def->disks);
+        while (ptr) {
+            if (STREQ(disk->dst, ptr->dst)) {
+                virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                                     _("duplicate disk target '%s'"),
+                                     disk->dst);
+                goto error;
+            }
+            if (virDomainDiskCompare(disk, ptr) < 0) {
+                disk->next = ptr;
+                *prev = disk;
+                break;
             }
+            prev = &(ptr->next);
+            ptr = ptr->next;
+        }
+
+        if (!ptr) {
+            disk->next = ptr;
+            *prev = disk;
         }
     }
     VIR_FREE(nodes);
index b02c7c183d55a5be5ad9213b2030e965d21b19ff..157ce04da4794531cc9866a3d04ad4511fc31b74 100644 (file)
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(acpi 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)(vncunused 0)(vncdisplay 17)(keymap 'ja')))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(acpi 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)(vncunused 0)(vncdisplay 17)(keymap 'ja')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
index 3c40f2056002150267d87400c03f37ac2148cc0a..433ec7ad9bb0463e7d8126bc3980383e816cfb2f 100644 (file)
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(acpi 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)(vncunused 1)(keymap 'ja')))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(acpi 1)(usb 1)(parallel none)(serial none)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)(vncunused 1)(keymap 'ja')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file