doc/dev: add section on using the gen_state_diagram.py script

Commands sourced from Jianshen Liu's blog post on the Ceph peering state machine: https://jianshenliu.com/blog/development/ceph-peering-state-machine/

Also fixed the formatting of "PG info".

Signed-off-by: Laura Flores <lflores@redhat.com>
This commit is contained in:
Laura Flores 2022-02-09 20:53:33 +00:00
parent 48315ec623
commit b544e6986c
2 changed files with 25 additions and 3 deletions

View File

@ -60,7 +60,8 @@ Concepts
accepting write operations, and *recovery* can proceed
in the background.
*PG info* basic metadata about the PG's creation epoch, the version
*PG info*
basic metadata about the PG's creation epoch, the version
for the most recent write to the PG, *last epoch started*, *last
epoch clean*, and the beginning of the *current interval*. Any
inter-OSD communication about PGs includes the *PG info*, such that
@ -253,7 +254,17 @@ The high level process is for the current PG primary to:
old object (all of whose copies disappeared before they could be
replicated on members of the current *acting set*).
State Model
-----------
Generate a State Model
----------------------
Use the `gen_state_diagram.py <https://github.com/ceph/ceph/blob/master/doc/scripts/gen_state_diagram.py>`_ script to generate a copy of the latest peering state model::
$ git clone https://github.com/ceph/ceph.git
$ cd ceph
$ cat src/osd/PeeringState.h src/osd/PeeringState.cc | doc/scripts/gen_state_diagram.py > doc/dev/peering_graph.generated.dot
$ sed -i 's/7,7/1080,1080/' doc/dev/peering_graph.generated.dot
$ dot -Tsvg doc/dev/peering_graph.generated.dot > doc/dev/peering_graph.generated.svg
Sample state model:
.. graphviz:: peering_graph.generated.dot

11
doc/scripts/README.md Normal file
View File

@ -0,0 +1,11 @@
Script Usage
============
Peering State Model: gen_state_diagram.py
------------------------------------------
$ git clone https://github.com/ceph/ceph.git
$ cd ceph
$ cat src/osd/PeeringState.h src/osd/PeeringState.cc | doc/scripts/gen_state_diagram.py > doc/dev/peering_graph.generated.dot
$ sed -i 's/7,7/1080,1080/' doc/dev/peering_graph.generated.dot
$ dot -Tsvg doc/dev/peering_graph.generated.dot > doc/dev/peering_graph.generated.svg