inventory

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2016 License: Apache-2.0 Imports: 12 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.

Index

Constants

View Source
const (
	MemoryTotalSizeKey             = "total"
	NetworkIPv4AddressKey          = "ipv4"
	NetworkIPv6AddressKey          = "ipv6"
	NetworkSpeedKey                = "speed"
	ProcPhysicalIDKey              = "physical-id"
	ProcSiblingsKey                = "siblings"
	ProcCoreIDKey                  = "core-id"
	ProcNumCoresKey                = "cores"
	ProcSpeedKey                   = "speed"
	ProcBitsKey                    = "arch"
	Disk                  DiskType = iota
	Part
)
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 DiscoverHardware

func DiscoverHardware(nodeID string, etcdClient etcd.KeysAPI, executor exec.Executor) error

func DiskTypeToStr

func DiskTypeToStr(diskType DiskType) string

func GetDeviceFromUUID

func GetDeviceFromUUID(uuid, nodeID string, etcdClient etcd.KeysAPI) (string, error)

func GetDeviceSize

func GetDeviceSize(name, nodeID string, etcdClient etcd.KeysAPI) (uint64, error)

func GetDeviceUUID

func GetDeviceUUID(device, nodeID string, etcdClient etcd.KeysAPI) (string, error)

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 SetDeviceUUID

func SetDeviceUUID(nodeID, device, uuid string, etcdClient etcd.KeysAPI) error

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"`
}

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 DiskConfig

type DiskConfig struct {
	Name        string   `json:"name"`
	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        DiskType `json:"type"`
	Parent      string   `json:"parent"`
	HasChildren bool     `json:"hasChildren"`
}

func TestSetDiskInfo

func TestSetDiskInfo(etcdClient *util.MockEtcdClient, hardwareKey string, name string, uuid string, size uint64, rotational bool, readonly bool,
	filesystem string, mountPoint string, diskType DiskType, parent string, hasChildren bool) DiskConfig

test usage only

type DiskType

type DiskType int

func StrToDiskType

func StrToDiskType(diskType string) (DiskType, error)

type MemoryConfig

type MemoryConfig struct {
	TotalSize uint64 `json:"totalSize"`
}

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           []DiskConfig      `json:"disks"`
	Processors      []ProcessorConfig `json:"processors"`
	Memory          MemoryConfig      `json:"memory"`
	NetworkAdapters []NetworkConfig   `json:"networkAdapters"`
	PublicIP        string            `json:"publicIp"`
	PrivateIP       string            `json:"privateIp"`
	HeartbeatAge    time.Duration     `json:"heartbeatAge"`
	Location        string            `json:"location"`
}

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