Archives: December 2010

A make check bot for Ceph contributors

The automated make check for Ceph bot runs on Ceph pull requests. It is still experimental and will not be triggered by all pull requests yet.

It does the following:

A use case for developers is:

  • write a patch and send a pull request
  • switch to another branch and work on another patch while the bot is running
  • if the bot reports failure, switch back to the original branch and repush a fix: the bot will notice the repush and run again

It also helps reviewers who can wait until the bot succeeds before looking at the patch closely.

To debug an error, can be executed locally on the branch of the pull request, after merging or rebasing against the destination branch.

It can also be run in a container for CentOS 7 or Ubuntu 14.04. Each container needs about 10GB of disk. They are run using a dedicated Ceph clone to not be disturbed while development continues.

The preparation of the container uses and takes a long time (from five to thirty minutes or more depending on the bandwidth). It is however done once and reused as long as its depedencies (, debian/control, etc.) are not modified. The second step, including make -jX check, takes six minutes on a 64GB RAM, 250GB SSD, 24 core server and fifteen minutes on a 16GB RAM, 250GB spinner, 4 core laptop. The -jX is set to half of the number of processors reported by /proc/cpuinfo (i.e. make -j4 if there are 8 processors and make -j12 if there are 24 processors).

The bot runs in a container so that cleaning up a failed test or aborting if it takes too long (30 minutes) can be done by removing the container (for instance with docker stop ceph-ubuntu-14.04).

The bot is triggered from a Gitlab CI based on a mirror of the git repository. They both need to be polished.

v0.90 released

This is the last development release before Christmas. There are some API cleanups for librados and librbd, and lots of bug fixes across the board for the OSD, MDS, RGW, and CRUSH. The OSD also gets support for discard (potentially helpful on SSDs, although it is off by default), and there are several improvements to ceph-disk.

