Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #1096] - Fix lint issue from previous #1097

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions pkg/base/linuxutils/lsblk/lsblk.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
Copyright © 2020-2024 Dell Inc. or its subsidiaries. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -161,12 +161,7 @@ func (l *LSBLK) GetBlockDevices(device string) ([]BlockDevice, error) {
// Receives an instance of drivecrd.Drive struct
// Returns drive's path based on provided drivecrd.Drive or error if something went wrong
func (l *LSBLK) SearchDrivePath(drive *api.Drive) (string, error) {
// device path might be already set by hwmgr
device := drive.Path
if device != "" {
return device, nil
}

device := ""
// try to find it with lsblk
lsblkOut, err := l.GetBlockDevices("")
if err != nil {
Expand All @@ -178,8 +173,9 @@ func (l *LSBLK) SearchDrivePath(drive *api.Drive) (string, error) {
vid := drive.VID
pid := drive.PID
for _, l := range lsblkOut {
if strings.EqualFold(l.Serial, sn) && strings.EqualFold(l.Vendor, vid) &&
strings.EqualFold(l.Model, pid) {
lvid := strings.TrimSpace(l.Vendor)
if strings.EqualFold(l.Serial, sn) && strings.EqualFold(lvid, vid) &&
strings.HasPrefix(l.Model, pid) {
device = l.Name
break
}
Expand Down
18 changes: 12 additions & 6 deletions pkg/scheduler/extender/extender.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,20 @@ func (e *Extender) PrioritizeHandler(w http.ResponseWriter, req *http.Request) {
e.Lock()
defer e.Unlock()

hostPriority, err := e.score(extenderArgs.Nodes.Items)
if err != nil {
ll.Errorf("Unable to score %v", err)
return
pod := extenderArgs.Pod
var hostPriority []schedulerapi.HostPriority
requests, err := e.gatherCapacityRequestsByProvisioner(req.Context(), pod)
if err == nil && len(requests) != 0 {
hostPriority, err = e.score(extenderArgs.Nodes.Items)
if err != nil {
ll.Errorf("Unable to score %v", err)
return
}
ll.Infof("Score results for pod %s: %v", pod, hostPriority)
} else {
ll.Infof("Skip skoring for pod: %s", pod)
}
ll.Infof("Score results: %v", hostPriority)
extenderRes := (schedulerapi.HostPriorityList)(hostPriority)

if err := resp.Encode(&extenderRes); err != nil {
ll.Errorf("Unable to write response %v: %v", extenderRes, err)
}
Expand Down
2 changes: 1 addition & 1 deletion variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CRD_OPTIONS ?= crd
### version
MAJOR := 1
MINOR := 5
PATCH := 0
PATCH := 1
PRODUCT_VERSION ?= ${MAJOR}.${MINOR}.${PATCH}
BUILD_REL_A := $(shell git rev-list HEAD |wc -l)
BUILD_REL_B := $(shell git rev-parse --short HEAD)
Expand Down
Loading