diff --git a/create_lxc_base.sh b/create_lxc_base.sh index f423478..52ec624 100755 --- a/create_lxc_base.sh +++ b/create_lxc_base.sh @@ -16,7 +16,7 @@ if ! lxc image list --format csv --columns l | grep -q "$UBUNTU_BASE_IMAGE_NAME" --alias "$UBUNTU_BASE_IMAGE_NAME" else # copy the image down from canonical. - lxc image copy "images:$BASE_LXC_IMAGE" "$REMOTE_NAME": --alias "$UBUNTU_BASE_IMAGE_NAME" --public --vm --auto-update + lxc image copy "images:$BASE_LXC_IMAGE" "$REMOTE_NAME": --alias "$UBUNTU_BASE_IMAGE_NAME" --public --vm --auto-update fi fi diff --git a/deploy.sh b/deploy.sh index af5d4a0..3b53552 100755 --- a/deploy.sh +++ b/deploy.sh @@ -382,7 +382,6 @@ EOL # check if the OVN network exists in this project. if ! lxc network list | grep -q "ss-ovn"; then lxc network create ss-ovn --type=ovn network=lxdbr1 ipv6.address=none - # ipv4.nat=false fi export MAC_ADDRESS_TO_PROVISION= diff --git a/deploy_vm.sh b/deploy_vm.sh index 3bd4a92..3b52dcc 100755 --- a/deploy_vm.sh +++ b/deploy_vm.sh @@ -42,6 +42,7 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then lxc config device override "$LXD_VM_NAME" root size="${ROOT_DISK_SIZE_GB}GB" lxc start "$LXD_VM_NAME" + sleep 10 bash -c "./wait_for_lxc_ip.sh --lxd-name=$LXD_VM_NAME" fi diff --git a/wait_for_lxc_ip.sh b/wait_for_lxc_ip.sh index d25bbf2..eac89e8 100755 --- a/wait_for_lxc_ip.sh +++ b/wait_for_lxc_ip.sh @@ -42,3 +42,8 @@ while true; do printf '.' fi done + +# wait for cloud-init to complet before returning. +while lxc exec "$LXC_INSTANCE_NAME" -- [ ! -f /var/lib/cloud/instance/boot-finished ]; do + sleep 1 +done \ No newline at end of file