vsphere

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageImageDir = "images"
)
View Source
const (
	VixEToolsNotRunning = "(3016, 0)"
)

Variables

View Source
var (
	DetachAll = true

	FileForMinOS = map[string]os.FileMode{
		"/etc/hostname":    0644,
		"/etc/hosts":       0644,
		"/etc/resolv.conf": 0644,
	}

	SymLinkForMinOS = map[string]string{
		"/etc/mtab": "/proc/mounts",
	}

	// Here the permission of .tether should be drwxrwxrwt.
	// The sticky bit 't' is added when mounting the tmpfs in bootstrap
	DirForMinOS = map[string]os.FileMode{
		"/etc":         0755,
		"/lib/modules": 0755,
		"/proc":        0555,
		"/sys":         0555,
		"/run":         0755,
		"/.tether":     0777,
	}
)

Set to false for unit tests

Functions

func BuildArchiveURL

func BuildArchiveURL(op trace.Operation, disklabel, target string, fs *archive.FilterSpec, recurse, data bool) (string, error)

Parse Archive builds an archive url with disklabel, filtersec, recursive, and data booleans.

func GetToolboxClient

func GetToolboxClient(op trace.Operation, vm *vm.VirtualMachine, id string) (*toolbox.Client, error)

GetToolboxClient returns a toolbox client given a vm and id

func IsToolBoxStateChangeErr

func IsToolBoxStateChangeErr(err error) bool

IsToolBoxConflictErr checks for conflictError for online import

func VolumeJoin

func VolumeJoin(op trace.Operation, handle *exec.Handle, volume *storage.Volume, mountPath string, diskOpts map[string]string) (*exec.Handle, error)

Types

type ContainerStore

type ContainerStore struct {
	disk.Vmdk
	// contains filtered or unexported fields
}

ContainerStore stores container storage information

func NewContainerStore

func NewContainerStore(op trace.Operation, s *session.Session, imageResolver storage.Resolver) (*ContainerStore, error)

NewContainerStore creates and returns a new container store

func (*ContainerStore) Export

func (c *ContainerStore) Export(op trace.Operation, id, ancestor string, spec *archive.FilterSpec, data bool) (io.ReadCloser, error)

func (*ContainerStore) Import

func (c *ContainerStore) Import(op trace.Operation, id string, spec *archive.FilterSpec, tarstream io.ReadCloser) error

func (*ContainerStore) NewDataSink

func (c *ContainerStore) NewDataSink(op trace.Operation, id string) (storage.DataSink, error)

NewDataSink creates and returns an DataSink associated with container storage

func (*ContainerStore) NewDataSource

func (c *ContainerStore) NewDataSource(op trace.Operation, id string) (storage.DataSource, error)

NewDataSource creates and returns an DataSource associated with container storage

func (*ContainerStore) Owners

func (c *ContainerStore) Owners(op trace.Operation, url *url.URL, filter func(vm *mo.VirtualMachine) bool) ([]*vm.VirtualMachine, error)

Owners returns a list of VMs that are using the resource specified by `url`

func (*ContainerStore) URL

func (c *ContainerStore) URL(op trace.Operation, id string) (*url.URL, error)

URL converts the id of a resource to a URL

type ContainerStorer

type ContainerStorer interface {
	storage.Resolver
	storage.Importer
	storage.Exporter
}

ContainerStorer defines the interface contract expected to allow import and export against containers

type ImageStore

type ImageStore struct {
	disk.Vmdk
}

func NewImageStore

func NewImageStore(op trace.Operation, s *session.Session, u *url.URL) (*ImageStore, error)

func (*ImageStore) CreateImageStore

func (v *ImageStore) CreateImageStore(op trace.Operation, storeName string) (*url.URL, error)

func (*ImageStore) DeleteImage

func (v *ImageStore) DeleteImage(op trace.Operation, image *portlayer.Image) (*portlayer.Image, error)

DeleteImage deletes an image from the image store. If the image is in use either by way of inheritance or because it's attached to a container, this will return an error.

func (*ImageStore) DeleteImageStore

func (v *ImageStore) DeleteImageStore(op trace.Operation, storeName string) error

DeleteImageStore deletes the image store top level directory

func (*ImageStore) Export

func (i *ImageStore) Export(op trace.Operation, id, ancestor string, spec *archive.FilterSpec, data bool) (io.ReadCloser, error)

Export reads the delta between child and parent image layers, returning the difference as a tar archive.

id - must inherit from ancestor if ancestor is specified ancestor - the layer up the chain against which to diff spec - describes filters on paths found in the data (include, exclude, rebase, strip) data - set to true to include file data in the tar archive, false to include headers only

func (*ImageStore) GetImage

func (v *ImageStore) GetImage(op trace.Operation, store *url.URL, ID string) (*portlayer.Image, error)

func (*ImageStore) GetImageStore

func (v *ImageStore) GetImageStore(op trace.Operation, storeName string) (*url.URL, error)

GetImageStore checks to see if the image store exists on disk and returns an error or the store's URL.

func (*ImageStore) Import

func (i *ImageStore) Import(op trace.Operation, id string, spec *archive.FilterSpec, tarStream io.ReadCloser) error

func (*ImageStore) ListImageStores

