Lxc rebuild questions

If I’m rebuilding inside a cluster, rebuild only succeeds if i run it against the exact cluster member where the container is running, everything else gives a storage failure error

$ lxc ls auatest2
| auatest2 | STOPPED |      |      | CONTAINER | 0         | lxd13    |
$ lxc rebuild c8 lxd11:auatest2
Error: Failed instance rebuild: Failed rebuilding instance from image: Instance storage pool not found
Exit Code: 1
$ lxc rebuild c8 lxd13:auatest2

is this intended? shouldn’t the cluster member that got the call forward it to wherever the container is? or at least can there be a --target? My cluster endpoint haproxies to the random cluster member and this is then a bit of a problem for me, as you can imagine :wink:

also would it be possible to support all the parameters as lxc init, especially --profile and --config? My use case is that I don’t want to necessarrily rebuild with the same config, but I want to keep old snapshots for easier rollback. Right now I’m doing

lxc mv container container-old
lxc init container --config .. --profile ...

in case of rollback:

 lxc rm -f container
 lxc mv container-old container

and that is messy as it creates a bunch of containers that clutter lxc lists and can be accidentally started, etc. Instead i want to be able to do something like this:

lxc snapshot container old
lxc rebuild container --profile --config ...

and then in case of rollback

lxc restore container old

much cleaner if you ask me


@gabrielmougard please can you see if you can help with this. Thanks

this got accidentally fixed in the meantime :slight_smile:

~$ lxc init c8 rebuildtest
Creating rebuildtest
~$ lxc file pull rebuildtest/etc/redhat-release -
CentOS Stream release 8
~$ lxc ls rebuildtest
|    NAME     |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS | LOCATION |
| rebuildtest | STOPPED |      |      | CONTAINER | 0         | lxd1     |
~$ lxc rebuild u22 lxd12:rebuildtest 
~$ lxc file pull rebuildtest/etc/debian_version -