config

package
v0.0.0-...-ded4e1a Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (
	DiskType   = "disk"
	SSDType    = "ssd"
	PartType   = "part"
	DMPartType = "md"
	CryptType  = "crypt"
	LVMType    = "lvm"
)

Variables

View Source
var (
	/* default pathes */
	DefaultNedgePrefix = "/opt/nedge"
	CCOWJsonFile       = "/etc/ccow/ccow.json"
	CCOWDJsonFile      = "/etc/ccow/ccowd.json"
	RTRDJsonFile       = "/etc/ccow/rt-rd.json"
	RTLFSJsonFile      = "/etc/ccow/rt-lfs.json"
	RTKVSJsonFile      = "/etc/ccow/rt-kvs.json"

	CorosyncConfFile            = "/etc/corosync/corosync.conf"
	CorosyncConfExampleFile     = "/etc/corosync/corosync.conf.example"
	CorosyncConfIPv4ExampleFile = "/etc/corosync/corosync.conf.example.ipv4"

	FlexHashCheckpointFile = "/var/run/flexhash-checkpoint.json"

	AuditdIniFile        = "/etc/ccow/auditd.ini"
	AuditdIniFileExample = "/etc/ccow/auditd.ini.example"

	CcowdUnixSocketFile = "/var/run/sock/ccowd.sock"
)
View Source
var (
	BrokerCmd = &cobra.Command{
		Use:   "broker",
		Short: "reconfigure broker network",
		Long:  "configure broker network based on current settings",
		Run:   ConfigBrokerFnc,
	}
)
View Source
var (
	ConfigCmd = &cobra.Command{
		Use:     "config",
		Aliases: []string{"c"},
		Short:   "Node configuration operations",
		Long:    "Node configuration operations, e.g. via file, automatic, profile-based",
	}
)
View Source
var (
	ConfigurationFile = "/etc/config/nesetup.json"
)
View Source
var (
	FileCmd = &cobra.Command{
		Use:   "file [/path/to/setup.json]",
		Short: "configure via JSON file",
		Long:  "setup cluster node via JSON configurational file",
		Run:   ConfigFileFnc,
	}
)
View Source
var (
	NodeCmd = &cobra.Command{
		Use:   "node",
		Short: "configure cluster node",
		Long: "Setup cluster node be part of local site\n\nDisk Options:\n" +
			"  MDReserved         (rtrd)(int) override default reserved 60% Metadata of Offload SSD/NVMe capacity\n" +
			"  HDDReadAhead       (rtrd)(int) override default 256KB read-ahead for HDD\n" +
			"  LmdbPageSize       (both)(int) 4096, 8192, 16384 (default) or 32768\n" +
			"  LmdbMdPageSize     (both)(int) 4096, 8192, 16384 (default) or 32768\n" +
			"  UseBcache          (rtrd)(bool) enable use of read cache\n" +
			"  UseBcacheWB        (rtrd)(bool) enable use of write back cache (needs UseBcache)\n" +
			"  UseMetadataMask    (rtrd)(string) what guts needs to go to SSD and what not. See extended doc\n" +
			"  UseMetadataOffload (rtrd)(bool) when useAllSSD mode is false, enable metadata offload on SSD\n" +
			"  RtPlevelOverride   (both)(int) override automatic partitioning numbering logic\n" +
			"  DisableVerifyChid  (both)(bool) force RtVerifyChid be 0, that is to disable CHID verification\n" +
			"  RtVerifyChid       (both)(int) 0 (disabled), 1 (default, verify on write) or 2 (verify on read/write)\n" +
			"  NoSync             (both)(int) force Sync be 0, that is to I/O fully asyncrhonous\n" +
			"  Sync               (both)(int) 0 (async), 1 (default, data sync, journal async), 2 (all sync), 3 (sync durable)\n" +
			"  MaxSizeGB          (rtlfs)(int) maximum per directory size to utilize in gigabytes (default 0, use all available)",
		Run: ConfigNodeFnc,
	}
)
View Source
var (
	RoleCmd = &cobra.Command{
		Use:   "role",
		Short: "detect a role of target",
		Long:  "detect a role of target by reading bind-mounted nesetup.json when provided",
		Run:   DetectRoleFnc,
	}
)
View Source
var (
	ServerCmd = &cobra.Command{
		Use:   "server",
		Short: "reconfigure server network",
		Long:  "configure server (including broker) network based on current settings",
		Run:   ConfigServerFnc,
	}
)

