Commit 817cdf9
authored
monitor: One-to-one relationship between guests and images (#75)
so far, we’ve managed the lifecycle of an image like servo-ubuntu2204
like this:
- rebuild the image by building a new _profile guest_ (libvirt guest
named “**servo-ubuntu2204**”)
- destroy the guest with that name, if it exists
- recreate the guest from profiles/servo-ubuntu2204/guest.xml
- set the disk to /path/to/base/servo-ubuntu2204/base.img@[timestamp]
- start the guest, so that it can install tooling, bake in cached
builds, etc
- destroy the libvirt guest
- recreate the guest from profiles/servo-ubuntu2204/guest.xml
- set the disk to /path/to/base/servo-ubuntu2204/base.img (symlink)
- if successful, symlink /path/to/base/servo-ubuntu2204/base.img to
base.img@[timestamp]
- if unsuccessful, symlink /path/to/base/servo-ubuntu2204/base.img to
base.img@[oldTimestamp]
- create runners by cloning that guest into each _runner guest_
(“**ci-runner-servo-ubuntu2204.[number]**”)
- clone the disks, but not the guests, with the monitor (so it can be
parallelised)
- clone the guest, but not the disks, with virt-clone
that works well enough for our current setup with libvirt and ZFS, but
some hypervisors, like UTM (#64), will require us to treat each virtual
machine as a self-contained object, with its own configuration and image
files. in UTM, it’s hard to destroy a guest without also destroying its
disks.
this patch moves the monitor closer to that world, by avoiding the
destroy-recreate-configure pattern in image rebuilds. the lifecycle for
servo-ubuntu2204 images now looks like this:
- rebuild the image by building a new _rebuild guest_
(“**ci-rebuild-servo-ubuntu2204@[timestamp]**”)
- create the guest from profiles/servo-ubuntu2204/guest.xml
- set the disk to /path/to/base/servo-ubuntu2204/base.img@[timestamp]
- start the guest, so that it can install tooling, bake in cached
builds, etc
- if successful, convert that guest to a new _template guest_
(“**ci-template-servo-ubuntu2204@[timestamp]**”)
- conversion just means renaming the guest from “ci-rebuild-…” to
“ci-template-…”
- if unsuccessful, just destroy that guest
- create runners by cloning that guest into each _runner guest_
(“**ci-runner-servo-ubuntu2204.[number]**”)
- clone the disks, but not the guests, with the monitor (so it can be
parallelised)
- clone the guest, but not the disks, with virt-clone
bonus: with this patch, failed rebuilds will no longer leave the
template in an inconsistent state, with the old image data (good) but
the new guest configuration (bad because it may be broken).
<img width="771" height="519" alt="image"
src="https://github.com/user-attachments/assets/21898110-d243-401a-9e0d-8852d2b74a9a"
/>1 parent 23f7b83 commit 817cdf9
File tree
10 files changed
+361
-452
lines changed- monitor
- settings/src
- src
- image
10 files changed
+361
-452
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| |||
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
245 | 259 | | |
246 | 260 | | |
247 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
25 | 42 | | |
26 | 43 | | |
27 | 44 | | |
| |||
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
0 commit comments