Skip to content

Commit

Permalink
use grpc client for wait request (#14)
Browse files Browse the repository at this point in the history
* use grpc client for wait request
* Use go-hal to detect vendor and set hard coded password for BMC in case of lenovo for now
* use nvm disk for y1 type of machines
* Use metal-stack/go-hal for all BMC and BIOS related calls
  • Loading branch information
Sandro Koll authored Aug 6, 2020
1 parent 390024d commit 8e5c21b
Show file tree
Hide file tree
Showing 23 changed files with 755 additions and 9,576 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ MAINMODULE := .
COMMONDIR := $(or ${COMMONDIR},../builder)
CGO_ENABLED := 1

in-docker: clean-local-dirs generate-client test all;
in-docker: clean-local-dirs generate-client gofmt test all;

include $(COMMONDIR)/Makefile.inc

release:: generate-client test all ;
release:: generate-client gofmt test all ;

.PHONY: clean
clean::
Expand Down Expand Up @@ -93,4 +93,8 @@ qemu-up:
DEBUG=1 \
BGP=1" \
-kernel metal-hammer-kernel \
-initrd metal-hammer-initrd.img.lz4
-initrd metal-hammer-initrd.img.lz4

.PHONY: protoc
protoc:
docker run -it --rm -v $(PWD)/../../..:/work metalstack/builder bash -c "cd github.com/metal-stack/metal-hammer && protoc -I cmd -I../../.. --go_out plugins=grpc:cmd cmd/api/v1/*.proto"
222 changes: 222 additions & 0 deletions cmd/api/v1/wait.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions cmd/api/v1/wait.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package v1;

option go_package = "api/v1";

message WaitRequest {
string machineID = 1;
}

message WaitResponse {}

service Wait {
rpc Wait (WaitRequest) returns (stream WaitResponse);
}
17 changes: 5 additions & 12 deletions cmd/bios.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"github.com/metal-stack/metal-hammer/cmd/event"
"github.com/metal-stack/metal-hammer/pkg/kernel"
"github.com/metal-stack/metal-hammer/pkg/sum"
"time"

log "github.com/inconshreveable/log15"
Expand All @@ -12,12 +11,11 @@ import (
// ConfigureBIOS ensures that UEFI boot is enabled and CSM-support is disabled.
// It then reboots the machine.
func (h *Hammer) ConfigureBIOS() error {
s, err := sum.New()
if err != nil {
return err
if h.Spec.DevMode || h.Hal.Board().VM {
return nil
}

reboot, err := s.ConfigureBIOS()
reboot, err := h.Hal.ConfigureBIOS()
if err != nil {
log.Warn("BIOS updates for this machine type are intentionally not supported, skipping ConfigureBIOS", "error", err)
return nil
Expand All @@ -39,16 +37,11 @@ func (h *Hammer) ConfigureBIOS() error {
// EnsureBootOrder ensures that the BIOS boot order is properly set,
// i.e. first boot from OS image and then PXE boot
func (h *Hammer) EnsureBootOrder(bootloaderID string) error {
if h.Spec.DevMode {
if h.Spec.DevMode || h.Hal.Board().VM {
return nil
}

s, err := sum.New()
if err != nil {
return err
}

err = s.EnsureBootOrder(bootloaderID)
err := h.Hal.EnsureBootOrder(bootloaderID)
if err != nil {
return err
}
Expand Down
9 changes: 2 additions & 7 deletions cmd/network/lldpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ func (l *LLDPClient) requirementsMet() bool {
}
}
}
// OK we found 2 distinct chassis mac's
if len(neighMap) >= l.Host.minimumNeighbors {
return true
}

// Requirements are not met
return false
// Requirements are met if we found at least 2 distinct chassis mac's
return len(neighMap) >= l.Host.minimumNeighbors
}
Loading

0 comments on commit 8e5c21b

Please sign in to comment.