server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UserID  = "userID"
	GroupID = "groupID"
)
View Source
const (
	TargetMGT    string = "MGT"
	TargetMDT    string = "MDT"
	TargetMGTMDT string = "MGTMDT"
	TargetOST    string = "OST"
)
View Source
const (
	BackFsLdiskfs string = "ldiskfs"
	BackFsZfs     string = "zfs"
)
View Source
const (
	VolumeGroupName   = "volumeGroupName"
	LogicalVolumeName = "logicalVolumeName"
)
View Source
const (
	RemoteStorageServiceId   = "NNFServer"
	RemoteStorageServicePort = 60050
)
View Source
const (
	StorageStatus_Starting StorageStatus = "starting"
	StorageStatus_Ready                  = "ready"
	StorageStatus_Error                  = "error"
	StorageStatus_Disabled               = "disabled"
)

Variables

View Source
var ErrServerControllerDisabled = fmt.Errorf("Server Controller Disabled")
View Source
var (
	FileSystemRegistry fileSystemRegistry
)

Functions

func Initialize

func Initialize() error

Types

type ConfigFile

type ConfigFile struct {
	Version  string
	Metadata struct {
		Name string
	}

	FileSystems []FileSystemConfig `yaml:"fileSystems"` // yaml sucks, and doesnt understand camelCase
}

type DefaultServerControllerProvider

type DefaultServerControllerProvider struct{}

func (DefaultServerControllerProvider) NewServerController

type DisabledServerController

type DisabledServerController struct{}

Server Controller API for when there is no server present, or the server is disabled

func (*DisabledServerController) Connected

func (*DisabledServerController) Connected() bool

func (*DisabledServerController) CreateFileSystem

func (*DisabledServerController) Delete

func (*DisabledServerController) DeleteFileSystem

func (*DisabledServerController) DeleteFileSystem(*Storage, FileSystemApi) error

func (*DisabledServerController) GetServerInfo

func (*DisabledServerController) GetServerInfo() ServerInfo

func (*DisabledServerController) GetStatus

func (*DisabledServerController) MountFileSystem

func (*DisabledServerController) NewStorage

func (*DisabledServerController) UnmountFileSystem

type FileSystem

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

FileSystem - Represents an abstract file system, with individual operations defined by the underlying FileSystemApi implementation

func (*FileSystem) LoadDeviceList

func (f *FileSystem) LoadDeviceList(devices []string)

func (*FileSystem) Unmount

func (f *FileSystem) Unmount(mountpoint string) error

type FileSystemApi

type FileSystemApi interface {
	New(oem FileSystemOem) (FileSystemApi, error)

	IsType(oem *FileSystemOem) bool // Returns true if the provided oem fields match the file system type, false otherwise
	IsMockable() bool               // Returns true if the file system can be instantiated by the mock server, false otherwise

	Type() string
	Name() string

	Create(devices []string, opts FileSystemOptions) error
	Delete() error

	VgChangeActivateDefault() string
	MkfsDefault() string

	Mount(mountpoint string) error
	Unmount(mountpoint string) error

	GenerateRecoveryData() map[string]string
	LoadRecoveryData(data map[string]string)
	LoadDeviceList(devices []string)
}

FileSystemApi - Defines the interface for interacting with various file systems supported by the NNF element controller.

type FileSystemConfig

type FileSystemConfig struct {
	Name       string
	Install    []FileSystemInstallConfig
	Operations []FileSystemOperationConfig
}

type FileSystemControllerApi

type FileSystemControllerApi interface {
	NewFileSystem(oem *FileSystemOem) (FileSystemApi, error)
}
var (
	FileSystemController FileSystemControllerApi
)

func NewFileSystemController

func NewFileSystemController(config *ConfigFile) FileSystemControllerApi

type FileSystemError

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

func (*FileSystemError) Error

func (e *FileSystemError) Error() string

func (*FileSystemError) Unwrap

func (e *FileSystemError) Unwrap() error

type FileSystemGfs2

type FileSystemGfs2 struct {
	FileSystemLvm

	Oem       FileSystemOemGfs2
	MkfsMount FileSystemOemMkfsMount
}

func (*FileSystemGfs2) Create

func (f *FileSystemGfs2) Create(devices []string, opts FileSystemOptions) (err error)

func (*FileSystemGfs2) IsMockable

