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:
yunion-ci-robot
2019-07-31 15:58:00 +08:00
committed by GitHub

View File

@@ -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)
}