guestman

package
v0.3.10-0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 72 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QGA_LOCK_TIMEOUT = time.Second * 5
	QGA_EXEC_TIMEOUT = time.Second * 10
)
View Source
const (
	VNC_PORT_BASE           = 5900
	GUEST_RUNNING           = compute.VM_RUNNING
	GUEST_BLOCK_STREAM      = compute.VM_BLOCK_STREAM
	GUEST_BLOCK_STREAM_FAIL = compute.VM_BLOCK_STREAM_FAIL
	GUEST_SUSPEND           = compute.VM_SUSPEND
	GUSET_STOPPED           = "stopped"
	GUEST_NOT_FOUND         = "notfound"
)
View Source
const (
	STATE_FILE_PREFIX             = "STATEFILE"
	MONITOR_PORT_BASE             = 55900
	LIVE_MIGRATE_PORT_BASE        = 4396
	BUILT_IN_NBD_SERVER_PORT_BASE = 7777
	MAX_TRY                       = 3
)
View Source
const (
	OS_NAME_LINUX   = qemu.OS_NAME_LINUX
	OS_NAME_WINDOWS = qemu.OS_NAME_WINDOWS
	OS_NAME_MACOS   = qemu.OS_NAME_MACOS
	OS_NAME_ANDROID = qemu.OS_NAME_ANDROID
	OS_NAME_VMWARE  = qemu.OS_NAME_VMWARE
	OS_NAME_CIRROS  = qemu.OS_NAME_CIRROS
	OS_NAME_OPENWRT = qemu.OS_NAME_OPENWRT

	MODE_READLINE = qemu.MODE_READLINE
	MODE_CONTROL  = qemu.MODE_CONTROL

	DISK_DRIVER_VIRTIO = qemu.DISK_DRIVER_VIRTIO
	DISK_DRIVER_SCSI   = qemu.DISK_DRIVER_SCSI
	DISK_DRIVER_PVSCSI = qemu.DISK_DRIVER_PVSCSI
	DISK_DRIVER_IDE    = qemu.DISK_DRIVER_IDE
	DISK_DRIVER_SATA   = qemu.DISK_DRIVER_SATA
)

Variables

View Source
var (
	LAST_USED_PORT            = 0
	LAST_USED_NBD_SERVER_PORT = 0
	LAST_USED_MIGRATE_PORT    = 0
	NbdWorker                 = appsrv.NewWorkerManager("nbd_worker", 1, appsrv.DEFAULT_BACKLOG, false)
)

Functions

func GetMemorySnapshotPath

func GetMemorySnapshotPath(serverId, instanceSnapshotId string) string

func Init

func Init(host hostutils.IHost, serversPath string)

func IsMacInGuestConfig

func IsMacInGuestConfig(guestConfig *compute.SImportGuestDesc, mac string) bool

func Stop

func Stop()

Types

type IGuestTasks

type IGuestTasks interface {
	Start(func(...error))
}

type MirrorJob

type MirrorJob int

func (MirrorJob) InProcess

func (ms MirrorJob) InProcess() bool

func (MirrorJob) IsFailed

func (ms MirrorJob) IsFailed() bool

func (MirrorJob) IsSucc

func (ms MirrorJob) IsSucc() bool

type SBaseParms

type SBaseParms struct {
	Sid  string
	Body jsonutils.JSONObject
}

type SCancelBlockJobs

type SCancelBlockJobs struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewCancelBlockJobsTask

func NewCancelBlockJobsTask(ctx context.Context, guest *SKVMGuestInstance) *SCancelBlockJobs

func (*SCancelBlockJobs) Start

func (task *SCancelBlockJobs) Start()

func (*SCancelBlockJobs) StartCancelBlockJobs

func (task *SCancelBlockJobs) StartCancelBlockJobs(drivers []string)

type SDeleteDiskSnapshot

type SDeleteDiskSnapshot struct {
	Sid             string
	DeleteSnapshot  string
	Disk            storageman.IDisk
	ConvertSnapshot string
	PendingDelete   bool
}

type SDestPrepareMigrate

type SDestPrepareMigrate struct {
	Sid               string
	ServerUrl         string
	QemuVersion       string
	SourceQemuCmdline string
	MigrateCerts      map[string]string
	EnableTLS         bool
	SnapshotsUri      string
	DisksUri          string
	// TargetStorageId string
	TargetStorageIds []string
	LiveMigrate      bool
	RebaseDisks      bool

	Desc             *desc.SGuestDesc
	DisksBackingFile jsonutils.JSONObject
	SrcSnapshots     jsonutils.JSONObject

	MemorySnapshotsUri string
	SrcMemorySnapshots []string

	UserCred mcclient.TokenCredential
}

type SDiskBackup

type SDiskBackup struct {
	Sid        string
	SnapshotId string
	BackupId   string
	Disk       storageman.IDisk
}

type SDiskSnapshot

type SDiskSnapshot struct {
	UserCred   mcclient.TokenCredential
	Sid        string
	SnapshotId string
	Disk       storageman.IDisk
}

type SDriveMirrorTask

type SDriveMirrorTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewDriveMirrorTask

