2010-10-28 21:54:56 +00:00
|
|
|
==========================
|
|
|
|
Submitting Patches to Ceph
|
|
|
|
==========================
|
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Patches to Ceph can be divided into three categories:
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
1. patches targeting Ceph kernel code
|
|
|
|
2. patches targeting the "master" branch
|
|
|
|
3. patches targeting stable branches (e.g.: "nautilus")
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Some parts of Ceph - notably the RBD and CephFS kernel clients - are maintained
|
|
|
|
within the Linux Kernel. For patches targeting this code, please refer to the
|
|
|
|
file ``SubmittingPatches-kernel.rst``.
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
The rest of this document assumes that your patch relates to Ceph code that is
|
|
|
|
maintained in the GitHub repository https://github.com/ceph/ceph
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
If you have a patch that fixes an issue, feel free to open a GitHub pull request
|
|
|
|
("PR") targeting the "master" branch, but do read this document first, as it
|
|
|
|
contains important information for ensuring that your PR passes code review
|
|
|
|
smoothly.
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
For patches targeting stable branches (e.g. "nautilus"), please also see
|
|
|
|
the file ``SubmittingPatches-backports.rst``.
|
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:depth: 3
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2016-01-20 05:40:01 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Sign your work
|
|
|
|
--------------
|
2016-01-20 05:40:01 +00:00
|
|
|
|
2016-10-20 04:04:48 +00:00
|
|
|
The sign-off is a simple line at the end of the explanation for the
|
2018-07-05 13:50:11 +00:00
|
|
|
commit, which certifies that you wrote it or otherwise have the right to
|
2018-05-23 18:29:37 +00:00
|
|
|
pass it on as a open-source patch. The rules are pretty simple: if you
|
2016-10-20 04:04:48 +00:00
|
|
|
can certify the below:
|
2016-01-20 05:40:01 +00:00
|
|
|
|
2016-10-20 03:51:08 +00:00
|
|
|
Developer's Certificate of Origin 1.1
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2016-01-20 05:40:01 +00:00
|
|
|
|
2016-10-20 04:04:48 +00:00
|
|
|
By making a contribution to this project, I certify that:
|
2016-01-20 05:40:01 +00:00
|
|
|
|
|
|
|
(a) The contribution was created in whole or in part by me and I
|
|
|
|
have the right to submit it under the open source license
|
|
|
|
indicated in the file; or
|
|
|
|
|
|
|
|
(b) The contribution is based upon previous work that, to the best
|
|
|
|
of my knowledge, is covered under an appropriate open source
|
|
|
|
license and I have the right under that license to submit that
|
|
|
|
work with modifications, whether created in whole or in part
|
|
|
|
by me, under the same open source license (unless I am
|
|
|
|
permitted to submit under a different license), as indicated
|
|
|
|
in the file; or
|
|
|
|
|
|
|
|
(c) The contribution was provided directly to me by some other
|
|
|
|
person who certified (a), (b) or (c) and I have not modified
|
|
|
|
it.
|
|
|
|
|
|
|
|
(d) I understand and agree that this project and the contribution
|
|
|
|
are public and that a record of the contribution (including all
|
|
|
|
personal information I submit with it, including my sign-off) is
|
|
|
|
maintained indefinitely and may be redistributed consistent with
|
|
|
|
this project or the open source license(s) involved.
|
|
|
|
|
2016-10-20 04:04:48 +00:00
|
|
|
then you just add a line saying ::
|
2016-01-20 05:40:01 +00:00
|
|
|
|
|
|
|
Signed-off-by: Random J Developer <random@developer.example.org>
|
|
|
|
|
2020-10-07 22:21:28 +00:00
|
|
|
using your real name (sorry, no pseudonyms or anonymous contributions).
|
2016-01-20 05:40:01 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Git can sign off on your behalf
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Please note that git makes it trivially easy to sign commits. First, set the
|
|
|
|
following config options::
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
$ git config --list | grep user
|
|
|
|
user.email=my_real_email_address@example.com
|
|
|
|
user.name=My Real Name
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Then just remember to use ``git commit -s``. Git will add the ``Signed-off-by``
|
|
|
|
line automatically.
|
2013-11-25 17:24:19 +00:00
|
|
|
|
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Separate your changes
|
|
|
|
---------------------
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Group *logical changes* into individual commits.
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
If you have a series of bulleted modifications, consider separating each of
|
|
|
|
those into its own commit.
|
2016-01-20 05:40:01 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
For example, if your changes include both bug fixes and performance enhancements
|
|
|
|
for a single component, separate those changes into two or more commits. If your
|
|
|
|
changes include an API update, and a new feature which uses that new API,
|
|
|
|
separate those into two patches.
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
On the other hand, if you make a single change that affects numerous
|
|
|
|
files, group those changes into a single commit. Thus a single logical change is
|
|
|
|
contained within a single patch. (If the change needs to be backported, that
|
|
|
|
might change the calculus, because smaller commits are easier to backport.)
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2016-01-20 05:40:01 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Describe your changes
|
|
|
|
---------------------
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Each commit has an associated commit message that is stored in git. The first
|
|
|
|
line of the commit message is the `commit title`_. The second line should be
|
|
|
|
left blank. The lines that follow constitute the `commit message`_.
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
A commit and its message should be focused around a particular change.
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Commit title
|
|
|
|
^^^^^^^^^^^^
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
The text up to the first empty line in a commit message is the commit
|
|
|
|
title. It should be a single short line of at most 72 characters,
|
|
|
|
summarizing the change, and prefixed with the
|
|
|
|
subsystem or module you are changing. Also, it is conventional to use the
|
|
|
|
imperative mood in the commit title. Positive examples include::
|
2015-06-06 13:16:16 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
mds: add perf counter for finisher of MDSRank
|
|
|
|
osd: make the ClassHandler::mutex private
|
2015-06-06 13:16:16 +00:00
|
|
|
|
2020-10-07 09:43:57 +00:00
|
|
|
If the change only touches the files under ``doc`` directory, the title
|
|
|
|
should start with "doc". For instance, a commit fixing a typo in
|
|
|
|
``doc/mgr/dashboard.rst`` could have a title like::
|
|
|
|
|
|
|
|
doc/mgr/dashboard: fix a typo
|
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
More positive examples can be obtained from the git history of the ``master``
|
|
|
|
branch::
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
git log
|
2013-11-25 17:24:19 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Some negative examples (how *not* to title a commit message)::
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
update driver X
|
|
|
|
bug fix for driver X
|
|
|
|
fix issue 99999
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2020-03-26 07:05:27 +00:00
|
|
|
Further to the last negative example ("fix issue 99999"), see `Fixes line(s)`_.
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Commit message
|
|
|
|
^^^^^^^^^^^^^^
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
(This section is about the body of the commit message. Please also see
|
|
|
|
the preceding section, `Commit title`_, for advice on titling commit messages.)
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
In the body of your commit message, be as specific as possible. If the commit
|
|
|
|
message title was too short to fully state what the commit is doing, use the
|
|
|
|
body to explain not just the "what", but also the "why".
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
For positive examples, peruse ``git log`` in the ``master`` branch. A negative
|
|
|
|
example would be a commit message that merely states the obvious. For example:
|
|
|
|
"this patch includes updates for subsystem X. Please apply."
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Fixes line(s)
|
|
|
|
^^^^^^^^^^^^^
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
If the commit fixes one or more issues tracked by http://tracker.ceph.com,
|
|
|
|
add a ``Fixes:`` line (or lines) to the commit message, to connect this change
|
|
|
|
to addressed issue(s) - for example::
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Fixes: http://tracker.ceph.com/issues/12345
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
This line should be added just before the ``Signed-off-by:`` line (see `Sign
|
|
|
|
your work`_).
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
It helps reviewers to get more context of this bug and facilitates updating of
|
|
|
|
the bug tracker. Also, anyone perusing the git history will see this line and be
|
|
|
|
able to refer to the bug tracker easily.
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Here is an example showing a properly-formed commit message::
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
doc: add "--foo" option to bar
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
This commit updates the man page for bar with the newly added "--foo"
|
|
|
|
option.
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Fixes: http://tracker.ceph.com/issues/12345
|
|
|
|
Signed-off-by: Random J Developer <random@developer.example.org>
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
If a commit fixes a regression introduced by a different commit, please also
|
|
|
|
(in addition to the above) add a line referencing the SHA1 of the commit that
|
|
|
|
introduced the regression. For example::
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Fixes: 9dbe7a003989f8bb45fe14aaa587e9d60a392727
|
2010-10-28 21:54:56 +00:00
|
|
|
|
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
PR best practices
|
|
|
|
-----------------
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
PRs should be opened on branches contained in your fork of
|
|
|
|
https://github.com/ceph/ceph.git - do not push branches directly to
|
|
|
|
``ceph/ceph.git``.
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
PRs should target "master". If you need to add a patch to a stable branch, such
|
|
|
|
as "nautilus", see the file ``SubmittingPatches-backports.rst``.
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
In addition to a base, or "target" branch, PRs have several other components:
|
|
|
|
the `PR title`_, the `PR description`_, labels, comments, etc. Of these, the PR
|
|
|
|
title and description are relevant for new contributors.
|
2016-01-20 08:54:57 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
PR title
|
|
|
|
^^^^^^^^
|
2016-01-20 08:54:57 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
If your PR has only one commit, the PR title can be the same as the commit title
|
|
|
|
(and GitHub will suggest this). If the PR has multiple commits, do not accept
|
2020-10-07 22:21:28 +00:00
|
|
|
the title GitHub suggests. Either use the title of the most relevant commit, or
|
2018-07-05 13:50:11 +00:00
|
|
|
write your own title. In the latter case, use the same "subsystem: short
|
|
|
|
description" convention described in `Commit title`_ for the PR title, with
|
|
|
|
the following difference: the PR title describes the entire set of changes,
|
|
|
|
while the `Commit title`_ describes only the changes in a particular commit.
|
2019-08-06 14:20:47 +00:00
|
|
|
|
2020-10-07 22:21:28 +00:00
|
|
|
If GitHub suggests a PR title based on a very long commit message it will split
|
|
|
|
the result with an elipsis (...) and fold the remainder into the PR description.
|
|
|
|
In such a case, please edit the title to be more concise and the description to
|
|
|
|
remove the elipsis.
|
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Keep in mind that the PR titles feed directly into the script that generates
|
|
|
|
release notes and it is tedious to clean up non-conformant PR titles at release
|
|
|
|
time. This document places no limit on the length of PR titles, but be aware
|
|
|
|
that they are subject to editing as part of the release process.
|
2019-08-06 14:20:47 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
PR description
|
|
|
|
^^^^^^^^^^^^^^
|
2019-08-06 14:20:47 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
In addition to a title, the PR also has a description field, or "body".
|
2019-08-06 14:20:47 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
The PR description is a place for summarizing the PR as a whole. It need not
|
|
|
|
duplicate information that is already in the commit messages. It can contain
|
|
|
|
notices to maintainers, links to tracker issues and other related information,
|
|
|
|
to-do lists, etc. The PR title and description should give readers a high-level
|
|
|
|
notion of what the PR is about, quickly enabling them to decide whether they
|
|
|
|
should take a closer look.
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2016-01-20 08:54:57 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Flag your changes for backport
|
|
|
|
------------------------------
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
If you believe your changes should be backported to stable branches after the PR
|
|
|
|
is merged, open a tracker issue at https://tracker.ceph.com explaining:
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
1. what bug is fixed
|
|
|
|
2. why does the bug need to be fixed in <release>
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
and fill out the Backport field in the tracker issue. For example::
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Backport: mimic, nautilus
|
2016-01-20 08:23:04 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
For information on how backports are done in the Ceph project, refer to the
|
|
|
|
document ``SubmittingPatches-backports.rst``.
|
2016-01-20 08:23:04 +00:00
|
|
|
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Test your changes
|
|
|
|
-----------------
|
2016-01-20 08:54:57 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Before opening your PR, it's a good idea to run tests on your patchset. Doing
|
|
|
|
that is simple, though the process can take a long time to complete, especially
|
|
|
|
on older machines with less memory and spinning disks.
|
2016-01-20 08:54:57 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
The most simple test is to verify that your patchset builds, at least in your
|
|
|
|
own development environment. The commands for this are::
|
2016-01-20 08:54:57 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
./install-deps.sh
|
|
|
|
./do_cmake.sh
|
|
|
|
make
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Ceph comes with a battery of tests that can be run on a single machine. These
|
|
|
|
are collectively referred to as "make check", and can be run by executing the
|
|
|
|
following command::
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
./run-make-check.sh
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
If your patchset does not build, or if one or more of the "make check" tests
|
|
|
|
fails, but the error shown is not obviously related to your patchset, don't let
|
|
|
|
that dissuade you from opening a PR. The Ceph project has a Jenkins instance
|
|
|
|
which will build your PR branch and run "make check" on it in a controlled
|
|
|
|
environment.
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Once your patchset builds and passes "make check", you can run even more tests
|
|
|
|
on it by issuing the following commands::
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
cd build
|
|
|
|
../qa/run-standalone.sh
|
2010-10-28 21:54:56 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Like "make check", the standalone tests take a long time to run. They also
|
|
|
|
produce voluminous output. If one or more of the standalone tests fails, it's
|
|
|
|
likely the relevant part of the output will have scrolled off your screen or
|
|
|
|
gotten swapped out of your buffer. Therefore, it makes sense to capture the
|
|
|
|
output in a file for later analysis.
|
2010-10-28 21:54:56 +00:00
|
|
|
|
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Document your changes
|
|
|
|
---------------------
|
2017-07-18 13:47:06 +00:00
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
If you have added or modified any user-facing functionality, such as CLI
|
|
|
|
commands or their output, then the pull request must include appropriate updates
|
|
|
|
to documentation.
|
2017-07-18 13:47:06 +00:00
|
|
|
|
|
|
|
It is the submitter's responsibility to make the changes, and the reviewer's
|
|
|
|
responsibility to make sure they are not merging changes that do not
|
|
|
|
have the needed updates to documentation.
|
|
|
|
|
2018-07-05 13:50:11 +00:00
|
|
|
Where there are areas that have absent documentation, or there is no clear place
|
|
|
|
to note the change that is being made, the reviewer should contact the component
|
|
|
|
lead, who should arrange for the missing section to be created with sufficient
|
|
|
|
detail for the PR submitter to document their changes.
|
2016-10-20 03:51:08 +00:00
|
|
|
|
2018-05-23 18:18:30 +00:00
|
|
|
When writing and/or editing documentation, follow the Google Developer
|
|
|
|
Documentation Style Guide: https://developers.google.com/style/
|