ceph-mgr orchestrator modules

Warning

This is developer documentation, describing Ceph internals that are only relevant to people writing ceph-mgr orchestrator modules.

In this context, orchestrator refers to some external service that provides the ability to discover devices and create Ceph services. This includes external projects such as ceph-ansible, DeepSea, and Rook.

An orchestrator module is a ceph-mgr module (ceph-mgr module developer’s guide) which implements common management operations using a particular orchestrator.

Orchestrator modules subclass the Orchestrator class: this class is an interface, it only provides method definitions to be implemented by subclasses. The purpose of defining this common interface for different orchestrators is to enable common UI code, such as the dashboard, to work with various different backends.

Behind all the abstraction, the purpose of orchestrator modules is simple: enable Ceph to do things like discover available hardware, create and destroy OSDs, and run MDS and RGW services.

A tutorial is not included here: for full and concrete examples, see the existing implemented orchestrator modules in the Ceph source tree.

Glossary

Stateful service
a daemon that uses local storage, such as OSD or mon.
Stateless service
a daemon that doesn’t use any local storage, such as an MDS, RGW, nfs-ganesha, iSCSI gateway.
Label
arbitrary string tags that may be applied by administrators to nodes. Typically administrators use labels to indicate which nodes should run which kinds of service. Labels are advisory (from human input) and do not guarantee that nodes have particular physical capabilities.
Drive group
collection of block devices with common/shared OSD formatting (typically one or more SSDs acting as journals/dbs for a group of HDDs).
Placement
choice of which node is used to run a service.

Key Concepts

The underlying orchestrator remains the source of truth for information about whether a service is running, what is running where, which nodes are available, etc. Orchestrator modules should avoid taking any internal copies of this information, and read it directly from the orchestrator backend as much as possible.

Bootstrapping nodes and adding them to the underlying orchestration system is outside the scope of Ceph’s orchestrator interface. Ceph can only work on nodes when the orchestrator is already aware of them.

Calls to orchestrator modules are all asynchronous, and return completion objects (see below) rather than returning values immediately.

Where possible, placement of stateless services should be left up to the orchestrator.

Completions and batching

All methods that read or modify the state of the system can potentially be long running. To handle that, all such methods return a completion object (a ReadCompletion or a WriteCompletion). Orchestrator modules must implement the wait method: this takes a list of completions, and is responsible for checking if they’re finished, and advancing the underlying operations as needed.

Each orchestrator module implements its own underlying mechanisms for completions. This might involve running the underlying operations in threads, or batching the operations up before later executing in one go in the background. If implementing such a batching pattern, the module would do no work on any operation until it appeared in a list of completions passed into wait.

WriteCompletion objects have a two-stage execution. First they become persistent, meaning that the write has made it to the orchestrator itself, and been persisted there (e.g. a manifest file has been updated). If ceph-mgr crashed at this point, the operation would still eventually take effect. Second, the completion becomes effective, meaning that the operation has really happened (e.g. a service has actually been started).

Orchestrator.wait(completions)

Given a list of Completion instances, progress any which are incomplete. Return a true if everything is done.

Callers should inspect the detail of each completion to identify partial completion/progress information, and present that information to the user.

For fast operations (e.g. reading from a database), implementations may choose to do blocking IO in this call.

class orchestrator.ReadCompletion

Orchestrator implementations should inherit from this class to implement their own handles to operations in progress, and return an instance of their subclass from calls into methods.

Read operations are

class orchestrator.WriteCompletion

Orchestrator implementations should inherit from this class to implement their own handles to operations in progress, and return an instance of their subclass from calls into methods.

Placement

In general, stateless services do not require any specific placement rules, as they can run anywhere that sufficient system resources are available. However, some orchestrators may not include the functionality to choose a location in this way, so we can optionally specify a location when creating a stateless service.

OSD services generally require a specific placement choice, as this will determine which storage devices are used.

