Skip to content

Commit

Permalink
And more
Browse files Browse the repository at this point in the history
  • Loading branch information
whywaita committed Feb 5, 2024
1 parent 7acf112 commit 71b82c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions server/pkg/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package api

import (
"fmt"
"log"
"log/slog"
"net"
"sync"
Expand Down Expand Up @@ -42,7 +41,7 @@ func (s *ShoesLXDMultiServer) Run(listenPort int) error {
if err != nil {
return fmt.Errorf("failed to listen: %w", err)
}
log.Printf("start listen :%d\n", listenPort)
slog.Info("start listen", "port", listenPort)

grpcServer := grpc.NewServer()
pb.RegisterShoesLXDMultiServer(grpcServer, s)
Expand Down
4 changes: 2 additions & 2 deletions server/pkg/api/server_add_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"log"
"log/slog"
"math/rand"
"net/url"
Expand Down Expand Up @@ -72,6 +71,7 @@ func (s *ShoesLXDMultiServer) AddInstance(ctx context.Context, req *pb.AddInstan
} else {
client = host.Client
}
l = l.With("host", host.HostConfig.LxdHost)

reqState := api.InstanceStatePut{
Action: "start",
Expand All @@ -89,7 +89,7 @@ func (s *ShoesLXDMultiServer) AddInstance(ctx context.Context, req *pb.AddInstan
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to retrieve instance information: %+v", err)
}
log.Printf("Success AddInstance host: %s, runnerName: %s\n", host.HostConfig.LxdHost, i.Name)
l.Info("Success AddInstance", "host", host.HostConfig.LxdHost, "runnerName", i.Name)

return &pb.AddInstanceResponse{
CloudId: i.Name,
Expand Down
5 changes: 2 additions & 3 deletions server/pkg/lxdclient/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package lxdclient
import (
"errors"
"fmt"
"log"
"log/slog"
"strconv"

Expand Down Expand Up @@ -113,7 +112,7 @@ func ScrapeLXDHostAllocatedResources(instances []api.Instance) (uint64, uint64,
}
allocatedCPU += uint64(cpu)
} else {
log.Printf("%s hasn't limits.cpu\n", instance.Name)
slog.Warn("instance hasn't limits.cpu", "instance", instance.Name)
}

instanceMemory := instance.Config["limits.memory"]
Expand All @@ -124,7 +123,7 @@ func ScrapeLXDHostAllocatedResources(instances []api.Instance) (uint64, uint64,
}
allocatedMemory += uint64(memory)
} else {
log.Printf("%s hasn't limits.memory\n", instance.Name)
slog.Warn("instance hasn't limits.memory", "instance", instance.Name)
}
}

Expand Down

0 comments on commit 71b82c1

Please sign in to comment.