mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #16351 from swordqiu/hotfix/qj-async-brvpc-mtu
fix: allow async setup brvpc mtu
This commit is contained in:
@@ -18,7 +18,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/hostman/system_service"
|
||||
@@ -27,12 +29,28 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/util/procutils"
|
||||
)
|
||||
|
||||
func mustConfigBridgeMtu(opts SOvnOptions) {
|
||||
func configBridgeMtu(opts SOvnOptions) {
|
||||
timer := time.NewTimer(time.Minute)
|
||||
go func() {
|
||||
<-timer.C
|
||||
err := ensureConfigBridgeMtu(opts)
|
||||
if err != nil {
|
||||
log.Errorf("configuring mtu fail: %s, retry...", err)
|
||||
configBridgeMtu(opts)
|
||||
} else {
|
||||
log.Infof("set brvpc MTU to %d success!", opts.OvnUnderlayMtu)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func ensureConfigBridgeMtu(opts SOvnOptions) error {
|
||||
args := []string{"set", "Interface", opts.OvnIntegrationBridge, fmt.Sprintf("mtu_request=%d", opts.OvnUnderlayMtu)}
|
||||
output, err := procutils.NewCommand("ovs-vsctl", args...).Output()
|
||||
if err != nil {
|
||||
panic(errors.Wrapf(err, "configuring ovn-controller: %s", string(output)))
|
||||
// panic(errors.Wrapf(err, "configuring ovn-controller: %s", string(output)))
|
||||
return errors.Wrapf(err, "ovs-vsctl %s", string(output))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func mustPrepOvsdbConfig(opts SOvnOptions) {
|
||||
@@ -108,7 +126,7 @@ func InitOvn(opts SOvnOptions) (err error) {
|
||||
}
|
||||
}()
|
||||
mustPrepOvsdbConfig(opts)
|
||||
mustConfigBridgeMtu(opts)
|
||||
configBridgeMtu(opts)
|
||||
if _, ok := ovnContainerImageTag(); !ok {
|
||||
mustPrepService()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user