Merge ~hyask/autopkgtest-cloud:skia/lxd-remote-bos03 into autopkgtest-cloud:master

Proposed by Skia
Status: Merged
Merged at revision: 5d5fbe11fb9022800f0d6359e97a8682919380e5
Proposed branch: ~hyask/autopkgtest-cloud:skia/lxd-remote-bos03
Merge into: autopkgtest-cloud:master
Diff against target: 105 lines (+27/-17)
2 files modified
charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/armhf-lxd.userdata (+23/-15)
docs/lxd.rst (+4/-2)
Reviewer Review Type Date Requested Status
Tim Andersson Approve
Review via email: mp+463351@code.launchpad.net

Description of the change

Based on the experience deploying armhf LXD remotes on bos03, here are the necessary changes that were needed.

To post a comment you must log in.
Revision history for this message
Tim Andersson (andersson123) wrote :

I only have one inline comment, but other than that, this LGTM as long as it doesn't break bos02 or bos01, which I'm presuming it doesn't.

I may also not be the best person to review this, but I think it looks good :)

Revision history for this message
Skia (hyask) wrote :

This completely breaks bos02, since the network interface and disk block device name have changed. Still, we decided to drop bos02, so this won't matter much, and even if we did want to go back to bos02, it's just a revert away :-)

Revision history for this message
Tim Andersson (andersson123) wrote :

