Skip to content

Commit

Permalink
fix log 24.12.24
Browse files Browse the repository at this point in the history
Signed-off-by: dolibali <[email protected]>
  • Loading branch information
dolibali committed Dec 24, 2024
1 parent 3631040 commit a67deeb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
5 changes: 2 additions & 3 deletions pkg/daemon/controller_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ func (c *Controller) getPolicyRouting(subnet *kubeovnv1.Subnet) ([]netlink.Rule,
}

func (c *Controller) handlePod(key string) error {
klog.V(3).Infof("v3 log start success")
namespace, name, err := cache.SplitMetaNamespaceKey(key)
if err != nil {
utilruntime.HandleError(fmt.Errorf("invalid resource key: %s", key))
Expand All @@ -550,6 +549,8 @@ func (c *Controller) handlePod(key string) error {
return err
}

klog.Infof("handle qos update for pod %s/%s", namespace, name)

podName := pod.Name
if pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, util.OvnProvider)] != "" {
podName = pod.Annotations[fmt.Sprintf(util.VMAnnotationTemplate, util.OvnProvider)]
Expand All @@ -574,8 +575,6 @@ func (c *Controller) handlePod(key string) error {
return err
}

klog.V(3).Infof("handle qos update for pod %s/%s", namespace, name)

// set multus-nic bandwidth
attachNets, err := nadutils.ParsePodNetworkAnnotation(pod)
if err != nil {
Expand Down
27 changes: 10 additions & 17 deletions pkg/ovs/ovs-vsctl_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress string)
ingressMPS, _ := strconv.Atoi(ingress)
ingressKPS := ingressMPS * 1000
ingressBurst := ingressKPS * 8 / 10
egressMPS, _ := strconv.Atoi(egress)
egressBPS := egressMPS * 1000 * 1000

interfaceList, err := ovsFind("interface", "name", fmt.Sprintf("external-ids:iface-id=%s", iface))
if err != nil {
Expand All @@ -35,41 +37,34 @@ func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress string)
return err
}

egressMPS, _ := strconv.Atoi(egress)
egressBPS := egressMPS * 1000 * 1000

for _, ifName := range interfaceList {
// ingress_policing_rate is in Kbps
klog.V(3).Infof("Set ingress policing rate to %d Kbps on interface %s", ingressKPS, ifName)
err := ovsSet("interface", ifName, fmt.Sprintf("ingress_policing_rate=%d", ingressKPS), fmt.Sprintf("ingress_policing_burst=%d", ingressBurst))
if err != nil {
klog.Error(err)
return err
} else {
klog.V(3).Infof("Successfully set ingress policing rate to %d Kbps on interface %s", ingressKPS, ifName)
}
}

if egressBPS > 0 {
klog.V(3).Infof("Set HTB QoS queue record for interface %s with egress %d Bps", iface, egressBPS)
queueUID, err := SetHtbQosQueueRecord(podName, podNamespace, iface, egressBPS, queueIfaceUIDMap)
if err != nil {
klog.Error(err)
return err
} else {
klog.V(3).Infof("Successfully set HTB QoS queue record for interface %s with egress %d Bps", iface, egressBPS)
}

}
klog.V(3).Infof("Bound QoS queue for interface %s", ifName)
if err = SetQosQueueBinding(podName, podNamespace, ifName, iface, queueUID, qosIfaceUIDMap); err != nil {
klog.Error(err)
return err
} else {
klog.V(3).Infof("Successfully bound QoS queue for interface %s", ifName)
}
}
} else {
if qosUID, ok := qosIfaceUIDMap[iface]; ok {
qosType, err := ovsGet("qos", qosUID, "type", "")
if err != nil {
klog.Error(err)
return err
}
}

if qosType != util.HtbQos {
continue
Expand All @@ -83,9 +78,7 @@ func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress string)
if _, err := Exec("remove", "queue", queueID, "other_config", "max-rate"); err != nil {
klog.Error(err)
return fmt.Errorf("failed to remove rate limit for queue in pod %v/%v, %w", podNamespace, podName, err)
} else {
klog.V(3).Infof("Successfully removed rate limit for queue ID %s in pod %v/%v", queueID, podNamespace, podName)
}
}
}
}

Expand Down

0 comments on commit a67deeb

Please sign in to comment.