[LXD] Unified P2C/P2V migration tool

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


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


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.



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.