node

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2018 License: BSD-2-Clause Imports: 18 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: "test-reserve" 
'

Documentation

Index

Constants

This section is empty.

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 GetIpmiAddress

func GetIpmiAddress() string

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

func GetSerial

func GetSerial() string

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

func GetTotalCPUMilliCores

func GetTotalCPUMilliCores() uint32

func GetTotalMemory

func GetTotalMemory() (uint64, error)

func RegisterNodeToAPI

func RegisterNodeToAPI(name, advertiseAddress, api string) error

TODO: エラーハンドリング適当

Types

type NodeAPI

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

func CreateNodeAPI

func CreateNodeAPI(ds datastore.Datastore) (*NodeAPI, error)

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 (a NodeAPI) ListNodes(ctx context.Context, req *ppool.ListNodesRequest) (*ppool.ListNodesResponse, error)

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)

type NodeConnections

type NodeConnections struct {
	NodeAPI ppool.NodeServiceClient
}

TODO: APIを叩く回数を減らす

func NewNodeConnections

func NewNodeConnections(api string) (*NodeConnections, error)

func (NodeConnections) GetConnection

func (nc NodeConnections) GetConnection(nodeName string) (*grpc.ClientConn, error)

GetConnection return a connection to Node having name of arguments.

func (NodeConnections) IsExisting

func (nc NodeConnections) IsExisting(nodeName string) (bool, error)

Jump to

Keyboard shortcuts

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