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

Re: [libvirt] [PATCH] bandwidth: Integrate bandwidth into portgroups



On 26.07.2011 20:04, Laine Stump wrote:
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 031862a..f99294c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8867,8 +8867,7 @@ virDomainNetDefFormat(virBufferPtr buf,
          virBufferAddLit(buf,   "</tune>\n");
      }

-    if (virBandwidthDefFormat(buf, virDomainNetGetActualBandwidth(def),
-                              "      ")<  0)
+    if (virBandwidthDefFormat(buf, def->bandwidth, "      ")<  0)
          return -1;

      if (virDomainDeviceInfoFormat(buf,&def->info, flags)<  0)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0fa26dd..a406100 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -337,6 +337,7 @@ virDomainLoadAllConfigs;
  virDomainMemballoonModelTypeFromString;
  virDomainMemballoonModelTypeToString;
  virDomainNetDefFree;
+virDomainNetGetActualBandwidth;
  virDomainNetGetActualBridgeName;
  virDomainNetGetActualDirectDev;
  virDomainNetGetActualDirectMode;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f8fd4ee..35d6b1e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -132,7 +132,8 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
                          vnet_hdr, def->uuid,
                          virDomainNetGetActualDirectVirtPortProfile(net),
                          &res_ifname,
-                        vmop, driver->stateDir, net->bandwidth);
+                        vmop, driver->stateDir,
+                        virDomainNetGetActualBandwidth(net));
      if (rc>= 0) {
          virDomainAuditNetDevice(def, net, res_ifname, true);
          VIR_FREE(net->ifname);
@@ -299,7 +300,8 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
      }

      if (tapfd>= 0&&
-        virBandwidthEnable(net->bandwidth, net->ifname)<  0) {
+        virBandwidthEnable(virDomainNetGetActualBandwidth(net),
+                           net->ifname)<  0) {
          qemuReportError(VIR_ERR_INTERNAL_ERROR,
                          _("cannot set bandwidth limits on %s"),
                          net->ifname);
diff --git a/src/util/network.c b/src/util/network.c
index 314cabe..6fcdab2 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -1284,6 +1284,7 @@ virBandwidthCopy(virBandwidthPtr *dest,
          return -1;
      }

+    *dest = NULL;
      if (!src) {
          /* nothing to be copied */
          return 0;
@@ -1305,6 +1306,7 @@ virBandwidthCopy(virBandwidthPtr *dest,
      if (src->out) {
          if (VIR_ALLOC((*dest)->out)<  0) {
              virReportOOMError();
+            VIR_FREE((*dest)->in);
              goto cleanup;
          }
Thanks, pushed.

Michal


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