The next two development releases will be getting a slew of new functionality for hammer. Stay tuned!


  • Previously, the formatted output of ‘ceph pg stat -f …’ was a full pg dump that included all metadata about all PGs in the system. It is now a concise summary of high-level PG stats, just like the unformatted ‘ceph pg stat’ command.
  • All JSON dumps of floating point values were incorrecting surrounding the value with quotes. These quotes have been removed. Any consumer of structured JSON output that was consuming the floating point values was previously having to interpret the quoted string and will most likely need to be fixed to take the unquoted number.


  • arch: fix NEON feaeture detection (#10185 Loic Dachary)
  • build: adjust build deps for yasm, virtualenv (Jianpeng Ma)
  • build: improve build dependency tooling (Loic Dachary)
  • ceph-disk: call partx/partprobe consistency (#9721 Loic Dachary)
  • ceph-disk: fix dmcrypt key permissions (Loic Dachary)
  • ceph-disk: fix umount race condition (#10096 Blaine Gardner)
  • ceph-disk: init=none option (Loic Dachary)
  • ceph-monstore-tool: fix shutdown (#10093 Loic Dachary)
  • ceph-objectstore-tool: fix import (#10090 David Zafman)
  • ceph-objectstore-tool: many improvements and tests (David Zafman)
  • ceph.spec: package rbd-replay-prep (Ken Dreyer)
  • common: add ‘perf reset …’ admin command (Jianpeng Ma)
  • common: do not unlock rwlock on destruction (Federico Simoncelli)
  • common: fix block device discard check (#10296 Sage Weil)
  • common: remove broken CEPH_LOCKDEP optoin (Kefu Chai)
  • crush: fix tree bucket behavior (Rongze Zhu)
  • doc: add build-doc guidlines for Fedora and CentOS/RHEL (Nilamdyuti Goswami)
  • doc: enable rbd cache on openstack deployments (Sebastien Han)
  • doc: improved installation nots on CentOS/RHEL installs (John Wilkins)
  • doc: misc cleanups (Adam Spiers, Sebastien Han, Nilamdyuti Goswami, Ken Dreyer, John Wilkins)
  • doc: new man pages (Nilamdyuti Goswami)
  • doc: update release descriptions (Ken Dreyer)
  • doc: update sepia hardware inventory (Sandon Van Ness)
  • librados: only export public API symbols (Jason Dillaman)
  • libradosstriper: fix stat strtoll (Dongmao Zhang)
  • libradosstriper: fix trunc method (#10129 Sebastien Ponce)
  • librbd: fix list_children from invalid pool ioctxs (#10123 Jason Dillaman)
  • librbd: only export public API symbols (Jason Dillaman)
  • many coverity fixes (Danny Al-Gaaf)
  • mds: ‘flush journal’ admin command (John Spray)
  • mds: fix MDLog IO callback deadlock (John Spray)
  • mds: fix deadlock during journal probe vs purge (#10229 Yan, Zheng)
  • mds: fix race trimming log segments (Yan, Zheng)
  • mds: store backtrace for stray dir (Yan, Zheng)
  • mds: verify backtrace when fetching dirfrag (#9557 Yan, Zheng)
  • mon: add max pgs per osd warning (Sage Weil)
  • mon: fix *_ratio units and types (Sage Weil)
  • mon: fix JSON dumps to dump floats as flots and not strings (Sage Weil)
  • mon: fix formatter ‘pg stat’ command output (Sage Weil)
  • msgr: async: several fixes (Haomai Wang)
  • msgr: simple: fix rare deadlock (Greg Farnum)
  • osd: batch pg log trim (Xinze Chi)
  • osd: clean up internal ObjectStore interface (Sage Weil)
  • osd: do not abort deep scrub on missing hinfo (#10018 Loic Dachary)
  • osd: fix ghobject_t formatted output to include shard (#10063 Loic Dachary)
  • osd: fix osd peer check on scrub messages (#9555 Sage Weil)
  • osd: fix pgls filter ops (#9439 David Zafman)
  • osd: flush snapshots from cache tier immediately (Sage Weil)
  • osd: keyvaluestore: fix getattr semantics (Haomai Wang)
  • osd: keyvaluestore: fix key ordering (#10119 Haomai Wang)
  • osd: limit in-flight read requests (Jason Dillaman)
  • osd: log when scrub or repair starts (Loic Dachary)
  • osd: support for discard for journal trim (Jianpeng Ma)
  • qa: fix osd create dup tests (#10083 Loic Dachary)
  • rgw: add location header when object is in another region (VRan Liu)
  • rgw: check timestamp on s3 keystone auth (#10062 Abhishek Lekshmanan)
  • rgw: make sysvinit script set ulimit -n properly (Sage Weil)
  • systemd: better systemd unit files (Owen Synge)
  • tests: ability to run unit tests under docker (Loic Dachary)


Realtime :

mount -o discard /dev/rbd0 /mnt/myrbd

Using batch :

fstrim /mnt/myrbd


The empty FS :

$ rbd create rbd/myrbd --size=20480
$ mkfs.xfs /dev/rbd0
$ rbd diff rbd/myrbd | awk '{ SUM += $2 } END { print SUM/1024/1024 " MB" }'
14.4062 MB

With a big file… :

$ mount /dev/rbd0 /mnt/myrbd
$ dd if=/dev/zero of=/mnt/myrbd/testfile bs=1M count=1024
$ rbd diff rbd/myrbd | awk '{ SUM += $2 } END { print SUM/1024/1024 " MB" }'
1038.41 MB

When the big file has been removed (with file system not mount with “discard”) :

$ rm /mnt/myrbd/testfile
$ rbd diff rbd/myrbd | awk '{ SUM += $2 } END { print SUM/1024/1024 " MB" }'
1038.41 MB

Launch FS trim :

$ fstrim /mnt/myrbd
$ rbd diff rbd/myrbd | awk '{ SUM += $2 } END { print SUM/1024/1024 " MB" }'
10.6406 MB

Benchmark discard option

Without “discard” :

$ mount /dev/rbd0 /mnt/rbd0

$ mkdir testdir; cd testdir
$ dd if=/dev/zero of=mainfile bs=1M count=200
$ split -b 4048 -a 7 mainfile; sync               # 4k file / ~51k files
$ cd ..
$ time rm -rf testdir; time sync
real    0m2.780s
user    0m0.096s
sys     0m2.632s

real    0m0.130s
user    0m0.004s
sys     0m0.016s

# total: < 3s

With “discard” :

$ mount -o discard /dev/rbd1 /mnt/rbd1

$ mkdir testdir; cd testdir
$ dd if=/dev/zero of=mainfile bs=1M count=200
$ split -b 4048 -a 7 mainfile; sync               # 4k file / ~51k files
$ cd ..
$ time rm -rf testdir; time sync
real    1m51.471s
user    0m0.104s
sys     0m2.084s

real    0m47.262s
user    0m0.000s
sys     0m0.008s

# total: ~1m56

This is on 2 osd without ssd journal…

In the case of intensive use of the file system, with many small file, it may be more advantageous to use fstrim, for example once a day.

Teuthology docker targets hack (3/3)

The teuthology container hack is improved so each Ceph command is run via docker exec -i which can read from stdin as of docker 1.4 released in December 2014.
It can run the following job

machine_type: container
os_type: ubuntu
os_version: "14.04"
suite_path: /home/loic/software/ceph/ceph-qa-suite
- - mon.a
  - osd.0
  - osd.1
  - client.0
      branch: master
    wait-for-scrub: false
- install:
- ceph:

under one minute, when repeated a second time and the bulk of the installation can be reused.

{duration: 50.01510691642761, flavor: basic,
  owner:, success: true}

The docker exec -i commands a run with

        self.p = subprocess.Popen(self.args,
                                  stdout=stdout, stderr=stderr,

The stdin is set when the command is created, as an os.pipe, so that it can be written to immediately, even before the command is actually run (which may happen at a later time if the thread is already busy finished a previous command). The stdout and stderr are consumed immediately after the command is run and copied over to the arguments provided by the caller:

        while ( self.file_copy(self.p.stdout, self.stdout) or
                self.file_copy(self.p.stderr, self.stderr) ):

All other file descriptors are closed (with close_fds=True), otherwise the child process will hang until they are all closed.

The ceph-disk script manages Ceph devices and rely on the content of the /dev/disk/by-partuuid directory which is updated by udev rules. For instance:

  • a new partition is created with /sbin/sgdisk –largest-new=1 –change-name=1:ceph data –partition-guid=1:83c14a9b-0493-4ccf-83ff-e3e07adae202 –typecode=1:89c57f98-2fe5-4dc0-89c1-f3ad0ceff2be — /dev/loop4
  • the kernel is notified of the change with partprobe or partx and fires a udev event
  • the udev daemon receives UDEV [249708.246769] add /devices/virtual/block/loop4/loop4p1 (block) and the /lib/udev/rules.d/60-persistent-storage.rules script creates the corresponding symlink.

Let say the partition table is removed later (with sudo sgdisk –zap-all –clear –mbrtogpt — /dev/loop4 for instance) and the kernel is not notified with partprobe or partx. If the first partition is created again and the kernel is notified as above, it will fail to notice any difference and will not send a udev event. As a result /dev/disk/by-partuuid will contain a symlink that is outdated.
The problem can be fixed by manually removing the stale symlink from /dev/disk/by-partuuid, clearing the partition table and notifying the kernel again. The events sent to udev can be displayed with:

# udevadm monitor
KERNEL[250902.072077] change   /devices/virtual/block/loop4 (block)
UDEV  [250902.100779] change   /devices/virtual/block/loop4 (block)
KERNEL[250902.101235] remove   /devices/virtual/block/loop4/loop4p1 (block)
UDEV  [250902.101421] remove   /devices/virtual/block/loop4/loop4p1 (block)

How many PGs in each OSD of a Ceph cluster ?

To display how many PGs in each OSD of a Ceph cluster:

$ ceph --format xml pg dump | \
   xmlstarlet sel -t -m "//pg_stats/pg_stat/acting" -v osd -n | \
   sort -n | uniq -c
    332 0
    312 1
    299 2
    326 3
    291 4
    295 5
    316 6
    311 7
    301 8
    313 9

Where xmlstarlet loops over each PG acting set ( -m “//pg_stats/pg_stat/acting” ) and displays the OSDs it contains (-v osd), one by line (-n). The first column is the number of PGs in which the OSD in the second column shows.
To restrict the display to the PGs belonging to a given pool:

ceph --format xml pg dump |  \
  xmlstarlet sel -t -m "//pg_stats/pg_stat[starts-with(pgid,'0.')]/acting" -v osd -n | \
  sort -n | uniq -c

Where 0. is the prefix of each PG that belongs to pool 0.

© 2014, Inktank Storage, Inc.. All rights reserved.