func (*FileSystemGfs2) IsMockable() bool

func (*FileSystemGfs2) IsType

func (*FileSystemGfs2) IsType(oem *FileSystemOem) bool

func (*FileSystemGfs2) MkfsDefault

func (*FileSystemGfs2) MkfsDefault() string

func (*FileSystemGfs2) Mount

func (f *FileSystemGfs2) Mount(mountpoint string) error

func (*FileSystemGfs2) Name

func (f *FileSystemGfs2) Name() string

func (*FileSystemGfs2) New

func (*FileSystemGfs2) Type

func (*FileSystemGfs2) Type() string

func (*FileSystemGfs2) VgChangeActivateDefault

func (*FileSystemGfs2) VgChangeActivateDefault() string

type FileSystemInstallConfig

type FileSystemInstallConfig struct {
	Dist    string
	Command string
	Gpg     string
}

type FileSystemLustre

type FileSystemLustre struct {
	// Satisfy FileSystemApi interface.
	FileSystem

	TargetType string

	Oem       FileSystemOemLustre
	MkfsMount FileSystemOemMkfsMount
	ZfsArgs   FileSystemOemZfs
}

func (*FileSystemLustre) Create

func (f *FileSystemLustre) Create(devices []string, options FileSystemOptions) error

func (*FileSystemLustre) Delete

func (f *FileSystemLustre) Delete() error

func (*FileSystemLustre) GenerateRecoveryData

func (f *FileSystemLustre) GenerateRecoveryData() map[string]string

func (*FileSystemLustre) IsMockable

func (*FileSystemLustre) IsMockable() bool

func (*FileSystemLustre) IsType

func (*FileSystemLustre) IsType(oem *FileSystemOem) bool

func (*FileSystemLustre) LoadRecoveryData

func (f *FileSystemLustre) LoadRecoveryData(map[string]string)

func (*FileSystemLustre) MkfsDefault

func (f *FileSystemLustre) MkfsDefault() string

func (*FileSystemLustre) Mount

func (f *FileSystemLustre) Mount(mountpoint string) error

func (*FileSystemLustre) Name

func (f *FileSystemLustre) Name() string

func (*FileSystemLustre) New

func (*FileSystemLustre) Type

func (*FileSystemLustre) Type() string

func (*FileSystemLustre) VgChangeActivateDefault

func (f *FileSystemLustre) VgChangeActivateDefault() string

type FileSystemLvm

type FileSystemLvm struct {
	// Satisfy FileSystemApi interface.
	FileSystem

	CmdArgs FileSystemOemLvm
	// contains filtered or unexported fields
}

func (*FileSystemLvm) Create

func (f *FileSystemLvm) Create(devices []string, opts FileSystemOptions) error

func (*FileSystemLvm) Delete

func (f *FileSystemLvm) Delete() error

func (*FileSystemLvm) GenerateRecoveryData

func (f *FileSystemLvm) GenerateRecoveryData() map[string]string

func (*FileSystemLvm) IsMockable

func (*FileSystemLvm) IsMockable() bool

func (*FileSystemLvm) IsType

func (*FileSystemLvm) IsType(oem *FileSystemOem) bool

func (*FileSystemLvm) LoadRecoveryData

func (f *FileSystemLvm) LoadRecoveryData(data map[string]string)

func (*FileSystemLvm) MkfsDefault

func (f *FileSystemLvm) MkfsDefault() string

func (*FileSystemLvm) Mount

func (f *FileSystemLvm) Mount(mountpoint string) error

func (*FileSystemLvm) Name

func (f *FileSystemLvm) Name() string

func (*FileSystemLvm) New

func (*FileSystemLvm) Type

func (*FileSystemLvm) Type() string

func (*FileSystemLvm) VgChangeActivateDefault

func (f *FileSystemLvm) VgChangeActivateDefault() string

type FileSystemOem

type FileSystemOem struct {
	Type string `json:"Type"`
	Name string `json:"Name"`

	Lustre FileSystemOemLustre `json:"Lustre,omitempty"`
	Gfs2   FileSystemOemGfs2   `json:"Gfs2,omitempty"`

	LvmCmd    FileSystemOemLvm       `json:"Lvm,omitempty"`
	MkfsMount FileSystemOemMkfsMount `json:"MkfsMount,omitempty"`
	ZfsCmd    FileSystemOemZfs       `json:"Zfs,omitempty"`
}

