Documentation
¶
Index ¶
- func ControllerDialOpts() api.DialOpts
- func ImportModel(importer StateImporter, getClaimer ClaimerFunc, bytes []byte) (*state.Model, *state.State, error)
- func SourcePrecheck(backend PrecheckBackend, modelPresence ModelPresence, ...) error
- func TargetPrecheck(backend PrecheckBackend, pool Pool, modelInfo coremigration.ModelInfo, ...) error
- func UploadBinaries(config UploadBinariesConfig) error
- type CharmDownloader
- type CharmUploader
- type ClaimerFunc
- type ModelPresence
- type Pool
- type PrecheckApplication
- type PrecheckBackend
- type PrecheckMachine
- type PrecheckModel
- type PrecheckRelation
- type PrecheckRelationUnit
- type PrecheckUnit
- type ResourceDownloader
- type ResourceUploader
- type StateExporter
- type StateImporter
- type ToolsDownloader
- type ToolsUploader
- type UploadBinariesConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ControllerDialOpts ¶
ControllerDialOpts returns dial parameters suitable for connecting from the source controller to the target controller during model migrations. Except for the inclusion of RetryDelay the options mirror what is used by the APICaller for logins.
func ImportModel ¶
func ImportModel(importer StateImporter, getClaimer ClaimerFunc, bytes []byte) (*state.Model, *state.State, error)
ImportModel deserializes a model description from the bytes, transforms the model config based on information from the controller model, and then imports that as a new database model.
func SourcePrecheck ¶
func SourcePrecheck( backend PrecheckBackend, modelPresence ModelPresence, controllerPresence ModelPresence, ) error
SourcePrecheck checks the state of the source controller to make sure that the preconditions for model migration are met. The backend provided must be for the model to be migrated.
func TargetPrecheck ¶
func TargetPrecheck(backend PrecheckBackend, pool Pool, modelInfo coremigration.ModelInfo, presence ModelPresence) error
TargetPrecheck checks the state of the target controller to make sure that the preconditions for model migration are met. The backend provided must be for the target controller.
func UploadBinaries ¶
func UploadBinaries(config UploadBinariesConfig) error
UploadBinaries will send binaries stored in the source blobstore to the target controller.
Types ¶
type CharmDownloader ¶
type CharmDownloader interface {
OpenCharm(*charm.URL) (io.ReadCloser, error)
}
CharmDownloader defines a single method that is used to download a charm from the source controller in a migration.
type CharmUploader ¶
CharmUploader defines a single method that is used to upload a charm to the target controller in a migration.
type ClaimerFunc ¶
type ClaimerFunc func(string) (leadership.Claimer, error)
ClaimerFunc is a function that returns a leadership claimer for the model UUID passed.
type ModelPresence ¶
type ModelPresence interface {
// For a given non controller agent, return the Status for that agent.
AgentStatus(agent string) (presence.Status, error)
}
ModelPresence represents the API server connections for a model.
type Pool ¶
type Pool interface {
GetModel(string) (PrecheckModel, func(), error)
}
Pool defines the interface to a StatePool used by the migration prechecks.
type PrecheckApplication ¶
type PrecheckApplication interface {
Name() string
Life() state.Life
CharmURL() (*charm.URL, bool)
AllUnits() ([]PrecheckUnit, error)
MinUnits() int
}
PrecheckApplication describes the state interface for an application needed by migration prechecks.
type PrecheckBackend ¶
type PrecheckBackend interface {
AgentVersion() (version.Number, error)
NeedsCleanup() (bool, error)
Model() (PrecheckModel, error)
AllModelUUIDs() ([]string, error)
IsUpgrading() (bool, error)
IsMigrationActive(string) (bool, error)
AllMachines() ([]PrecheckMachine, error)
AllApplications() ([]PrecheckApplication, error)
AllRelations() ([]PrecheckRelation, error)
ControllerBackend() (PrecheckBackend, error)
CloudCredential(tag names.CloudCredentialTag) (state.Credential, error)
ListPendingResources(string) ([]resource.Resource, error)
}
PrecheckBackend defines the interface to query Juju's state for migration prechecks.
func PrecheckShim ¶
func PrecheckShim(modelState, controllerState *state.State) (PrecheckBackend, error)
PrecheckShim wraps a pair of *state.States to implement PrecheckBackend.
type PrecheckMachine ¶
type PrecheckMachine interface {
Id() string
AgentTools() (*tools.Tools, error)
Life() state.Life
Status() (status.StatusInfo, error)
InstanceStatus() (status.StatusInfo, error)
ShouldRebootOrShutdown() (state.RebootAction, error)
}
PrecheckMachine describes the state interface for a machine needed by migration prechecks.
type PrecheckModel ¶
type PrecheckModel interface {
UUID() string
Name() string
Type() state.ModelType
Owner() names.UserTag
Life() state.Life
MigrationMode() state.MigrationMode
CloudCredentialTag() (names.CloudCredentialTag, bool)
}
PrecheckModel describes the state interface a model as needed by the migration prechecks.
type PrecheckRelation ¶
type PrecheckRelation interface {
String() string
IsCrossModel() (bool, error)
Endpoints() []state.Endpoint
Unit(PrecheckUnit) (PrecheckRelationUnit, error)
}
PrecheckRelation describes the state interface for relations needed for prechecks.
type PrecheckRelationUnit ¶
PrecheckRelationUnit describes the interface for relation units needed for migration prechecks.
type PrecheckUnit ¶
type PrecheckUnit interface {
Name() string
AgentTools() (*tools.Tools, error)
Life() state.Life
CharmURL() (*charm.URL, bool)
AgentStatus() (status.StatusInfo, error)
Status() (status.StatusInfo, error)
ShouldBeAssigned() bool
IsSidecar() (bool, error)
}
PrecheckUnit describes state interface for a unit needed by migration prechecks.
type ResourceDownloader ¶
type ResourceDownloader interface {
OpenResource(string, string) (io.ReadCloser, error)
}
ResourceDownloader defines the interface for downloading resources from the source controller during a migration.
type ResourceUploader ¶
type ResourceUploader interface {
UploadResource(resource.Resource, io.ReadSeeker) error
SetPlaceholderResource(resource.Resource) error
SetUnitResource(string, resource.Resource) error
}
ResourceUploader defines the interface for uploading resources into the target controller during a migration.
type StateExporter ¶
type StateExporter interface {
// Export generates an abstract representation of a model.
Export() (description.Model, error)
}
StateExporter describes interface on state required to export a model.
type StateImporter ¶
type StateImporter interface {
Import(model description.Model) (*state.Model, *state.State, error)
}
StateImporter describes the method needed to import a model into the database.
type ToolsDownloader ¶
ToolsDownloader defines a single method that is used to download tools from the source controller in a migration.
type ToolsUploader ¶
ToolsUploader defines a single method that is used to upload tools to the target controller in a migration.
type UploadBinariesConfig ¶
type UploadBinariesConfig struct {
Charms []string
CharmDownloader CharmDownloader
CharmUploader CharmUploader
Tools map[version.Binary]string
ToolsDownloader ToolsDownloader
ToolsUploader ToolsUploader
Resources []migration.SerializedModelResource
ResourceDownloader ResourceDownloader
ResourceUploader ResourceUploader
}
UploadBinariesConfig provides all the configuration that the UploadBinaries function needs to operate. To construct the config with the default helper functions, use `NewUploadBinariesConfig`.
func (*UploadBinariesConfig) Validate ¶
func (c *UploadBinariesConfig) Validate() error
Validate makes sure that all the config values are non-nil.