migrate

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package migrate provides functionality to migrate servers that have been provisioned by the OpenStack Compute service.

Example of Migrate Server (migrate Action)

serverID := "b16ba811-199d-4ffd-8839-ba96c1185a67"
err := migrate.Migrate(computeClient, serverID).ExtractErr()
if err != nil {
	panic(err)
}

Example of Live-Migrate Server (os-migrateLive Action)

serverID := "b16ba811-199d-4ffd-8839-ba96c1185a67"
host := "01c0cadef72d47e28a672a76060d492c"
blockMigration := false

migrationOpts := migrate.LiveMigrateOpts{
	Host: &host,
	BlockMigration: &blockMigration,
}

err := migrate.LiveMigrate(computeClient, serverID, migrationOpts).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LiveMigrateOpts

type LiveMigrateOpts struct {
	// The host to which to migrate the server.
	// If this parameter is None, the scheduler chooses a host.
	Host *string `json:"host"`

	// Set to True to migrate local disks by using block migration.
	// If the source or destination host uses shared storage and you set
	// this value to True, the live migration fails.
	BlockMigration *bool `json:"block_migration,omitempty"`

	// Set to True to enable over commit when the destination host is checked
	// for available disk space. Set to False to disable over commit. This setting
	// affects only the libvirt virt driver.
	DiskOverCommit *bool `json:"disk_over_commit,omitempty"`
}

LiveMigrateOpts specifies parameters of live migrate action.

func (LiveMigrateOpts) ToLiveMigrateMap

func (opts LiveMigrateOpts) ToLiveMigrateMap() (map[string]interface{}, error)

ToLiveMigrateMap constructs a request body from LiveMigrateOpts.

type LiveMigrateOptsBuilder

type LiveMigrateOptsBuilder interface {
	ToLiveMigrateMap() (map[string]interface{}, error)
}

LiveMigrateOptsBuilder allows extensions to add additional parameters to the LiveMigrate request.

type MigrateResult

type MigrateResult struct {
	gophercloud.ErrResult
}

MigrateResult is the response from a Migrate operation. Call its ExtractErr method to determine if the request suceeded or failed.

func LiveMigrate

func LiveMigrate(client *gophercloud.ServiceClient, id string, opts LiveMigrateOptsBuilder) (r MigrateResult)

LiveMigrate will initiate a live-migration (without rebooting) of the instance to another host.

func Migrate

func Migrate(client *gophercloud.ServiceClient, id string) (r MigrateResult)

Migrate will initiate a migration of the instance to another host.

Directories

Path Synopsis
compute_extensions_startstop_v2
compute_extensions_startstop_v2

Jump to

Keyboard shortcuts

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