vm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerManager

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

func NewDockerManager

func NewDockerManager() (*DockerManager, error)

func (*DockerManager) Create

func (d *DockerManager) Create() error

func (*DockerManager) CreateAndStart

func (d *DockerManager) CreateAndStart() error

func (*DockerManager) CreateAndStartAndInjectionPublicKey

func (d *DockerManager) CreateAndStartAndInjectionPublicKey(publicKey string) error

func (*DockerManager) Destroy

func (d *DockerManager) Destroy() error

Destroy delete container

func (*DockerManager) GetAccessPort

func (d *DockerManager) GetAccessPort() int

func (*DockerManager) GetIp

func (d *DockerManager) GetIp() (string, error)

query container ip address

func (*DockerManager) InjectionPublicKey

func (d *DockerManager) InjectionPublicKey(publicKey string) error

InjectionPublicKey add the public key to the container

func (*DockerManager) Reboot

func (d *DockerManager) Reboot() error

func (*DockerManager) SetTemplate

func (d *DockerManager) SetTemplate(t Template)

func (*DockerManager) Shutdown

func (d *DockerManager) Shutdown() error

func (*DockerManager) Start

func (d *DockerManager) Start() error

StartContainer running containers in the background

func (*DockerManager) Status

func (d *DockerManager) Status() (*Status, error)

func (*DockerManager) Stop

func (d *DockerManager) Stop() error

type Manager

type Manager interface {
	// SetTemplate  config template
	SetTemplate(t Template)
	// Create create the virtual machine
	Create() error
	// Start start the virtual machine
	Start() error
	// CreateAndStart create and start
	CreateAndStart() error
	// CreateAndStartAndInjectionPublicKey start and inject public key
	CreateAndStartAndInjectionPublicKey(publicKey string) error
	// Stop shut down the virtual machine
	Stop() error
	// Reboot restart the virtual machine
	Reboot() error
	// Shutdown shut down the virtual machine
	Shutdown() error
	// Destroy destroy the virtual machine
	Destroy() error
	// InjectionPublicKey Inject publicKey (vm implementation and docker implementation timing are different)
	InjectionPublicKey(publicKey string) error
	// Status view status
	Status() (*Status, error)

	// GetIp get runtime ip
	GetIp() (string, error)
	// GetAccessPort get runtime port
	GetAccessPort() int
}

Manager virtualized interface

type Status

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

func (*Status) IsRunning

func (s *Status) IsRunning() bool

IsRunning is it running

type Template

type Template struct {
	Cpu, Memory, Dist uint64
	Name              string
	System            string
	PublicKey         string
	Image             string
}

type VirtManager

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

VirtManager virtual machine management client

func NewVirtManager

func NewVirtManager() (*VirtManager, error)

NewVirtManager create virtManager

func (*VirtManager) Create

func (v *VirtManager) Create() error

Create 创建

func (*VirtManager) CreateAndStart

func (v *VirtManager) CreateAndStart() error

CreateAndStart create and start

func (*VirtManager) CreateAndStartAndInjectionPublicKey

func (v *VirtManager) CreateAndStartAndInjectionPublicKey(publicKey string) error

func (*VirtManager) Destroy

func (v *VirtManager) Destroy() error

Destroy destroy the virtual machine

func (*VirtManager) GetAccessPort

func (v *VirtManager) GetAccessPort() int

GetAccessPort get runtime port

func (*VirtManager) GetIp

func (v *VirtManager) GetIp() (string, error)

GetIp get runtime ip

func (*VirtManager) InjectionPublicKey

func (v *VirtManager) InjectionPublicKey(publicKey string) error

InjectionPublicKey injection publickey (The timing of vm implementation and docker implementation are different)

func (*VirtManager) Reboot

func (v *VirtManager) Reboot() error

Reboot restart the virtual machine

func (*VirtManager) SetTemplate

func (v *VirtManager) SetTemplate(t Template)

func (*VirtManager) Shutdown

func (v *VirtManager) Shutdown() error

Shutdown shut down the virtual machine

func (*VirtManager) Start

func (v *VirtManager) Start() error

Start start the virtual machine

func (*VirtManager) Status

func (v *VirtManager) Status() (*Status, error)

Status View status

func (*VirtManager) Stop

func (v *VirtManager) Stop() error

Stop shut down the virtual machine

Jump to

Keyboard shortcuts

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