func (v *ImageStore) ListImageStores(op trace.Operation) ([]*url.URL, error)

func (*ImageStore) ListImages

func (v *ImageStore) ListImages(op trace.Operation, store *url.URL, IDs []string) ([]*portlayer.Image, error)

func (*ImageStore) NewDataSink

func (i *ImageStore) NewDataSink(op trace.Operation, id string) (storage.DataSink, error)

NewDataSink creates and returns an DataSource associated with image storage

func (*ImageStore) NewDataSource

func (i *ImageStore) NewDataSource(op trace.Operation, id string) (storage.DataSource, error)

func (*ImageStore) Owners

func (v *ImageStore) Owners(op trace.Operation, url *url.URL, filter func(vm *mo.VirtualMachine) bool) ([]*vm.VirtualMachine, error)

Owners returns a list of VMs that are using the disk specified by `url`

func (*ImageStore) URL

func (v *ImageStore) URL(op trace.Operation, id string) (*url.URL, error)

URL returns a url to the disk image represented by `id` This is a "ds://" URL so cannot be used as input to most of the ImageStore methods that take URLs.

func (*ImageStore) WriteImage

func (v *ImageStore) WriteImage(op trace.Operation, parent *portlayer.Image, ID string, meta map[string][]byte, sum string,
	r io.Reader) (*portlayer.Image, error)

WriteImage creates a new image layer from the given parent. Eg parentImage + newLayer = new Image built from parent

parent - The parent image to create the new image from. ID - textual ID for the image to be written meta - metadata associated with the image Tag - the tag of the image to be written

type ToolboxDataSink

type ToolboxDataSink struct {
	ID    string
	VM    *vm.VirtualMachine
	Clean func()
}

ToolboxDataSink implements the DataSink interface for mounted devices

func (*ToolboxDataSink) Close

func (t *ToolboxDataSink) Close() error

func (*ToolboxDataSink) Import

func (t *ToolboxDataSink) Import(op trace.Operation, spec *archive.FilterSpec, data io.ReadCloser) error

Import writes `data` to the data sink associated with this DataSink

func (*ToolboxDataSink) Sink

func (t *ToolboxDataSink) Sink() interface{}

Sink returns the data sink associated with the DataSink

type ToolboxDataSource

type ToolboxDataSource struct {
	ID    string
	VM    *vm.VirtualMachine
	Clean func()
}

ToolboxDataSource implements the DataSource interface for mounted devices

func (*ToolboxDataSource) Close

func (t *ToolboxDataSource) Close() error

func (*ToolboxDataSource) Export

func (t *ToolboxDataSource) Export(op trace.Operation, spec *archive.FilterSpec, data bool) (io.ReadCloser, error)

Export reads data from the associated data source and returns it as a tar archive

func (*ToolboxDataSource) Source

func (t *ToolboxDataSource) Source() interface{}

Source returns the data source associated with the DataSource

func (*ToolboxDataSource) Stat

Stat returns file stats of the destination header determined but the filterspec inclusion path

type VolumeStore

type VolumeStore struct {
	disk.Vmdk

	// Service url to this VolumeStore
	SelfLink *url.URL
}

VolumeStore caches Volume references to volumes in the system.

func NewVolumeStore

func NewVolumeStore(op trace.Operation, storeName string, s *session.Session, ds *datastore.Helper) (*VolumeStore, error)

func (*VolumeStore) Export

func (v *VolumeStore) Export(op trace.Operation, id, ancestor string, spec *archive.FilterSpec, data bool) (io.ReadCloser, error)

Export reads the delta between child and parent volume layers, returning the difference as a tar archive.

store - the volume store containing the two layers id - must inherit from ancestor if ancestor is specified ancestor - the volume layer up the chain against which to diff spec - describes filters on paths found in the data (include, exclude, strip) data - set to true to include file data in the tar archive, false to include headers only

func (*VolumeStore) Import

func (v *VolumeStore) Import(op trace.Operation, id string, spec *archive.FilterSpec, tarstream io.ReadCloser) error

func (*VolumeStore) NewDataSink

func (v *VolumeStore) NewDataSink(op trace.Operation, id string) (storage.DataSink, error)

NewDataSource creates and returns an DataSource associated with container storage

func (*VolumeStore) NewDataSource

func (v *VolumeStore) NewDataSource(op trace.Operation, id string) (storage.DataSource, error)

NewDataSource creates and returns an DataSource associated with container storage

func (*VolumeStore) URL

func (v *VolumeStore) URL(op trace.Operation, id string) (*url.URL, error)

func (*VolumeStore) VolumeCreate

func (v *VolumeStore) VolumeCreate(op trace.Operation, ID string, store *url.URL, capacityKB uint64, info map[string][]byte) (*storage.Volume, error)

func (*VolumeStore) VolumeDestroy

func (v *VolumeStore) VolumeDestroy(op trace.Operation, vol *storage.Volume) error

func (*VolumeStore) VolumeGet

func (v *VolumeStore) VolumeGet(op trace.Operation, ID string) (*storage.Volume, error)

func (*VolumeStore) VolumesList

func (v *VolumeStore) VolumesList(op trace.Operation) ([]*storage.Volume, error)

Jump to

Keyboard shortcuts

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