node

package
v0.2.134 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2019 License: BSD-2-Clause Imports: 23 Imported by: 0

README

Node

Principle

  • 行いたいことは以下のとおりである
    • bare metal provisioning (本来の目的であるが実装予定)
    • サーバインベントリ管理
    • n0coreのサービスディスカバリ
    • 死活監視
  • nodeやユーザーがサーバインベントリを登録する
  • memberlistでサービスの死活監視を行う
  • Nodeとmemberlistの両方があることでサービスとして利用できると考える

Discovery / Alive monitoring

  • With memberlist.
  • データの優先度は memberlist > Node model
Agentが正常開始 (Node作成 -> memberlist参加)
  1. AgentがAPIにNodeを保存、APIはmemberlistにないのでNotReadyに
  2. AgentがAPIを起点にmemberlistに参加、APIは通知からNodeをReadyに
Agentが正常開始 (memberlist参加 -> Node作成)
  1. AgentがAPIを起点にmemberlistに参加、APIはNodeがないのでなにも変更せず
  2. AgentがAPIにNodeを保存、APIのmemberlistにあるのでReadyに
Agentが正常終了
  1. AgentがAPIからNodeを削除
  2. Agentがmemberlistから抜ける
Agentが異常終了
  1. Agentがmemberlistから抜ける
  2. APIが離脱を検知し、NodeをNotReadyに
APIが異常終了 (同時にAgentが異常終了した場合も同様)
  • APIが死亡時は動作としては問題がない
APIが復活
  • TODO: AgentとAPIどちらがどちらのmemberlistにジョインするか
    • Agentからな気がする
TODO: memberlistとNodeの値が一致しない
  • APIへのリクエスト失敗が考えられる
  • NotReady or 情報の確実性は memberlist > Node なのでNodeを更新 or Invalid

Example

grpc_cli call localhost:20181 n0stack.pool.NodeService/ListNodes ''
grpc_cli call localhost:20181 n0stack.pool.NodeService/GetNode \
'name: "test"'
grpc_cli call localhost:20181 n0stack.pool.NodeService/DeleteNode \
'name: "test"'
grpc_cli call localhost:20181 n0stack.pool.NodeService/ReserveCompute '
name: "test"
compute_name: "test-reserve"
request_cpu_milli_core: 10
limit_cpu_milli_core: 10
request_memory_bytes: 10
limit_memory_bytes: 10
grpc_cli call localhost:20181 n0stack.pool.NodeService/ReleaseCompute '
name: "test"
compute_name: "test-reserve"
'
grpc_cli call localhost:20181 n0stack.pool.NodeService/ReserveStorage '
name: "test"
storage_name: "test-reserve"
request_bytes: 10
limit_bytes: 10
grpc_cli call localhost:20181 n0stack.pool.NodeService/ReleaseStorage '
name: "test" 
storage_name: "ubuntu-1804-iso" 
'

Documentation

Index

Constants

View Source
const AnnotationComputeDisableDeletionLock = "n0core/pool/node/disable_deletion_lock"
View Source
const AnnotationStorageDisableDeletionLock = "n0core/pool/node/disable_deletion_lock"
View Source
const MockNodeIP = "127.0.20.180"

Variables

This section is empty.

Functions

func CheckCompute

func CheckCompute(requestCpus, totalCpus uint32, requestMemory, totalMemory uint64, reserved map[string]*pbudget.Compute) error

func CheckStorage

func CheckStorage(request, total uint64, reserved map[string]*pbudget.Storage) error

func GetConnection

func GetConnection(ctx context.Context, api ppool.NodeServiceClient, nodeName string) (*grpc.ClientConn, error)

func GetIpmiAddress

func GetIpmiAddress() string

IPMIを持っていない場合が考えられるので、とりあえずエラーハンドリングはしていない

func GetSerial

func GetSerial() string

Serialが取得できなくても動作に問題はないため、エラーハンドリングはしていない

func GetTotalCPUMilliCores

func GetTotalCPUMilliCores() uint32

func GetTotalMemory

func GetTotalMemory() uint64

func IsLockedForDeletion

func IsLockedForDeletion(node *ppool.Node) bool

Types

type MockNodeAPI

type MockNodeAPI struct {
	// contains filtered or unexported fields
}

func NewMockNodeAPI

