向 Ceph 贡献:开发者指南

作者:Loic Dachary
作者:Nathan Cutler
许可证:Creative Commons Attribution-ShareAlike (CC BY-SA)

Note

旧的 (pre-2016) 开发者文档已经挪到了 内部开发者文档

简介

This guide has two aims. First, it should lower the barrier to entry forsoftware developers who wish to get involved in the Ceph project. Second,it should serve as a reference for Ceph developers.

We assume that readers are already familiar with Ceph (the distributedobject store and file system designed to provide excellent performance,reliability and scalability). If not, please refer to the project websiteand especially the publications list.

Since this document is to be consumed by developers, who are assumed tohave Internet access, topics covered elsewhere, either within the Cephdocumentation or elsewhere on the web, are treated by linking. If younotice that a link is broken or if you know of a better link, pleasereport it as a bug.

必备知识

本章包含必要信息,每个 Ceph 开发者都应该知道。

项目领袖

Ceph 项目是由 Sage Weil 领导的。另外,各主要项目组件有自己的领导,下面的表格罗列了所有领导、以及他们在 GitHub 上的昵称。

ScopeLeadGitHub nick
CephSage Weilliewegas
RADOSSamuel Justathanatos
RGWYehuda Sadehyehudasa
RBDJosh Durginjdurgin
CephFSGregory Farnumgregsfortytwo
Build/OpsKen Dreyerktdreyer

上述表格里的 Ceph 专有缩写在下面的体系架构一节解释。

历史

请翻阅 Wikipedia 的 History 这章

软件许可

Ceph 是自由软件。

Unless stated otherwise, the Ceph source code is distributed under the terms ofthe LGPL2.1. For full details, see the file COPYING in the top-leveldirectory of the source-code tree.

源代码仓库

The source code of Ceph lives on GitHub in a number of repositories belowthe Ceph “organization”.

To make a meaningful contribution to the project as a developer, a workingknowledge of git is essential.

Although the Ceph “organization” includes several software repositories,this document covers only one: https://github.com/ceph/ceph.

问题跟踪器

Although GitHub is used for code, Ceph-related issues (Bugs, Features,Backports, Documentation, etc.) are tracked at http://tracker.ceph.com,which is powered by Redmine.

The tracker has a Ceph project with a number of subprojects looselycorresponding to the project components listed in 体系架构.

Mere registration in the tracker automatically grants permissionssufficient to open new issues and comment on existing ones.

要报告软件缺陷或者提议新功能,请跳转到 Ceph 项目并点击 New issue

邮件列表

Ceph 的开发邮件讨论是通过邮件列表 ceph-devel@vger.kernel.org 进行的。这个邮件列表对所有人开放,把下面这行发送到 majordomo@vger.kernel.org 即可订阅:

  1. subscribe ceph-devel

要作为邮件正文发出。

There are also other Ceph-related mailing lists.

IRC

In addition to mailing lists, the Ceph community also communicates in realtime using Internet Relay Chat.

See https://ceph.com/resources/mailing-list-irc/ for how to set up your IRCclient and a list of channels.

补丁的提交

The canonical instructions for submitting patches are contained in thethe file CONTRIBUTING.rst in the top-level directory of the source-codetree. There may be some overlap between this guide and that file.

All newcomers are encouraged to read that file carefully.

从源码构建

请参考 构建 Ceph

开发模式集群

编译完源码后,你可以启动一个开发模式的 Ceph 集群,命令如下:

  1. cd src
  2. install -d -m0755 out dev/osd0
  3. ./vstart.sh -n -x -l
  4. # check that it's there
  5. ./ceph health

基本工作流

Without bugs, there would be no software, and without software, there wouldbe no software developers.

—Unknown

没有缺陷,就不会有软件;没有软件,就不会有软件开发者。

——无名

前面已经介绍了问题跟踪器源代码仓库,也提及了补丁的提交,现在我们再详细解释一下它们在基本的 Ceph 开发流程里如何运作。

问题跟踪器惯例

When you start working on an existing issue, it’s nice to let the otherdevelopers know this - to avoid duplication of labor. Typically, this isdone by changing the Assignee field (to yourself) and changing theStatus to In progress. Newcomers to the Ceph community typically do nothave sufficient privileges to update these fields, however: they cansimply update the issue with a brief note.

Meanings of some commonly used statuses
StatusMeaning
NewInitial status
In ProgressSomebody is working on it
Need ReviewPull request is open with a fix
Pending BackportFix has been merged, backport(s) pending
ResolvedFix and backports (if any) have been merged

拉取请求

The Ceph source code is maintained in the ceph/ceph repository onGitHub.

The GitHub web interface provides a key feature for contributing codeto the project: the pull request.

Newcomers who are uncertain how to use pull requests may readthis GitHub pull request tutorial.

For some ideas on what constitutes a “good” pull request, seethe Git 提交的优良做法 article at the OpenStack 项目百科.

体系架构

Ceph is a collection of components built on top of RADOS and provideservices (RBD, RGW, CephFS) and APIs (S3, Swift, POSIX) for the user tostore and retrieve data.

See 体系结构 for an overview of Ceph architecture. Thefollowing sections treat each of the major architectural componentsin more detail, with links to code and tests.

RADOS

RADOS stands for “Reliable, Autonomic Distributed Object Store”. In a Cephcluster, all data are stored in objects, and RADOS is the component responsiblefor that.

RADOS itself can be further broken down into Monitors, Object Storage Daemons(OSDs), and client APIs (librados). Monitors and OSDs are introduced atCeph 简介. The client library is explained atCeph 存储集群 API.

RGW

RGW stands for RADOS Gateway. Using the embedded HTTP server civetweb, RGWprovides a REST interface to RADOS objects.

A more thorough introduction to RGW can be found at Ceph 对象网关.

RBD

RBD stands for RADOS Block Device. It enables a Ceph cluster to store diskimages, and includes in-kernel code enabling RBD images to be mounted.

To delve further into RBD, see Ceph 块设备.

CephFS

CephFS is a distributed file system that enables a Ceph cluster to be used as a NAS.

File system metadata is managed by Meta Data Server (MDS) daemons. The Cephfile system is explained in more detail at Ceph 文件系统.