Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exec ¶
type Exec interface { Run(prog string, args []string) error RunWithExitCode(prog string, args []string) (int, error) // for mountpoint querying Read(prog string, args []string) (stdout string, err error) ReadWithExitCode(prog string, args []string) (stdout string, rc int, err error) // for blkid querying Lookup(prog string) error Getuid() int // unit read/write injection ReadFile(fn string) ([]byte, error) WriteFile(fn string, c []byte, p os.FileMode) error MkdirAll(path string, perm os.FileMode) error Exists(path string) (bool, error) // Local Filesystem Functions EvalSymlinks(string) (string, error) }
Exec is interface to `real system` also used for test injections NB: should be reviewed, and possible refactored as base for all
processes/filesystem operrations, to make the easy mockable
NB: possoble split to ExecInterface, FilesystemInterface (possible also SystemInterface for Getuid) Related issue: https://github.com/asteris-llc/converge/issues/455
type LVM ¶
type LVM interface { // Check for LVM tools installed and useable Check() error // Check for mkfs.* tools installed and useable CheckFilesystemTools(fstype string) error QueryLogicalVolumes(vg string) (map[string]*LogicalVolume, error) QueryPhysicalVolumes() (map[string]*PhysicalVolume, error) QueryVolumeGroups() (map[string]*VolumeGroup, error) CreateVolumeGroup(vg string, devs []string) error ExtendVolumeGroup(vg string, dev string) error ReduceVolumeGroup(vg string, dev string) error CreatePhysicalVolume(dev string) error RemovePhysicalVolume(dev string, force bool) error CreateLogicalVolume(group string, volume string, size *LvmSize) error Mkfs(dev string, fstype string) error Mountpoint(path string) (bool, error) Blkid(dev string) (string, error) WaitForDevice(path string) error // systemd units CheckUnit(filename string, content string) (bool, error) UpdateUnit(filename string, content string) error StartUnit(filename string) error }
LVM is a public interface to LVM guts for converge highlevel modules
func MakeRealLVM ¶
MakeRealLVM is actually kludge for DI (intended for creating test-backed RealLVM, and unpublish type inself)
type LogicalVolume ¶
type LogicalVolume struct { Name string `mapstructure:"LVM2_LV_NAME"` DevicePath string `mapstructure:"LVM2_LV_DM_PATH"` }
LogicalVolume is parsed record for LVM Logical Volume (from `lvs` output) Add more fields, if required
type LvmSize ¶
LvmSize represent parsed and validated LVM compatible size
func (*LvmSize) CommandLine ¶
CommandLine return part of command line for calling LVM tools like lvcreate
type PhysicalVolume ¶
type PhysicalVolume struct { Name string `mapstructure:"LVM2_PV_NAME"` Group string `mapstructure:"LVM2_VG_NAME"` Device string }
PhysicalVolume is parsed record for LVM Physical Volume (from `pvs` output) Add more fields, if required
type VolumeGroup ¶
type VolumeGroup struct {
Name string `mapstructure:"LVM2_VG_NAME"`
}
VolumeGroup is parsed record for LVM Volume Groups (from `vgs` output) Add more fields, if required (at the moment we need only LVM2_VG_NAME to get list all existing groups)