Documentation ¶
Index ¶
- Variables
- func ContainerVolumeRefsCount(c *localtypes.Container, volumeRefs map[string]string) error
- func GenerateSandboxMetaJSON(homeDir string, sandboxCons []*localtypes.Container) error
- func PrepareVolumes(homeDir string, volumes []*volumetypes.Volume, volumeRefs map[string]string) error
- func Register(name string, create func(Config) (Migrator, error))
- func SetDirDiskQuota(defaultQuota, quotaID, dir string) error
- type Config
- type D2pMigrator
- func (d *D2pMigrator) Cleanup() error
- func (d *D2pMigrator) Migrate(ctx context.Context) error
- func (d *D2pMigrator) PostMigrate(ctx context.Context) error
- func (d *D2pMigrator) PreMigrate(ctx context.Context) error
- func (d *D2pMigrator) PrepareImages(ctx context.Context) error
- func (d *D2pMigrator) RevertMigration(ctx context.Context) error
- type Migrator
Constants ¶
This section is empty.
Variables ¶
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 ¶
Register registers a migrator to be a d2p-migrator.
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 ¶
NewColdMigrator creates a migrator tool instance.