func NewMockNodeAPI(datastore *memory.MemoryDatastore) *MockNodeAPI

func (MockNodeAPI) ApplyNode

func (a MockNodeAPI) ApplyNode(ctx context.Context, in *ppool.ApplyNodeRequest, opts ...grpc.CallOption) (*ppool.Node, error)

func (MockNodeAPI) DeleteNode

func (a MockNodeAPI) DeleteNode(ctx context.Context, in *ppool.DeleteNodeRequest, opts ...grpc.CallOption) (*empty.Empty, error)

func (MockNodeAPI) GetNode

func (a MockNodeAPI) GetNode(ctx context.Context, in *ppool.GetNodeRequest, opts ...grpc.CallOption) (*ppool.Node, error)

func (MockNodeAPI) ListNodes

func (a MockNodeAPI) ListNodes(ctx context.Context, in *ppool.ListNodesRequest, opts ...grpc.CallOption) (*ppool.ListNodesResponse, error)

func (MockNodeAPI) ReleaseCompute

func (a MockNodeAPI) ReleaseCompute(ctx context.Context, in *ppool.ReleaseComputeRequest, opts ...grpc.CallOption) (*empty.Empty, error)

func (MockNodeAPI) ReleaseStorage

func (a MockNodeAPI) ReleaseStorage(ctx context.Context, in *ppool.ReleaseStorageRequest, opts ...grpc.CallOption) (*empty.Empty, error)

func (MockNodeAPI) ReserveCompute

func (a MockNodeAPI) ReserveCompute(ctx context.Context, in *ppool.ReserveComputeRequest, opts ...grpc.CallOption) (*ppool.Node, error)

func (MockNodeAPI) ReserveStorage

func (a MockNodeAPI) ReserveStorage(ctx context.Context, in *ppool.ReserveStorageRequest, opts ...grpc.CallOption) (*ppool.Node, error)

func (MockNodeAPI) ScheduleCompute

func (a MockNodeAPI) ScheduleCompute(ctx context.Context, in *ppool.ScheduleComputeRequest, opts ...grpc.CallOption) (*ppool.Node, error)

func (MockNodeAPI) ScheduleStorage

func (a MockNodeAPI) ScheduleStorage(ctx context.Context, in *ppool.ScheduleStorageRequest, opts ...grpc.CallOption) (*ppool.Node, error)

func (MockNodeAPI) SetupMockNode

func (a MockNodeAPI) SetupMockNode(ctx context.Context) (*ppool.Node, error)

type NodeAPI

type NodeAPI struct {
	// contains filtered or unexported fields
}

func CreateNodeAPI

func CreateNodeAPI(ds datastore.Datastore) *NodeAPI

func (NodeAPI) ApplyNode

func (a NodeAPI) ApplyNode(ctx context.Context, req *ppool.ApplyNodeRequest) (*ppool.Node, error)

func (NodeAPI) DeleteNode

func (a NodeAPI) DeleteNode(ctx context.Context, req *ppool.DeleteNodeRequest) (*empty.Empty, error)

func (NodeAPI) GetNode

func (a NodeAPI) GetNode(ctx context.Context, req *ppool.GetNodeRequest) (*ppool.Node, error)

func (NodeAPI) ListNodes

func (NodeAPI) ReleaseCompute

func (a NodeAPI) ReleaseCompute(ctx context.Context, req *ppool.ReleaseComputeRequest) (*empty.Empty, error)

func (NodeAPI) ReleaseStorage

func (a NodeAPI) ReleaseStorage(ctx context.Context, req *ppool.ReleaseStorageRequest) (*empty.Empty, error)

func (NodeAPI) ReserveCompute

func (a NodeAPI) ReserveCompute(ctx context.Context, req *ppool.ReserveComputeRequest) (*ppool.Node, error)

func (NodeAPI) ReserveStorage

func (a NodeAPI) ReserveStorage(ctx context.Context, req *ppool.ReserveStorageRequest) (*ppool.Node, error)

func (NodeAPI) ScheduleCompute

func (a NodeAPI) ScheduleCompute(ctx context.Context, req *ppool.ScheduleComputeRequest) (*ppool.Node, error)

func (NodeAPI) ScheduleStorage

func (a NodeAPI) ScheduleStorage(ctx context.Context, req *ppool.ScheduleStorageRequest) (*ppool.Node, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL