To configure Ceph for use with ``libvirt``, perform the following steps:
-#. `Create a pool`_ (or use the default). The following example uses the
+#. `Create a pool`_. The following example uses the
pool name ``libvirt-pool`` with 128 placement groups. ::
ceph osd pool create libvirt-pool 128 128
ceph osd lspools
+#. Use the ``rbd`` tool to initialize the pool for use by RBD::
+
+ rbd pool init <pool-name>
+
#. `Create a Ceph User`_ (or use ``client.admin`` for version 0.9.7 and
earlier). The following example uses the Ceph user name ``client.libvirt``
and references ``libvirt-pool``. ::
.. important:: To use Ceph Block Device commands, you must have access to
a running Ceph cluster.
+Create a Block Device Pool
+==========================
+
+#. On the admin node, use the ``ceph`` tool to `create a pool`_.
+
+#. On the admin node, use the ``rbd`` tool to initialize the pool for use by RBD::
+
+ rbd pool init <pool-name>
+
+.. note:: The ``rbd`` tool assumes a default pool name of 'rbd' when not
+ provided.
Creating a Block Device Image
=============================
rbd rm swimmingpool/bar
-
+.. _create a pool: ../../rados/operations/pools/#create-a-pool
.. _Storage Pools: ../../rados/operations/pools
.. _RBD – Manage RADOS Block Device (RBD) Images: ../../man/8/rbd/
for your pools, and `Placement Groups`_ for details on the number of placement
groups you should set for your pools.
+A newly created pool must initialized prior to use. Use the ``rbd`` tool
+to initialize the pool::
+
+ rbd pool init cloudstack
+
Create a Ceph User
==================
your pools, and `Placement Groups`_ for details on the number of placement
groups you should set for your pools.
+Newly created pools must initialized prior to use. Use the ``rbd`` tool
+to initialize the pools::
+
+ rbd pool init volumes
+ rbd pool init images
+ rbd pool init backups
+ rbd pool init vms
+
.. _Create a Pool: ../../rados/operations/pools#createpool
.. _Placement Groups: ../../rados/operations/placement-groups
directory. Ensure that the keyring file has appropriate read permissions
(e.g., ``sudo chmod +r /etc/ceph/ceph.client.admin.keyring``).
-Create an rbd pool
-==================
-#. On the admin node, use the ``ceph`` tool to `Create a Pool`_
+Create a Block Device Pool
+==========================
+
+#. On the admin node, use the ``ceph`` tool to `create a pool`_
(we recommend the name 'rbd').
+#. On the admin node, use the ``rbd`` tool to initialize the pool for use by RBD::
+
+ rbd pool init <pool-name>
+
Configure a Block Device
========================
.. _Create a Pool: ../../rados/operations/pools#createpool
.. _Storage Cluster Quick Start: ../quick-ceph-deploy
+.. _create a pool: ../../rados/operations/pools/#create-a-pool
.. _block devices: ../../rbd/rbd
.. _FAQ: http://wiki.ceph.com/How_Can_I_Give_Ceph_a_Try
.. _OS Recommendations: ../os-recommendations
nbd unmap Unmap a nbd device.
object-map check Verify the object map is correct.
object-map rebuild Rebuild an invalid object map.
+ pool init Initialize pool for use by RBD.
remove (rm) Delete an image.
rename (mv) Rename image within pool.
resize Resize (expand or shrink) image.
--snap arg snapshot name
--no-progress disable progress output
+ rbd help pool init
+ usage: rbd pool init [--pool <pool>] [--force]
+ <pool-name>
+
+ Initialize pool for use by RBD.
+
+ Positional arguments
+ <pool-name> pool name
+
+ Optional arguments
+ -p [ --pool ] arg pool name
+ --force force initialize pool for RBD use if registered by
+ another application
+
rbd help remove
usage: rbd remove [--pool <pool>] [--image <image>] [--no-progress]
<image-spec>
action/MirrorImage.cc
action/Nbd.cc
action/ObjectMap.cc
+ action/Pool.cc
action/Remove.cc
action/Rename.cc
action/Resize.cc
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "tools/rbd/ArgumentTypes.h"
+#include "tools/rbd/Shell.h"
+#include "tools/rbd/Utils.h"
+#include "include/stringify.h"
+#include "common/errno.h"
+#include "osd/osd_types.h"
+#include <iostream>
+#include <boost/program_options.hpp>
+
+namespace rbd {
+namespace action {
+namespace pool {
+
+namespace at = argument_types;
+namespace po = boost::program_options;
+
+void get_arguments_init(po::options_description *positional,
+ po::options_description *options) {
+ at::add_pool_options(positional, options);
+ options->add_options()
+ ("force", po::bool_switch(),
+ "force initialize pool for RBD use if registered by another application");
+}
+
+int execute_init(const po::variables_map &vm) {
+ size_t arg_index = 0;
+ std::string pool_name = utils::get_pool_name(vm, &arg_index);
+
+ librados::Rados rados;
+ librados::IoCtx io_ctx;
+ int r = utils::init(pool_name, &rados, &io_ctx);
+ if (r < 0) {
+ return r;
+ }
+
+ r = io_ctx.application_enable(pg_pool_t::APPLICATION_NAME_RBD,
+ vm["force"].as<bool>());
+ if (r == -EOPNOTSUPP) {
+ std::cerr << "rbd: luminous or later release required." << std::endl;
+ } else if (r == -EPERM) {
+ std::cerr << "rbd: pool already registered to a different application."
+ << std::endl;
+ } else if (r < 0) {
+ std::cerr << "rbd: error registered application: " << cpp_strerror(r)
+ << std::endl;
+ }
+
+ return 0;
+}
+
+Shell::Action action(
+ {"pool", "init"}, {}, "Initialize pool for use by RBD.", "",
+ &get_arguments_init, &execute_init);
+
+} // namespace pool
+} // namespace action
+} // namespace rbd