migrate libvirt config between machines

Michal Prívozník
Tue, 30 Nov 2021 08:28:36 -0000

On 11/29/21 17:37, daggs wrote:
> Greetings,
>
> I'd like to migrate my current libvirt config from one machine to
another, what is the best way to do so?
>
> Thanks
>

Do you mean domain/network/... XMLs or {libvirtd,qemu,...}.config files?

For the former I suggest 'virsh dumpxml $dom > dom.xml' and copying
over
the file onto new machine and defining the domain again 'virsh define
dom.xml' (s/dumpxml/net-dumpxml/ and s/define/net-define/ for networks
and so on).

If you run new enough libvirt there's even 'virsh migrate --offline'
that encapsulates steps from above.

For the latter just copy over the files onto new machine.

In theory, copying over XMLs should work too, but we don't really like
seeing users touching those behind libvirt's back as 'virsh define'
does
more than just saving the XML file.

Michal