inventory

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2016 The Rook Authors. 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. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. 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. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. 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. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. 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. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. 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. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. 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. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	NodesHealthKey              = "/rook/nodes/health"
	NodesConfigKey              = "/rook/nodes/config"
	TriggerHardwareDetectionKey = "trigger-hardware-detection"
)
View Source
const (
	HeartbeatKey = "heartbeat"
)

Variables

View Source
var (
	HeartbeatTtlDuration = time.Duration(heartbeatTtlSeconds) * time.Second
)

Functions

func GetAvailableDevices added in v0.3.0

func GetAvailableDevices(devices []*LocalDisk) []string

func GetNodeConfigKey

func GetNodeConfigKey(nodeID string) string

gets the key under which all node hardware/config will be stored

func GetNodeIDSet

func GetNodeIDSet(c *Config) *util.Set

Helper to get the set of node IDs

func SetIPAddress

func SetIPAddress(etcdClient etcd.KeysAPI, nodeId, publicIP, privateIP string) error

Set the IP address for a node

func SetLocation

func SetLocation(etcdClient etcd.KeysAPI, nodeId, location string) error

func TriggerClusterHardwareDetection

func TriggerClusterHardwareDetection(etcdClient etcd.KeysAPI)

Types

type Config

type Config struct {
	Nodes map[string]*NodeConfig `json:"nodes"`
	Local *Hardware              `json:"local"`
}

func CreateConfig

func CreateConfig(nodeIDs []string) *Config

Helper to create a Config with a set of node IDs

func LoadDiscoveredNodes

func LoadDiscoveredNodes(etcdClient etcd.KeysAPI) (*Config, error)

type Disk

type Disk struct {
	Empty      bool   `json:"empty"`
	Type       string `json:"type"`
	Size       uint64 `json:"size"`
	Rotational bool   `json:"rotational"`
}

type Hardware added in v0.3.0

type Hardware struct {
	Disks           []*LocalDisk       `json:"disks"`
	Processors      []*ProcessorConfig `json:"processors"`
	NetworkAdapters []*NetworkConfig   `json:"networkAdapters"`
	Memory          uint64             `json:"memory"`
}

Local hardware info

func DiscoverHardware

func DiscoverHardware(executor exec.Executor) (*Hardware, error)

Discover all the hardware properties for this node.

func DiscoverHardwareAndStore added in v0.3.0

func DiscoverHardwareAndStore(etcdClient etcd.KeysAPI, executor exec.Executor, nodeID string) (*Hardware, error)

Discover all the hardware properties for this node. Store the important properties in etcd and more detailed info for the local node in the context.

type LocalDisk added in v0.3.0

type LocalDisk struct {
	Name        string `json:"name"`
	ID          string `json:"id"`
	UUID        string `json:"uuid"`
	Size        uint64 `json:"size"`
	Rotational  bool   `json:"rotational"`
	Readonly    bool   `json:"readonly"`
	FileSystem  string `json:"fileSystem"`
	MountPoint  string `json:"mountPoint"`
	Type        string `json:"type"`
	Parent      string `json:"parent"`
	HasChildren bool   `json:"hasChildren"`
	Empty       bool   `json:"empty"`
}

type NetworkConfig

type NetworkConfig struct {
	Name        string `json:"name"`
	IPv4Address string `json:"ipv4"`
	IPv6Address string `json:"ipv6"`
	Speed       uint64 `json:"speed"`
}

type NodeConfig

type NodeConfig struct {
	Disks           []*Disk            `json:"disks"`
	Processors      []*ProcessorConfig `json:"processors"`
	NetworkAdapters []*NetworkConfig   `json:"networkAdapters"`
	Memory          uint64             `json:"memory"`
	PublicIP        string             `json:"publicIp"`
	PrivateIP       string             `json:"privateIp"`
	HeartbeatAge    time.Duration      `json:"heartbeatAge"`
	Location        string             `json:"location"`
}

Basic config info for a node in the cluster

type ProcessorConfig

type ProcessorConfig struct {
	ID         uint    `json:"id"`
	PhysicalID uint    `json:"physicalId"`
	Siblings   uint    `json:"siblings"`
	CoreID     uint    `json:"coreId"`
	NumCores   uint    `json:"numCores"`
	Speed      float64 `json:"speed"`
	Bits       uint    `json:"bits"`
}

Jump to

Keyboard shortcuts

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