mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
virnetdevopenvswitch: Introduce virNetDevOpenvswitchInterfaceClearTxQos and virNetDevOpenvswitchInterfaceClearRxQos
Separate virNetDevOpenvswitchInterfaceClearQos into two steps. When setting qos, we can set only rx or tx and the other one should be cleared. Signed-off-by: zhangjl02 <zhangjl02@inspur.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a6986fb2cf
commit
56723f8846
@ -2817,6 +2817,8 @@ virNetDevOpenvswitchAddPort;
|
|||||||
virNetDevOpenvswitchGetMigrateData;
|
virNetDevOpenvswitchGetMigrateData;
|
||||||
virNetDevOpenvswitchGetVhostuserIfname;
|
virNetDevOpenvswitchGetVhostuserIfname;
|
||||||
virNetDevOpenvswitchInterfaceClearQos;
|
virNetDevOpenvswitchInterfaceClearQos;
|
||||||
|
virNetDevOpenvswitchInterfaceClearRxQos;
|
||||||
|
virNetDevOpenvswitchInterfaceClearTxQos;
|
||||||
virNetDevOpenvswitchInterfaceGetMaster;
|
virNetDevOpenvswitchInterfaceGetMaster;
|
||||||
virNetDevOpenvswitchInterfaceParseStats;
|
virNetDevOpenvswitchInterfaceParseStats;
|
||||||
virNetDevOpenvswitchInterfaceSetQos;
|
virNetDevOpenvswitchInterfaceSetQos;
|
||||||
|
@ -789,6 +789,10 @@ virNetDevOpenvswitchInterfaceSetQos(const char *ifname,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (virNetDevOpenvswitchInterfaceClearTxQos(ifname, vmuuid) < 0) {
|
||||||
|
VIR_WARN("Clean tx qos for interface %s failed", ifname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rx) {
|
if (rx) {
|
||||||
@ -807,14 +811,18 @@ virNetDevOpenvswitchInterfaceSetQos(const char *ifname,
|
|||||||
_("Unable to set vlan configuration on port %s"), ifname);
|
_("Unable to set vlan configuration on port %s"), ifname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (virNetDevOpenvswitchInterfaceClearRxQos(ifname) < 0) {
|
||||||
|
VIR_WARN("Clean rx qos for interface %s failed", ifname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
virNetDevOpenvswitchInterfaceClearQos(const char *ifname,
|
virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
|
||||||
const unsigned char *vmuuid)
|
const unsigned char *vmuuid)
|
||||||
{
|
{
|
||||||
char vmuuidstr[VIR_UUID_STRING_BUFLEN];
|
char vmuuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
g_autoptr(virCommand) cmd = NULL;
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
@ -891,3 +899,41 @@ virNetDevOpenvswitchInterfaceClearQos(const char *ifname,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
virNetDevOpenvswitchInterfaceClearRxQos(const char *ifname)
|
||||||
|
{
|
||||||
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
|
|
||||||
|
cmd = virNetDevOpenvswitchCreateCmd();
|
||||||
|
virCommandAddArgList(cmd, "set", "Interface", ifname, NULL);
|
||||||
|
virCommandAddArgFormat(cmd, "ingress_policing_rate=%llu", 0llu);
|
||||||
|
virCommandAddArgFormat(cmd, "ingress_policing_burst=%llu", 0llu);
|
||||||
|
|
||||||
|
if (virCommandRun(cmd, NULL) < 0) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Unable to set vlan configuration on port %s"), ifname);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
virNetDevOpenvswitchInterfaceClearQos(const char *ifname,
|
||||||
|
const unsigned char *vmuuid)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (virNetDevOpenvswitchInterfaceClearTxQos(ifname, vmuuid) < 0) {
|
||||||
|
VIR_WARN("Clean tx qos for interface %s failed", ifname);
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (virNetDevOpenvswitchInterfaceClearRxQos(ifname) < 0) {
|
||||||
|
VIR_WARN("Clean rx qos for interface %s failed", ifname);
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -80,3 +80,10 @@ int virNetDevOpenvswitchInterfaceSetQos(const char *ifname,
|
|||||||
int virNetDevOpenvswitchInterfaceClearQos(const char *ifname,
|
int virNetDevOpenvswitchInterfaceClearQos(const char *ifname,
|
||||||
const unsigned char *vmuuid)
|
const unsigned char *vmuuid)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
int virNetDevOpenvswitchInterfaceClearRxQos(const char *ifname)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
int virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
|
||||||
|
const unsigned char *vmid)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
Loading…
Reference in New Issue
Block a user