[LXD] Unified P2C/P2V migration tool

Project LXD
Status Implemented
Author(s) @monstermunchkin
Approver(s) @stgraber
Release 4.23
Internal ID LX011

Abstract

A new tool lxd-migrate is to be created which will replace the existing lxd-p2c tool, and adds VM support.

Rationale

Currently, there is the lxd-p2c tool which lets you turn a Linux filesystem into a LXD container. But since LXD also supports VMs, we need a tool which handles this as well. The new tool will create a container or VM depending on its input (path or raw image). To make things easier, lxd-migrate will be entirely interactive.

Specification

Design

The usage will be different from lxd-p2c as it will be entirely interactive. The user will be prompted for:

  • Server URL
  • Fingerprint prompt (if not trusted by the system CA)
  • Authentication
  • Show LXD server name and version
  • Source path or raw image path
  • Instance name on target
  • What project to transfer to, if server has more than one project
  • Set profiles, configs, storage, network, …
  • Show overview and ask for confirmation
  • Perform the transfer
  • Remove ourselves from the trust store, if a self-generated certificate or token as used

API changes

No API changes.

CLI changes

The lxd-migrate tool will have no arguments or flags as it will be entirely interactive.

Database changes

No database changes.

Upgrade handling

No upgrade handling.

Further information

No further information.

Is this tool available?

Yes, it’s been available since LXD 4.23.

The lxd-migrate tool is built via GitHub actions so you can find the compiled binary in the artifacts. Here’s the link to the current one: