From 9403a90b9ae7bb4b8e392d773dd04bd08abd2a51 Mon Sep 17 00:00:00 2001 From: seraphico Date: Fri, 18 Nov 2022 11:02:23 +0800 Subject: [PATCH] fix(baremetal): When the mac address in nics_standby does not have Index or nic_type, it will cause a panic, which will cause the physical server to fail to switch to bare metal --- pkg/baremetal/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/baremetal/manager.go b/pkg/baremetal/manager.go index 3c9bdc6f1a..4946464868 100644 --- a/pkg/baremetal/manager.go +++ b/pkg/baremetal/manager.go @@ -2945,7 +2945,7 @@ func (s *SBaremetalServer) reIndexDescNics(term *ssh.Client, desc *deployapi.Gue } reIndexNics := func(nics []*deployapi.Nic) ([]*deployapi.Nic, error) { for idx, nic := range nics { - if nic.GetNicType() == api.NIC_TYPE_IPMI { + if nic.GetNicType() == api.NIC_TYPE_IPMI || nic.GetIndex() >= 0 { continue } rIdx, rNic := findRemoteNic(nic.GetMac())