juju: github.com/juju/juju/migration Index | Files

package migration

import "github.com/juju/juju/migration"

Index

Package Files

dialopts.go migration.go precheck.go precheck_shim.go

func ControllerDialOpts Uses

func ControllerDialOpts() api.DialOpts

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

func UploadBinaries(config UploadBinariesConfig) error

UploadBinaries will send binaries stored in the source blobstore to the target controller.

type CharmDownloader Uses

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 Uses

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 ClaimerFunc Uses

type ClaimerFunc func(string) (leadership.Claimer, error)

ClaimerFunc is a function that returns a leadership claimer for the model UUID passed.

type ModelPresence Uses

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 Uses

type Pool interface {
    GetModel(string) (PrecheckModel, func(), error)
}

Pool defines the interface to a StatePool used by the migration prechecks.

func PoolShim Uses

func PoolShim(pool *state.StatePool) Pool

PoolShim wraps a state.StatePool to produce a Pool.

type PrecheckApplication Uses

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 Uses

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 Uses

func PrecheckShim(modelState, controllerState *state.State) (PrecheckBackend, error)

PrecheckShim wraps a pair of *state.States to implement PrecheckBackend.

type PrecheckMachine Uses

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 Uses

type PrecheckModel interface {
    UUID() string
    Name() string
    Type() state.ModelType
    Owner() names.UserTag
    Life() state.Life
    MigrationMode() state.MigrationMode
    CloudCredential() (names.CloudCredentialTag, bool)
}

PrecheckModel describes the state interface a model as needed by the migration prechecks.

type PrecheckRelation Uses

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 Uses

type PrecheckRelationUnit interface {
    Valid() (bool, error)
    InScope() (bool, error)
}

PrecheckRelationUnit describes the interface for relation units needed for migration prechecks.

type PrecheckUnit Uses

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)
    ShouldBeAssigned() bool
}

PrecheckUnit describes state interface for a unit needed by migration prechecks.

type ResourceDownloader Uses

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 Uses

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 Uses

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 Uses

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 Uses

type ToolsDownloader interface {
    OpenURI(string, url.Values) (io.ReadCloser, error)
}

ToolsDownloader defines a single method that is used to download tools from the source controller in a migration.

type ToolsUploader Uses

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 UploadBinariesConfig Uses

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 Uses

func (c *UploadBinariesConfig) Validate() error

Validate makes sure that all the config values are non-nil.

Package migration imports 23 packages (graph) and is imported by 80 packages. Updated 2019-08-26. Refresh now. Tools for package owners.