lxd icon indicating copy to clipboard operation
lxd copied to clipboard

Add support for `lxc cluster failure-domain ...` commands (to make tests more reliable)

Open tomponline opened this issue 2 years ago • 6 comments

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.

tomponline avatar Aug 24 '22 07:08 tomponline

Hey @tomponline I am happy to take this one.

zakufish avatar Sep 13 '22 04:09 zakufish

Thanks!

tomponline avatar Sep 13 '22 06:09 tomponline

Been a bit busy at work lately, I'll probably work on this over the weekend. Sorry for the delay.

zakufish avatar Oct 06 '22 02:10 zakufish

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.

jeffreyxie0615 avatar Feb 21 '23 17:02 jeffreyxie0615

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

tomponline avatar Feb 21 '23 17:02 tomponline

Cleared assignment due to inactivity

tomponline avatar Feb 21 '24 13:02 tomponline