Excluded functionality

  • Ceph’s orchestrator interface is not a general purpose framework for managing linux servers – it is deliberately constrained to manage the Ceph cluster’s services only.
  • Multipathed storage is not handled (multipathing is unnecessary for Ceph clusters). Each drive is assumed to be visible only on a single node.

Inventory and status

Orchestrator.get_inventory(node_filter=None)
Parameters:node_filter
Returns:list of InventoryNode
class orchestrator.InventoryFilter

When fetching inventory, use this filter to avoid unnecessarily scanning the whole estate.

Typical use: filter by node when presenting UI workflow for configuring
a particular server. filter by label when not all of estate is Ceph servers, and we want to only learn about the Ceph servers. filter by label when we are interested particularly in e.g. OSD servers.
class orchestrator.InventoryNode(name, devices)
class orchestrator.InventoryDevice

When fetching inventory, block devices are reported in this format.

Note on device identifiers: the format of this is up to the orchestrator, but the same identifier must also work when passed into StatefulServiceSpec. The identifier should be something meaningful like a device WWID or stable device node path – not something made up by the orchestrator.

“Extended” is for reporting any special configuration that may have already been done out of band on the block device. For example, if the device has already been configured for encryption, report that here so that it can be indicated to the user. The set of extended properties may differ between orchestrators. An orchestrator is permitted to support no extended properties (only normal block devices)

Orchestrator.describe_service(service_type=None, service_id=None, node_name=None)

Describe a service (of any kind) that is already configured in the orchestrator. For example, when viewing an OSD in the dashboard we might like to also display information about the orchestrator’s view of the service (like the kubernetes pod ID).

When viewing a CephFS filesystem in the dashboard, we would use this to display the pods being currently run for MDS daemons.

Returns a list of ServiceDescription objects.

class orchestrator.ServiceDescription

For responding to queries about the status of a particular service, stateful or stateless.

This is not about health or performance monitoring of services: it’s about letting the orchestrator tell Ceph whether and where a service is scheduled in the cluster. When an orchestrator tells Ceph “it’s running on node123”, that’s not a promise that the process is literally up this second, it’s a description of where the orchestrator has decided the service should run.

OSD management

Orchestrator.create_osds(osd_spec)

Create one or more OSDs within a single Drive Group.

The principal argument here is the drive_group member of OsdSpec: other fields are advisory/extensible for any finer-grained OSD feature enablement (choice of backing store, compression/encryption, etc).

Parameters:osd_spec – OsdCreationSpec
Orchestrator.replace_osds(osd_spec)

Like create_osds, but the osd_id_claims must be fully populated.

Orchestrator.remove_osds(node, osd_ids)
Parameters:
  • node – A node name, must exist.
  • osd_ids – list of OSD IDs

Note that this can only remove OSDs that were successfully created (i.e. got an OSD ID).

class orchestrator.OsdCreationSpec

Used during OSD creation.

The drive names used here may be ephemeral.

class orchestrator.DriveGroupSpec(devices)

Describe a drive group in the same form that ceph-volume understands.

Upgrades

Orchestrator.upgrade_available()

Report on what versions are available to upgrade to

Returns:List of strings
Orchestrator.upgrade_start(upgrade_spec)
Orchestrator.upgrade_status()

If an upgrade is currently underway, report on where we are in the process, or if some error has occurred.

Returns:UpgradeStatusSpec instance
class orchestrator.UpgradeSpec
class orchestrator.UpgradeStatusSpec

Utility

Orchestrator.available()

Report whether we can talk to the orchestrator. This is the place to give the user a meaningful message if the orchestrator isn’t running or can’t be contacted.

This method may be called frequently (e.g. every page load to conditionally display a warning banner), so make sure it’s not too expensive. It’s okay to give a slightly stale status (e.g. based on a periodic background ping of the orchestrator) if that’s necessary to make this method fast.

Do not override this method if you don’t have a meaningful status to return: the default None, None return value is used to indicate that a module is unable to indicate its availability.

Returns:two-tuple of boolean, string