Skip to content

Commit

Permalink
Fix run dir issues
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Sabaini <[email protected]>
  • Loading branch information
sabaini committed Jul 12, 2024
1 parent c79b31d commit 2c9e17e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ jobs:
run: ~/actionutils.sh headexec testrgw

- name: Install local build
run: ~/actionutils.sh install_multinode
run: ~/actionutils.sh upgrade_multinode

- name: Wait until 3 OSDs are up
run: ~/actionutils.sh headexec wait_for_osds 3
Expand Down
6 changes: 3 additions & 3 deletions microceph/ceph/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func GetConstConfigTable() ConfigTable {
"rgw_keystone_implicit_tenants": {"global", []string{"rgw"}},
"rgw_swift_account_in_url": {"global", []string{"rgw"}},
"rgw_swift_versioning_enabled": {"global", []string{"rgw"}},
"rgw_swift_enforce_content_length": {"global", []string{"rgw"}},
"rgw_swift_custom_header": {"global", []string{"rgw"}},
"rgw_swift_enforce_content_length": {"global", []string{"rgw"}},
"rgw_swift_custom_header": {"global", []string{"rgw"}},
}
}

Expand Down Expand Up @@ -254,7 +254,7 @@ func backwardCompatMonitors(s interfaces.StateInterface) ([]string, error) {
// UpdateConfig updates the ceph.conf file with the current configuration.
func UpdateConfig(s interfaces.StateInterface) error {
confPath := filepath.Join(os.Getenv("SNAP_DATA"), "conf")
runPath := filepath.Join(os.Getenv("SNAP_DATA"), "run")
runPath := filepath.Join(filepath.Dir(os.Getenv("SNAP_DATA")), "current", "run")

err := backwardCompatPubnet(s)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions snapcraft/commands/common
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
wait_for_config() {

local confpath="${SNAP_DATA}/conf/ceph.conf"
local search_str="^run dir = ${SNAP_DATA}/run"
local search_str="^run dir = "
local max_attempts=300
local attempt=0

Expand All @@ -15,6 +14,6 @@ wait_for_config() {
sleep 2
done

echo "No updated conf found in ${confpath}"
echo "No conf found in ${confpath}"
return 1
}
41 changes: 29 additions & 12 deletions tests/scripts/actionutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,33 @@ function install_store() {
done
}

function upgrade_multinode() {
# Refresh to local version, checking health
for container in node-wrk0 node-wrk1 node-wrk2 node-wrk3 ; do
lxc exec $container -- sh -c "sudo snap install --dangerous /mnt/microceph_*.snap"
lxc exec $container -- sh -c "snap connect microceph:block-devices ; snap connect microceph:hardware-observe ; snap connect microceph:mount-observe"
sleep 5
expect=3
for i in $(seq 1 8); do
res=$( ( lxc exec $container -- sh -c "microceph.ceph osd status" | fgrep -c "exists,up" ) )
if [[ $res -eq $expect ]] ; then
echo "Found ${expect} osd up"
break
else
echo -n '.'
sleep 5
fi
done
res=$( ( lxc exec $container -- sh -c "microceph.ceph osd status" | fgrep -c "exists,up" ) )
if [[ $res -ne $expect ]] ; then
echo "Expected $expect OSD up, got $res"
lxc exec $container -- sh -c "microceph.ceph -s"
exit -1
fi
done
}


function refresh_snap() {
local chan="${1?missing}"
for container in node-wrk0 node-wrk1 node-wrk2 node-wrk3 ; do
Expand Down Expand Up @@ -209,7 +236,7 @@ function bootstrap_head() {
set -ex

local arg=$1
if [ $arg = "public" ]; then
if [ "$arg" = "public" ]; then
# Bootstrap microceph on the head node
local nw=$(get_lxd_network public)
local gw=$(echo "$nw" | cut -d/ -f1)
Expand All @@ -219,7 +246,7 @@ function bootstrap_head() {
sleep 5
# Verify ceph.conf
verify_bootstrap_configs node-wrk0 "${nw}" "${node_ip}"
elif [ $arg = "internal" ]; then
elif [ "$arg" = "internal" ]; then
# Bootstrap microceph on the head node with custom microceph ip.
local nw=$(get_lxd_network internal)
local gw=$(echo "$nw" | cut -d/ -f1)
Expand Down Expand Up @@ -421,16 +448,6 @@ function test_ceph_conf() {
for n in $( lxc ls -c n --format csv ); do
echo "checking node $n"
lxc exec $n -- sh <<'EOF'
# Test: configured rundir must be current
current=$( realpath /var/snap/microceph/current )
rundir=$( cat /var/snap/microceph/current/conf/ceph.conf | awk '/run dir/{ print $4 }' )
p=$( dirname $rundir )
if [ $p != $current ]; then
echo "Error: snap data dir $current, configured run dir: $rundir"
cat /var/snap/microceph/current/conf/ceph.conf
exit -1
fi
# Test: must contain public_network
if ! grep -q public_net /var/snap/microceph/current/conf/ceph.conf ; then
echo "Error: didn't find public_net in ceph.conf"
Expand Down

0 comments on commit 2c9e17e

Please sign in to comment.