Documentation ¶
Index ¶
- Constants
- func AddMountsFromConfig(config *types.Config) error
- func AddVirtfsShares(config *types.Config) error
- func FindBridgedIP(instanceID string) string
- func FindBridgedIPByPID(pid string) string
- func GetVolumes(dir string, query map[string]string) ([]lepton.NanosVolume, error)
- type OnPrem
- func (op *OnPrem) AttachVolume(ctx *lepton.Context, instanceName string, volumeName string, attachID int) error
- func (p *OnPrem) BuildImage(ctx *lepton.Context) (string, error)
- func (p *OnPrem) BuildImageWithPackage(ctx *lepton.Context, pkgpath string) (string, error)
- func (p *OnPrem) CreateImage(ctx *lepton.Context, imagePath string) error
- func (p *OnPrem) CreateInstance(ctx *lepton.Context) error
- func (p *OnPrem) CreateInstancePID(ctx *lepton.Context) (string, error)
- func (op *OnPrem) CreateVolume(ctx *lepton.Context, cv types.CloudVolume, data, provider string) (lepton.NanosVolume, error)
- func (p *OnPrem) CustomizeImage(ctx *lepton.Context) (string, error)
- func (p *OnPrem) DeleteImage(ctx *lepton.Context, imagename string) error
- func (p *OnPrem) DeleteInstance(ctx *lepton.Context, instancename string) error
- func (op *OnPrem) DeleteVolume(ctx *lepton.Context, name string) error
- func (op *OnPrem) DetachVolume(ctx *lepton.Context, instanceName string, volumeName string) error
- func (op *OnPrem) GetAllVolumes(ctx *lepton.Context) (*[]lepton.NanosVolume, error)
- func (p *OnPrem) GetImages(ctx *lepton.Context, search string) (images []lepton.CloudImage, err error)
- func (p *OnPrem) GetInstanceByName(ctx *lepton.Context, name string) (*lepton.CloudInstance, error)
- func (p *OnPrem) GetInstanceLogs(ctx *lepton.Context, instancename string) (string, error)
- func (p *OnPrem) GetInstances(ctx *lepton.Context) (instances []lepton.CloudInstance, err error)
- func (p *OnPrem) GetMetaInstanceByName(ctx *lepton.Context, name string) (*instance, error)
- func (p *OnPrem) GetMetaInstances(ctx *lepton.Context) (instances []instance, err error)
- func (p *OnPrem) GetStorage() lepton.Storage
- func (p *OnPrem) Initialize(config *types.ProviderConfig) error
- func (p *OnPrem) InstanceStats(ctx *lepton.Context, iname string, watch bool) error
- func (p *OnPrem) ListImages(ctx *lepton.Context, filter string) error
- func (p *OnPrem) ListInstances(ctx *lepton.Context) error
- func (p *OnPrem) PrintInstanceLogs(ctx *lepton.Context, instancename string, watch bool) error
- func (p *OnPrem) RebootInstance(ctx *lepton.Context, instancename string) error
- func (p *OnPrem) ResizeImage(ctx *lepton.Context, imagename string, hbytes string) error
- func (p *OnPrem) StartInstance(ctx *lepton.Context, instancename string) error
- func (p *OnPrem) StopInstance(ctx *lepton.Context, instancename string) error
- func (p *OnPrem) SyncImage(config *types.Config, target lepton.Provider, image string) error
Constants ¶
const ( Byte = 1 << (iota * 10) KiByte MiByte GiByte TiByte PiByte EiByte )
IEC Sizes. kibis of bits
const ( IByte = 1 KByte = IByte * 1000 MByte = KByte * 1000 GByte = MByte * 1000 TByte = GByte * 1000 PByte = TByte * 1000 EByte = PByte * 1000 )
SI Sizes.
const ( // MinimumVolumeSize is the minimum size of a volume created with mkfs (1 MB). MinimumVolumeSize = MByte )
const ProviderName = "onprem"
ProviderName of the cloud platform provider
Variables ¶
This section is empty.
Functions ¶
func AddMountsFromConfig ¶
AddMountsFromConfig adds RunConfig.Mounts to image from existing Mounts to simulate attach/detach volume locally
func AddVirtfsShares ¶
AddVirtfsShares sets up RunConfig.VirtfsShares for the hypervisor
func FindBridgedIP ¶
FindBridgedIP returns the ip for an instance by forcing arp resolution. You should probably use the other function that takes a pid though.
super hacky mac extraction, arp resolution; revisit in future could also potentially extract from logs || could have nanos ping upon boot
func FindBridgedIPByPID ¶
FindBridgedIPByPID finds a qemu process with the pid and returns the ip.
func GetVolumes ¶
GetVolumes get nanos volume using filter TODO might be better to interface this
Types ¶
type OnPrem ¶
type OnPrem struct{}
OnPrem Provider to interact with OnPrem infrastructure
func (*OnPrem) AttachVolume ¶
func (op *OnPrem) AttachVolume(ctx *lepton.Context, instanceName string, volumeName string, attachID int) error
AttachVolume attaches volume to instance on `ops instance create -t onprem` or `ops run --mounts` on `ops image create --mount`, it simply creates a mount path with the given volume label label can refer to volume UUID or volume label
You must start the instance with QMP otherwise this won't work. { "RunConfig": { "QMP": true } }
this currently requires instance name to be unique
func (*OnPrem) BuildImage ¶
BuildImage for onprem
func (*OnPrem) BuildImageWithPackage ¶
BuildImageWithPackage for onprem
func (*OnPrem) CreateImage ¶
CreateImage on prem assumes local for now
func (*OnPrem) CreateInstance ¶
CreateInstance on premise assumes local
func (*OnPrem) CreateInstancePID ¶
CreateInstancePID creates an instance and returns the pid.
func (*OnPrem) CreateVolume ¶
func (op *OnPrem) CreateVolume(ctx *lepton.Context, cv types.CloudVolume, data, provider string) (lepton.NanosVolume, error)
CreateVolume creates volume for onprem image
func (*OnPrem) CustomizeImage ¶
CustomizeImage for onprem as stub to satisfy interface
func (*OnPrem) DeleteImage ¶
DeleteImage on premise
func (*OnPrem) DeleteInstance ¶
DeleteInstance from on premise
func (*OnPrem) DeleteVolume ¶
DeleteVolume deletes nanos-managed volume (filename and symlink)
func (*OnPrem) DetachVolume ¶
DetachVolume detaches volume
func (*OnPrem) GetAllVolumes ¶
GetAllVolumes prints list of all onprem nanos-managed volumes
func (*OnPrem) GetImages ¶
func (p *OnPrem) GetImages(ctx *lepton.Context, search string) (images []lepton.CloudImage, err error)
GetImages return all images on prem
func (*OnPrem) GetInstanceByName ¶
GetInstanceByName returns instance with given name
func (*OnPrem) GetInstanceLogs ¶
GetInstanceLogs for onprem instance logs
func (*OnPrem) GetInstances ¶
GetInstances return all instances on prem
func (*OnPrem) GetMetaInstanceByName ¶
GetMetaInstanceByName returns onprem metadata about a given named instance.
func (*OnPrem) GetMetaInstances ¶
GetMetaInstances returns instance data for onprem metadata found in ~/.ops/instances .
func (*OnPrem) GetStorage ¶
GetStorage returns storage interface for cloud provider
func (*OnPrem) Initialize ¶
func (p *OnPrem) Initialize(config *types.ProviderConfig) error
Initialize on prem provider
func (*OnPrem) InstanceStats ¶
InstanceStats shows metrics for instance onprem .
func (*OnPrem) ListImages ¶
ListImages on premise
func (*OnPrem) ListInstances ¶
ListInstances on premise
func (*OnPrem) PrintInstanceLogs ¶
PrintInstanceLogs writes instance logs to console
func (*OnPrem) RebootInstance ¶
RebootInstance from on premise
func (*OnPrem) ResizeImage ¶
ResizeImage resizes the lcoal image imagename. You should never specify a negative size.
func (*OnPrem) StartInstance ¶
StartInstance from on premise right now this assumes it was paused; not a boot; there's another call we can use here to get the status first
func (*OnPrem) StopInstance ¶
StopInstance from on premise