Documentation
¶
Overview ¶
Package storageeff is VirtoMir's storage efficiency (D15, ADR-0074): ZFS compression and deduplication per pool (with the RAM warning dedup deserves), storage tiers as labels on pools that disks move between, and NVMe/TCP namespaces that become pools. It drives zfs, zpool and nvme through a Runner, so every command is tested without them installed. NVMe/TCP is experimental: not tested on hardware.
Index ¶
- Constants
- Variables
- func Connect(ctx context.Context, r Runner, store *Store, t Target) error
- func Disconnect(ctx context.Context, r Runner, store *Store, nqn string) error
- func Reconnect(ctx context.Context, r Runner, store *Store) []error
- func SetZFS(ctx context.Context, r Runner, dataset string, s ZFSSettings) error
- type Exec
- type Namespace
- type Runner
- type Store
- type Subsystem
- type Target
- type TiersShared
- type ZFSEfficiency
- type ZFSSettings
Constants ¶
const DedupRAMWarning = "" /* 313-byte string literal not displayed */
DedupRAMWarning is why dedup needs a second thought.
Variables ¶
var ( ErrInvalid = errors.New("invalid") ErrNotFound = errors.New("not found") )
Errors for the API.
var Tiers = []string{"nvme", "ssd", "hdd"}
Tiers are labels for pools by speed; disks move to a tier by moving to its pool.
Functions ¶
func Disconnect ¶
Disconnect disconnects a subsystem; its namespaces disappear from this host.
Types ¶
type Namespace ¶
type Namespace struct {
Device string `json:"device"` // /dev/nvme0n1
NSID int `json:"nsid"`
SizeBytes uint64 `json:"sizeBytes"`
Model string `json:"model"`
Serial string `json:"serial"`
}
Namespace is a block device of a connected subsystem.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store keeps -state-dir/storageeff.json.
func (*Store) Adopt ¶
func (s *Store) Adopt(sh TiersShared) (bool, error)
Adopt takes over a member's tiers when they are newer; it reports whether it did.
func (*Store) NVMeTargets ¶
NVMeTargets are the subsystems to connect at start.
func (*Store) Shared ¶
func (s *Store) Shared() TiersShared
Shared returns the tiers with their version.
type Subsystem ¶
type Subsystem struct {
NQN string `json:"nqn"`
Transport string `json:"transport"` // tcp, pcie, …
Address string `json:"address,omitempty"` // traddr=…,trsvcid=…
State string `json:"state"` // live, connecting, …
Namespaces []Namespace `json:"namespaces"`
// Managed: VirtoMir connected it (and connects it again at start).
Managed bool `json:"managed"`
}
Subsystem is a connected NVMe subsystem with its paths and namespaces.
type Target ¶
type Target struct {
Portal string `json:"portal"` // the target's IP address
Port int `json:"port,omitempty"` // default 4420
NQN string `json:"nqn"`
}
Target is an NVMe/TCP subsystem at a portal.
type TiersShared ¶
type TiersShared struct {
}
TiersShared is the versioned pool → tier map members exchange (newest version wins): pools of the same name on different hosts are the same kind of storage.
type ZFSEfficiency ¶
type ZFSEfficiency struct {
Dataset string `json:"dataset"`
Compression string `json:"compression"`
CompressRatio float64 `json:"compressRatio"`
Dedup string `json:"dedup"`
// DedupRatio is the whole zpool's: ZFS only counts deduplication per pool.
DedupRatio float64 `json:"dedupRatio"`
UsedBytes uint64 `json:"usedBytes"`
LogicalUsedBytes uint64 `json:"logicalUsedBytes"`
SavedBytes uint64 `json:"savedBytes"` // what compression saves: logical minus used
}
ZFSEfficiency is what compression and deduplication save on a dataset (a libvirt zfs pool's source; its zvols inherit the settings).
func InspectZFS ¶
InspectZFS reads a dataset's compression and dedup settings and what they save.
type ZFSSettings ¶
type ZFSSettings struct {
Compression string `json:"compression,omitempty"`
Dedup string `json:"dedup,omitempty"`
// AcknowledgeDedupRAM: turning dedup on needs this, after reading what it costs.
AcknowledgeDedupRAM bool `json:"acknowledgeDedupRam,omitempty"`
}
ZFSSettings changes a dataset; empty fields stay as they are.