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
22 echo "shortid $shortid"
26 if [ -x "$(which ip 2>/dev/null)" ]; then
31 # filter out IPv4 and localhost addresses
32 ip
="$($IP_CMD | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' | head -n1)"
33 # if nothing left, try using localhost address, it might work
34 if [ -z "$ip" ]; then ip
="127.0.0.1"; fi
44 port
="$(echo $(( RANDOM % 1000 + 40000 )))"
45 ss
-a -n |
grep LISTEN |
grep "${ip}:${port} " 2>&1 >/dev
/null ||
break
52 # make sure we have an image
53 if ! sudo
$runtime image inspect
$image_base:$shortid 1>/dev
/null
2>/dev
/null
; then
54 echo "building initial $image_base:$shortid image..."
55 sudo ..
/src
/script
/cpatch
-t $image_base:$shortid
58 sudo ..
/src
/cephadm
/cephadm rm-cluster
--force --fsid $fsid
59 sudo ..
/src
/cephadm
/cephadm
--image ${image_base}:${shortid} bootstrap \
62 --mon-addrv "[v2:$ip:$port]" \
67 # kludge to make 'bin/ceph ...' work
68 sudo
chmod 755 ceph.client.admin.keyring
69 echo 'keyring = ceph.client.admin.keyring' >> ceph.conf
71 # don't use repo digests; this implicitly does a pull and we don't want that
72 bin
/ceph config
set mgr mgr
/cephadm
/use_repo_digest false
75 echo "sudo ../src/script/cpatch -t $image_base:$shortid"