ovfutils

package
v0.0.0-...-110224e Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMemoryInMB

func GetMemoryInMB(virtualHardware *ovf.VirtualHardwareSection) (int64, error)

GetMemoryInMB returns memory size in MB from OVF virtualHardware section. If there are multiple elements defining memory for the same virtual system, the first memory element will be used.

func GetNumberOfCPUs

func GetNumberOfCPUs(virtualHardware *ovf.VirtualHardwareSection) (int64, error)

GetNumberOfCPUs returns number of CPUs in from virtualHardware section. If multiple CPUs are defined, the first one will be returned.

func GetOSId

func GetOSId(ovfDescriptor *ovf.Envelope) (string, error)

GetOSId returns OS ID from OVF descriptor, or error if OS ID could not be retrieved.

func GetVirtualHardwareSection

func GetVirtualHardwareSection(virtualSystem *ovf.VirtualSystem) (*ovf.VirtualHardwareSection, error)

GetVirtualHardwareSection returns VirtualHardwareSection from OVF VirtualSystem

func GetVirtualHardwareSectionFromDescriptor

func GetVirtualHardwareSectionFromDescriptor(ovfDescriptor *ovf.Envelope) (*ovf.VirtualHardwareSection, error)

GetVirtualHardwareSectionFromDescriptor returns VirtualHardwareSection from OVF descriptor

func GetVirtualSystem

func GetVirtualSystem(ovfDescriptor *ovf.Envelope) (*ovf.VirtualSystem, error)

GetVirtualSystem returns VirtualSystem element from OVF descriptor envelope

Types

type ByteCapacity

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

ByteCapacity assists with interpreting and converting quantities related to bytes.

func Parse

func Parse(quantity int64, unit string) (*ByteCapacity, error)

Parse interprets a human-friendly description of a byte quantity. Units can be represented as a name, abbreviation, or with scientific notation. All of the following are valid ways to represent the gigabyte unit:

  • GB
  • gigabyte
  • gigabytes
  • byte * 2^30

Values are calculated in binary: 1 GB is 2^30 bytes.

For more info on programmatic units, see: https://www.dmtf.org/sites/default/files/standards/documents/DSP0004_2.7.pdf

func (*ByteCapacity) ToGB

func (b *ByteCapacity) ToGB() int

ToGB converts to gigabytes by dividing by 1024^3. Remainders are always rounded up.

func (*ByteCapacity) ToMB

func (b *ByteCapacity) ToMB() int

ToMB converts to megabytes by dividing by 1024^2. Remainders are always rounded up.

type DiskInfo

type DiskInfo struct {
	FilePath string
	SizeInGB int
}

DiskInfo holds information about virtual disks in an OVF package

func GetDiskInfos

func GetDiskInfos(virtualHardware *ovf.VirtualHardwareSection, diskSection *ovf.DiskSection,
	references *[]ovf.File) ([]DiskInfo, error)

GetDiskInfos returns disk info about disks in a virtual appliance. The first file is boot disk.

func GetOVFDescriptorAndDiskPaths

func GetOVFDescriptorAndDiskPaths(ovfDescriptorLoader domain.OvfDescriptorLoaderInterface,
	ovfGcsPath string) (*ovf.Envelope, []DiskInfo, error)

GetOVFDescriptorAndDiskPaths loads OVF descriptor from GCS folder location. It returns descriptor object and full paths to disk files, including ovfGcsPath.

type OsInfo

type OsInfo struct {
	OsType string
	// contains filtered or unexported fields
}

OsInfo holds OS information for OVF import and export

func GetOSInfoForInspectionResults

func GetOSInfoForInspectionResults(ir *pb.InspectionResults) (*OsInfo, int16)

GetOSInfoForInspectionResults builds OS info from inspection results

type OvfDescriptorLoader

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

OvfDescriptorLoader is responsible for loading OVF descriptor from a GCS directory path.

func NewOvfDescriptorLoader

func NewOvfDescriptorLoader(sc domain.StorageClientInterface) *OvfDescriptorLoader

NewOvfDescriptorLoader creates new OvfDescriptorLoader

func (*OvfDescriptorLoader) Load

func (l *OvfDescriptorLoader) Load(ovfGcsPath string) (*ovf.Envelope, error)

Load finds and loads OVF descriptor from a GCS directory path. ovfGcsPath is a path to OVF directory, not a path to OVF descriptor file itself.

type OvfValidator

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

OvfValidator is responsible for validating OVF packages

func NewOvfValidator

func NewOvfValidator(
	storageClient domain.StorageClientInterface) *OvfValidator

NewOvfValidator creates a new OvfValidator

func (*OvfValidator) ValidateOvfPackage

func (v *OvfValidator) ValidateOvfPackage(
	ovfDescriptor *ovf.Envelope, ovfGcsPath string) (*ovf.Envelope, error)

ValidateOvfPackage validates OVF package. This includes checking that references to resources in GCS exist.

Jump to

Keyboard shortcuts

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