Documentation
¶
Index ¶
- func ControllerDialOpts() api.DialOpts
- func ExportModel(st StateExporter) ([]byte, error)
- func ImportModel(st *state.State, bytes []byte) (*state.Model, *state.State, error)
- func SourcePrecheck(backend PrecheckBackend) error
- func TargetPrecheck(backend PrecheckBackend, modelInfo coremigration.ModelInfo) error
- func UploadBinaries(config UploadBinariesConfig) error
- type CharmDownloader
- type CharmUploader
- type PrecheckApplication
- type PrecheckBackend
- type PrecheckMachine
- type PrecheckModel
- type PrecheckUnit
- type StateExporter
- type ToolsDownloader
- type ToolsUploader
- type UploadBackend
- 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. The total attempt time can't be too long because the areas of the code which make these connections need to be interruptable but a number of retries is useful to deal with short lived issues.
func ExportModel ¶
func ExportModel(st StateExporter) ([]byte, error)
ExportModel creates a description.Model representation of the active model for StateExporter (typically a *state.State), and returns the serialized version. It provides the symmetric functionality to ImportModel.
func ImportModel ¶
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) 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, modelInfo coremigration.ModelInfo) 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)
}
CharmDownlaoder defines a single method that is used to download a charm from the source controller in a migration.
type CharmUploader ¶
type CharmUploader interface {
UploadCharm(*charm.URL, io.ReadSeeker) (*charm.URL, error)
}
CharmUploader defines a single method that is used to upload a charm to the target controller in a migration.
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) AllModels() ([]PrecheckModel, error) IsUpgrading() (bool, error) IsMigrationActive(string) (bool, error) AllMachines() ([]PrecheckMachine, error) AllApplications() ([]PrecheckApplication, error) ControllerBackend() (PrecheckBackend, error) }
PrecheckBackend defines the interface to query Juju's state for migration prechecks.
func PrecheckShim ¶
func PrecheckShim(st *state.State) PrecheckBackend
PrecheckShim wraps a *state.State to implement PrecheckBackend.
type PrecheckMachine ¶
type PrecheckMachine interface { Id() string AgentTools() (*tools.Tools, error) Life() state.Life Status() (status.StatusInfo, error) AgentPresence() (bool, 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 Owner() names.UserTag Life() state.Life MigrationMode() state.MigrationMode }
PrecheckModel describes the state interface a model as needed by the 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) AgentPresence() (bool, error) }
PrecheckUnit describes state interface for a unit needed by migration prechecks.
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 ToolsDownloader ¶
ToolsDownloader defines a single method that is used to download tools from the source controller in a migration.
type ToolsUploader ¶
type ToolsUploader interface {
UploadTools(io.ReadSeeker, version.Binary, ...string) (tools.List, error)
}
ToolsUploader defines a single method that is used to upload tools to the target controller in a migration.
type UploadBackend ¶
type UploadBackend interface { Charm(*charm.URL) (*state.Charm, error) ModelUUID() string MongoSession() *mgo.Session ToolsStorage() (binarystorage.StorageCloser, error) }
UploadBackend define the methods on *state.State that are needed for uploading the tools and charms from the current controller to a different controller.
type UploadBinariesConfig ¶
type UploadBinariesConfig struct { Charms []string CharmDownloader CharmDownloader CharmUploader CharmUploader Tools map[version.Binary]string ToolsDownloader ToolsDownloader ToolsUploader ToolsUploader }
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.