3 image_base
="quay.io/ceph-ci/ceph"
5 if which podman
2>&1 > /dev
/null
; then
20 shortid
=`echo $fsid | cut -c 1-8`
21 echo "shortid $shortid"
25 if [ -x "$(which ip 2>/dev/null)" ]; then
30 # filter out IPv4 and localhost addresses
31 ip
="$($IP_CMD | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' | head -n1)"
32 # if nothing left, try using localhost address, it might work
33 if [ -z "$ip" ]; then ip
="127.0.0.1"; fi
38 if [ -z "$port" ]; then
41 port
="$(echo $(( RANDOM % 1000 + 40000 )))"
42 ss
-a -n |
grep LISTEN |
grep "${ip}:${port} " 1>/dev
/null
2>&1 ||
break
47 # make sure we have an image
48 if ! $runtime image inspect
$image_base:$shortid 2>/dev
/null
; then
49 echo "building initial $image_base:$shortid image..."
50 sudo ..
/src
/script
/cpatch
-t $image_base:$shortid
53 sudo ..
/src
/cephadm
/cephadm rm-cluster
--force --fsid $fsid
54 sudo ..
/src
/cephadm
/cephadm
--image ${image_base}:${shortid} bootstrap \
57 --mon-addrv "[v2:$ip:$port]" \
61 # kludge to make 'bin/ceph ...' work
62 sudo
chmod 755 ceph.client.admin.keyring
63 echo 'keyring = ceph.client.admin.keyring' >> ceph.conf
66 echo "sudo ../src/script/cpatch -t $image_base:$shortid"