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

[libvirt] [PATCH] qemu: Add network bandwidth settings for ethernet type interfaces



Please apply.

thanks,
Anirban Chakraborty

Signed-off-by: Anirban Chakraborty <abchak juniper net>
---
 src/qemu/qemu_command.c | 5 +++++
 src/qemu/qemu_hotplug.c | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2184caa..258c6a7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7251,6 +7251,11 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
         if (tapfd[0] < 0)
             goto cleanup;
     }
+	/* Configure network bandwidth for ethernet type network interfaces */
+	if (actualType == VIR_DOMAIN_NET_TYPE_ETHERNET)
+		if (virNetDevBandwidthSet(net->ifname,
+			virDomainNetGetActualBandwidth(net), false) < 0)
+			goto cleanup;

     if ((actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
          actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a364c52..aeb53c5 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -940,6 +940,9 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
         if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, vhostfd, &vhostfdSize) < 0)
             goto cleanup;
     } else if (actualType == VIR_DOMAIN_NET_TYPE_ETHERNET) {
+		if (virNetDevBandwidthSet(net->ifname,
+				virDomainNetGetActualBandwidth(net), false) < 0)
+			goto cleanup;
         vhostfdSize = 1;
         if (VIR_ALLOC(vhostfd) < 0)
             goto cleanup;
-- 
1.8.2.3


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