File System OEM defines the structure that is expected to be included inside a Redfish / Swordfish FileSystemV122FileSystem

func (*FileSystemOem) IsEmpty

func (oem *FileSystemOem) IsEmpty() bool

func (*FileSystemOem) LoadDefaults

func (oem *FileSystemOem) LoadDefaults(fs FileSystemApi)

type FileSystemOemGfs2

type FileSystemOemGfs2 struct {
	ClusterName string `json:"ClusterName"`
}

type FileSystemOemLustre

type FileSystemOemLustre struct {
	MgsNode    string `json:"MgsNode,omitempty"`
	TargetType string `json:"TargetType"`
	Index      int    `json:"Index"`
	BackFs     string `json:"BackFs"`
}

type FileSystemOemLvm

type FileSystemOemLvm struct {
	// The pvcreate commandline, minus the "pvcreate" command.
	PvCreate string `json:"PvCreate,omitempty"`

	// The vgcreate commandline, minus the "vgcreate" command.
	VgCreate string `json:"VgCreate,omitempty"`

	// The lvcreate commandline, minus the "lvcreate" command.
	LvCreate string `json:"LvCreate,omitempty"`

	// The vgchange commandline, minus the "vgchange" command.
	VgChange FileSystemOemVgChange `json:"VgChange,omitempty"`

	// The vgremove commandline, minus the "vgremove" command.
	VgRemove string `json:"VgRemove,omitempty"`

	// The lvremove commandline, minus the "lvremove" command
	LvRemove string `json:"LvRemove,omitempty"`
}

type FileSystemOemMkfsMount

type FileSystemOemMkfsMount struct {
	// The mkfs commandline, minus the "mkfs" command itself.
	Mkfs string `json:"Mkfs,omitempty"`

	// Arguments for the mount-utils library.
	Mount []string `json:"Mount,omitempty"`
}

type FileSystemOemVgChange

type FileSystemOemVgChange struct {
	// The vgchange commandline, minus the "vgchange" command
	Activate string `json:"Activate,omitempty"`

	// The vgchange commandline, minus the "vgchange" command
	Deactivate string `json:"Deactivate,omitempty"`

	// The vgchange commandline, minus the "vgchange" command
	LockStart string `json:"Lockstart,omitempty"`
}

type FileSystemOemZfs

type FileSystemOemZfs struct {
	// The zpool create commandline, minus the "zpool create" command.
	ZpoolCreate string `json:"ZpoolCreate,omitempty"`
}

type FileSystemOperationConfig

type FileSystemOperationConfig struct {
	Label     string
	Command   string
	Arguments []string
	Options   []map[string]string
}

type FileSystemOptions

type FileSystemOptions = map[string]interface{}

type FileSystemRaw

type FileSystemRaw struct {
	FileSystemLvm
	// contains filtered or unexported fields
}

func (*FileSystemRaw) Create

func (f *FileSystemRaw) Create(devices []string, opts FileSystemOptions) error

func (*FileSystemRaw) IsType

func (*FileSystemRaw) IsType(oem *FileSystemOem) bool

func (*FileSystemRaw) Mount

func (f *FileSystemRaw) Mount(mountpoint string) error

func (*FileSystemRaw) New

func (*FileSystemRaw) Type

func (*FileSystemRaw) Type() string

type FileSystemXfs

type FileSystemXfs struct {
	FileSystemLvm

	MkfsMount FileSystemOemMkfsMount
}

FileSystemXfs establishes an XFS file system on an underlying LVM logical volume.

func (*FileSystemXfs) Create

func (f *FileSystemXfs) Create(devices []string, opts FileSystemOptions) (err error)

func (*FileSystemXfs) IsMockable

func (*FileSystemXfs) IsMockable() bool

func (*FileSystemXfs) IsType

func (*FileSystemXfs) IsType(oem *FileSystemOem) bool

func (*FileSystemXfs) MkfsDefault

func (f *FileSystemXfs) MkfsDefault() string

func (*FileSystemXfs) Mount

func (f *FileSystemXfs) Mount(mountpoint string) error

func (*FileSystemXfs) Name

func (f *FileSystemXfs) Name() string

func (*FileSystemXfs) New

func (*FileSystemXfs) Type

