[libvirt PATCH 5/6] util: openvswitch: do not reuse cmd in InterfaceSetTxQos

Ján Tomko jtomko at redhat.com
Mon Jan 17 16:40:23 UTC 2022


Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/util/virnetdevopenvswitch.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 32f423ef04..a5180e5843 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -814,19 +814,18 @@ virNetDevOpenvswitchInterfaceSetTxQos(const char *ifname,
 
     if (qos_uuid && *qos_uuid) {
         g_auto(GStrv) lines = g_strsplit(qos_uuid, "\n", 0);
+        g_autoptr(virCommand) qoscmd = virNetDevOpenvswitchCreateCmd();
 
-        virCommandFree(cmd);
-        cmd = virNetDevOpenvswitchCreateCmd();
-        virCommandAddArgList(cmd, "set", "qos", lines[0], NULL);
-        virCommandAddArgFormat(cmd, "other_config:min-rate=%s", average);
+        virCommandAddArgList(qoscmd, "set", "qos", lines[0], NULL);
+        virCommandAddArgFormat(qoscmd, "other_config:min-rate=%s", average);
         if (burst) {
-            virCommandAddArgFormat(cmd, "other_config:burst=%s", burst);
+            virCommandAddArgFormat(qoscmd, "other_config:burst=%s", burst);
         }
         if (peak) {
-            virCommandAddArgFormat(cmd, "other_config:max-rate=%s", peak);
+            virCommandAddArgFormat(qoscmd, "other_config:max-rate=%s", peak);
         }
-        virCommandAddArgList(cmd, vmid_ex_id, ifname_ex_id, NULL);
-        if (virCommandRun(cmd, NULL) < 0) {
+        virCommandAddArgList(qoscmd, vmid_ex_id, ifname_ex_id, NULL);
+        if (virCommandRun(qoscmd, NULL) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unable to set qos configuration on port %s"), ifname);
             return -1;
-- 
2.31.1




More information about the libvir-list mailing list