migration

package
v0.0.0-...-e02bb5f Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 7 Imported by: 63

Documentation

Index

Constants

View Source
const ErrMigrating = errors.ConstError("model is being migrated")

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrationStatus

type MigrationStatus struct {
	// MigrationId hold the unique id for the migration.
	MigrationId string

	// ModelUUID holds the UUID of the model being migrated.
	ModelUUID string

	// Phases indicates the current migration phase.
	Phase Phase

	// PhaseChangedTime indicates the time the phase was changed to
	// its current value.
	PhaseChangedTime time.Time

	// TargetInfo contains the details of how to connect to the target
	// controller.
	TargetInfo TargetInfo
}

MigrationStatus returns the details for a migration as needed by the migrationmaster worker.

type MinionReports

type MinionReports struct {
	// ModelUUID holds the unique identifier for the model migration.
	MigrationId string

	// Phases indicates the migration phase the reports relate to.
	Phase Phase

	// SuccesCount indicates how many agents have successfully
	// completed the migration phase.
	SuccessCount int

	// UnknownCount indicates how many agents are yet to report
	// regarding the migration phase.
	UnknownCount int

	// SomeUnknownMachines holds the ids of some of the machines which
	// have not yet reported in.
	SomeUnknownMachines []string

	// SomeUnknownUnits holds the names of some of the units which
	// have not yet reported in.
	SomeUnknownUnits []string

	// SomeUnknownApplications holds the names of some of the applications which
	// have not yet reported in.
	SomeUnknownApplications []string

	// FailedMachines holds the ids of machines which have failed to
	// complete the migration phase.
	FailedMachines []string

	// FailedUnits holds the names of units which have failed to
	// complete the migration phase.
	FailedUnits []string

	// FailedApplications holds the names of applications which have failed to
	// complete the migration phase.
	FailedApplications []string
}

MinionReports returns information about the migration minion reports received so far for a given migration phase.

func (*MinionReports) IsZero

func (r *MinionReports) IsZero() bool

IsZero returns true if the MinionReports instance hasn't been set.

type ModelInfo

type ModelInfo struct {
	UUID                   string
	Owner                  names.UserTag
	Name                   string
	AgentVersion           version.Number
	ControllerAgentVersion version.Number
}

ModelInfo is used to report basic details about a model.

func (*ModelInfo) Validate

func (i *ModelInfo) Validate() error

type Phase

type Phase int

Phase values specify model migration phases.

const (
	UNKNOWN Phase = iota
	NONE
	QUIESCE
	IMPORT
	PROCESSRELATIONS
	VALIDATION
	SUCCESS
	LOGTRANSFER
	REAP
	REAPFAILED
	DONE
	ABORT
	ABORTDONE
)

Enumerate all possible migration phases.

func ParsePhase

func ParsePhase(target string) (Phase, bool)

ParsePhase converts a string model migration phase name to its constant value.

func SuccessfulMigrationPhases

func SuccessfulMigrationPhases() []Phase

Those phases are only used to get a complete successful round for testing purposes.

func (Phase) CanTransitionTo

func (p Phase) CanTransitionTo(targetPhase Phase) bool

CanTransitionTo returns true if the given phase is a valid next model migration phase.

func (Phase) IsRunning

func (p Phase) IsRunning() bool

IsRunning returns true if the phase indicates the migration is active and up to or at the SUCCESS phase. It returns false if the phase is one of the final cleanup phases or indicates an failed migration.

func (Phase) IsTerminal

func (p Phase) IsTerminal() bool

IsTerminal returns true if the phase is one which signifies the end of a migration.

func (Phase) String

func (p Phase) String() string

String returns the name of an model migration phase constant.

type SerializedModel

type SerializedModel struct {
	// Bytes contains the serialized data for the model.
	Bytes []byte

	// Charms lists the charm URLs in use in the model.
	Charms []string

	// Tools lists the tools versions in use with the model along with
	// their URIs. The URIs can be used to download the tools from the
	// source controller.
	Tools map[version.Binary]string // version -> tools URI

	// Resources represents all the resources in use in the model.
	Resources []SerializedModelResource
}

SerializedModel wraps a buffer contain a serialised Juju model as well as containing metadata about the charms and tools used by the model.

type SerializedModelResource

type SerializedModelResource struct {
	ApplicationRevision resources.Resource
	CharmStoreRevision  resources.Resource
	UnitRevisions       map[string]resources.Resource
}

SerializedModelResource defines the resource revisions for a specific application and its units.

type SourceControllerInfo

type SourceControllerInfo struct {
	ControllerTag   names.ControllerTag
	ControllerAlias string
	Addrs           []string
	CACert          string
}

SourceControllerInfo holds the details required to connect to a migration's source controller.

type TargetInfo

type TargetInfo struct {
	// ControllerTag holds tag for the target controller.
	ControllerTag names.ControllerTag

	// ControllerAlias holds an optional alias for the target controller.
	ControllerAlias string

	// Addrs holds the addresses and ports of the target controller's
	// API servers.
	Addrs []string

	// CACert holds the CA certificate that will be used to validate
	// the target API server's certificate, in PEM format.
	CACert string

	// AuthTag holds the user tag to authenticate with to the target
	// controller.
	AuthTag names.UserTag

	// Password holds the password to use with AuthTag.
	Password string

	// Macaroons holds macaroons to use with AuthTag. At least one of
	// Password or Macaroons must be set.
	Macaroons []macaroon.Slice
}

TargetInfo holds the details required to connect to a migration's target controller.

TODO(mjs) - Note the similarity to api.Info. It would be nice to be able to use api.Info here but state can't import api and moving api.Info to live under the core package is too big a project to be done right now.

func (*TargetInfo) Validate

func (info *TargetInfo) Validate() error

Validate returns an error if the TargetInfo contains bad data. Nil is returned otherwise.

Jump to

Keyboard shortcuts

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