Functions

func ConfigBrokerFnc

func ConfigBrokerFnc(cmd *cobra.Command, args []string)

func ConfigFileFnc

func ConfigFileFnc(cmd *cobra.Command, args []string)

func ConfigNode

func ConfigNode()

func ConfigNodeFnc

func ConfigNodeFnc(cmd *cobra.Command, args []string)

func ConfigServerFnc

func ConfigServerFnc(cmd *cobra.Command, args []string)

func CreateDirIfNotExist

func CreateDirIfNotExist(dir string)

func DetectMTU

func DetectMTU(ifname string) int

func DetectRoleFnc

func DetectRoleFnc(cmd *cobra.Command, args []string)

func GetAvailableDevices

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

func GetDeviceEmpty

func GetDeviceEmpty(device *LocalDisk) bool

check whether a device is completely empty

func GetDeviceFilesystems

func GetDeviceFilesystems(device string) (string, error)

get the file systems availab

func GetDeviceProperties

func GetDeviceProperties(device string) (map[string]string, error)

func GetDevicePropertiesFromPath

func GetDevicePropertiesFromPath(devicePath string) (map[string]string, error)

func GetDiskUUID

func GetDiskUUID(device string) (string, error)

look up the UUID for a disk.

func GetUdevInfo

func GetUdevInfo(device string) (map[string]string, error)

func ListDevices

func ListDevices() ([]string, error)

Types

type AuditdConf

type AuditdConf struct {
	IsAggregator int `json:"is_aggregator"`
}

type CcowConf

type CcowConf struct {
	Trlog   CcowTrlog   `json:"trlog,omitempty"`
	Tenant  CcowTenant  `json:"tenant"`
	Network CcowNetwork `json:"network"`
}

type CcowNetwork

type CcowNetwork struct {
	BrokerInterfaces string `json:"broker_interfaces"`
	ServerUnixSocket string `json:"server_unix_socket"`
	BrokerIP4addr    string `json:"broker_ip4addr,omitempty"`
	ServerIP4addr    string `json:"server_ip4addr,omitempty"`
	ServerPort       int    `json:"server_port,omitempty"`
	NoIP4Frag        int    `json:"no_ipfrag,omitempty"`
}

type CcowTenant

type CcowTenant struct {
	UnicastIO        int `json:"unicast_io"`
	FailureDomain    int `json:"failure_domain"`
	ReplicationCount int `json:"replication_count,omitempty"`
	SyncPut          int `json:"sync_put,omitempty"`
	SyncPutNamed     int `json:"sync_put_named,omitempty"`
	CommitWait       int `json:"sync_put_commit_wait"`
	ChunkSize        int `json:"chunkmap_chunk_size,omitempty"`
}

type CcowTrlog

type CcowTrlog struct {
	Interval   int `json:"interval,omitempty"`
	Quarantine int `json:"quarantine,omitempty"`
}

type CcowdBgConfig

type CcowdBgConfig struct {
	TrlogDeleteAfterHours     int `json:"trlog_delete_after_hours,omitempty"`
	SpeculativeBackrefTimeout int `json:"speculative_backref_timeout,omitempty"`
}

type CcowdConf

type CcowdConf struct {
	BgConfig  CcowdBgConfig `json:"repdev_bg_config,omitempty"`
	Zone      int           `json:"zone,omitempty"`
	Network   CcowdNetwork  `json:"network"`
	Transport []string      `json:"transport"`
}

