vsphere

package
v0.0.0-...-6054725 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderName = "vsphere"

ProviderName of the cloud platform provider

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastores

type Datastores struct{}

Datastores provides access to VSphere's Datastores

func (*Datastores) CopyToBucket

func (s *Datastores) CopyToBucket(config *types.Config, archPath string) error

CopyToBucket converts the raw disk image to a monolithicFlat vmdk.

func (*Datastores) DeleteFromBucket

func (s *Datastores) DeleteFromBucket(config *types.Config, key string) error

DeleteFromBucket deletes key from config's bucket

type Vsphere

type Vsphere struct {
	Storage *Datastores
	// contains filtered or unexported fields
}

Vsphere Provider to interact with Vsphere infrastructure

func NewProvider

func NewProvider() *Vsphere

NewProvider Vsphere

func (*Vsphere) AttachVolume

func (v *Vsphere) AttachVolume(ctx *lepton.Context, image, name string, attachID int) error

AttachVolume attaches a volume to an instance

func (*Vsphere) BuildImage

func (v *Vsphere) BuildImage(ctx *lepton.Context) (string, error)

BuildImage to be upload on VSphere

func (*Vsphere) BuildImageWithPackage

func (v *Vsphere) BuildImageWithPackage(ctx *lepton.Context, pkgpath string) (string, error)

BuildImageWithPackage to upload on Vsphere.

func (*Vsphere) CreateImage

func (v *Vsphere) CreateImage(ctx *lepton.Context, imagePath string) error

CreateImage - Creates image on vsphere using nanos images This merely uploads the flat and base image to the datastore and then creates a copy of the image to perform the vmfs translation (import does not do this by default). This sidesteps the vmfkstools transformation.

func (*Vsphere) CreateInstance

func (v *Vsphere) CreateInstance(ctx *lepton.Context) error

CreateInstance - Creates instance on VSphere. Currently we support pvsci adapter && vmnetx3 network driver.

func (*Vsphere) CreateVolume

func (v *Vsphere) CreateVolume(ctx *lepton.Context, name, data, provider string) (lepton.NanosVolume, error)

CreateVolume converts local volume raw file to mkfs and uploads required files to datastore

func (*Vsphere) CustomizeImage

func (v *Vsphere) CustomizeImage(ctx *lepton.Context) (string, error)

CustomizeImage returns image path with adaptations needed by cloud provider

func (*Vsphere) DeleteImage

func (v *Vsphere) DeleteImage(ctx *lepton.Context, imagename string) error

DeleteImage deletes image from VSphere

func (*Vsphere) DeleteInstance

func (v *Vsphere) DeleteInstance(ctx *lepton.Context, instancename string) error

DeleteInstance deletes instance from VSphere

func (*Vsphere) DeleteVolume

func (v *Vsphere) DeleteVolume(ctx *lepton.Context, name string) (err error)

DeleteVolume deletes a volume on vsphere

func (*Vsphere) DetachVolume

func (v *Vsphere) DetachVolume(ctx *lepton.Context, image, name string) error

DetachVolume detaches a volume from an instance

func (*Vsphere) GetAllVolumes

func (v *Vsphere) GetAllVolumes(ctx *lepton.Context) (*[]lepton.NanosVolume, error)

GetAllVolumes returns volumes. Work in progress

func (*Vsphere) GetImages

func (v *Vsphere) GetImages(ctx *lepton.Context) ([]lepton.CloudImage, error)

GetImages return all images for vsphere

func (*Vsphere) GetInstanceByName

func (v *Vsphere) GetInstanceByName(ctx *lepton.Context, name string) (*lepton.CloudInstance, error)

GetInstanceByName returns instance with given name

func (*Vsphere) GetInstanceLogs

func (v *Vsphere) GetInstanceLogs(ctx *lepton.Context, instancename string) (string, error)

GetInstanceLogs gets instance related logs. govc datastore.tail -n 100 gtest/serial.out logs don't appear until you spin up the instance.

func (*Vsphere) GetInstances

func (v *Vsphere) GetInstances(ctx *lepton.Context) ([]lepton.CloudInstance, error)

GetInstances return all instances on vSphere

func (*Vsphere) GetStorage

func (v *Vsphere) GetStorage() lepton.Storage

GetStorage returns storage interface for cloud provider

func (*Vsphere) Initialize

func (v *Vsphere) Initialize(config *types.ProviderConfig) error

Initialize Vsphere related things

func (*Vsphere) ListImages

func (v *Vsphere) ListImages(ctx *lepton.Context) error

ListImages lists images on a datastore. This is incredibly naive at the moment and probably worth putting under a root folder. essentially does the equivalent of 'govc datastore.ls'

func (*Vsphere) ListInstances

func (v *Vsphere) ListInstances(ctx *lepton.Context) error

ListInstances lists instances on VSphere. It essentially does: govc ls /ha-datacenter/vm

func (*Vsphere) PrintInstanceLogs

func (v *Vsphere) PrintInstanceLogs(ctx *lepton.Context, instancename string, watch bool) error

PrintInstanceLogs writes instance logs to console

func (*Vsphere) RebootInstance

func (v *Vsphere) RebootInstance(ctx *lepton.Context, instanceName string) error

RebootInstance reboots the instance.

func (*Vsphere) ResizeImage

func (v *Vsphere) ResizeImage(ctx *lepton.Context, imagename string, hbytes string) error

ResizeImage is not supported on VSphere.

func (*Vsphere) StartInstance

func (v *Vsphere) StartInstance(ctx *lepton.Context, instancename string) error

StartInstance starts an instance in VSphere. It is the equivalent of: govc vm.power -on=true <instance_name>

func (*Vsphere) StopInstance

func (v *Vsphere) StopInstance(ctx *lepton.Context, instancename string) error

StopInstance stops an instance from VSphere It is the equivalent of: govc vm.power -on=false <instance_name>

func (*Vsphere) SyncImage

func (v *Vsphere) SyncImage(config *types.Config, target lepton.Provider, image string) error

SyncImage syncs image from provider to another provider

Jump to

Keyboard shortcuts

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