func NewDriveMirrorTask(
	ctx context.Context, s *SKVMGuestInstance, nbdUri, syncMode string,
	blockReplication bool, onSucc func(),
) *SDriveMirrorTask

func (*SDriveMirrorTask) Start

func (s *SDriveMirrorTask) Start()

type SDriverMirror

type SDriverMirror struct {
	Sid          string
	NbdServerUri string
	Desc         *desc.SGuestDesc
}

type SEsxiAccessInfo

type SEsxiAccessInfo struct {
	Datastore  vcenter.SVCenterAccessInfo
	HostIp     string
	GuestExtId string
}

type SGuestBlockIoThrottleTask

type SGuestBlockIoThrottleTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func (*SGuestBlockIoThrottleTask) Start

func (task *SGuestBlockIoThrottleTask) Start() error

type SGuestCreateFromEsxi

type SGuestCreateFromEsxi struct {
	Sid            string
	GuestDesc      *desc.SGuestDesc
	EsxiAccessInfo SEsxiAccessInfo
}

type SGuestCreateFromLibvirt

type SGuestCreateFromLibvirt struct {
	Sid         string
	MonitorPath string
	GuestDesc   *desc.SGuestDesc
	DisksPath   *jsonutils.JSONDict
}

type SGuestDeploy

type SGuestDeploy struct {
	UserCred mcclient.TokenCredential

	Sid    string
	Body   jsonutils.JSONObject
	IsInit bool
}

type SGuestDiskSnapshotTask

type SGuestDiskSnapshotTask struct {
	*SGuestReloadDiskTask
	// contains filtered or unexported fields
}

func NewGuestDiskSnapshotTask

func NewGuestDiskSnapshotTask(
	ctx context.Context, s *SKVMGuestInstance, disk storageman.IDisk, snapshotId string,
) *SGuestDiskSnapshotTask

func (*SGuestDiskSnapshotTask) Start

func (s *SGuestDiskSnapshotTask) Start()

type SGuestDiskSyncTask

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

func NewGuestDiskSyncTask

func NewGuestDiskSyncTask(guest *SKVMGuestInstance, delDisks, addDisks []*desc.SGuestDisk, cdroms []*desc.SGuestCdrom, floppys []*desc.SGuestFloppy) *SGuestDiskSyncTask

func (*SGuestDiskSyncTask) OnChangeCdromContentSucc

func (d *SGuestDiskSyncTask) OnChangeCdromContentSucc(cdrom *desc.SGuestCdrom)

func (*SGuestDiskSyncTask) OnChangeFloppyContentSucc

func (d *SGuestDiskSyncTask) OnChangeFloppyContentSucc(floppy *desc.SGuestFloppy)

func (*SGuestDiskSyncTask) OnEjectCdromContentSucc

func (d *SGuestDiskSyncTask) OnEjectCdromContentSucc(cdName string)

func (*SGuestDiskSyncTask) OnEjectFloppyContentSucc

func (d *SGuestDiskSyncTask) OnEjectFloppyContentSucc(flName string)

func (*SGuestDiskSyncTask) Start

func (d *SGuestDiskSyncTask) Start(callback func(...error))

type SGuestHotplugCpuMem

type SGuestHotplugCpuMem struct {
	Sid         string
	AddCpuCount int64
	AddMemSize  int64
}

type SGuestHotplugCpuMemTask

type SGuestHotplugCpuMemTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestHotplugCpuMemTask

func NewGuestHotplugCpuMemTask(
	ctx context.Context, s *SKVMGuestInstance, addCpuCount, addMemSize int,
) *SGuestHotplugCpuMemTask

func (*SGuestHotplugCpuMemTask) Start

func (task *SGuestHotplugCpuMemTask) Start()

First at all add cpu count, second add mem size

type SGuestIoThrottle

type SGuestIoThrottle struct {
	Sid  string
	BPS  int64
	IOPS int64
}

type SGuestIsolatedDeviceSyncTask

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

func NewGuestIsolatedDeviceSyncTask

func NewGuestIsolatedDeviceSyncTask(guest *SKVMGuestInstance, delDevs, addDevs []*desc.SGuestIsolatedDevice) *SGuestIsolatedDeviceSyncTask

func (*SGuestIsolatedDeviceSyncTask) Start

func (t *SGuestIsolatedDeviceSyncTask) Start(cb func(...error))

type SGuestLiveChangeDisk

type SGuestLiveChangeDisk struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestLiveChangeDiskTask

func NewGuestLiveChangeDiskTask(ctx context.Context, guest *SKVMGuestInstance, params *SStorageCloneDisk) (*SGuestLiveChangeDisk, error)

func (*SGuestLiveChangeDisk) Start

func (t *SGuestLiveChangeDisk) Start()

type SGuestLiveMigrateTask

type SGuestLiveMigrateTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestLiveMigrateTask

func NewGuestLiveMigrateTask(
	ctx context.Context, guest *SKVMGuestInstance, params *SLiveMigrate,
) *SGuestLiveMigrateTask

func (*SGuestLiveMigrateTask) Start

func (s *SGuestLiveMigrateTask) Start()

type SGuestManager