type CcowdNetwork

type CcowdNetwork struct {
	ServerInterfaces string `json:"server_interfaces"`
	ServerUnixSocket string `json:"server_unix_socket"`
	ServerIP4addr    string `json:"server_ip4addr,omitempty"`
	ServerPort       int    `json:"server_port,omitempty"`
	NoIP4Frag        int    `json:"no_ipfrag,omitempty"`
}

type LocalDisk

type LocalDisk struct {
	// Name is the device name
	Name string `json:"name"`
	// Parent is the device parent's name
	Parent string `json:"parent"`
	// HasChildren is whether the device has a children device
	HasChildren bool `json:"hasChildren"`
	// DevLinks is the persistent device path on the host
	DevLinks string `json:"devLinks"`
	// Size is the device capacity in byte
	Size uint64 `json:"size"`
	// UUID is used by /dev/disk/by-uuid
	UUID string `json:"uuid"`
	// Serial is the disk serial used by /dev/disk/by-id
	Serial string `json:"serial"`
	// Type is disk type
	Type string `json:"type"`
	// Rotational is the boolean whether the device is rotational: true for hdd, false for ssd and nvme
	Rotational bool `json:"rotational"`
	// ReadOnly is the boolean whether the device is readonly
	Readonly bool `json:"readOnly"`
	// Partitions is a partition slice
	Partitions []Partition
	// Filesystem is the filesystem currently on the device
	Filesystem string `json:"filesystem"`
	// Vendor is the device vendor
	Vendor string `json:"vendor"`
	// Model is the device model
	Model string `json:"model"`
	// WWN is the world wide name of the device
	WWN string `json:"wwn"`
	// WWNVendorExtension is the WWN_VENDOR_EXTENSION from udev info
	WWNVendorExtension string `json:"wwnVendorExtension"`
	// Empty checks whether the device is completely empty
	Empty bool `json:"empty"`
}

LocalDevice contains information about an unformatted block device

func DetectLocalDisks

func DetectLocalDisks() (disks []LocalDisk, err error)

func DiscoverDevices

func DiscoverDevices() ([]*LocalDisk, error)

Discover all the details of devices available on the local node

func DiscoverDevicesPred

func DiscoverDevicesPred(pred func(*LocalDisk) bool) ([]*LocalDisk, error)

Discover all the details of devices available on the local node The predicate used to filter out unwanted entries

func ProbeDevices

func ProbeDevices(verbose bool) ([]LocalDisk, error)

type NodeConfig

type NodeConfig struct {
	Ccow            CcowConf     `json:"ccow"`
	Ccowd           CcowdConf    `json:"ccowd"`
	Auditd          AuditdConf   `json:"auditd"`
	IPv4Autodetect  int          `json:"ipv4_autodetect,omitempty"`
	RtlfsAutodetect string       `json:"rtlfs_autodetect,omitempty"`
	ClusterNodes    []string     `json:"cluster_nodes,omitempty"`
	Rtrd            RTDevices    `json:"rtrd"`
	RtrdSlaves      []RTDevices  `json:"rtrdslaves"`
	Rtlfs           RtlfsDevices `json:"rtlfs"`
	Rtkvs           RtkvsDevices `json:"rtkvs"`
	NodeType        string       `json:"nodeType"`
}

type Partition

type Partition struct {
	Name       string
	Size       uint64
	Label      string
	Filesystem string
	MountPoint string
}

func GetDevicePartitions

func GetDevicePartitions(device string) (partitions []Partition, unusedSpace uint64, err error)

type RTDevice

