[libvirt] [PATCH 0/2] Allow hotplug of vhost-mq

Basically this is trivial. Everything is prepared and the only thing that prevented us from doing this was missing exception in one check. Trivial. Michal Privoznik (2): qemuDomainAttachNetDevice: Don't overwrite error on rollback qemuDomainAttachNetDevice: Enable multiqueue for vhost-user src/qemu/qemu_hotplug.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.8.4

If there is an error hotpluging a net device (for whatever reason) a rollback operation is performed. However, whilst doing so various helper functions that are called report errors on their own. This results in the original error to be overwritten and thus misleading the user. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/qemu/qemu_hotplug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e06862c..34f2135 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -935,6 +935,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, virDomainNetDefPtr net) { qemuDomainObjPrivatePtr priv = vm->privateData; + virErrorPtr originalError = NULL; char **tapfdName = NULL; int *tapfd = NULL; size_t tapfdSize = 0; @@ -1320,6 +1321,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!virDomainObjIsActive(vm)) goto cleanup; + originalError = virSaveLastError(); if (vlan < 0) { if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) { char *netdev_name; @@ -1350,6 +1352,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, ignore_value(qemuDomainObjExitMonitor(driver, vm)); VIR_FREE(hostnet_name); } + virSetError(originalError); + virFreeError(originalError); goto cleanup; } -- 2.8.4

On 11/04/2016 08:28 AM, Michal Privoznik wrote:
If there is an error hotpluging a net device (for whatever reason) a rollback operation is performed. However, whilst doing so various helper functions that are called report errors on their own. This results in the original error to be overwritten and thus misleading the user.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/qemu/qemu_hotplug.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e06862c..34f2135 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -935,6 +935,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, virDomainNetDefPtr net) { qemuDomainObjPrivatePtr priv = vm->privateData; + virErrorPtr originalError = NULL; char **tapfdName = NULL; int *tapfd = NULL; size_t tapfdSize = 0; @@ -1320,6 +1321,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!virDomainObjIsActive(vm)) goto cleanup;
+ originalError = virSaveLastError();
Coverity has found that there's a couple places between here and the virSetError/virFreeError below where we goto cleanup and thus would leak originalError John
if (vlan < 0) { if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) { char *netdev_name; @@ -1350,6 +1352,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, ignore_value(qemuDomainObjExitMonitor(driver, vm)); VIR_FREE(hostnet_name); } + virSetError(originalError); + virFreeError(originalError); goto cleanup; }

https://bugzilla.redhat.com/show_bug.cgi?id=1386976 We have everything ready. Actually the only limitation was our check that denied hotplug of vhost-user. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/qemu/qemu_hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 34f2135..a7dcf83 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -977,7 +977,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, !(actualType == VIR_DOMAIN_NET_TYPE_NETWORK || actualType == VIR_DOMAIN_NET_TYPE_BRIDGE || actualType == VIR_DOMAIN_NET_TYPE_DIRECT || - actualType == VIR_DOMAIN_NET_TYPE_ETHERNET)) { + actualType == VIR_DOMAIN_NET_TYPE_ETHERNET || + actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Multiqueue network is not supported for: %s"), virDomainNetTypeToString(actualType)); -- 2.8.4

On Fri, Nov 04, 2016 at 01:28:57PM +0100, Michal Privoznik wrote:
Basically this is trivial. Everything is prepared and the only thing that prevented us from doing this was missing exception in one check. Trivial.
Michal Privoznik (2): qemuDomainAttachNetDevice: Don't overwrite error on rollback qemuDomainAttachNetDevice: Enable multiqueue for vhost-user
src/qemu/qemu_hotplug.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
ACK series

On 10.11.2016 14:04, Martin Kletzander wrote:
On Fri, Nov 04, 2016 at 01:28:57PM +0100, Michal Privoznik wrote:
Basically this is trivial. Everything is prepared and the only thing that prevented us from doing this was missing exception in one check. Trivial.
Michal Privoznik (2): qemuDomainAttachNetDevice: Don't overwrite error on rollback qemuDomainAttachNetDevice: Enable multiqueue for vhost-user
src/qemu/qemu_hotplug.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
ACK series
Thank you. Pushed now. Michal

On Fri, 2016-11-04 at 13:28 +0100, Michal Privoznik wrote:
Basically this is trivial. Everything is prepared and the only thing that prevented us from doing this was missing exception in one check. Trivial. Michal Privoznik (2): qemuDomainAttachNetDevice: Don't overwrite error on rollback qemuDomainAttachNetDevice: Enable multiqueue for vhost-user
Still a good candidate for a NEWS file entry, don't you agree? :) -- Andrea Bolognani / Red Hat / Virtualization

On 18.11.2016 16:57, Andrea Bolognani wrote:
On Fri, 2016-11-04 at 13:28 +0100, Michal Privoznik wrote:
Basically this is trivial. Everything is prepared and the only thing that prevented us from doing this was missing exception in one check. Trivial.
Michal Privoznik (2): qemuDomainAttachNetDevice: Don't overwrite error on rollback qemuDomainAttachNetDevice: Enable multiqueue for vhost-user
Still a good candidate for a NEWS file entry, don't you agree? :)
Sure: Improvements: With this release, hotplug of vhostuser typed interfaces with multiqueue feature was enabled. The packet stream from this kind of interfaces can thus be processed on multiple cores simultaneously enabling higher performance. Michal

On Fri, 2016-11-18 at 17:14 +0100, Michal Privoznik wrote:
Basically this is trivial. Everything is prepared and the only thing that prevented us from doing this was missing exception in one check. Trivial. Michal Privoznik (2): qemuDomainAttachNetDevice: Don't overwrite error on rollback qemuDomainAttachNetDevice: Enable multiqueue for vhost-user Still a good candidate for a NEWS file entry, don't you agree? :) Sure: Improvements: With this release, hotplug of vhostuser typed interfaces with multiqueue feature was enabled. The packet stream from this kind of interfaces can thus be processed on multiple cores simultaneously enabling higher performance.
I've pushed a shortened version of the text you proposed. But of course you already know that, because you're the one who ACKed the relevant patch ;) Thanks! -- Andrea Bolognani / Red Hat / Virtualization
participants (4)
-
Andrea Bolognani
-
John Ferlan
-
Martin Kletzander
-
Michal Privoznik