Comment 10 for bug 1881747

Revision history for this message
Tobias Bossert (tobib) wrote (last edit ):

Related pull request: https://github.com/ceph/ceph/pull/46043

## Edit

Since it probably takes a while until the PR is merged here is my script to "modify" the ceph docker image:

```
#!/bin/bash
# Use this file to create a patched ceph docker image
# Usage: ./patch_ceph_image.sh <ceph_version>
# Example: ./patch_ceph_image.sh v16.2.7
#
# Relevant pull request: https://github.com/ceph/ceph/pull/46043
#
# After creating the patched image, you most likely want to upload it to a docker registry
CEPH_VERSION_TAG=$1
CEPH_IMAGE_SOURCE="quay.io/ceph/ceph"
CONTAINER_NAME=ceph_custom_$CEPH_VERSION_TAG
docker pull $CEPH_IMAGE_SOURCE:$CEPH_VERSION_TAG
IMAGE_ID=`docker images | grep -E "$CEPH_IMAGE_SOURCE|$CEPH_VERSION_TAG" | awk -F ' ' '{print \$3}'`
docker create --name $CONTAINER_NAME $IMAGE_ID
# And directly exit the container
docker cp $CONTAINER_NAME:/usr/lib/python3.6/site-packages/ceph_volume/util/system.py .
patch system.py -p0 -c --fuzz=3 --ignore-whitespace --output system_$CEPH_VERSION_TAG.py --verbose << 'EOF'
*** system.py 2021-12-07 17:15:49.000000000 +0100
--- system_n.py 2022-06-02 13:25:32.579878573 +0200
***************
*** 287,293 ****
              device = fields[0]
          path = os.path.realpath(fields[1])
          # only care about actual existing devices
          if not os.path.exists(device) or not device.startswith('/'):
! if device not in do_not_skip:
                  continue
          if device in devices_mounted.keys():
--- 287,294 ----
              device = fields[0]
          path = os.path.realpath(fields[1])
+ filesystem = fields[2]
          # only care about actual existing devices
          if not os.path.exists(device) or not device.startswith('/'):
! if device not in do_not_skip and filesystem != 'zfs':
                  continue
          if device in devices_mounted.keys():
EOF
# Verify
diff -u system.py system_$CEPH_VERSION_TAG.py
read -p "Is the diff correct? (y/N)" CONT
if [ "$CONT" = "y" ]; then
  docker cp system_$CEPH_VERSION_TAG.py $CONTAINER_NAME:/usr/lib/python3.6/site-packages/ceph_volume/util/system.py
  MOD_CONTAINER_ID=`docker ps -a | grep $CONTAINER_NAME | cut -d' ' -f 1`
  docker commit $MOD_CONTAINER_ID ceph-oep-patched:$CEPH_VERSION_TAG
  docker rm $CONTAINER_NAME
else
  docker rm $CONTAINER_NAME
  exit
fi
```