How to check if container creation has finished copying files?

Hi guys, I’m working on a “cluster manager” ( a series of scripts) to allow our APP to manage the LXD cluster.

We have several methods in place to check task completion and container health for different scenarios, however, there is one scenario where I don’t know how to check…

For creating a new copy (instance) of our APP, we copy an existing stopped container, after issuing the command to copy, it takes some time for the files to get copied and I don’t know how to check if this process has been fully completed.

Trying to start the container before this process is completed has a lot of problems, so…

Is there a way to check if ZFS is done with copying files and changing permissions for those files on the new container?

Would using an image instead of a stopped container make things faster at container creation?

Thank you!

If both sides are zfs, you probably will see the processes zfs-send or zfs-recv (depending on which side you’re looking)

Thanks a lot @kbos, I’m not sending or receiving via ZFS commands because LXD is taking care of this, however, digging your recommendation I found that you can also “zfs diff” whatever commands LXD issued, I guess I just need to compare origin nd destination directories and check if there are the same or not, once they are the same, the file cloning should be complete (not sure about how I will check file permissions, which is also a time consuing task LXD does after the copy)

After you launch the create operation you will get a resonse containing the operation id you can then use the api call Operation wait which will only return once its complete

Also self promotion: i have a lxd manager app that might be of use LxdMosaic