Skip to content

Commit

Permalink
filter used qos when delete qos
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Dec 23, 2021
1 parent 26f239a commit 0a48f6a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions pkg/ovs/ovs-vsctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,26 @@ func ClearPodBandwidth(podName, podNamespace string) error {
}
qosList = append(qosList, qosListByPod...)
qosList = util.UniqString(qosList)
for _, qos := range qosList {
if err := ovsDestroy("qos", qos); err != nil {

// https://github.com/kubeovn/kube-ovn/issues/1191
usedQosList, err := ovsFind("port", "qos", "qos!=[]")
if err != nil {
return err
}

for _, qosId := range qosList {
found := false
for _, usedQosId := range usedQosList {
if qosId == usedQosId {
found = true
break
}
}
if found {
continue
}

if err := ovsDestroy("qos", qosId); err != nil {
return err
}
}
Expand Down

0 comments on commit 0a48f6a

Please sign in to comment.