mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #10855 from swordqiu/hotfix/qj-ipmi-probe-reset-link-up-state
fix(baremetal): baremetal ipmi probe reset link up state
This commit is contained in:
@@ -1690,7 +1690,9 @@ func (b *SBaremetalInstance) SendNicInfo(nic *types.SNicDevInfo, idx int, nicTyp
|
||||
params.Add(jsonutils.NewString(nicType), "nic_type")
|
||||
}
|
||||
params.Add(jsonutils.NewInt(int64(nic.Mtu)), "mtu")
|
||||
params.Add(jsonutils.NewBool(nic.Up), "link_up")
|
||||
if nic.Up != nil {
|
||||
params.Add(jsonutils.NewBool(*nic.Up), "link_up")
|
||||
}
|
||||
if reset {
|
||||
params.Add(jsonutils.JSONTrue, "reset")
|
||||
}
|
||||
|
||||
@@ -190,7 +190,6 @@ func (task *sBaremetalPrepareTask) configIPMISetting(cli *ssh.Client, i *baremet
|
||||
|
||||
ipmiNic := &types.SNicDevInfo{
|
||||
Mac: conf.Mac,
|
||||
Up: false,
|
||||
Speed: 100,
|
||||
Mtu: 1500,
|
||||
}
|
||||
@@ -441,7 +440,7 @@ func (task *sBaremetalPrepareTask) updateBmInfo(cli *ssh.Client, i *baremetalPre
|
||||
}
|
||||
if o.Options.EnablePxeBoot && task.baremetal.EnablePxeBoot() {
|
||||
for _, nicInfo := range i.nicsInfo {
|
||||
if nicInfo.Mac.String() != adminNic.GetMac().String() && nicInfo.Up {
|
||||
if nicInfo.Mac.String() != adminNic.GetMac().String() && nicInfo.Up != nil && *nicInfo.Up {
|
||||
err = task.doNicWireProbe(cli, nicInfo)
|
||||
if err != nil {
|
||||
// ignore the error
|
||||
|
||||
@@ -245,8 +245,9 @@ func (s *sBaremetalRegisterTask) updateIpmiInfo(cli *ssh.Client) {
|
||||
ipmitool.SetDellIPMILanPortShared(ipmiTool)
|
||||
}
|
||||
}
|
||||
up := true
|
||||
var nic = &types.SNicDevInfo{
|
||||
Up: true,
|
||||
Up: &up,
|
||||
Speed: 100,
|
||||
Mtu: 1500,
|
||||
}
|
||||
|
||||
@@ -157,9 +157,10 @@ func (self *SBaremetalIpmiProbeTask) sendIpmiNicInfo(lanConf *types.SIPMILanConf
|
||||
if speed <= 0 {
|
||||
speed = 100
|
||||
}
|
||||
up := true
|
||||
ipmiNic := &types.SNicDevInfo{
|
||||
Mac: lanConf.Mac,
|
||||
Up: true,
|
||||
Up: &up,
|
||||
Speed: speed,
|
||||
Mtu: 1500,
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ type SNicDevInfo struct {
|
||||
Dev string `json:"dev"`
|
||||
Mac net.HardwareAddr `json:"mac"`
|
||||
Speed int `json:"speed"`
|
||||
Up bool `json:"up"`
|
||||
Up *bool `json:"up"`
|
||||
Mtu int `json:"mtu"`
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ func ParseNicInfo(lines []string) []*types.SNicDevInfo {
|
||||
Dev: dev,
|
||||
Mac: mac,
|
||||
Speed: speed,
|
||||
Up: up,
|
||||
Up: &up,
|
||||
Mtu: mtu,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -241,6 +241,8 @@ func TestParseNicInfo(t *testing.T) {
|
||||
type args struct {
|
||||
lines []string
|
||||
}
|
||||
up := true
|
||||
down := false
|
||||
mac1Str := "00:22:25:0b:ab:49"
|
||||
mac2Str := "00:22:25:0b:ab:50"
|
||||
mac1, _ := net.ParseMAC(mac1Str)
|
||||
@@ -259,8 +261,8 @@ func TestParseNicInfo(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: []*types.SNicDevInfo{
|
||||
{Dev: "eth0", Mac: mac1, Speed: 0, Up: true, Mtu: 1500},
|
||||
{Dev: "eth1", Mac: mac2, Speed: 0, Up: false, Mtu: 1500},
|
||||
{Dev: "eth0", Mac: mac1, Speed: 0, Up: &up, Mtu: 1500},
|
||||
{Dev: "eth1", Mac: mac2, Speed: 0, Up: &down, Mtu: 1500},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user