Skip to content

m-vinc/lvmclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LVMClient

This package aim to simplify interations with LVM while using Go. To do that we use lvmdbusd and the dbus package.

On ubuntu and debian you can install lvmdbusd :

$ apt install lvm2-dbusd

Then you're ready to go and use lvmclient :

myVolumeGroup, err := lvm.GetVolumeGroup(ctx, &lvmclient.GetVolumeGroupParams{Name: "my_volume_group"})
if err != nil {
    return nil, err
}

log.Printf("%+v", myVolumeGroup)

Actually the client does not support many operations but I'll add them while working with LVM :

type Client interface {
	GetVolumeGroup(ctx context.Context, params *GetVolumeGroupParams) (*VolumeGroup, error)
	GetVolumeGroups(ctx context.Context) ([]*VolumeGroup, error)
	GetLogicalVolumes(ctx context.Context, params *GetVolumeGroupParams) ([]*LogicalVolume, error)

	GetLogicalVolume(ctx context.Context, params *GetLogicalVolumeParams) (*LogicalVolume, error)
	ToggleLogicalVolume(ctx context.Context, params *GetLogicalVolumeParams, state bool) (bool, error)

	CreateLogicalVolume(ctx context.Context, params *CreateLogicalVolumeParams) (*LogicalVolume, error)
	RemoveLogicalVolume(ctx context.Context, params *GetLogicalVolumeParams) error
}

Contributions

If you found any bugs or you want to implement a missing new functions, don't hesitate to do a PR.

About

A simple lvmdbusd client in Go

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages