@@ -150,7 +150,6 @@ func (s *Scheduler) Stop() {
150150
151151func (s * Scheduler ) RegisterFromNodeAnnotations () {
152152 klog .V (5 ).Infoln ("Scheduler into RegisterFromNodeAnnotations" )
153- nodeInfoCopy := make (map [string ]* util.NodeInfo )
154153 ticker := time .NewTicker (time .Second * 15 )
155154 for {
156155 select {
@@ -168,26 +167,20 @@ func (s *Scheduler) RegisterFromNodeAnnotations() {
168167 for _ , val := range nodes {
169168 nodeNames = append (nodeNames , val .Name )
170169 for devhandsk , devInstance := range device .GetDevices () {
171- health , needUpdate := devInstance .CheckHealth (devhandsk , val )
170+ health := devInstance .CheckHealth (devhandsk , val )
172171 if ! health {
173- _ , ok := s .nodes [val .Name ]
172+ info , ok := s .nodes [val .Name ]
174173 if ok {
175- _ , ok = nodeInfoCopy [devhandsk ]
176- if ok && nodeInfoCopy [devhandsk ] != nil {
177- s .rmNodeDevice (val .Name , nodeInfoCopy [devhandsk ])
178- klog .Infof ("node %v device %s:%v leave, %v remaining devices:%v" , val .Name , devhandsk , nodeInfoCopy [devhandsk ], err , s .nodes [val .Name ].Devices )
179-
180- err := devInstance .NodeCleanUp (val .Name )
181- if err != nil {
182- klog .ErrorS (err , "markAnnotationsToDeleteFailed" )
183- }
184- continue
174+ err := devInstance .NodeCleanUp (val .Name )
175+ if err != nil {
176+ klog .ErrorS (err , "markAnnotationsToDeleteFailed" )
185177 }
178+ s .rmNodeDevice (val .Name , info , devhandsk )
179+ klog .Infof ("node %v device %s:%v leave, %v remaining devices:%v" , val .Name , devhandsk , info , err , s .nodes [val .Name ].Devices )
186180 }
187- }
188- if ! needUpdate {
189181 continue
190182 }
183+
191184 _ , ok := util .HandshakeAnnos [devhandsk ]
192185 if ok {
193186 tmppat := make (map [string ]string )
@@ -223,21 +216,21 @@ func (s *Scheduler) RegisterFromNodeAnnotations() {
223216 }
224217 if ! found {
225218 nodeInfo .Devices = append (nodeInfo .Devices , util.DeviceInfo {
226- ID : deviceinfo .Id ,
227- Index : uint (deviceinfo .Index ),
228- Count : deviceinfo .Count ,
229- Devmem : deviceinfo .Devmem ,
230- Devcore : deviceinfo .Devcore ,
231- Type : deviceinfo .Type ,
232- Numa : deviceinfo .Numa ,
233- Health : deviceinfo .Health ,
219+ ID : deviceinfo .Id ,
220+ Index : uint (deviceinfo .Index ),
221+ Count : deviceinfo .Count ,
222+ Devmem : deviceinfo .Devmem ,
223+ Devcore : deviceinfo .Devcore ,
224+ Type : deviceinfo .Type ,
225+ Numa : deviceinfo .Numa ,
226+ Health : deviceinfo .Health ,
227+ DeviceVendor : devhandsk ,
234228 })
235229 }
236230 }
237231 s .addNode (val .Name , nodeInfo )
238- nodeInfoCopy [devhandsk ] = nodeInfo
239232 if s .nodes [val .Name ] != nil && len (nodeInfo .Devices ) > 0 {
240- klog .Infof ("node %v device %s come node info=%v total=%v" , val .Name , devhandsk , nodeInfoCopy [ devhandsk ] , s .nodes [val .Name ].Devices )
233+ klog .Infof ("node %v device %s come node info=%v total=%v" , val .Name , devhandsk , nodeInfo , s .nodes [val .Name ].Devices )
241234 }
242235 }
243236 }
0 commit comments