mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
Merge pull request #2040 from wanyaoqi/bugfix/wyq/fix-guest-get-host-wire-from-network
bugfix: fix guest get host wire from network
This commit is contained in:
@@ -284,12 +284,12 @@ func (self *SGuestnetwork) getJsonDescAtBaremetal(host *SHost) jsonutils.JSONObj
|
||||
return self.getGeneralJsonDesc(host, network, hostwire)
|
||||
}
|
||||
|
||||
func getHostNetworkAdminWire(host *SHost, network *SNetwork) (*SHostwire, error) {
|
||||
func guestGetHostWireFromNetwork(host *SHost, network *SNetwork) (*SHostwire, error) {
|
||||
hostwires := host.getHostwiresOfId(network.WireId)
|
||||
var hostWire *SHostwire
|
||||
for i := 0; i < len(hostwires); i++ {
|
||||
if netInter, _ := NetInterfaceManager.FetchByMac(hostwires[i].MacAddr); netInter != nil {
|
||||
if netInter.NicType == api.NIC_TYPE_ADMIN {
|
||||
if netInter.NicType != api.NIC_TYPE_IPMI {
|
||||
hostWire = &hostwires[i]
|
||||
break
|
||||
}
|
||||
@@ -304,7 +304,7 @@ func getHostNetworkAdminWire(host *SHost, network *SNetwork) (*SHostwire, error)
|
||||
|
||||
func (self *SGuestnetwork) getJsonDescAtHost(host *SHost) jsonutils.JSONObject {
|
||||
network := self.GetNetwork()
|
||||
hostWire, err := getHostNetworkAdminWire(host, network)
|
||||
hostWire, err := guestGetHostWireFromNetwork(host, network)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user