mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
util: openvswitch: do not reuse cmd in InterfaceClearTxQos
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
3ab7df7421
commit
a5e8eec7d5
@ -643,7 +643,6 @@ virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char vmuuidstr[VIR_UUID_STRING_BUFLEN];
|
char vmuuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
g_autoptr(virCommand) cmd = NULL;
|
|
||||||
g_autofree char *ifname_ex_id = NULL;
|
g_autofree char *ifname_ex_id = NULL;
|
||||||
g_autofree char *vmid_ex_id = NULL;
|
g_autofree char *vmid_ex_id = NULL;
|
||||||
g_autofree char *qos_uuid = NULL;
|
g_autofree char *qos_uuid = NULL;
|
||||||
@ -666,29 +665,29 @@ virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
|
|||||||
/* destroy qos */
|
/* destroy qos */
|
||||||
for (i = 0; lines[i] != NULL; i++) {
|
for (i = 0; lines[i] != NULL; i++) {
|
||||||
const char *line = lines[i];
|
const char *line = lines[i];
|
||||||
|
g_autoptr(virCommand) listcmd = NULL;
|
||||||
|
g_autoptr(virCommand) destroycmd = NULL;
|
||||||
|
|
||||||
if (!*line) {
|
if (!*line) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
virCommandFree(cmd);
|
listcmd = virNetDevOpenvswitchCreateCmd();
|
||||||
cmd = virNetDevOpenvswitchCreateCmd();
|
virCommandAddArgList(listcmd, "--no-heading", "--columns=_uuid", "--if-exists",
|
||||||
virCommandAddArgList(cmd, "--no-heading", "--columns=_uuid", "--if-exists",
|
|
||||||
"list", "port", ifname, "qos", NULL);
|
"list", "port", ifname, "qos", NULL);
|
||||||
virCommandSetOutputBuffer(cmd, &port_qos);
|
virCommandSetOutputBuffer(listcmd, &port_qos);
|
||||||
if (virCommandRun(cmd, NULL) < 0) {
|
if (virCommandRun(listcmd, NULL) < 0) {
|
||||||
VIR_WARN("Unable to remove port qos on port %s", ifname);
|
VIR_WARN("Unable to remove port qos on port %s", ifname);
|
||||||
}
|
}
|
||||||
if (port_qos && *port_qos) {
|
if (port_qos && *port_qos) {
|
||||||
virCommandFree(cmd);
|
g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd();
|
||||||
cmd = virNetDevOpenvswitchCreateCmd();
|
|
||||||
virCommandAddArgList(cmd, "remove", "port", ifname, "qos", line, NULL);
|
virCommandAddArgList(cmd, "remove", "port", ifname, "qos", line, NULL);
|
||||||
if (virCommandRun(cmd, NULL) < 0) {
|
if (virCommandRun(cmd, NULL) < 0) {
|
||||||
VIR_WARN("Unable to remove port qos on port %s", ifname);
|
VIR_WARN("Unable to remove port qos on port %s", ifname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virCommandFree(cmd);
|
destroycmd = virNetDevOpenvswitchCreateCmd();
|
||||||
cmd = virNetDevOpenvswitchCreateCmd();
|
virCommandAddArgList(destroycmd, "destroy", "qos", line, NULL);
|
||||||
virCommandAddArgList(cmd, "destroy", "qos", line, NULL);
|
if (virCommandRun(destroycmd, NULL) < 0) {
|
||||||
if (virCommandRun(cmd, NULL) < 0) {
|
|
||||||
VIR_WARN("Unable to destroy qos on port %s", ifname);
|
VIR_WARN("Unable to destroy qos on port %s", ifname);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
@ -699,11 +698,12 @@ virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
|
|||||||
g_auto(GStrv) lines = g_strsplit(queue_uuid, "\n", 0);
|
g_auto(GStrv) lines = g_strsplit(queue_uuid, "\n", 0);
|
||||||
|
|
||||||
for (i = 0; lines[i] != NULL; i++) {
|
for (i = 0; lines[i] != NULL; i++) {
|
||||||
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
const char *line = lines[i];
|
const char *line = lines[i];
|
||||||
if (!*line) {
|
if (!*line) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
virCommandFree(cmd);
|
|
||||||
cmd = virNetDevOpenvswitchCreateCmd();
|
cmd = virNetDevOpenvswitchCreateCmd();
|
||||||
virCommandAddArgList(cmd, "destroy", "queue", line, NULL);
|
virCommandAddArgList(cmd, "destroy", "queue", line, NULL);
|
||||||
if (virCommandRun(cmd, NULL) < 0) {
|
if (virCommandRun(cmd, NULL) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user