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

[libvirt] Re: [PATCH 0/12] Standardized device addressing & SCSI controller/disk hotplug



Hi,

Daniel P. Berrange wrote:
> This patch series is a combination of series done by
> Wolfgang Mauerer to support proper SCSI drive hotplug
> and new work by myself to introduce generic addressing
> for all devices.
>
> Wolfgang's most recent posting was
>
> http://www.redhat.com/archives/libvir-list/2009-November/msg00574.html
> http://www.redhat.com/archives/libvir-list/2009-November/msg00701.html
>
> When testing that series I came across a few minor issues,
> but more importantly it made me realize how important it is
> that we introduce explicit device addressing in our XML format.
> (...)

essentially, this all looks good to me - thanks for the extensions.
Unfortunately, I was not yet successful in fully testing the code
because I have some issues with the underlying qemu that prevent my
machines from booting correctly with recent qemu-kvms. However, I came
across a small issue: When certain PCI devices are not present in the
system, libvirt can crash at startup. The attached patch fixes this.

Best, Wolfgang
commit 9d183e9710f8a062c4a95f208e0c39652016f729
Author: Wolfgang Mauerer <wolfgang mauerer siemens com>
Date:   Mon Dec 14 17:09:37 2009 +0100

    Fix crashes at startup when certain devices are not present
    
    At startup, libvirt tries to detect which devices are available by parsing the
    output of info pci. However, some of the possible devices (like watchdogs)
    might not be available, which must be taken into account by the code.

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9b5fac6..5d63108 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1754,6 +1754,9 @@ qemuGetPCIDiskVendorProduct(virDomainDiskDefPtr def,
                             unsigned *vendor,
                             unsigned *product)
 {
+    if (!def)
+        return -1;
+
     switch (def->bus) {
     case VIR_DOMAIN_DISK_BUS_VIRTIO:
         *vendor = QEMU_PCI_VENDOR_REDHAT;
@@ -1772,7 +1775,7 @@ qemuGetPCINetVendorProduct(virDomainNetDefPtr def,
                             unsigned *vendor,
                             unsigned *product)
 {
-    if (!def->model)
+    if (!def || !def->model)
         return -1;
 
     if (STREQ(def->model, "ne2k_pci")) {
@@ -1803,6 +1806,9 @@ qemuGetPCIControllerVendorProduct(virDomainControllerDefPtr def,
                                   unsigned *vendor,
                                   unsigned *product)
 {
+    if (!def)
+        return -1;
+
     switch (def->type) {
     case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
         *vendor = QEMU_PCI_VENDOR_LSI_LOGIC;
@@ -1833,6 +1839,9 @@ qemuGetPCIVideoVendorProduct(virDomainVideoDefPtr def,
                              unsigned *vendor,
                              unsigned *product)
 {
+    if (!def)
+        return -1;
+
     switch (def->type) {
     case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
         *vendor = QEMU_PCI_VENDOR_CIRRUS;
@@ -1860,6 +1869,9 @@ qemuGetPCISoundVendorProduct(virDomainSoundDefPtr def,
                              unsigned *vendor,
                              unsigned *product)
 {
+    if (!def)
+        return -1;
+
     switch (def->model) {
     case VIR_DOMAIN_SOUND_MODEL_ES1370:
         *vendor = QEMU_PCI_VENDOR_ENSONIQ;
@@ -1883,6 +1895,9 @@ qemuGetPCIWatchdogVendorProduct(virDomainWatchdogDefPtr def,
                                 unsigned *vendor,
                                 unsigned *product)
 {
+    if (!def)
+        return -1;
+
     switch (def->model) {
     case VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB:
         *vendor = QEMU_PCI_VENDOR_INTEL;

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