canonical/lxd

`lxc export` to stdout doesn't work with VM instances

simondeziel opened this issue · 0 comments

Initial setup:

$ lxc init images:alpine/edge v1 -c security.secureboot=false --vm
$ lxc init images:alpine/edge c1

lxc export to stdout doesn't work for VM instances:

$ lxc export v1 --compression=none - | tar -t backup/virtual-machine.img
tar: This does not look like a tar archive
tar: Skipping to next header
tar: backup/virtual-machine.img: Not found in archive
tar: Exiting with failure status due to previous errors

but works for containers:

$ lxc export c1 --compression=none - | tar -t backup/container/templates
backup/container/templates
backup/container/templates/hostname.tpl
backup/container/templates/hosts.tpl
backup/container/templates/inittab.tpl

It seems that for VMs, the exported stream isn't a tar file:

$ lxc export v1 --compression=none - | file -
/dev/stdin: data

$ lxc export c1 --compression=none - | file -
/dev/stdin: POSIX tar archive

Update: here's a workaround found after the bug fix was merged: add --quiet when exporting the VM:

$ lxc export v1 --quiet --compression=none - | tar -t backup/virtual-machine.img
backup/virtual-machine.img