]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: openvswitch: do not reuse cmd in InterfaceSetTxQos
authorJán Tomko <jtomko@redhat.com>
Mon, 17 Jan 2022 16:28:44 +0000 (17:28 +0100)
committerJán Tomko <jtomko@redhat.com>
Tue, 18 Jan 2022 16:48:32 +0000 (17:48 +0100)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virnetdevopenvswitch.c

index 32f423ef04f36b98fc16f45ce832c7397dc55fa5..a5180e58436358c9c55869dbbf50636a64315e5b 100644 (file)
@@ -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;