func (*FileSystemXfs) Type() string

type FileSystemZfs

type FileSystemZfs struct {
	// Satisfy FileSystemApi interface.
	FileSystem
}

func (*FileSystemZfs) Create

func (f *FileSystemZfs) Create(devices []string, options FileSystemOptions) error

func (*FileSystemZfs) Delete

func (f *FileSystemZfs) Delete() error

func (*FileSystemZfs) GenerateRecoveryData

func (f *FileSystemZfs) GenerateRecoveryData() map[string]string

func (*FileSystemZfs) IsMockable

func (*FileSystemZfs) IsMockable() bool

func (*FileSystemZfs) IsType

func (*FileSystemZfs) IsType(oem *FileSystemOem) bool

func (*FileSystemZfs) LoadRecoveryData

func (f *FileSystemZfs) LoadRecoveryData(map[string]string)

func (*FileSystemZfs) MkfsDefault

func (f *FileSystemZfs) MkfsDefault() string

func (*FileSystemZfs) Mount

func (f *FileSystemZfs) Mount(mountpoint string) error

func (*FileSystemZfs) Name

func (f *FileSystemZfs) Name() string

func (*FileSystemZfs) New

func (*FileSystemZfs) Type

func (*FileSystemZfs) Type() string

func (*FileSystemZfs) Unmount

func (f *FileSystemZfs) Unmount(mountpoint string) error

func (*FileSystemZfs) VgChangeActivateDefault

func (f *FileSystemZfs) VgChangeActivateDefault() string

type LocalServerController

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

func (*LocalServerController) Connected

func (c *LocalServerController) Connected() bool

func (*LocalServerController) CreateFileSystem

func (c *LocalServerController) CreateFileSystem(s *Storage, fs FileSystemApi, opts FileSystemOptions) error

func (*LocalServerController) Delete

func (c *LocalServerController) Delete(s *Storage) error

func (*LocalServerController) DeleteFileSystem

func (c *LocalServerController) DeleteFileSystem(s *Storage, fs FileSystemApi) error

func (*LocalServerController) Discover

func (c *LocalServerController) Discover(s *Storage) error

func (*LocalServerController) GetServerInfo

func (c *LocalServerController) GetServerInfo() ServerInfo

func (*LocalServerController) GetStatus

func (c *LocalServerController) GetStatus(s *Storage) (StorageStatus, error)

func (*LocalServerController) MountFileSystem

func (c *LocalServerController) MountFileSystem(s *Storage, fs FileSystemApi, mountPoint string) error

func (*LocalServerController) NewStorage

func (c *LocalServerController) NewStorage(pid uuid.UUID, expectedNamespaces []StorageNamespace) *Storage

func (*LocalServerController) UnmountFileSystem

func (c *LocalServerController) UnmountFileSystem(s *Storage, fs FileSystemApi, mountPoint string) error

type MockServerController

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

func (*MockServerController) Connected

func (c *MockServerController) Connected() bool

func (*MockServerController) CreateFileSystem

func (*MockServerController) CreateFileSystem(s *Storage, fs FileSystemApi, opts FileSystemOptions) error

func (*MockServerController) Delete

func (c *MockServerController) Delete(s *Storage) error

func (*MockServerController) DeleteFileSystem

func (*MockServerController) DeleteFileSystem(s *Storage, fs FileSystemApi) error

func (*MockServerController) GetServerInfo

func (m *MockServerController) GetServerInfo() ServerInfo

func (*MockServerController) GetStatus

func (*MockServerController) GetStatus(s *Storage) (StorageStatus, error)

func (*MockServerController) MountFileSystem

func (*MockServerController) MountFileSystem(s *Storage, fs FileSystemApi, mountpoint string) error

func (*MockServerController) NewStorage

func (c *MockServerController) NewStorage(pid uuid.UUID, expectedNamespaces []StorageNamespace) *Storage

func (*MockServerController) UnmountFileSystem

func (*MockServerController) UnmountFileSystem(s *Storage, fs FileSystemApi, mountpoint string) error

type MockServerControllerProvider

type MockServerControllerProvider struct{}

func (MockServerControllerProvider) NewServerController

type RemoteServerController

type RemoteServerController struct{}

Remote Server Controller defines a Server Controller API for a connected server that is not local to the running process. This contains many "do nothing" methods as management of storage, file systems, and related content is done "off-rabbit".