type SGuestManager struct {
	ServersPath      string
	Servers          *sync.Map
	CandidateServers map[string]*SKVMGuestInstance
	UnknownServers   *sync.Map
	ServersLock      *sync.Mutex

	GuestStartWorker *appsrv.SWorkerManager
	// contains filtered or unexported fields
}

func GetGuestManager

func GetGuestManager() *SGuestManager

func NewGuestManager

func NewGuestManager(host hostutils.IHost, serversPath string) *SGuestManager

func (*SGuestManager) Bootstrap

func (m *SGuestManager) Bootstrap() chan struct{}

func (*SGuestManager) CPUSet

func (*SGuestManager) CPUSetRemove

func (m *SGuestManager) CPUSetRemove(ctx context.Context, sid string) error

func (*SGuestManager) CanMigrate

func (m *SGuestManager) CanMigrate(sid string) bool

func (*SGuestManager) CancelBlockJobs

func (m *SGuestManager) CancelBlockJobs(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) CleanServer

func (m *SGuestManager) CleanServer(sid string)

func (*SGuestManager) ClenaupCpuset

func (m *SGuestManager) ClenaupCpuset()

func (*SGuestManager) CloseForward

func (*SGuestManager) CpusetBalance

func (m *SGuestManager) CpusetBalance(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

delay cpuset balance

func (*SGuestManager) Delete

func (m *SGuestManager) Delete(sid string) (*SKVMGuestInstance, error)

func (*SGuestManager) DeleteSnapshot

func (m *SGuestManager) DeleteSnapshot(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) DestPrepareMigrate

func (m *SGuestManager) DestPrepareMigrate(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) DoDeleteMemorySnapshot

func (m *SGuestManager) DoDeleteMemorySnapshot(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) DoMemorySnapshot

func (m *SGuestManager) DoMemorySnapshot(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) DoResetMemorySnapshot

func (m *SGuestManager) DoResetMemorySnapshot(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) DoSnapshot

func (m *SGuestManager) DoSnapshot(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) ExitGuestCleanup

func (m *SGuestManager) ExitGuestCleanup()

func (*SGuestManager) GenerateDescFromXml

func (m *SGuestManager) GenerateDescFromXml(libvirtConfig *compute.SLibvirtHostConfig) (jsonutils.JSONObject, error)

func (*SGuestManager) GetFreePortByBase

func (m *SGuestManager) GetFreePortByBase(basePort int) int

func (*SGuestManager) GetFreeVncPort

func (m *SGuestManager) GetFreeVncPort() int

func (*SGuestManager) GetGuestNicDesc

func (m *SGuestManager) GetGuestNicDesc(
	mac, ip, port, bridge string, isCandidate bool,
) (*desc.SGuestDesc, *desc.SGuestNetwork)

func (*SGuestManager) GetHost

func (m *SGuestManager) GetHost() hostutils.IHost

func (*SGuestManager) GetLiveMigrateFreePort

func (m *SGuestManager) GetLiveMigrateFreePort() int

func (*SGuestManager) GetNBDServerFreePort

func (m *SGuestManager) GetNBDServerFreePort() int

func (*SGuestManager) GetServer

func (m *SGuestManager) GetServer(sid string) (*SKVMGuestInstance, bool)

func (*SGuestManager) GetUnknownServer

func (m *SGuestManager) GetUnknownServer(sid string) (*SKVMGuestInstance, bool)

func (*SGuestManager) GuestCreate

func (m *SGuestManager) GuestCreate(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) GuestCreateFromEsxi

func (m *SGuestManager) GuestCreateFromEsxi(
	ctx context.Context, params interface{},
) (jsonutils.JSONObject, error)

func (*SGuestManager) GuestCreateFromLibvirt

func (m *SGuestManager) GuestCreateFromLibvirt(
	ctx context.Context, params interface{},
) (jsonutils.JSONObject, error)

func (*SGuestManager) GuestDeploy

func (m *SGuestManager) GuestDeploy(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

Delay process

func (*SGuestManager) GuestIoThrottle

func (m *SGuestManager) GuestIoThrottle(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) GuestStart

func (*SGuestManager) GuestStop

func (m *SGuestManager) GuestStop(ctx context.Context, sid string, timeout int64) error

func (*SGuestManager) GuestSuspend

func (m *SGuestManager) GuestSuspend(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) GuestSync

func (m *SGuestManager) GuestSync(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) HotplugCpuMem

func (m *SGuestManager) HotplugCpuMem(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) InitQemuMaxCpus

func (m *SGuestManager) InitQemuMaxCpus(machineCaps []monitor.MachineInfo, kvmMaxCpus uint)

func (*SGuestManager) InitQemuMaxMems

func (m *SGuestManager) InitQemuMaxMems(maxMems uint)

func (*SGuestManager) IsGuestDir

func (m *SGuestManager) IsGuestDir(f os.FileInfo) bool

func (*SGuestManager) IsGuestExist

func (m *SGuestManager) IsGuestExist(sid string) bool

func (*SGuestManager) LibvirtDomainDiskToDiskConfig

func (m *SGuestManager) LibvirtDomainDiskToDiskConfig(
	domainDisks []libvirtxml.DomainDisk) ([]compute.SImportDisk, error)

func (*SGuestManager) LibvirtDomainInterfaceToNicConfig

func (m *SGuestManager) LibvirtDomainInterfaceToNicConfig(
	domainInterfaces []libvirtxml.DomainInterface) ([]compute.SImportNic, error)

func (*SGuestManager) LibvirtDomainToGuestDesc

func (m *SGuestManager) LibvirtDomainToGuestDesc(domain *libvirtxml.Domain) (*compute.SImportGuestDesc, error)

Read key infomation from domain xml

func (*SGuestManager) ListForward

func (*SGuestManager) LiveChangeDisk

func (m *SGuestManager) LiveChangeDisk(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) LiveMigrate

func (m *SGuestManager) LiveMigrate(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) LoadExistingGuests

func (m *SGuestManager) LoadExistingGuests()

func (*SGuestManager) LoadServer

func (m *SGuestManager) LoadServer(sid string)

func (*SGuestManager) Monitor

func (m *SGuestManager) Monitor(sid, cmd string, qmp bool, callback func(string)) error

func (*SGuestManager) OnLoadExistingGuestsComplete

func (m *SGuestManager) OnLoadExistingGuestsComplete()

func (*SGuestManager) OnVerifyExistingGuestsFail

func (m *SGuestManager) OnVerifyExistingGuestsFail(err error, pendingDelete bool)

func (*SGuestManager) OnVerifyExistingGuestsSucc

func (m *SGuestManager) OnVerifyExistingGuestsSucc(servers []jsonutils.JSONObject, pendingDelete bool)

func (*SGuestManager) OnlineResizeDisk

func (m *SGuestManager) OnlineResizeDisk(ctx context.Context, sid string, diskId string, sizeMb int64) (jsonutils.JSONObject, error)

func (*SGuestManager) OpenForward

func (*SGuestManager) PrepareCreate

func (m *SGuestManager) PrepareCreate(sid string) error

func (*SGuestManager) PrepareDeploy

func (m *SGuestManager) PrepareDeploy(sid string) error

func (*SGuestManager) PrepareImportFromLibvirt

func (m *SGuestManager) PrepareImportFromLibvirt(
	ctx context.Context, params interface{},
) (jsonutils.JSONObject, error)

func (*SGuestManager) QemuLogDir

func (m *SGuestManager) QemuLogDir() string

func (*SGuestManager) QgaCommand

func (m *SGuestManager) QgaCommand(cmd *monitor.Command, sid string) (string, error)

func (*SGuestManager) QgaGuestPing

func (m *SGuestManager) QgaGuestPing(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) QgaGuestSetPassword

func (m *SGuestManager) QgaGuestSetPassword(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) ReloadDiskSnapshot

func (m *SGuestManager) ReloadDiskSnapshot(
	ctx context.Context, params interface{},
) (jsonutils.JSONObject, error)

func (*SGuestManager) RemoveCandidateServer

func (m *SGuestManager) RemoveCandidateServer(server *SKVMGuestInstance)

func (*SGuestManager) RequestVerifyDirtyServer

func (m *SGuestManager) RequestVerifyDirtyServer(s *SKVMGuestInstance)

func (*SGuestManager) Resume

func (m *SGuestManager) Resume(ctx context.Context, sid string, isLiveMigrate bool, cleanTLS bool) (jsonutils.JSONObject, error)

func (*SGuestManager) SaveServer

func (m *SGuestManager) SaveServer(sid string, s *SKVMGuestInstance)

func (*SGuestManager) ShutdownServers

func (m *SGuestManager) ShutdownServers()

func (*SGuestManager) SrcPrepareMigrate

func (m *SGuestManager) SrcPrepareMigrate(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) StartCpusetBalancer

func (m *SGuestManager) StartCpusetBalancer()

func (*SGuestManager) StartDriveMirror

func (m *SGuestManager) StartDriveMirror(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) Status

func (m *SGuestManager) Status(sid string) string

func (*SGuestManager) StatusWithBlockJobsCount

func (m *SGuestManager) StatusWithBlockJobsCount(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) StorageCloneDisk

func (m *SGuestManager) StorageCloneDisk(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SGuestManager) VerifyExistingGuests

func (m *SGuestManager) VerifyExistingGuests(pendingDelete bool)

type SGuestNetworkSyncTask

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

func NewGuestNetworkSyncTask

func NewGuestNetworkSyncTask(
	guest *SKVMGuestInstance, delNics, addNics []*desc.SGuestNetwork,
) *SGuestNetworkSyncTask

func (*SGuestNetworkSyncTask) Start

func (n *SGuestNetworkSyncTask) Start(callback func(...error))

type SGuestOnlineResizeDiskTask

type SGuestOnlineResizeDiskTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestOnlineResizeDiskTask

func NewGuestOnlineResizeDiskTask(
	ctx context.Context, s *SKVMGuestInstance, diskId string, sizeMB int64,
) *SGuestOnlineResizeDiskTask

func (*SGuestOnlineResizeDiskTask) OnGetBlocksSucc

func (task *SGuestOnlineResizeDiskTask) OnGetBlocksSucc(blocks []monitor.QemuBlock)

func (*SGuestOnlineResizeDiskTask) OnResizeSucc

func (task *SGuestOnlineResizeDiskTask) OnResizeSucc(err string)

func (*SGuestOnlineResizeDiskTask) Start

func (task *SGuestOnlineResizeDiskTask) Start()

type SGuestReloadDiskTask

type SGuestReloadDiskTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestReloadDiskTask

func NewGuestReloadDiskTask(
	ctx context.Context, s *SKVMGuestInstance, disk storageman.IDisk,
) *SGuestReloadDiskTask

func (*SGuestReloadDiskTask) Start

func (s *SGuestReloadDiskTask) Start()

func (*SGuestReloadDiskTask) WaitSnapshotReplaced

func (s *SGuestReloadDiskTask) WaitSnapshotReplaced(callback func()) error

type SGuestResumeTask

type SGuestResumeTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestResumeTask

func NewGuestResumeTask(ctx context.Context, s *SKVMGuestInstance, isTimeout bool, cleanTLS bool) *SGuestResumeTask

func (*SGuestResumeTask) GetStateFilePath

func (s *SGuestResumeTask) GetStateFilePath() string

func (*SGuestResumeTask) SetGetTaskData

func (s *SGuestResumeTask) SetGetTaskData(f func() (jsonutils.JSONObject, error))

func (*SGuestResumeTask) Start

func (s *SGuestResumeTask) Start()

func (*SGuestResumeTask) Stop

func (s *SGuestResumeTask) Stop()

type SGuestSnapshotDeleteTask

type SGuestSnapshotDeleteTask struct {
	*SGuestReloadDiskTask
	// contains filtered or unexported fields
}

func NewGuestSnapshotDeleteTask

func NewGuestSnapshotDeleteTask(
	ctx context.Context, s *SKVMGuestInstance, disk storageman.IDisk,
	deleteSnapshot, convertSnapshot string, pendingDelete bool,
) *SGuestSnapshotDeleteTask

func (*SGuestSnapshotDeleteTask) Start

func (s *SGuestSnapshotDeleteTask) Start()

type SGuestStopTask

type SGuestStopTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestStopTask

func NewGuestStopTask(guest *SKVMGuestInstance, ctx context.Context, timeout int64) *SGuestStopTask

func (*SGuestStopTask) CheckGuestRunningLater

func (s *SGuestStopTask) CheckGuestRunningLater()

func (*SGuestStopTask) Start

func (s *SGuestStopTask) Start()

type SGuestStorageCloneDiskTask

type SGuestStorageCloneDiskTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestStorageCloneDiskTask

func NewGuestStorageCloneDiskTask(ctx context.Context, guest *SKVMGuestInstance, params *SStorageCloneDisk) *SGuestStorageCloneDiskTask

func (*SGuestStorageCloneDiskTask) Start

func (t *SGuestStorageCloneDiskTask) Start(guestRunning bool)

type SGuestStreamDisksTask

type SGuestStreamDisksTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestStreamDisksTask

func NewGuestStreamDisksTask(ctx context.Context, guest *SKVMGuestInstance, callback func(), disksIdx []int) *SGuestStreamDisksTask

func (*SGuestStreamDisksTask) Start

func (s *SGuestStreamDisksTask) Start()

type SGuestSuspendTask

type SGuestSuspendTask struct {
	*SKVMGuestInstance
	// contains filtered or unexported fields
}

func NewGuestSuspendTask

func NewGuestSuspendTask(
	guest *SKVMGuestInstance,
	ctx context.Context,
	onFinishCallback func(*SGuestSuspendTask, string),
) *SGuestSuspendTask

func (*SGuestSuspendTask) GetStateFilePath

func (s *SGuestSuspendTask) GetStateFilePath() string

func (*SGuestSuspendTask) Start

func (s *SGuestSuspendTask) Start()

type SGuestSyncConfigTaskExecutor

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

func NewGuestSyncConfigTaskExecutor

func NewGuestSyncConfigTaskExecutor(ctx context.Context, guest *SKVMGuestInstance, tasks []IGuestTasks, callback func([]error)) *SGuestSyncConfigTaskExecutor

func (*SGuestSyncConfigTaskExecutor) Start

func (t *SGuestSyncConfigTaskExecutor) Start(delay int)

type SKVMGuestInstance

type SKVMGuestInstance struct {
	SKVMInstanceRuntime

	Id      string
	Monitor monitor.Monitor

	// runtime description, generate from source desc
	Desc *desc.SGuestDesc
	// source description, input from region
	SourceDesc *desc.SGuestDesc
	// contains filtered or unexported fields
}

func NewKVMGuestInstance

func NewKVMGuestInstance(id string, manager *SGuestManager) *SKVMGuestInstance

func (*SKVMGuestInstance) BlockIoThrottle

func (s *SKVMGuestInstance) BlockIoThrottle(ctx context.Context, bps, iops int64) error

func (*SKVMGuestInstance) BlockJobsCount

func (s *SKVMGuestInstance) BlockJobsCount() int

func (*SKVMGuestInstance) CPUSet

func (*SKVMGuestInstance) CPUSetRemove

func (s *SKVMGuestInstance) CPUSetRemove(ctx context.Context) error

func (*SKVMGuestInstance) CheckBlockOrRunning

func (s *SKVMGuestInstance) CheckBlockOrRunning(jobs int)

func (*SKVMGuestInstance) CleanGuest

func (s *SKVMGuestInstance) CleanGuest(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

Delay process

func (*SKVMGuestInstance) CleanImportMetadata

func (s *SKVMGuestInstance) CleanImportMetadata() *jsonutils.JSONDict

func (*SKVMGuestInstance) CleanStartupTask

func (s *SKVMGuestInstance) CleanStartupTask()

func (*SKVMGuestInstance) CleanStatefiles

func (s *SKVMGuestInstance) CleanStatefiles()

func (*SKVMGuestInstance) CleanupCpuset

func (s *SKVMGuestInstance) CleanupCpuset()

func (*SKVMGuestInstance) CpuMax

func (s *SKVMGuestInstance) CpuMax() (uint, error)

func (*SKVMGuestInstance) CreateFromDesc

func (s *SKVMGuestInstance) CreateFromDesc(desc *desc.SGuestDesc) error

func (*SKVMGuestInstance) Delete

func (s *SKVMGuestInstance) Delete(ctx context.Context, migrated bool) error

func (*SKVMGuestInstance) DeployFs

func (*SKVMGuestInstance) DirtyServerRequestStart

func (s *SKVMGuestInstance) DirtyServerRequestStart()

func (*SKVMGuestInstance) DiskCount

func (s *SKVMGuestInstance) DiskCount() int

func (*SKVMGuestInstance) DoResumeTask

func (s *SKVMGuestInstance) DoResumeTask(ctx context.Context, isTimeout bool)

func (*SKVMGuestInstance) ExecDeleteSnapshotTask

func (s *SKVMGuestInstance) ExecDeleteSnapshotTask(
	ctx context.Context, disk storageman.IDisk,
	deleteSnapshot string, convertSnapshot string, pendingDelete bool,
) (jsonutils.JSONObject, error)

func (*SKVMGuestInstance) ExecDiskSnapshotTask

func (s *SKVMGuestInstance) ExecDiskSnapshotTask(
	ctx context.Context, userCred mcclient.TokenCredential, disk storageman.IDisk, snapshotId string,
) (jsonutils.JSONObject, error)

func (*SKVMGuestInstance) ExecMemorySnapshotResetTask

func (s *SKVMGuestInstance) ExecMemorySnapshotResetTask(ctx context.Context, input *hostapi.GuestMemorySnapshotResetRequest) (jsonutils.JSONObject, error)

func (*SKVMGuestInstance) ExecMemorySnapshotTask

func (*SKVMGuestInstance) ExecReloadDiskTask

func (s *SKVMGuestInstance) ExecReloadDiskTask(ctx context.Context, disk storageman.IDisk) (jsonutils.JSONObject, error)

func (*SKVMGuestInstance) ExecStopTask

func (s *SKVMGuestInstance) ExecStopTask(ctx context.Context, params interface{}) (jsonutils.JSONObject, error)

func (*SKVMGuestInstance) ExecSuspendTask

func (s *SKVMGuestInstance) ExecSuspendTask(ctx context.Context)

func (*SKVMGuestInstance) ExitCleanup

func (s *SKVMGuestInstance) ExitCleanup(clear bool)

func (*SKVMGuestInstance) ForceStop

func (s *SKVMGuestInstance) ForceStop() bool

func (*SKVMGuestInstance) GetCgroupName

func (s *SKVMGuestInstance) GetCgroupName() string

func (*SKVMGuestInstance) GetCleanFiles

func (s *SKVMGuestInstance) GetCleanFiles() []string

func (*SKVMGuestInstance) GetDescFilePath

func (s *SKVMGuestInstance) GetDescFilePath() string

func (*SKVMGuestInstance) GetFuseTmpPath

func (s *SKVMGuestInstance) GetFuseTmpPath() string

func (*SKVMGuestInstance) GetHmpMonitorPort

func (s *SKVMGuestInstance) GetHmpMonitorPort(vncPort int) int

func (*SKVMGuestInstance) GetId

func (s *SKVMGuestInstance) GetId() string

func (*SKVMGuestInstance) GetKernelVersion

func (s *SKVMGuestInstance) GetKernelVersion() string

func (*SKVMGuestInstance) GetMonitorPath

func (s *SKVMGuestInstance) GetMonitorPath() string

func (*SKVMGuestInstance) GetName

func (s *SKVMGuestInstance) GetName() string

func (*SKVMGuestInstance) GetNeedMergeBackingFileDiskIndexs

func (s *SKVMGuestInstance) GetNeedMergeBackingFileDiskIndexs() []int

func (*SKVMGuestInstance) GetNicDescMatch

func (s *SKVMGuestInstance) GetNicDescMatch(mac, ip, port, bridge string) *desc.SGuestNetwork

func (*SKVMGuestInstance) GetOsName

func (s *SKVMGuestInstance) GetOsName() string

func (*SKVMGuestInstance) GetPciBus

func (s *SKVMGuestInstance) GetPciBus() string

func (*SKVMGuestInstance) GetPid

func (s *SKVMGuestInstance) GetPid() int

func (*SKVMGuestInstance) GetPidFilePath

func (s *SKVMGuestInstance) GetPidFilePath() string

func (*SKVMGuestInstance) GetPowerStates

func (s *SKVMGuestInstance) GetPowerStates() string

func (*SKVMGuestInstance) GetQemuVersionStr

func (s *SKVMGuestInstance) GetQemuVersionStr() string

func (*SKVMGuestInstance) GetQmpMonitorPort

func (s *SKVMGuestInstance) GetQmpMonitorPort(vncPort int) int

func (*SKVMGuestInstance) GetSourceDescFilePath

func (s *SKVMGuestInstance) GetSourceDescFilePath() string

func (*SKVMGuestInstance) GetStartScriptPath

func (s *SKVMGuestInstance) GetStartScriptPath() string

func (*SKVMGuestInstance) GetStateFilePath

func (s *SKVMGuestInstance) GetStateFilePath(version string) string

func (*SKVMGuestInstance) GetStopScriptPath

func (s *SKVMGuestInstance) GetStopScriptPath() string

func (*SKVMGuestInstance) GetVdiProtocol

func (s *SKVMGuestInstance) GetVdiProtocol() string

func (*SKVMGuestInstance) GetVncFilePath

func (s *SKVMGuestInstance) GetVncFilePath() string

func (*SKVMGuestInstance) GetVncPort

func (s *SKVMGuestInstance) GetVncPort() int

func (*SKVMGuestInstance) GetVpcNIC

func (s *SKVMGuestInstance) GetVpcNIC() *desc.SGuestNetwork

func (*SKVMGuestInstance) HasGpu

func (s *SKVMGuestInstance) HasGpu() bool

func (*SKVMGuestInstance) HomeDir

func (s *SKVMGuestInstance) HomeDir() string

func (*SKVMGuestInstance) ImportServer

func (s *SKVMGuestInstance) ImportServer(pendingDelete bool)

func (*SKVMGuestInstance) InitQga

func (s *SKVMGuestInstance) InitQga() error

func (*SKVMGuestInstance) IsDaemon

func (s *SKVMGuestInstance) IsDaemon() bool

func (*SKVMGuestInstance) IsDirtyShotdown

func (s *SKVMGuestInstance) IsDirtyShotdown() bool

func (*SKVMGuestInstance) IsEnabledNestedVirt

func (s *SKVMGuestInstance) IsEnabledNestedVirt() bool

func (*SKVMGuestInstance) IsKvmSupport

func (s *SKVMGuestInstance) IsKvmSupport() bool

func (*SKVMGuestInstance) IsLoaded

func (s *SKVMGuestInstance) IsLoaded() bool

func (*SKVMGuestInstance) IsMaster

func (s *SKVMGuestInstance) IsMaster() bool

func (*SKVMGuestInstance) IsMigratingDestGuest

func (s *SKVMGuestInstance) IsMigratingDestGuest() bool

func (*SKVMGuestInstance) IsMonitorAlive

func (s *SKVMGuestInstance) IsMonitorAlive() bool

func (*SKVMGuestInstance) IsOldWindows

func (s *SKVMGuestInstance) IsOldWindows() bool

is windows prioer to windows server 2003

func (*SKVMGuestInstance) IsRunning

func (s *SKVMGuestInstance) IsRunning() bool

func (*SKVMGuestInstance) IsSharedStorage

func (s *SKVMGuestInstance) IsSharedStorage() bool

func (*SKVMGuestInstance) IsSlave

func (s *SKVMGuestInstance) IsSlave() bool

func (*SKVMGuestInstance) IsStopped

func (s *SKVMGuestInstance) IsStopped() bool

func (*SKVMGuestInstance) IsStopping

func (s *SKVMGuestInstance) IsStopping() bool

func (*SKVMGuestInstance) IsSuspend

func (s *SKVMGuestInstance) IsSuspend() bool

func (*SKVMGuestInstance) IsValid

func (s *SKVMGuestInstance) IsValid() bool

func (*SKVMGuestInstance) IsVdiSpice

func (s *SKVMGuestInstance) IsVdiSpice() bool

func (*SKVMGuestInstance) ListStateFilePaths

func (s *SKVMGuestInstance) ListStateFilePaths() []string

func (*SKVMGuestInstance) LoadDesc

func (s *SKVMGuestInstance) LoadDesc() error

func (*SKVMGuestInstance) LogFilePath

func (s *SKVMGuestInstance) LogFilePath() string

func (*SKVMGuestInstance) MirrorJobStatus

func (s *SKVMGuestInstance) MirrorJobStatus() MirrorJob

func (*SKVMGuestInstance) OnResumeSyncMetadataInfo

func (s *SKVMGuestInstance) OnResumeSyncMetadataInfo()

func (*SKVMGuestInstance) PrepareDir

func (s *SKVMGuestInstance) PrepareDir() error

func (*SKVMGuestInstance) PrepareDisksMigrate

func (s *SKVMGuestInstance) PrepareDisksMigrate(liveMigrage bool) (*jsonutils.JSONDict, error)

func (*SKVMGuestInstance) PrepareMigrateCerts

func (s *SKVMGuestInstance) PrepareMigrateCerts() (map[string]string, error)

func (*SKVMGuestInstance) QgaPath

func (s *SKVMGuestInstance) QgaPath() string

func (*SKVMGuestInstance) SaveLiveDesc

func (s *SKVMGuestInstance) SaveLiveDesc(guestDesc *desc.SGuestDesc) error

func (*SKVMGuestInstance) SaveSourceDesc

func (s *SKVMGuestInstance) SaveSourceDesc(guestDesc *desc.SGuestDesc) error

func (*SKVMGuestInstance) SetCgroup

func (s *SKVMGuestInstance) SetCgroup()

func (*SKVMGuestInstance) SetVncPassword

func (s *SKVMGuestInstance) SetVncPassword()

func (*SKVMGuestInstance) StartDelete

func (s *SKVMGuestInstance) StartDelete(ctx context.Context, migrated bool) error

func (*SKVMGuestInstance) StartGuest

func (s *SKVMGuestInstance) StartGuest(ctx context.Context, userCred mcclient.TokenCredential, params *jsonutils.JSONDict) error

func (*SKVMGuestInstance) StartMonitor

func (s *SKVMGuestInstance) StartMonitor(ctx context.Context, cb func()) error

func (*SKVMGuestInstance) StartMonitorWithImportGuestSocketFile

func (s *SKVMGuestInstance) StartMonitorWithImportGuestSocketFile(ctx context.Context, socketFile string, cb func()) error

func (*SKVMGuestInstance) StartPresendArp

func (s *SKVMGuestInstance) StartPresendArp()

func (*SKVMGuestInstance) StaticSaveSnapshot

func (s *SKVMGuestInstance) StaticSaveSnapshot(
	ctx context.Context, disk storageman.IDisk, snapshotId string,
	encryptKey string, encFormat qemuimg.TEncryptFormat, encAlg seclib2.TSymEncAlg,
) (jsonutils.JSONObject, error)

func (*SKVMGuestInstance) Stop

func (s *SKVMGuestInstance) Stop() bool

func (*SKVMGuestInstance) StreamDisks

func (s *SKVMGuestInstance) StreamDisks(ctx context.Context, callback func(), disksIdx []int)

func (*SKVMGuestInstance) SyncConfig

func (s *SKVMGuestInstance) SyncConfig(
	ctx context.Context, guestDesc *desc.SGuestDesc, fwOnly bool,
) (jsonutils.JSONObject, error)

func (*SKVMGuestInstance) SyncMetadata

func (s *SKVMGuestInstance) SyncMetadata(meta *jsonutils.JSONDict) error

func (*SKVMGuestInstance) SyncMirrorJobFailed

func (s *SKVMGuestInstance) SyncMirrorJobFailed(reason string)

func (*SKVMGuestInstance) SyncQemuCmdline

func (s *SKVMGuestInstance) SyncQemuCmdline(cmdline string)

func (*SKVMGuestInstance) SyncStatus

func (s *SKVMGuestInstance) SyncStatus(reason string)

func (*SKVMGuestInstance) WriteMigrateCerts

func (s *SKVMGuestInstance) WriteMigrateCerts(certs map[string]string) error

type SKVMInstanceRuntime

type SKVMInstanceRuntime struct {
	QemuVersion string
	VncPassword string

	LiveMigrateDestPort *int64
	LiveMigrateUseTls   bool

	StartupTask *SGuestResumeTask
	MigrateTask *SGuestLiveMigrateTask
	// contains filtered or unexported fields
}

type SLibvirtDomainImportConfig

type SLibvirtDomainImportConfig struct {
	LibvritDomainXmlDir string
	Servers             []SLibvirtServer
}

type SLibvirtServer

type SLibvirtServer struct {
	Uuid  string
	MacIp map[string]string
}

type SLiveMigrate

type SLiveMigrate struct {
	Sid            string
	DestPort       int
	DestIp         string
	IsLocal        bool
	EnableTLS      bool
	MaxBandwidthMB *int64
	QuicklyFinish  bool
}

type SMemorySnapshot

type SMemorySnapshot struct {
	*hostapi.GuestMemorySnapshotRequest
	Sid string
}

type SMemorySnapshotDelete

type SMemorySnapshotDelete struct {
	*hostapi.GuestMemorySnapshotDeleteRequest
}

type SMemorySnapshotReset

type SMemorySnapshotReset struct {
	*hostapi.GuestMemorySnapshotResetRequest
	Sid string
}

type SQgaGuestSetPassword

type SQgaGuestSetPassword struct {
	*hostapi.GuestSetPasswordRequest
	Sid string
}

type SReloadDisk

type SReloadDisk struct {
	Sid  string
	Disk storageman.IDisk
}

type SSrcPrepareMigrate

type SSrcPrepareMigrate struct {
	Sid               string
	LiveMigrate       bool
	LiveMigrateUseTLS bool
}

type SStorageCloneDisk

type SStorageCloneDisk struct {
	ServerId       string
	SourceStorage  storageman.IStorage
	SourceDisk     storageman.IDisk
	TargetStorage  storageman.IStorage
	TargetDiskId   string
	DiskFormat     string
	TargetDiskDesc *compute.GuestdiskJsonDesc
}

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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