vmdk

package
v0.0.0-...-5f55900 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFormat = errors.New("vmdk: invalid format (must be streamOptimized)")
)

Functions

func Import

func Import(ctx context.Context, c *vim25.Client, name string, datastore *object.Datastore, p ImportParams) error

Import uploads a local vmdk file specified by name to the given datastore.

Types

type ImportParams

type ImportParams struct {
	Path       string
	Logger     progress.Sinker
	Type       types.VirtualDiskType
	Force      bool
	Datacenter *object.Datacenter
	Pool       *object.ResourcePool
	Folder     *object.Folder
	Host       *object.HostSystem
}

ImportParams contains the set of optional params to the Import function. Note that "optional" may depend on environment, such as ESX or vCenter.

type Info

type Info struct {
	Header struct {
		MagicNumber uint32
		Version     uint32
		Flags       uint32
		Capacity    uint64
	}

	Capacity   uint64
	Size       int64
	Name       string
	ImportName string
}

Info is used to inspect a vmdk and generate an ovf template

func Stat

func Stat(name string) (*Info, error)

Stat looks at the vmdk header to make sure the format is streamOptimized and extracts the disk capacity required to properly generate the ovf descriptor.

func (*Info) OVF

func (di *Info) OVF() (string, error)

OVF returns an expanded descriptor template

type VirtualDiskInfo

type VirtualDiskInfo struct {
	CapacityInBytes int64
	DeviceKey       int32
	FileName        string
	Size            int64
	UniqueSize      int64
}

func GetVirtualDiskInfoByUUID

func GetVirtualDiskInfoByUUID(
	ctx context.Context,
	client *vim25.Client,
	mo mo.VirtualMachine,
	fetchProperties bool,
	diskUUID string) (VirtualDiskInfo, error)

GetVirtualDiskInfoByUUID returns information about a virtual disk identified by the provided UUID. This method is valid for the following backing types:

- VirtualDiskFlatVer2BackingInfo - VirtualDiskSeSparseBackingInfo - VirtualDiskRawDiskMappingVer1BackingInfo - VirtualDiskSparseVer2BackingInfo - VirtualDiskRawDiskVer2BackingInfo

These are the only backing types that have a UUID property for comparing the provided value.

Jump to

Keyboard shortcuts

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