[PATCH] add checking index for pci-bridge controller

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

 



hi all,

There is a bug here https://bugzilla.redhat.com/show_bug.cgi?id=981261 about controller configuration.
For the pci-bridge controller, if index less than zero, there is no alert for it, and libvirt will pass this 
value to qemu-kvm. But qemu-kvm will report the argument error, like:
"qemu-kvm: -device pci-bridge,chassis_nr=-1,id=pci.-1,bus=pci.0,addr=0x9: Parameter 'chassis_nr' expects uint8_t"

So libvirt should check the arguments of controller.

Here is my patch for pci-bridge:

--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5693,6 +5693,14 @@ virDomainControllerDefParseXML(xmlNodePtr node,
                                  "have an address"));
                 goto error;
             }
+        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
+            if (def->idx < 0) {
+                virReportError(VIR_ERR_XML_ERROR, "%s",
+                               _("pci-bridge controller index invalid, should not "
+                                 "less than zero"));
+                goto error;
+            }
+
         }

And I also see qemuBuildControllerDevStr() in qemu_command.c 
        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
            if (def->idx == 0) {
                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                               _("PCI bridge index should be > 0"));
                goto error;
            }
            virBufferAsprintf(&buf, "pci-bridge,chassis_nr=%d,id=pci.%d",
                              def->idx, def->idx);

And if I modify it to "def->idx > 0", testsuite will fail.
So why only check "def->idx == 0" ?  

Thanks and regards
Jincheng Miao

--
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]