migrator

package
v0.0.0-...-6d8d8d4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultDockerRpmName specify the default docker rpm name
	DefaultDockerRpmName = "docker"
	// DefaultPouchRpmPath specify the default pouch rpm file location
	DefaultPouchRpmPath = "pouch"
)

Functions

func ContainerVolumeRefsCount

func ContainerVolumeRefsCount(c *localtypes.Container, volumeRefs map[string]string) error

ContainerVolumeRefsCount count a container's reference to volumes

func GenerateSandboxMetaJSON

func GenerateSandboxMetaJSON(homeDir string, sandboxCons []*localtypes.Container) error

GenerateSandboxMetaJSON generate cri sandbox meta.

func PrepareVolumes

func PrepareVolumes(homeDir string, volumes []*volumetypes.Volume, volumeRefs map[string]string) error

PrepareVolumes put volumes info into pouch volume store.

func Register

func Register(name string, create func(Config) (Migrator, error))

Register registers a migrator to be a d2p-migrator.

func SetDirDiskQuota

func SetDirDiskQuota(defaultQuota, quotaID, dir string) error

SetDirDiskQuota set disk quota for the dir.

Types

type Config

type Config struct {
	// Type specifies the type of Migrator, now support living and cold two types.
	Type string
	// DockerRpmName represents the docker rpm name.
	DockerRpmName string
	// PouchRpmPath represents the path where pouch rpm location.
	PouchRpmPath string
	// DockerHomeDir represents the docker service home dir, we also can
	// get pouch service home dir by the DockerHomeDir
	DockerHomeDir string
	// d2p-migrator only download the image manifest file or not.
	ImageManifestOnly bool
	// ContainerPlugin is the container plugin for migration.
	ContainerPlugin hookplugins.ContainerPlugin
}

Config contains the configurations of Migrator

type D2pMigrator

type D2pMigrator struct {
	// contains filtered or unexported fields
}

D2pMigrator is the core component to do migrate.

func NewD2pMigrator

func NewD2pMigrator(cfg Config) (*D2pMigrator, error)

NewD2pMigrator create a migrator

func (*D2pMigrator) Cleanup

func (d *D2pMigrator) Cleanup() error

Cleanup does some clean works when migrator exited

func (*D2pMigrator) Migrate

func (d *D2pMigrator) Migrate(ctx context.Context) error

Migrate does migrate procedures

func (*D2pMigrator) PostMigrate

func (d *D2pMigrator) PostMigrate(ctx context.Context) error

PostMigrate do something after migration

func (*D2pMigrator) PreMigrate

func (d *D2pMigrator) PreMigrate(ctx context.Context) error

PreMigrate prepares things for the migration

func (*D2pMigrator) PrepareImages

func (d *D2pMigrator) PrepareImages(ctx context.Context) error

PrepareImages just pull images for containers

func (*D2pMigrator) RevertMigration

func (d *D2pMigrator) RevertMigration(ctx context.Context) error

RevertMigration reverts the migration

type Migrator

type Migrator interface {
	// PreMigrate do something before migration
	PreMigrate(ctx context.Context, cli *docker.Dockerd, ctrdCli *ctrd.Client) error

	// Migrate does migrate action
	Migrate(ctx context.Context, cli *docker.Dockerd, ctrdCli *ctrd.Client) error

	// PostMigrate do something after migration
	PostMigrate(ctx context.Context, cli *docker.Dockerd, ctrdCli *ctrd.Client, dockerRpmName, pouchRpmPath string) error

	// RevertMigration reverts migration
	RevertMigration(ctx context.Context, cli *docker.Dockerd, ctrdCli *ctrd.Client) error

	// Cleanup does some clean works when migrator exited
	Cleanup() error
}

Migrator is an interface to migrate docker containers to other containers

func NewColdMigrator

func NewColdMigrator(cfg Config) (Migrator, error)

NewColdMigrator creates a migrator tool instance.

func NewLiveMigrator

func NewLiveMigrator(cfg Config) (Migrator, error)

NewLiveMigrator creates a migrator tool instance.

Jump to

Keyboard shortcuts

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