great, well, this is an approval in spirit until the day we decide to fully drop bos02.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/armhf-lxd.userdata b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/armhf-lxd.userdata
2index bb50ada..291715b 100644
3--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/armhf-lxd.userdata
4+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/armhf-lxd.userdata
5@@ -61,7 +61,6 @@ write_files:
6 ipv4.address: 10.0.4.1/24
7 ipv4.nat: "true"
8 ipv6.address: none
9- raw.dnsmasq: dhcp-option=6,91.189.91.130
10 description: ""
11 name: lxdbr0
12 type: bridge
13@@ -79,8 +78,8 @@ write_files:
14 security.nesting: "true"
15 description: Default LXD profile
16 devices:
17- eth0:
18- name: eth0
19+ enp1s0:
20+ name: enp1s0
21 nictype: bridged
22 parent: lxdbr0
23 type: nic
24@@ -100,14 +99,23 @@ write_files:
25 systemctl stop snap.lxd.daemon.unix.socket snap.lxd.daemon.service || true
26 systemctl start snap.lxd.daemon.unix.socket snap.lxd.daemon.service
27 lxd init --preseed < /var/tmp/setup/lxd-init
28- if lxc image info ubuntu-daily:$(distro-info --devel)/armhf >/dev/null 2>&1; then
29- /home/ubuntu/autopkgtest/tools/autopkgtest-build-lxd ubuntu-daily:$(distro-info --devel)/armhf
30+ export MIRROR=http://ftpmaster.internal/ubuntu/
31+ for r in $({ distro-info --supported; distro-info --supported-esm; } | sort -u | grep -v "$(distro-info --devel)\|trusty"); do
32+ command="/home/ubuntu/autopkgtest/tools/autopkgtest-build-lxd ubuntu:$r/armhf"
33+ ( sleep 20; $command ) || \
34+ ( sleep 20; $command ) || \
35+ ( sleep 20; $command ) || echo "Failed building $r image, please do it manually with 'MIRROR=$MIRROR $command'"
36+ done
37+ devel="$(distro-info --devel)"
38+ if lxc image info ubuntu-daily:$devel/armhf >/dev/null 2>&1; then
39+ command="/home/ubuntu/autopkgtest/tools/autopkgtest-build-lxd ubuntu-daily:$devel/armhf"
40+ $command || $command || $command || echo "Failed building $devel image, please do it manually with 'MIRROR=$MIRROR $command'"
41 else
42 # if image for the devel release does not exist then take the latest stable release and upgrade it.
43 # see autopkgtest-build-lxd(1) on what the RELEASE environment variable does.
44- MIRROR=http://ftpmaster.internal/ubuntu/ RELEASE=$(distro-info --devel) /home/ubuntu/autopkgtest/tools/autopkgtest-build-lxd ubuntu:$(distro-info --stable)/armhf
45+ command="RELEASE=$(distro-info --devel) /home/ubuntu/autopkgtest/tools/autopkgtest-build-lxd ubuntu:$(distro-info --stable)/armhf"
46+ $command || $command || $command || echo "Failed building $devel image, please do it manually with 'MIRROR=$MIRROR $command'"
47 fi
48- for r in $({ distro-info --supported; distro-info --supported-esm; } | sort -u | grep -v "$(distro-info --devel)\|trusty"); do /home/ubuntu/autopkgtest/tools/autopkgtest-build-lxd ubuntu:$r/armhf; done
49 echo "Finished building - rebooting so changed kernel command line comes into effect..."
50 reboot
51
52@@ -115,18 +123,18 @@ write_files:
53 # http://askubuntu.com/questions/446991/gparted-claims-whole-hard-drive-is-unallocated-and-gives-warning-about-gpt-table
54 # then create new ~ 100 GB partition and mount it as /srv
55 bootcmd:
56- - printf 'x\ne\nw\ny\n' | gdisk /dev/sda
57- - printf "d\n1\nn\n\n\n+10000M\n\n\nw\ny\n" | gdisk /dev/sda
58+ - printf 'x\ne\nw\ny\n' | gdisk /dev/vda
59+ - printf "d\n1\nn\n\n\n+10000M\n\n\nw\ny\n" | gdisk /dev/vda
60 - partprobe
61- - resize2fs /dev/sda1
62- - lsblk -dno PARTUUID /dev/sda1 | awk '{ print "GRUB_FORCE_PARTUUID=" $0 }' | tee /etc/default/grub.d/40-force-partuuid.cfg
63+ - resize2fs /dev/vda1
64+ - lsblk -dno PARTUUID /dev/vda1 | awk '{ print "GRUB_FORCE_PARTUUID=" $0 }' | tee /etc/default/grub.d/40-force-partuuid.cfg
65 - update-grub
66- - echo 'mkpart primary btrfs 10600MB 100%\n' | parted /dev/sda
67- - for timeout in `seq 10`; do [ -e /dev/sda2 ] && break; sleep 1; done
68+ - echo 'mkpart primary btrfs 10600MB 100%\n' | parted /dev/vda
69+ - for timeout in `seq 10`; do [ -e /dev/vda2 ] && break; sleep 1; done
70
71 # use compat_uts_machine=armv7l so that 'linux32 uname -m' shows armv7l, like the buildds
72 runcmd:
73- - mkfs.btrfs -L autopkgtest /dev/sda2
74+ - mkfs.btrfs -L autopkgtest /dev/vda2
75 - systemctl stop snap.lxd.daemon.service snap.lxd.daemon.unix.socket
76 - echo 'LABEL=autopkgtest /srv btrfs defaults 0 0' >> /etc/fstab
77 - echo '/srv/var-snap-lxd-common /var/snap/lxd/common none defaults,bind 0 0' >> /etc/fstab
78@@ -154,6 +162,6 @@ runcmd:
79 - adduser ubuntu lxd
80
81 - apt-get install -y --no-install-recommends git
82- - su - -c '[ -e autopkgtest ] || git clone https://git.launchpad.net/~ubuntu-release/autopkgtest/+git/development autopkgtest' ubuntu
83+ - su - -c '[ -e autopkgtest ] || git clone -b ubuntu/cb2df3e+deb822+prod https://salsa.debian.org/ubuntu-ci-team/autopkgtest autopkgtest' ubuntu
84 - su - -c 'cat /var/tmp/setup/ubuntu-crontab | crontab -' ubuntu
85 - sh -xe /var/tmp/setup/post-boot-setup.sh &
86diff --git a/docs/lxd.rst b/docs/lxd.rst
87index 2c86419..54dd744 100644
88--- a/docs/lxd.rst
89+++ b/docs/lxd.rst
90@@ -31,11 +31,13 @@ To deploy a new node, after having sourced the cloud ``.rc`` file (``source ~/.s
91 $ NET_ID=$(openstack network show net_prod-proposed-migration --format json | jq -r '."id"')
92 $ openstack server create --image $IMAGE --flavor m1.xlarge --nic net-id=$NET_ID --key-name prod-proposed-migration-environment --security-group default --security-group lxd --user-data ~/autopkgtest-cloud/autopkgtest-cloud/tools/armhf-lxd.userdata -- lxd-armhfN
93
94-*Note*: on a new environment, you may need to upload the `prod-proposed-migration-environment` SSH key with something like ``openstack keypair create --public-key ~/.ssh/id_ed25519.pub prod-proposed-migration-environment``.
95+*Note*: on a new environment, you may need to:
96+ * upload the `prod-proposed-migration-environment` SSH key with something like ``openstack keypair create --public-key ~/.ssh/id_ed25519.pub prod-proposed-migration-environment``.
97+ * make sure the correct security group is created with the right rules (at least allowing ingress 8443/tcp), with ``mojo/make-lxd-secgroup`` (open that script and adapt it if needed, it's currently not very flexible but easy to tweak to your needs).
98
99 In the event that you want to deploy the new node on a specifc host you can use the ``--hint same_host`` argument e.g. ``openstack server create --hint same_host=2e838a71-f6d9-46c4-94f9-dd0c6a2632fe``.
100
101-N.B. Wait for it to finish deploying (watch ``/var/log/cloud-init-output.log``) on the newly deployed node. If you do not wait then the unit files for the node on the autopkgtest-lxd-worker will fail as there will be missing images for releases.
102+N.B. Wait for it to finish deploying (watch ``/var/log/cloud-init-output.log``) on the newly deployed node. If you do not wait then the unit files for the node on the autopkgtest-lxd-worker will fail as there will be missing images for releases. You can also use ``lxc image list`` to check what was correctly built, and finish the work manually if needed. Commands should be in the cloud-init log.
103
104 And you then need to add the IP to the ``autopkgtest-lxd-worker``
105 ``lxd-remotes`` section, in the ``service-bundle`` for example:

Subscribers

People subscribed via source and target branches