vmdkops

package
v0.0.0-...-96d2ce7 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

README

GO module for client-side vmdk operations

This is client-side (Guest VM) GO module communicating over vSockets to VMDK service (on ESX Host) to request VMDK attach/detach/create/delete ops

The service code is in ../esx_service

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EsxPort int

EsxPort used to connect to ESX, passed in as command line param

Functions

This section is empty.

Types

type EsxVmdkCmd

type EsxVmdkCmd struct {
	Mtx *sync.Mutex // For serialization of Run comand/response
}

EsxVmdkCmd struct - empty , we use it only to implement VmdkCmdRunner interface

func (EsxVmdkCmd) Run

func (vmdkCmd EsxVmdkCmd) Run(cmd string, name string, opts map[string]string) ([]byte, error)

Run command Guest VM requests on ESX via vmdkops_serv.py listening on vSocket * * For each request: * - Establishes a vSocket connection * - Sends json string up to ESX * - waits for reply and returns resulting JSON or an error

type MockVmdkCmd

type MockVmdkCmd struct{}

MockVmdkCmd struct

func NewMockCmd

func NewMockCmd() MockVmdkCmd

NewMockCmd returns a new instance of MockVmdkCmd.

func (MockVmdkCmd) Run

func (mockCmd MockVmdkCmd) Run(cmd string, name string, opts map[string]string) ([]byte, error)

Run returns JSON responses to each command or an error

type VmdkCmdRunner

type VmdkCmdRunner interface {
	Run(cmd string, name string, opts map[string]string) ([]byte, error)
}

VmdkCmdRunner interface for sending Vmdk Commands to an ESX server.

type VmdkOps

type VmdkOps struct {
	Cmd VmdkCmdRunner // see *_vmdkcmd.go for implementations.
}

VmdkOps struct

func (VmdkOps) Attach

func (v VmdkOps) Attach(name string, opts map[string]string) (*fs.VolumeDevSpec, error)

Attach attaches a volume and returns the disk's VolumeDevSpec.

func (VmdkOps) Create

func (v VmdkOps) Create(name string, opts map[string]string) error

Create a volume

func (VmdkOps) Detach

func (v VmdkOps) Detach(name string, opts map[string]string) error

Detach a volume

func (VmdkOps) Get

func (v VmdkOps) Get(name string) (map[string]interface{}, error)

Get for volume

func (VmdkOps) List

func (v VmdkOps) List() ([]VolumeData, error)

List all volumes

func (VmdkOps) RawAttach

func (v VmdkOps) RawAttach(name string, opts map[string]string) ([]byte, error)

RawAttach attaches a volume and returns `[]byte` representing the raw response string.

func (VmdkOps) Remove

func (v VmdkOps) Remove(name string, opts map[string]string) error

Remove a volume

type VolumeData

type VolumeData struct {
	Name       string
	Attributes map[string]string
}

VolumeData we return to the caller

type VolumeInfo

type VolumeInfo struct {
	Name    string            `json:"Name"`
	Options map[string]string `json:"Opts,omitempty"`
}

VolumeInfo we get about the volume from upstairs

Jump to

Keyboard shortcuts

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