From 988414133af0774fa5159c47b419af9a83134ee1 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 26 Apr 2024 09:26:53 -0400 Subject: [PATCH] tests/container-copy: allow some time for the VM time to stabilize Fixes https://github.com/canonical/lxd/issues/13388 Signed-off-by: Simon Deziel --- tests/container-copy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/container-copy b/tests/container-copy index a1d583a4b..8b2c6e4e8 100644 --- a/tests/container-copy +++ b/tests/container-copy @@ -22,10 +22,18 @@ echo "==> Launch a VM which will be the target of the copy" lxc launch "${IMAGE}" target --vm waitInstanceBooted target -echo "==> Add the target VM as a remote LXD" +echo "==> Setup LXD on the target VM" lxc exec target -- snap install lxd --channel "${LXD_SNAP_CHANNEL}" lxc exec target -- lxd init --auto lxc exec target -- lxc config set core.https_address=:8443 + +echo "==> Wait for the target VM time to be synchronized with NTP" +for _ in $(seq 6); do + [ "$(lxc exec target -- timedatectl show --property=NTPSynchronized --value)" = "yes" ] && break + sleep 10 +done + +echo "==> Add the target VM as a remote LXD" token="$(lxc exec target -- lxc config trust add --name host --quiet)" lxc remote add target "${token}" --accept-certificate