11.2. Packaging resource agents

When you package resource agents as part of your own project, you should apply the considerations outlined in this section.

[Note]Note

If you instead prefer to submit your resource agent to the Linux-HA resource agents repository, see Section 11.3, “Submitting resource agents” for information on doing so.

11.2.1. RPM packaging

It is recommended to put your OCF resource agent(s) in an RPM sub-package, with the name <toppackage>-resource-agents. Ensure that the package owns its provider directory, and depends on the upstream resource-agents package which lays out the directory hierarchy and provides convenience shell functions. An example RPM spec snippet is given below:

%package resource-agents
Summary: OCF resource agent for Foobar
Group: System Environment/Base
Requires: %{name} = %{version}-%{release}, resource-agents

%description resource-agents
This package contains the OCF-compliant resource agents for Foobar.

%files resource-agents
%defattr(755,root,root,-)
%dir %{_prefix}/lib/ocf/resource.d/fortytwo
%{_prefix}/lib/ocf/resource.d/fortytwo/foobar
[Note]Note

If an RPM spec file contains a %package declaration, then RPM considers this a sub-package which inherits top-level fields such as Name, Version, License, etc. Sub-packages have the top-level package name automatically prepended to their own name. Thus the snippet above would create a sub-package named foobar-resource-agents (presuming the package Name is foobar).

11.2.2. Debian packaging

For Debian packages, like for RPMs, it is recommended to create a separate package holding your resource agents, which then should depend on the cluster-agents package.

[Note]Note

This section assumes that you are packaging with debhelper.

An example debian/control snippet is given below:

Package: foobar-cluster-agents
Priority: extra
Architecture: all
Depends: cluster-agents
Description: OCF-compliant resource agents for Foobar

You will also create a separate .install file. Sticking with the example of installing the foobar resource agent as a sub-package of fortytwo, the debian/fortytwo-cluster-agents.install file could consist of the following content:

usr/lib/ocf/resource.d/fortytwo/foobar