type RTDevice struct {
	Name                string `json:"name,omitempty"`
	Device              string `json:"device,omitempty"`
	Psize               int    `json:"psize,omitempty"`
	MdPsize             int    `json:"mdpsize,omitempty"`
	MdcacheReserved     int    `json:"mdcache_reserved,omitempty"`
	HddReadahead        int    `json:"hdd_readahead,omitempty"`
	VerifyChid          int    `json:"verify_chid"`
	Journal             string `json:"journal,omitempty"`
	Metadata            string `json:"metadata,omitempty"`
	Bcache              int    `json:"bcache,omitempty"`
	BcacheWritearound   int    `json:"bcache_writearound"`
	PlevelOverride      int    `json:"plevel_override,omitempty"`
	Sync                int    `json:"sync"`
	Detached            int    `json:"detached"`
	WalDisabled         int    `json:"wal_disabled,omitempty"`
	PayloadS3URL        string `json:"payload_s3_bucket_url,omitempty"`
	PayloadS3Region     string `json:"payload_s3_region,omitempty"`
	PayloadS3MinKb      int    `json:"payload_s3_min_kb,omitempty"`
	PayloadS3Capacity   int    `json:"payload_s3_capacity,omitempty"`
	PayloadS3Secret     string `json:"payload_s3_key_file,omitempty"`
	PayloadS3SyncGetMax int    `json:"payload_s3_sync_get_max,omitempty"`
}

func GetRTDevices

func GetRTDevices(nodeDisks []LocalDisk, rtParams *RTDeviceParams) (rtDevices []RTDevice, err error)

type RTDeviceParams

type RTDeviceParams struct {
	MDReserved         int    // override default 60%
	HDDReadAhead       int    // override default 256k
	DisableVerifyChid  bool   // force RtVerifyChid be 0
	NoSync             bool   // force Sync be 0
	RtVerifyChid       int    // 0 (disabled), 1 (verify on write) or 2(verify on read/write)
	LmdbPageSize       int    // 4096, 8192, 16384 or 32768
	LmdbMdPageSize     int    // 4096, 8192, 16384 or 32768
	MaxSizeGB          uint64 // 0 (use all available capacity), in gigabytes
	UseBcache          bool   // enable bcache
	UseBcacheWB        bool   // enable write back cache
	UseMetadataMask    string // what guts needs to go to SSD and what not
	UseMetadataOffload bool   // when useAllSSD is false, enable metadata offload on SSD
	UseAllSSD          bool   // only look for SSD/NVMe
	RtPlevelOverride   int    // if > 0, override automatic partitioning numbering logic
	Sync               int    // Consistency mode
	WalDisabled        int    // Write-Ahead-Log mode
}

func DefaultRTParams

func DefaultRTParams() (params *RTDeviceParams)

type RTDevices

type RTDevices struct {
	Devices []RTDevice `json:"devices,omitempty"`
}

type RtkvsDevice

type RtkvsDevice struct {
	Name           string `json:"name"`
	Path           string `json:"path"`
	JornalPath     string `json:"journal"`
	JournalMaxsize uint64 `json:"jenvsize,omitempty"`
	VerifyChid     int    `json:"verify_chid"`
	PlevelOverride int    `json:"plevel_override,omitempty"`
	Sync           int    `json:"sync"`
	WalDisabled    int    `json:"wal_disabled,omitempty"`
	ReadAhead      int    `json:"readahead"`
}

type RtkvsDevices

type RtkvsDevices struct {
	Backend string        `json:"backend"`
	Devices []RtkvsDevice `json:"devices"`
}

type RtlfsDevice

type RtlfsDevice struct {
	Name                string `json:"name"`
	Path                string `json:"path"`
	CheckMountpoint     int    `json:"check_mountpoint"`
	JournalMaxChunkSize int    `json:"journal_maxchunksize,omitempty"`
	Sync                int    `json:"sync"`
	Psize               int    `json:"psize,omitempty"`
	VerifyChid          int    `json:"verify_chid"`
	PlevelOverride      int    `json:"plevel_override,omitempty"`
	MaxSize             uint64 `json:"maxsize,omitempty"`
	WalDisabled         int    `json:"wal_disabled,omitempty"`
}

type RtlfsDevices

type RtlfsDevices struct {
	Devices []RtlfsDevice `json:"devices"`
}

Jump to

Keyboard shortcuts

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