func (*RemoteServerController) Connected

func (c *RemoteServerController) Connected() bool

func (*RemoteServerController) CreateFileSystem

func (*RemoteServerController) Delete

func (c *RemoteServerController) Delete(s *Storage) error

func (*RemoteServerController) DeleteFileSystem

func (r *RemoteServerController) DeleteFileSystem(*Storage, FileSystemApi) error

func (*RemoteServerController) GetServerInfo

func (c *RemoteServerController) GetServerInfo() ServerInfo

func (*RemoteServerController) GetStatus

func (c *RemoteServerController) GetStatus(s *Storage) (StorageStatus, error)

func (*RemoteServerController) MountFileSystem

func (r *RemoteServerController) MountFileSystem(*Storage, FileSystemApi, string) error

func (*RemoteServerController) NewStorage

func (c *RemoteServerController) NewStorage(pid uuid.UUID, expectedNamespaces []StorageNamespace) *Storage

func (*RemoteServerController) UnmountFileSystem

func (r *RemoteServerController) UnmountFileSystem(*Storage, FileSystemApi, string) error

type ServerControllerApi

type ServerControllerApi interface {
	Connected() bool

	GetServerInfo() ServerInfo

	// Allocate a new Storage object to be managed by this controller
	NewStorage(uuid.UUID, []StorageNamespace) *Storage

	Delete(*Storage) error

	// Retrieve the status of the provided Storage object from the controller
	GetStatus(*Storage) (StorageStatus, error)

	CreateFileSystem(*Storage, FileSystemApi, FileSystemOptions) error
	DeleteFileSystem(*Storage, FileSystemApi) error
	MountFileSystem(*Storage, FileSystemApi, string) error
	UnmountFileSystem(*Storage, FileSystemApi, string) error
}

Server Controller API defines the interface for interacting with and controlling a Server in the Rabbit NNF topology. That is - A remote initiator endpoint or the local NNF server.

func NewDisabledServerController

func NewDisabledServerController() ServerControllerApi

func NewMockServerController

func NewMockServerController() ServerControllerApi

func NewRemoteServerController

func NewRemoteServerController(opts ServerControllerOptions) ServerControllerApi

type ServerControllerOptions

type ServerControllerOptions struct {
	Local   bool   // Set to true if the server controller is local to the running program
	Address string // IP Address of the Server
}

type ServerControllerProvider

type ServerControllerProvider interface {
	NewServerController(ServerControllerOptions) ServerControllerApi
}

type ServerInfo

type ServerInfo struct {
	LNetNids []string
}

type Storage

type Storage struct {
	// ID is the Pool ID identified by recovering the NVMe Namespace Metadata
	// for this particular namespace. The Pool ID is common for all namespaces
	// which are part of that storage pool.
	Id uuid.UUID
	// contains filtered or unexported fields
}

Storage represents a unique collection of Server Storage Volumes that are identified by a shared Storage Pool ID.

func (*Storage) CreateFileSystem

func (s *Storage) CreateFileSystem(fs FileSystemApi, opts FileSystemOptions) error

func (*Storage) Delete

func (s *Storage) Delete() error

func (*Storage) DeleteFileSystem

func (s *Storage) DeleteFileSystem(fs FileSystemApi) error

func (*Storage) Devices

func (s *Storage) Devices() []string

Returns the list of devices for this pool.

func (*Storage) GetStatus

func (s *Storage) GetStatus() (StorageStatus, error)

func (*Storage) MountFileSystem

func (s *Storage) MountFileSystem(fs FileSystemApi, mountPoint string) error

func (*Storage) UnmountFileSystem

func (s *Storage) UnmountFileSystem(fs FileSystemApi, mountPoint string) error

type StorageNamespace

type StorageNamespace struct {
	// The drive serial number
	SerialNumber string `json:"SerialNumber"`

	// The NVMe Namespace Identifer
	Id nvme.NamespaceIdentifier `json:"Id"`
	// contains filtered or unexported fields
}

Storage Namespace represents an NVMe Namespace present on the host.

type StoragePoolOem

type StoragePoolOem struct {
	Namespaces []StorageNamespace `json:"Namespaces"`
}

type StorageStatus

type StorageStatus string

func (StorageStatus) State

func (s StorageStatus) State() sf.ResourceState

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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