Documentation
¶
Index ¶
- Constants
- func BuildDrives(vm *models.MicroVM, opts DriveOptions) (models.Drives, error)
- func GenerateNetworkConfig(vm *models.MicroVM) (string, error)
- func GuestDeviceName(index int) string
- func PIDReadFromFile(pidFile string, fs afero.Fs) (int, error)
- func PIDWriteToFile(pid int, pidFile string, fs afero.Fs) error
- func RemoveStaleSockets(fs afero.Fs, paths ...string) error
- func ResolveImageFile(root, filename string) (string, error)
- func ResolveSocketPath(fs afero.Fs, path, legacyPath string) string
- type DriveOptions
- type MachineMetrics
- type Metrics
Constants ¶
const (
// CloudInitDriveID is the id of the drive that holds the cloud-init image.
CloudInitDriveID = "cloud-init"
)
Variables ¶
This section is empty.
Functions ¶
func BuildDrives ¶ added in v0.16.0
BuildDrives returns the drives of a microvm in the order the guest sees them: the root volume, the cloud-init image if there is one, then the additional volumes in the order of the spec. A virtiofs volume is not a block device and gets no drive.
The path of a drive is empty until its volume has been mounted.
func GenerateNetworkConfig ¶
GenerateNetworkConfig will generate the cloud-init network config from the vm spec.
func GuestDeviceName ¶ added in v0.16.0
GuestDeviceName returns the name that the guest gives to the virtio block device at the index, counting from zero: vda to vdz, then vdaa, vdab and so on. It returns an empty string for a negative index.
func RemoveStaleSockets ¶ added in v0.15.2
RemoveStaleSockets removes any of the given socket files that exist, so a VMM can bind to them on (re)create.
func ResolveImageFile ¶ added in v0.15.2
ResolveImageFile returns the host path of filename within the image mounted at root, which must be an absolute path. Symlinks are followed as if root were the filesystem root, so the result never escapes the mount. The result must be a regular file.
func ResolveSocketPath ¶ added in v0.15.2
ResolveSocketPath returns the socket path for a process that is already running. That's path, unless only legacyPath exists, which means the process was started before sockets moved out of the state directory. Legacy fallback for #1226, to be removed in the next minor release.
Types ¶
type DriveOptions ¶ added in v0.16.0
type DriveOptions struct {
// CloudInitImage is the location on the host of the cloud-init image.
// When it is set, the image is presented read-only as the drive after the
// root volume.
CloudInitImage string
}
DriveOptions holds what differs between providers when the drives of a microvm are worked out.
type MachineMetrics ¶
type MachineMetrics struct {
Namespace string `json:"Namespace"`
MachineName string `json:"MachineName"`
MachineUID string `json:"MachineUID"`
Data Metrics `json:"Data"`
}
func (MachineMetrics) ToPrometheus ¶
func (mm MachineMetrics) ToPrometheus() []byte