lxd
lxd copied to clipboard
Add support for `lxc cluster failure-domain ...` commands (to make tests more reliable)
Currently in the test_clustering_failure_domains
test we have this section just after spawning a 6 member cluster:
# Set failure domains
# shellcheck disable=SC2039
printf "roles: [\"database\"]\nfailure_domain: \"az1\"\ngroups: [\"default\"]" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node1
# shellcheck disable=SC2039
printf "roles: [\"database\"]\nfailure_domain: \"az2\"\ngroups: [\"default\"]" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node2
# shellcheck disable=SC2039
printf "roles: [\"database\"]\nfailure_domain: \"az3\"\ngroups: [\"default\"]" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node3
# shellcheck disable=SC2039
printf "roles: []\nfailure_domain: \"az1\"\ngroups: [\"default\"]" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node4
# shellcheck disable=SC2039
printf "roles: []\nfailure_domain: \"az2\"\ngroups: [\"default\"]" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node5
# shellcheck disable=SC2039
printf "roles: []\nfailure_domain: \"az3\"\ngroups: [\"default\"]" | LXD_DIR="${LXD_THREE_DIR}" lxc cluster edit node6
Sometimes this section fails with:
/lxc-ci/build/tmp.JPbQe1OLZy/go/bin/lxc cluster edit node2 --verbose
Error: The 'database' role cannot be added at this time
This occurs because automatic cluster member roll assignment is not guaranteed to assign the roles in order of when each cluster member was spawned (especially accounting for spawning them all in quick succession).
Because there is no lxc cluster failure-domain set
command, this test section is forced to use lxc cluster edit
and include a roles
list that is what the cluster is expected to be in. But this is not always the case and is not relevant to the test.
We should add lxc cluster failure-domain [get|set|unset]
commands and update this test section to use them.
Hey @tomponline I am happy to take this one.
Thanks!
Been a bit busy at work lately, I'll probably work on this over the weekend. Sorry for the delay.
Hey! My partner and I are students from UT Austin as part of their virtualization class, and we were wondering that if no one has worked on this lately, we could tackle this issue! If so, we would appreciate any assistance in getting things setup/any background knowledge that can be offered.
Thanks!
The first step will be to get a working LXD build, take a look at https://linuxcontainers.org/lxd/docs/master/installing/#install-lxd-from-source
Cleared assignment due to inactivity