diff --git a/0001-virsh-Fix-regression-of-vol-resize.patch b/0001-virsh-Fix-regression-of-vol-resize.patch new file mode 100644 index 0000000..3453fc8 --- /dev/null +++ b/0001-virsh-Fix-regression-of-vol-resize.patch @@ -0,0 +1,27 @@ +From 729bd0a37adbb20472500ab090c99ac684697fa0 Mon Sep 17 00:00:00 2001 +From: Osier Yang +Date: Fri, 24 May 2013 11:59:14 +0800 +Subject: [PATCH] virsh: Fix regression of vol-resize + +Introduced by commit 1daa4ba33acf. vshCommandOptStringReq returns +0 on *success* or the option is not required && not present, both +are right result. Error out when returning 0 is not correct. +the caller, it doesn't have to check wether it +(cherry picked from commit 2a3a725c33aba2046443d33eb473eb54517f61c8) +--- + tools/virsh-volume.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c +index 728bc23..a9abdc1 100644 +--- a/tools/virsh-volume.c ++++ b/tools/virsh-volume.c +@@ -1075,7 +1075,7 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) + if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL))) + return false; + +- if (vshCommandOptStringReq(ctl, cmd, "capacity", &capacityStr) <= 0) ++ if (vshCommandOptStringReq(ctl, cmd, "capacity", &capacityStr) < 0) + goto cleanup; + virSkipSpaces(&capacityStr); + if (*capacityStr == '-') { diff --git a/0001-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch b/0002-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch similarity index 97% rename from 0001-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch rename to 0002-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch index c32c397..ec3350e 100644 --- a/0001-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch +++ b/0002-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch @@ -1,4 +1,4 @@ -From 973fda18d4f5be790b912dde5c8f13a5812388c3 Mon Sep 17 00:00:00 2001 +From 51a1506b2944e5a2c905d0acc3fa68f829c3bb95 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 16 Sep 2013 13:37:34 +0200 Subject: [PATCH] qemu: Fix checking of ABI stability when restoring external diff --git a/0002-qemu-Use-migratable-XML-definition-when-doing-extern.patch b/0003-qemu-Use-migratable-XML-definition-when-doing-extern.patch similarity index 95% rename from 0002-qemu-Use-migratable-XML-definition-when-doing-extern.patch rename to 0003-qemu-Use-migratable-XML-definition-when-doing-extern.patch index e1ecb58..62818eb 100644 --- a/0002-qemu-Use-migratable-XML-definition-when-doing-extern.patch +++ b/0003-qemu-Use-migratable-XML-definition-when-doing-extern.patch @@ -1,4 +1,4 @@ -From e3905e84a3bcd66841f3a40d63a5a98d563424ac Mon Sep 17 00:00:00 2001 +From eaf803e7f0a6ec66aef24157488696a3b9d3a890 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 16 Sep 2013 13:40:42 +0200 Subject: [PATCH] qemu: Use "migratable" XML definition when doing external diff --git a/0004-Remove-virConnectPtr-arg-from-virNWFilterDefParse.patch b/0004-Remove-virConnectPtr-arg-from-virNWFilterDefParse.patch new file mode 100644 index 0000000..42bf49c --- /dev/null +++ b/0004-Remove-virConnectPtr-arg-from-virNWFilterDefParse.patch @@ -0,0 +1,105 @@ +From f6b6a016a93218cb3ed881faca9df6a27c859bcf Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 3 Oct 2013 14:06:58 +0100 +Subject: [PATCH] Remove virConnectPtr arg from virNWFilterDefParse* + +None of the virNWFilterDefParse* methods require a virConnectPtr +arg, so just drop it + +Signed-off-by: Daniel P. Berrange +--- + src/conf/nwfilter_conf.c | 15 ++++++--------- + src/conf/nwfilter_conf.h | 6 ++---- + src/nwfilter/nwfilter_driver.c | 2 +- + tests/nwfilterxml2xmltest.c | 2 +- + 4 files changed, 10 insertions(+), 15 deletions(-) + +diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c +index b61010d..5559c09 100644 +--- a/src/conf/nwfilter_conf.c ++++ b/src/conf/nwfilter_conf.c +@@ -2651,8 +2651,7 @@ cleanup: + + + static virNWFilterDefPtr +-virNWFilterDefParse(virConnectPtr conn ATTRIBUTE_UNUSED, +- const char *xmlStr, ++virNWFilterDefParse(const char *xmlStr, + const char *filename) { + virNWFilterDefPtr def = NULL; + xmlDocPtr xml; +@@ -2667,18 +2666,16 @@ virNWFilterDefParse(virConnectPtr conn ATTRIBUTE_UNUSED, + + + virNWFilterDefPtr +-virNWFilterDefParseString(virConnectPtr conn, +- const char *xmlStr) ++virNWFilterDefParseString(const char *xmlStr) + { +- return virNWFilterDefParse(conn, xmlStr, NULL); ++ return virNWFilterDefParse(xmlStr, NULL); + } + + + virNWFilterDefPtr +-virNWFilterDefParseFile(virConnectPtr conn, +- const char *filename) ++virNWFilterDefParseFile(const char *filename) + { +- return virNWFilterDefParse(conn, NULL, filename); ++ return virNWFilterDefParse(NULL, filename); + } + + +@@ -3076,7 +3073,7 @@ virNWFilterObjLoad(virConnectPtr conn, + virNWFilterDefPtr def; + virNWFilterObjPtr nwfilter; + +- if (!(def = virNWFilterDefParseFile(conn, path))) { ++ if (!(def = virNWFilterDefParseFile(path))) { + return NULL; + } + +diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h +index 48998ec..f7d21a1 100644 +--- a/src/conf/nwfilter_conf.h ++++ b/src/conf/nwfilter_conf.h +@@ -714,10 +714,8 @@ int virNWFilterLoadAllConfigs(virConnectPtr conn, + char *virNWFilterConfigFile(const char *dir, + const char *name); + +-virNWFilterDefPtr virNWFilterDefParseString(virConnectPtr conn, +- const char *xml); +-virNWFilterDefPtr virNWFilterDefParseFile(virConnectPtr conn, +- const char *filename); ++virNWFilterDefPtr virNWFilterDefParseString(const char *xml); ++virNWFilterDefPtr virNWFilterDefParseFile(const char *filename); + + void virNWFilterObjLock(virNWFilterObjPtr obj); + void virNWFilterObjUnlock(virNWFilterObjPtr obj); +diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c +index 8f73d3b..db7d9cb 100644 +--- a/src/nwfilter/nwfilter_driver.c ++++ b/src/nwfilter/nwfilter_driver.c +@@ -534,7 +534,7 @@ nwfilterDefineXML(virConnectPtr conn, + nwfilterDriverLock(driver); + virNWFilterCallbackDriversLock(); + +- if (!(def = virNWFilterDefParseString(conn, xml))) ++ if (!(def = virNWFilterDefParseString(xml))) + goto cleanup; + + if (!(nwfilter = virNWFilterObjAssignDef(conn, &driver->nwfilters, def))) +diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c +index a215bf8..44088b2 100644 +--- a/tests/nwfilterxml2xmltest.c ++++ b/tests/nwfilterxml2xmltest.c +@@ -33,7 +33,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, + + virResetLastError(); + +- if (!(dev = virNWFilterDefParseString(NULL, inXmlData))) ++ if (!(dev = virNWFilterDefParseString(inXmlData))) + goto fail; + + if (!!virGetLastError() != expect_error) diff --git a/0005-Don-t-pass-virConnectPtr-in-nwfilter-struct-domUpdat.patch b/0005-Don-t-pass-virConnectPtr-in-nwfilter-struct-domUpdat.patch new file mode 100644 index 0000000..46171d8 --- /dev/null +++ b/0005-Don-t-pass-virConnectPtr-in-nwfilter-struct-domUpdat.patch @@ -0,0 +1,355 @@ +From c43c0de0cd294168151ef9d2c227bc7d85b43889 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 3 Oct 2013 14:06:59 +0100 +Subject: [PATCH] Don't pass virConnectPtr in nwfilter 'struct + domUpdateCBStruct' + +The nwfilter driver only needs a reference to its private +state object, not a full virConnectPtr. Update the domUpdateCBStruct +struct to have a 'void *opaque' field instead of a virConnectPtr. + +Signed-off-by: Daniel P. Berrange +--- + src/conf/nwfilter_conf.c | 14 +++++++++++--- + src/conf/nwfilter_conf.h | 4 ++-- + src/nwfilter/nwfilter_dhcpsnoop.c | 12 ++++++------ + src/nwfilter/nwfilter_driver.c | 5 +++-- + src/nwfilter/nwfilter_gentech_driver.c | 32 ++++++++++++++++---------------- + src/nwfilter/nwfilter_gentech_driver.h | 10 +++++----- + src/nwfilter/nwfilter_learnipaddr.c | 6 +++--- + 7 files changed, 46 insertions(+), 37 deletions(-) + +diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c +index 5559c09..9348c2b 100644 +--- a/src/conf/nwfilter_conf.c ++++ b/src/conf/nwfilter_conf.c +@@ -2867,6 +2867,7 @@ virNWFilterCallbackDriversUnlock(void) + + + static virDomainObjListIterator virNWFilterDomainFWUpdateCB; ++static void *virNWFilterDomainFWUpdateOpaque; + + /** + * virNWFilterInstFiltersOnAllVMs: +@@ -2878,7 +2879,7 @@ virNWFilterInstFiltersOnAllVMs(virConnectPtr conn) + { + int i; + struct domUpdateCBStruct cb = { +- .conn = conn, ++ .opaque = virNWFilterDomainFWUpdateOpaque, + .step = STEP_APPLY_CURRENT, + .skipInterfaces = NULL, /* not needed */ + }; +@@ -2897,7 +2898,7 @@ virNWFilterTriggerVMFilterRebuild(virConnectPtr conn) + int i; + int ret = 0; + struct domUpdateCBStruct cb = { +- .conn = conn, ++ .opaque = virNWFilterDomainFWUpdateOpaque, + .step = STEP_APPLY_NEW, + .skipInterfaces = virHashCreate(0, NULL), + }; +@@ -3500,9 +3501,14 @@ char *virNWFilterConfigFile(const char *dir, + } + + +-int virNWFilterConfLayerInit(virDomainObjListIterator domUpdateCB) ++int virNWFilterConfLayerInit(virDomainObjListIterator domUpdateCB, ++ void *opaque) + { ++ if (initialized) ++ return -1; ++ + virNWFilterDomainFWUpdateCB = domUpdateCB; ++ virNWFilterDomainFWUpdateOpaque = opaque; + + initialized = true; + +@@ -3521,6 +3527,8 @@ void virNWFilterConfLayerShutdown(void) + virMutexDestroy(&updateMutex); + + initialized = false; ++ virNWFilterDomainFWUpdateOpaque = NULL; ++ virNWFilterDomainFWUpdateCB = NULL; + } + + +diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h +index f7d21a1..ea90fbd 100644 +--- a/src/conf/nwfilter_conf.h ++++ b/src/conf/nwfilter_conf.h +@@ -587,7 +587,7 @@ enum UpdateStep { + }; + + struct domUpdateCBStruct { +- virConnectPtr conn; ++ void *opaque; + enum UpdateStep step; + virHashTablePtr skipInterfaces; + }; +@@ -723,7 +723,7 @@ void virNWFilterObjUnlock(virNWFilterObjPtr obj); + void virNWFilterLockFilterUpdates(void); + void virNWFilterUnlockFilterUpdates(void); + +-int virNWFilterConfLayerInit(virDomainObjListIterator domUpdateCB); ++int virNWFilterConfLayerInit(virDomainObjListIterator domUpdateCB, void *opaque); + void virNWFilterConfLayerShutdown(void); + + int virNWFilterInstFiltersOnAllVMs(virConnectPtr conn); +diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c +index 5012b14..a2a69a2 100644 +--- a/src/nwfilter/nwfilter_dhcpsnoop.c ++++ b/src/nwfilter/nwfilter_dhcpsnoop.c +@@ -481,15 +481,15 @@ virNWFilterSnoopIPLeaseInstallRule(virNWFilterSnoopIPLeasePtr ipl, + /* instantiate the filters */ + + if (req->ifname) +- rc = virNWFilterInstantiateFilterLate(NULL, ++ rc = virNWFilterInstantiateFilterLate(req->driver, ++ NULL, + req->ifname, + req->ifindex, + req->linkdev, + req->nettype, + &req->macaddr, + req->filtername, +- req->vars, +- req->driver); ++ req->vars); + + exit_snooprequnlock: + virNWFilterSnoopReqUnlock(req); +@@ -871,15 +871,15 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req, + goto skip_instantiate; + + if (ipAddrLeft) { +- ret = virNWFilterInstantiateFilterLate(NULL, ++ ret = virNWFilterInstantiateFilterLate(req->driver, ++ NULL, + req->ifname, + req->ifindex, + req->linkdev, + req->nettype, + &req->macaddr, + req->filtername, +- req->vars, +- req->driver); ++ req->vars); + } else { + const virNWFilterVarValuePtr dhcpsrvrs = + virHashLookup(req->vars->hashTable, NWFILTER_VARNAME_DHCPSERVER); +diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c +index db7d9cb..d69721c 100644 +--- a/src/nwfilter/nwfilter_driver.c ++++ b/src/nwfilter/nwfilter_driver.c +@@ -201,7 +201,8 @@ nwfilterStateInitialize(bool privileged, + + virNWFilterTechDriversInit(privileged); + +- if (virNWFilterConfLayerInit(virNWFilterDomainFWUpdateCB) < 0) ++ if (virNWFilterConfLayerInit(virNWFilterDomainFWUpdateCB, ++ driverState) < 0) + goto err_techdrivers_shutdown; + + /* +@@ -640,7 +641,7 @@ nwfilterInstantiateFilter(virConnectPtr conn, + const unsigned char *vmuuid, + virDomainNetDefPtr net) + { +- return virNWFilterInstantiateFilter(conn, vmuuid, net); ++ return virNWFilterInstantiateFilter(conn->nwfilterPrivateData, vmuuid, net); + } + + +diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c +index 958f47a..5323e45 100644 +--- a/src/nwfilter/nwfilter_gentech_driver.c ++++ b/src/nwfilter/nwfilter_gentech_driver.c +@@ -812,7 +812,8 @@ err_unresolvable_vars: + * Call this function while holding the NWFilter filter update lock + */ + static int +-__virNWFilterInstantiateFilter(const unsigned char *vmuuid, ++__virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver, ++ const unsigned char *vmuuid, + bool teardownOld, + const char *ifname, + int ifindex, +@@ -822,7 +823,6 @@ __virNWFilterInstantiateFilter(const unsigned char *vmuuid, + const char *filtername, + virNWFilterHashTablePtr filterparams, + enum instCase useNewFilter, +- virNWFilterDriverStatePtr driver, + bool forceWithPendingReq, + bool *foundNewFilter) + { +@@ -935,7 +935,7 @@ err_exit: + + + static int +-_virNWFilterInstantiateFilter(virConnectPtr conn, ++_virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver, + const unsigned char *vmuuid, + const virDomainNetDefPtr net, + bool teardownOld, +@@ -962,7 +962,8 @@ _virNWFilterInstantiateFilter(virConnectPtr conn, + goto cleanup; + } + +- rc = __virNWFilterInstantiateFilter(vmuuid, ++ rc = __virNWFilterInstantiateFilter(driver, ++ vmuuid, + teardownOld, + net->ifname, + ifindex, +@@ -972,7 +973,6 @@ _virNWFilterInstantiateFilter(virConnectPtr conn, + net->filter, + net->filterparams, + useNewFilter, +- conn->nwfilterPrivateData, + false, + foundNewFilter); + +@@ -984,22 +984,23 @@ cleanup: + + + int +-virNWFilterInstantiateFilterLate(const unsigned char *vmuuid, ++virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver, ++ const unsigned char *vmuuid, + const char *ifname, + int ifindex, + const char *linkdev, + enum virDomainNetType nettype, + const virMacAddrPtr macaddr, + const char *filtername, +- virNWFilterHashTablePtr filterparams, +- virNWFilterDriverStatePtr driver) ++ virNWFilterHashTablePtr filterparams) + { + int rc; + bool foundNewFilter = false; + + virNWFilterLockFilterUpdates(); + +- rc = __virNWFilterInstantiateFilter(vmuuid, ++ rc = __virNWFilterInstantiateFilter(driver, ++ vmuuid, + true, + ifname, + ifindex, +@@ -1009,7 +1010,6 @@ virNWFilterInstantiateFilterLate(const unsigned char *vmuuid, + filtername, + filterparams, + INSTANTIATE_ALWAYS, +- driver, + true, + &foundNewFilter); + if (rc < 0) { +@@ -1029,13 +1029,13 @@ virNWFilterInstantiateFilterLate(const unsigned char *vmuuid, + + + int +-virNWFilterInstantiateFilter(virConnectPtr conn, ++virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver, + const unsigned char *vmuuid, + const virDomainNetDefPtr net) + { + bool foundNewFilter = false; + +- return _virNWFilterInstantiateFilter(conn, vmuuid, net, ++ return _virNWFilterInstantiateFilter(driver, vmuuid, net, + 1, + INSTANTIATE_ALWAYS, + &foundNewFilter); +@@ -1043,14 +1043,14 @@ virNWFilterInstantiateFilter(virConnectPtr conn, + + + int +-virNWFilterUpdateInstantiateFilter(virConnectPtr conn, ++virNWFilterUpdateInstantiateFilter(virNWFilterDriverStatePtr driver, + const unsigned char *vmuuid, + const virDomainNetDefPtr net, + bool *skipIface) + { + bool foundNewFilter = false; + +- int rc = _virNWFilterInstantiateFilter(conn, vmuuid, net, ++ int rc = _virNWFilterInstantiateFilter(driver, vmuuid, net, + 0, + INSTANTIATE_FOLLOW_NEWFILTER, + &foundNewFilter); +@@ -1168,7 +1168,7 @@ virNWFilterDomainFWUpdateCB(virDomainObjPtr obj, + if ((net->filter) && (net->ifname)) { + switch (cb->step) { + case STEP_APPLY_NEW: +- ret = virNWFilterUpdateInstantiateFilter(cb->conn, ++ ret = virNWFilterUpdateInstantiateFilter(cb->opaque, + vm->uuid, + net, + &skipIface); +@@ -1193,7 +1193,7 @@ virNWFilterDomainFWUpdateCB(virDomainObjPtr obj, + break; + + case STEP_APPLY_CURRENT: +- ret = virNWFilterInstantiateFilter(cb->conn, ++ ret = virNWFilterInstantiateFilter(cb->opaque, + vm->uuid, + net); + if (ret) +diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter_gentech_driver.h +index 4b47b4a..8528e2a 100644 +--- a/src/nwfilter/nwfilter_gentech_driver.h ++++ b/src/nwfilter/nwfilter_gentech_driver.h +@@ -39,23 +39,23 @@ enum instCase { + }; + + +-int virNWFilterInstantiateFilter(virConnectPtr conn, ++int virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver, + const unsigned char *vmuuid, + const virDomainNetDefPtr net); +-int virNWFilterUpdateInstantiateFilter(virConnectPtr conn, ++int virNWFilterUpdateInstantiateFilter(virNWFilterDriverStatePtr driver, + const unsigned char *vmuuid, + const virDomainNetDefPtr net, + bool *skipIface); + +-int virNWFilterInstantiateFilterLate(const unsigned char *vmuuid, ++int virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver, ++ const unsigned char *vmuuid, + const char *ifname, + int ifindex, + const char *linkdev, + enum virDomainNetType nettype, + const virMacAddrPtr macaddr, + const char *filtername, +- virNWFilterHashTablePtr filterparams, +- virNWFilterDriverStatePtr driver); ++ virNWFilterHashTablePtr filterparams); + + int virNWFilterTeardownFilter(const virDomainNetDefPtr net); + +diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c +index 990374d..7ee51d2 100644 +--- a/src/nwfilter/nwfilter_learnipaddr.c ++++ b/src/nwfilter/nwfilter_learnipaddr.c +@@ -613,15 +613,15 @@ learnIPAddressThread(void *arg) + "cache for interface %s"), inetaddr, req->ifname); + } + +- ret = virNWFilterInstantiateFilterLate(NULL, ++ ret = virNWFilterInstantiateFilterLate(req->driver, ++ NULL, + req->ifname, + req->ifindex, + req->linkdev, + req->nettype, + &req->macaddr, + req->filtername, +- req->filterparams, +- req->driver); ++ req->filterparams); + VIR_DEBUG("Result from applying firewall rules on " + "%s with IP addr %s : %d\n", req->ifname, inetaddr, ret); + } diff --git a/0006-Remove-use-of-virConnectPtr-from-all-remaining-nwfil.patch b/0006-Remove-use-of-virConnectPtr-from-all-remaining-nwfil.patch new file mode 100644 index 0000000..e9f9637 --- /dev/null +++ b/0006-Remove-use-of-virConnectPtr-from-all-remaining-nwfil.patch @@ -0,0 +1,382 @@ +From 4688a920f1f7ce2e687e5f2a86955597a3980092 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 3 Oct 2013 14:07:00 +0100 +Subject: [PATCH] Remove use of virConnectPtr from all remaining nwfilter code + +The virConnectPtr is passed around loads of nwfilter code in +order to provide it as a parameter to the callback registered +by the virt drivers. None of the virt drivers use this param +though, so it serves no purpose. + +Avoiding the need to pass a virConnectPtr means that the +nwfilterStateReload method no longer needs to open a bogus +QEMU driver connection. This addresses a race condition that +can lead to a crash on startup. + +The nwfilter driver starts before the QEMU driver and registers +some callbacks with DBus to detect firewalld reload. If the +firewalld reload happens while the QEMU driver is still starting +up though, the nwfilterStateReload method will open a connection +to the partially initialized QEMU driver and cause a crash. + +Signed-off-by: Daniel P. Berrange +--- + src/conf/nwfilter_conf.c | 49 ++++++++++++++++-------------------------- + src/conf/nwfilter_conf.h | 14 +++++------- + src/lxc/lxc_driver.c | 3 +-- + src/nwfilter/nwfilter_driver.c | 42 ++++++++++++++---------------------- + src/qemu/qemu_driver.c | 3 +-- + src/uml/uml_driver.c | 3 +-- + 6 files changed, 43 insertions(+), 71 deletions(-) + +diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c +index 9348c2b..4e5bf69 100644 +--- a/src/conf/nwfilter_conf.c ++++ b/src/conf/nwfilter_conf.c +@@ -2761,8 +2761,7 @@ cleanup: + + + static int +-_virNWFilterDefLoopDetect(virConnectPtr conn, +- virNWFilterObjListPtr nwfilters, ++_virNWFilterDefLoopDetect(virNWFilterObjListPtr nwfilters, + virNWFilterDefPtr def, + const char *filtername) + { +@@ -2786,7 +2785,7 @@ _virNWFilterDefLoopDetect(virConnectPtr conn, + obj = virNWFilterObjFindByName(nwfilters, + entry->include->filterref); + if (obj) { +- rc = _virNWFilterDefLoopDetect(conn, nwfilters, ++ rc = _virNWFilterDefLoopDetect(nwfilters, + obj->def, filtername); + + virNWFilterObjUnlock(obj); +@@ -2802,7 +2801,6 @@ _virNWFilterDefLoopDetect(virConnectPtr conn, + + /* + * virNWFilterDefLoopDetect: +- * @conn: pointer to virConnect object + * @nwfilters : the nwfilters to search + * @def : the filter definition that may add a loop and is to be tested + * +@@ -2812,11 +2810,10 @@ _virNWFilterDefLoopDetect(virConnectPtr conn, + * Returns 0 in case no loop was detected, -1 otherwise. + */ + static int +-virNWFilterDefLoopDetect(virConnectPtr conn, +- virNWFilterObjListPtr nwfilters, ++virNWFilterDefLoopDetect(virNWFilterObjListPtr nwfilters, + virNWFilterDefPtr def) + { +- return _virNWFilterDefLoopDetect(conn, nwfilters, def, def->name); ++ return _virNWFilterDefLoopDetect(nwfilters, def, def->name); + } + + int nCallbackDriver; +@@ -2875,7 +2872,7 @@ static void *virNWFilterDomainFWUpdateOpaque; + * error. This should be called upon reloading of the driver. + */ + int +-virNWFilterInstFiltersOnAllVMs(virConnectPtr conn) ++virNWFilterInstFiltersOnAllVMs(void) + { + int i; + struct domUpdateCBStruct cb = { +@@ -2885,15 +2882,14 @@ virNWFilterInstFiltersOnAllVMs(virConnectPtr conn) + }; + + for (i = 0; i < nCallbackDriver; i++) +- callbackDrvArray[i]->vmFilterRebuild(conn, +- virNWFilterDomainFWUpdateCB, ++ callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB, + &cb); + + return 0; + } + + static int +-virNWFilterTriggerVMFilterRebuild(virConnectPtr conn) ++virNWFilterTriggerVMFilterRebuild(void) + { + int i; + int ret = 0; +@@ -2907,8 +2903,7 @@ virNWFilterTriggerVMFilterRebuild(virConnectPtr conn) + return -1; + + for (i = 0; i < nCallbackDriver; i++) { +- if (callbackDrvArray[i]->vmFilterRebuild(conn, +- virNWFilterDomainFWUpdateCB, ++ if (callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB, + &cb) < 0) + ret = -1; + } +@@ -2917,15 +2912,13 @@ virNWFilterTriggerVMFilterRebuild(virConnectPtr conn) + cb.step = STEP_TEAR_NEW; /* rollback */ + + for (i = 0; i < nCallbackDriver; i++) +- callbackDrvArray[i]->vmFilterRebuild(conn, +- virNWFilterDomainFWUpdateCB, ++ callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB, + &cb); + } else { + cb.step = STEP_TEAR_OLD; /* switch over */ + + for (i = 0; i < nCallbackDriver; i++) +- callbackDrvArray[i]->vmFilterRebuild(conn, +- virNWFilterDomainFWUpdateCB, ++ callbackDrvArray[i]->vmFilterRebuild(virNWFilterDomainFWUpdateCB, + &cb); + } + +@@ -2936,14 +2929,13 @@ virNWFilterTriggerVMFilterRebuild(virConnectPtr conn) + + + int +-virNWFilterTestUnassignDef(virConnectPtr conn, +- virNWFilterObjPtr nwfilter) ++virNWFilterTestUnassignDef(virNWFilterObjPtr nwfilter) + { + int rc = 0; + + nwfilter->wantRemoved = 1; + /* trigger the update on VMs referencing the filter */ +- if (virNWFilterTriggerVMFilterRebuild(conn)) ++ if (virNWFilterTriggerVMFilterRebuild()) + rc = -1; + + nwfilter->wantRemoved = 0; +@@ -2982,8 +2974,7 @@ cleanup: + } + + virNWFilterObjPtr +-virNWFilterObjAssignDef(virConnectPtr conn, +- virNWFilterObjListPtr nwfilters, ++virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters, + virNWFilterDefPtr def) + { + virNWFilterObjPtr nwfilter; +@@ -3002,7 +2993,7 @@ virNWFilterObjAssignDef(virConnectPtr conn, + virNWFilterObjUnlock(nwfilter); + } + +- if (virNWFilterDefLoopDetect(conn, nwfilters, def) < 0) { ++ if (virNWFilterDefLoopDetect(nwfilters, def) < 0) { + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("filter would introduce a loop")); + return NULL; +@@ -3021,7 +3012,7 @@ virNWFilterObjAssignDef(virConnectPtr conn, + + nwfilter->newDef = def; + /* trigger the update on VMs referencing the filter */ +- if (virNWFilterTriggerVMFilterRebuild(conn)) { ++ if (virNWFilterTriggerVMFilterRebuild()) { + nwfilter->newDef = NULL; + virNWFilterUnlockFilterUpdates(); + virNWFilterObjUnlock(nwfilter); +@@ -3066,8 +3057,7 @@ virNWFilterObjAssignDef(virConnectPtr conn, + + + static virNWFilterObjPtr +-virNWFilterObjLoad(virConnectPtr conn, +- virNWFilterObjListPtr nwfilters, ++virNWFilterObjLoad(virNWFilterObjListPtr nwfilters, + const char *file, + const char *path) + { +@@ -3086,7 +3076,7 @@ virNWFilterObjLoad(virConnectPtr conn, + return NULL; + } + +- if (!(nwfilter = virNWFilterObjAssignDef(conn, nwfilters, def))) { ++ if (!(nwfilter = virNWFilterObjAssignDef(nwfilters, def))) { + virNWFilterDefFree(def); + return NULL; + } +@@ -3104,8 +3094,7 @@ virNWFilterObjLoad(virConnectPtr conn, + + + int +-virNWFilterLoadAllConfigs(virConnectPtr conn, +- virNWFilterObjListPtr nwfilters, ++virNWFilterLoadAllConfigs(virNWFilterObjListPtr nwfilters, + const char *configDir) + { + DIR *dir; +@@ -3133,7 +3122,7 @@ virNWFilterLoadAllConfigs(virConnectPtr conn, + if (!(path = virFileBuildPath(configDir, entry->d_name, NULL))) + continue; + +- nwfilter = virNWFilterObjLoad(conn, nwfilters, entry->d_name, path); ++ nwfilter = virNWFilterObjLoad(nwfilters, entry->d_name, path); + if (nwfilter) + virNWFilterObjUnlock(nwfilter); + +diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h +index ea90fbd..1b72ba8 100644 +--- a/src/conf/nwfilter_conf.h ++++ b/src/conf/nwfilter_conf.h +@@ -688,12 +688,10 @@ int virNWFilterObjSaveDef(virNWFilterDriverStatePtr driver, + + int virNWFilterObjDeleteDef(virNWFilterObjPtr nwfilter); + +-virNWFilterObjPtr virNWFilterObjAssignDef(virConnectPtr conn, +- virNWFilterObjListPtr nwfilters, ++virNWFilterObjPtr virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters, + virNWFilterDefPtr def); + +-int virNWFilterTestUnassignDef(virConnectPtr conn, +- virNWFilterObjPtr nwfilter); ++int virNWFilterTestUnassignDef(virNWFilterObjPtr nwfilter); + + virNWFilterDefPtr virNWFilterDefParseNode(xmlDocPtr xml, + xmlNodePtr root); +@@ -707,8 +705,7 @@ int virNWFilterSaveXML(const char *configDir, + int virNWFilterSaveConfig(const char *configDir, + virNWFilterDefPtr def); + +-int virNWFilterLoadAllConfigs(virConnectPtr conn, +- virNWFilterObjListPtr nwfilters, ++int virNWFilterLoadAllConfigs(virNWFilterObjListPtr nwfilters, + const char *configDir); + + char *virNWFilterConfigFile(const char *dir, +@@ -726,11 +723,10 @@ void virNWFilterUnlockFilterUpdates(void); + int virNWFilterConfLayerInit(virDomainObjListIterator domUpdateCB, void *opaque); + void virNWFilterConfLayerShutdown(void); + +-int virNWFilterInstFiltersOnAllVMs(virConnectPtr conn); ++int virNWFilterInstFiltersOnAllVMs(void); + + +-typedef int (*virNWFilterRebuild)(virConnectPtr conn, +- virDomainObjListIterator domUpdateCB, ++typedef int (*virNWFilterRebuild)(virDomainObjListIterator domUpdateCB, + void *data); + typedef void (*virNWFilterVoidCall)(void); + +diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c +index 94c1f37..a5eab76 100644 +--- a/src/lxc/lxc_driver.c ++++ b/src/lxc/lxc_driver.c +@@ -82,8 +82,7 @@ virLXCDriverPtr lxc_driver = NULL; + + /* callbacks for nwfilter */ + static int +-lxcVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED, +- virDomainObjListIterator iter, void *data) ++lxcVMFilterRebuild(virDomainObjListIterator iter, void *data) + { + return virDomainObjListForEach(lxc_driver->domains, iter, data); + } +diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c +index d69721c..51a991f 100644 +--- a/src/nwfilter/nwfilter_driver.c ++++ b/src/nwfilter/nwfilter_driver.c +@@ -230,8 +230,7 @@ nwfilterStateInitialize(bool privileged, + + VIR_FREE(base); + +- if (virNWFilterLoadAllConfigs(NULL, +- &driverState->nwfilters, ++ if (virNWFilterLoadAllConfigs(&driverState->nwfilters, + driverState->configDir) < 0) + goto error; + +@@ -270,37 +269,28 @@ err_free_driverstate: + * files and update its state + */ + static int +-nwfilterStateReload(void) { +- virConnectPtr conn; +- +- if (!driverState) { ++nwfilterStateReload(void) ++{ ++ if (!driverState) + return -1; +- } + + if (!driverState->privileged) + return 0; + +- conn = virConnectOpen("qemu:///system"); +- +- if (conn) { +- virNWFilterDHCPSnoopEnd(NULL); +- /* shut down all threads -- they will be restarted if necessary */ +- virNWFilterLearnThreadsTerminate(true); +- +- nwfilterDriverLock(driverState); +- virNWFilterCallbackDriversLock(); ++ virNWFilterDHCPSnoopEnd(NULL); ++ /* shut down all threads -- they will be restarted if necessary */ ++ virNWFilterLearnThreadsTerminate(true); + +- virNWFilterLoadAllConfigs(conn, +- &driverState->nwfilters, +- driverState->configDir); ++ nwfilterDriverLock(driverState); ++ virNWFilterCallbackDriversLock(); + +- virNWFilterCallbackDriversUnlock(); +- nwfilterDriverUnlock(driverState); ++ virNWFilterLoadAllConfigs(&driverState->nwfilters, ++ driverState->configDir); + +- virNWFilterInstFiltersOnAllVMs(conn); ++ virNWFilterCallbackDriversUnlock(); ++ nwfilterDriverUnlock(driverState); + +- virConnectClose(conn); +- } ++ virNWFilterInstFiltersOnAllVMs(); + + return 0; + } +@@ -538,7 +528,7 @@ nwfilterDefineXML(virConnectPtr conn, + if (!(def = virNWFilterDefParseString(xml))) + goto cleanup; + +- if (!(nwfilter = virNWFilterObjAssignDef(conn, &driver->nwfilters, def))) ++ if (!(nwfilter = virNWFilterObjAssignDef(&driver->nwfilters, def))) + goto cleanup; + + if (virNWFilterObjSaveDef(driver, nwfilter, def) < 0) { +@@ -579,7 +569,7 @@ nwfilterUndefine(virNWFilterPtr obj) { + goto cleanup; + } + +- if (virNWFilterTestUnassignDef(obj->conn, nwfilter) < 0) { ++ if (virNWFilterTestUnassignDef(nwfilter) < 0) { + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", + _("nwfilter is in use")); +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index bdb7adb..10e2b86 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -157,8 +157,7 @@ static void + qemuVMDriverUnlock(void) {} + + static int +-qemuVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED, +- virDomainObjListIterator iter, void *data) ++qemuVMFilterRebuild(virDomainObjListIterator iter, void *data) + { + return virDomainObjListForEach(qemu_driver->domains, iter, data); + } +diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c +index 9b0aba6..61586b0 100644 +--- a/src/uml/uml_driver.c ++++ b/src/uml/uml_driver.c +@@ -147,8 +147,7 @@ static int umlMonitorCommand(const struct uml_driver *driver, + static struct uml_driver *uml_driver = NULL; + + static int +-umlVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED, +- virDomainObjListIterator iter, void *data) ++umlVMFilterRebuild(virDomainObjListIterator iter, void *data) + { + return virDomainObjListForEach(uml_driver->domains, iter, data); + } diff --git a/0007-qemu_hotplug-Allow-QoS-update-in-qemuDomainChangeNet.patch b/0007-qemu_hotplug-Allow-QoS-update-in-qemuDomainChangeNet.patch new file mode 100644 index 0000000..872f55a --- /dev/null +++ b/0007-qemu_hotplug-Allow-QoS-update-in-qemuDomainChangeNet.patch @@ -0,0 +1,66 @@ +From d78741e154c932ba45fc31d6a2ae615f2f1d1e15 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 1 Oct 2013 15:04:48 +0200 +Subject: [PATCH] qemu_hotplug: Allow QoS update in qemuDomainChangeNet + +The qemuDomainChangeNet() is called when 'virsh update-device' is +invoked on a NIC. Currently, we fail to update the QoS even though +we have routines for that. + +Signed-off-by: Michal Privoznik +(cherry picked from commit 9fa10d3901a14997f724fe50ad8a33d7f0d23abe) +--- + src/qemu/qemu_hotplug.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c +index f88632d..dfcbd11 100644 +--- a/src/qemu/qemu_hotplug.c ++++ b/src/qemu/qemu_hotplug.c +@@ -1470,6 +1470,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, + bool needFilterChange = false; + bool needLinkStateChange = false; + bool needReplaceDevDef = false; ++ bool needBandwidthSet = false; + int ret = -1; + + if (!devslot || !(olddev = *devslot)) { +@@ -1738,8 +1739,6 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, + virDomainNetGetActualDirectMode(olddev) != virDomainNetGetActualDirectMode(olddev) || + !virNetDevVPortProfileEqual(virDomainNetGetActualVirtPortProfile(olddev), + virDomainNetGetActualVirtPortProfile(newdev)) || +- !virNetDevBandwidthEqual(virDomainNetGetActualBandwidth(olddev), +- virDomainNetGetActualBandwidth(newdev)) || + !virNetDevVlanEqual(virDomainNetGetActualVlan(olddev), + virDomainNetGetActualVlan(newdev))) { + needReconnect = true; +@@ -1748,6 +1747,10 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, + if (olddev->linkstate != newdev->linkstate) + needLinkStateChange = true; + ++ if (!virNetDevBandwidthEqual(virDomainNetGetActualBandwidth(olddev), ++ virDomainNetGetActualBandwidth(newdev))) ++ needBandwidthSet = true; ++ + /* FINALLY - actually perform the required actions */ + + if (needReconnect) { +@@ -1757,6 +1760,18 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, + goto cleanup; + } + ++ if (needBandwidthSet) { ++ if (virNetDevBandwidthSet(newdev->ifname, ++ virDomainNetGetActualBandwidth(newdev), ++ false) < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("cannot set bandwidth limits on %s"), ++ newdev->ifname); ++ goto cleanup; ++ } ++ needReplaceDevDef = true; ++ } ++ + if (needBridgeChange) { + if (qemuDomainChangeNetBridge(dom->conn, vm, olddev, newdev) < 0) + goto cleanup; diff --git a/0008-virNetDevBandwidthEqual-Make-it-more-robust.patch b/0008-virNetDevBandwidthEqual-Make-it-more-robust.patch new file mode 100644 index 0000000..f2a4463 --- /dev/null +++ b/0008-virNetDevBandwidthEqual-Make-it-more-robust.patch @@ -0,0 +1,57 @@ +From c898a40e76db8bf32529fc37872f0b52430e043d Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Wed, 2 Oct 2013 09:18:02 +0200 +Subject: [PATCH] virNetDevBandwidthEqual: Make it more robust + +So far the virNetDevBandwidthEqual() expected both ->in and ->out items +to be allocated for both @a and @b compared. This is not necessary true +for all our code. For instance, running 'update-device' twice over a NIC +with the very same XML results in SIGSEGV-ing in this function. + +Signed-off-by: Michal Privoznik +(cherry picked from commit ee02fbc8e4a24c1347761ceff2ddb2c108e9611c) +--- + src/util/virnetdevbandwidth.c | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c +index 2c5b63a..78608fd 100644 +--- a/src/util/virnetdevbandwidth.c ++++ b/src/util/virnetdevbandwidth.c +@@ -339,16 +339,30 @@ virNetDevBandwidthEqual(virNetDevBandwidthPtr a, + return false; + + /* in */ +- if (a->in->average != b->in->average || +- a->in->peak != b->in->peak || +- a->in->burst != b->in->burst) ++ if (a->in) { ++ if (!b->in) ++ return false; ++ ++ if (a->in->average != b->in->average || ++ a->in->peak != b->in->peak || ++ a->in->burst != b->in->burst) ++ return false; ++ } else if (b->in) { + return false; ++ } + + /*out*/ +- if (a->out->average != b->out->average || +- a->out->peak != b->out->peak || +- a->out->burst != b->out->burst) ++ if (a->out) { ++ if (!b->out) ++ return false; ++ ++ if (a->out->average != b->out->average || ++ a->out->peak != b->out->peak || ++ a->out->burst != b->out->burst) ++ return false; ++ } else if (b->out) { + return false; ++ } + + return true; + } diff --git a/libvirt.spec b/libvirt.spec index 9d8fded..ab529bd 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -341,7 +341,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 1.0.5.6 -Release: 2%{?dist}%{?extra_release} +Release: 3%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -352,9 +352,18 @@ URL: http://libvirt.org/ %endif Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz +# Fix virsh vol-resize (bz #1014874) +Patch0001: 0001-virsh-Fix-regression-of-vol-resize.patch # Fix snapshot restore when VM has disabled usb support (bz #1011520) -Patch0001: 0001-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch -Patch0002: 0002-qemu-Use-migratable-XML-definition-when-doing-extern.patch +Patch0002: 0002-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch +Patch0003: 0003-qemu-Use-migratable-XML-definition-when-doing-extern.patch +# Fix nwfilter crash during firewalld install (bz #1014933) +Patch0004: 0004-Remove-virConnectPtr-arg-from-virNWFilterDefParse.patch +Patch0005: 0005-Don-t-pass-virConnectPtr-in-nwfilter-struct-domUpdat.patch +Patch0006: 0006-Remove-use-of-virConnectPtr-from-all-remaining-nwfil.patch +# Allow QoS change with update-device (bz #1014200) +Patch0007: 0007-qemu_hotplug-Allow-QoS-update-in-qemuDomainChangeNet.patch +Patch0008: 0008-virNetDevBandwidthEqual-Make-it-more-robust.patch %if %{with_libvirtd} Requires: libvirt-daemon = %{version}-%{release} @@ -1088,9 +1097,18 @@ of recent versions of Linux (and other OSes). %prep %setup -q -# Fix snapshot restore when VM has disabled usb support (bz #1011520) +# Fix virsh vol-resize (bz #1014874) %patch0001 -p1 +# Fix snapshot restore when VM has disabled usb support (bz #1011520) %patch0002 -p1 +%patch0003 -p1 +# Fix nwfilter crash during firewalld install (bz #1014933) +%patch0004 -p1 +%patch0005 -p1 +%patch0006 -p1 +# Allow QoS change with update-device (bz #1014200) +%patch0007 -p1 +%patch0008 -p1 %build %if ! %{with_xen} @@ -2013,6 +2031,11 @@ fi %endif %changelog +* Sun Oct 06 2013 Cole Robinson - 1.0.5.6-3 +- Fix virsh vol-resize (bz #1014874) +- Fix nwfilter crash during firewalld install (bz #1014933) +- Allow QoS change with update-device (bz #1014200) + * Tue Sep 24 2013 Cole Robinson - 1.0.5.6-2 - Fix snapshot restore when VM has disabled usb support (bz #1011520)