Merge pull request #9115 from yousong/automated-cherry-pick-of-#9109-upstream-release-3.1

Automated cherry pick of #9109: fix(host): make sure it won't match vpc guests by accident
This commit is contained in:
Zexi Li
2020-12-01 20:22:08 +08:00
committed by GitHub
+4 -1
View File
@@ -971,10 +971,13 @@ func (s *SKVMGuestInstance) ExecSuspendTask(ctx context.Context) {
func (s *SKVMGuestInstance) GetNicDescMatch(mac, ip, port, bridge string) jsonutils.JSONObject {
nics, _ := s.Desc.GetArray("nics")
for _, nic := range nics {
nicBridge, _ := nic.GetString("bridge")
if bridge == "" && nicBridge != "" && nicBridge == options.HostOptions.OvnIntegrationBridge {
continue
}
nicMac, _ := nic.GetString("mac")
nicIp, _ := nic.GetString("ip")
nicPort, _ := nic.GetString("ifname")
nicBridge, _ := nic.GetString("bridge")
if (len(mac) == 0 || netutils2.MacEqual(nicMac, mac)) &&
(len(ip) == 0 || nicIp == ip) &&
(len(port) == 0 || nicPort == port) &&