Skip to content

Commit

Permalink
Added documentation changes required for CLI change
Browse files Browse the repository at this point in the history
Signed-off-by: utkarsh bhatt <[email protected]>
  • Loading branch information
UtkarshBhatthere committed Nov 7, 2024
1 parent 405ff1f commit 7ec932f
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ jobs:
run : ~/actionutils.sh remote_configure_rbd_mirroring

- name: Wait for RBD mirror to sync images
run : ~/actionutils.sh remote_wait_for_secondary_to_sync
run : ~/actionutils.sh remote_wait_for_secondary_to_sync 4

- name: Verify RBD mirror
run : ~/actionutils.sh remote_verify_rbd_mirroring
Expand Down
24 changes: 12 additions & 12 deletions docs/how-to/configure-rbd-mirroring.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
==================================
Configure RBD remote replication
Configure RBD replication
==================================

MicroCeph supports asynchronously replicating (mirroring) RBD images to a remote cluster.
Expand All @@ -13,25 +13,25 @@ Prerequisites
3. Both clusters have 2 rbd pools: pool_one and pool_two.
4. Both pools at cluster "primary_cluster" have 2 images each (image_one and image_two) while the pools at cluster "secondary_cluster" are empty.

Enable RBD remote replication
Enable RBD replication
-------------------------------

An operator can enable replication for a given rbd pool which is present at both clusters as

.. code-block:: none
sudo microceph remote replication rbd enable pool_one --remote secondary_cluster
sudo microceph replication rbd enable pool_one --remote secondary_cluster
Here, pool_one is the name of the rbd pool and it is expected to be present at both the clusters.

Check RBD remote replication status
Check RBD replication status
------------------------------------

The above command will enable replication for ALL the images inside pool_one, it can be checked as:

.. code-block:: none
sudo microceph remote replication rbd status pool_one
sudo microceph replication rbd status pool_one
+------------------------+----------------------+
| SUMMARY | HEALTH |
+-------------+----------+-------------+--------+
Expand All @@ -48,14 +48,14 @@ The above command will enable replication for ALL the images inside pool_one, it
The status shows that there are 2 images in the pool which are enabled for mirroring.

Listing all RBD remote replication images
Listing all RBD replication images
------------------------------------------

An operator can list all the images that have replication (mirroring) enabled as follows:

.. code-block:: none
sudo microceph remote replication rbd list
sudo microceph replication rbd list
+-----------+------------+------------+---------------------+
| POOL NAME | IMAGE NAME | IS PRIMARY | LAST LOCAL UPDATE |
+-----------+------------+------------+---------------------+
Expand All @@ -65,7 +65,7 @@ An operator can list all the images that have replication (mirroring) enabled as
| pool_two | image_two | true | 2024-10-08 13:55:07 |
+-----------+------------+------------+---------------------+
Disabling RBD remote replication
Disabling RBD replication
---------------------------------

In some cases, it may be desired to disable replication. A single image ($pool/$image) or
Expand All @@ -74,8 +74,8 @@ a whole pool ($pool) can be disabled in a single command as follows:
Disable Pool replication:
.. code-block:: none
sudo microceph remote replication disable pool_one
sudo microceph remote replication list
sudo microceph replication rbd disable pool_one
sudo microceph replication rbd list
+-----------+------------+------------+---------------------+
| POOL NAME | IMAGE NAME | IS PRIMARY | LAST LOCAL UPDATE |
+-----------+------------+------------+---------------------+
Expand All @@ -86,8 +86,8 @@ Disable Pool replication:
Disable Image replication:
.. code-block:: none
sudo microceph remote replication disable pool_two/image_two
sudo microceph remote replication list
sudo microceph replication rbd disable pool_two/image_two
sudo microceph replication rbd list
+-----------+------------+------------+---------------------+
| POOL NAME | IMAGE NAME | IS PRIMARY | LAST LOCAL UPDATE |
+-----------+------------+------------+---------------------+
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/import-remote-cluster.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MicroCeph supports adding secondary MicroCeph clusters as remote clusters.
This creates ``$remote.conf/$remote.keyring`` files in the snap's config directory
allowing users (and microceph) to perform ceph operations on the remote clusters.

This also enables capabilities like remote replication by exposing required
This also enables capabilities like replication to remote clusters by exposing required
remote cluster details to MicroCeph and Ceph.

Working with remote MicroCeph clusters
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ migrate services and more.
Managing a remote cluster
-------------------------

Make MicroCeph aware of a remote cluster and configure remote replication for
Make MicroCeph aware of a remote cluster and configure replication for
RBD pools and images.

.. toctree::
Expand Down
14 changes: 7 additions & 7 deletions docs/how-to/perform-site-failover.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Prerequisites
--------------
1. A primary and a secondary MicroCeph cluster, for example named "primary_cluster" and "secondary_cluster"
2. primary_cluster has imported configurations from secondary_cluster and vice versa. refer to :doc:`import remote <./import-remote-cluster>`
3. RBD remote replication is configured for at least 1 rbd image. refer to :doc:`configure rbd replication <./configure-rbd-mirroring>`
3. RBD replication is configured for at least 1 rbd image. refer to :doc:`configure rbd replication <./configure-rbd-mirroring>`

Failover to a non-primary remote cluster
-----------------------------------------
List all the resources on 'secondary_cluster' to check primary status.

.. code-block:: none
sudo microceph remote replication rbd list
sudo microceph replication rbd list
+-----------+------------+------------+---------------------+
| POOL NAME | IMAGE NAME | IS PRIMARY | LAST LOCAL UPDATE |
+-----------+------------+------------+---------------------+
Expand All @@ -31,20 +31,20 @@ An operator can perform cluster wide promotion as follows:

.. code-block:: none
sudo microceph remote replication rbd promote --remote primary_cluster --yes-i-really-mean-it
sudo microceph replication rbd promote --remote primary_cluster --yes-i-really-mean-it
Here, <remote> parameter helps microceph filter the resources to promote.
Since promotion of secondary_cluster may cause a split-brain condition in future,
it is necessary to pass --yes-i-really-mean-it flag.

Verify RBD remote replication primary status
Verify RBD replication primary status
---------------------------------------------

List all the resources on 'secondary_cluster' again to check primary status.

.. code-block:: none
sudo microceph remote replication rbd status pool_one
sudo microceph replication rbd status pool_one
+-----------+------------+------------+---------------------+
| POOL NAME | IMAGE NAME | IS PRIMARY | LAST LOCAL UPDATE |
+-----------+------------+------------+---------------------+
Expand All @@ -68,14 +68,14 @@ Note: Demotion can cause data loss and hence can only be performed with the 'yes
At primary_cluster (was primary before disaster), perform demotion.
.. code-block:: none
sudo microceph remote replication rbd demote --remote secondary_cluster
sudo microceph replication rbd demote --remote secondary_cluster
failed to process demote_replication request for rbd: demotion may cause data loss on this cluster. If you
understand the *RISK* and you're *ABSOLUTELY CERTAIN* that is what you want, pass --yes-i-really-mean-it.
Now, again at the 'primary_cluster', perform demotion with --yes-i-really-mean-it flag.
.. code-block:: none
sudo microceph remote replication rbd demote --remote secondary_cluster --yes-i-really-mean-it
sudo microceph replication rbd demote --remote secondary_cluster --yes-i-really-mean-it
Note: MicroCeph with demote the primary pools and will issue a resync for all the mirroring images, hence it may
cause data loss at the old primary cluster.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
=============================
``remote replication rbd``
``replication rbd``
=============================

Usage:

.. code-block:: none
microceph remote replication rbd [command]
microceph replication rbd [command]
Available commands:

.. code-block:: none
configure Configure remote replication parameters for RBD resource (Pool or Image)
disable Disable remote replication for RBD resource (Pool or Image)
enable Enable remote replication for RBD resource (Pool or Image)
list List all configured remotes replication pairs.
configure Configure replication parameters for RBD resource (Pool or Image)
disable Disable replication for RBD resource (Pool or Image)
enable Enable replication for RBD resource (Pool or Image)
list List all configured replications.
status Show RBD resource (Pool or Image) replication status
Global options:
Expand All @@ -31,13 +31,13 @@ Global options:
``enable``
----------

Enable remote replication for RBD resource (Pool or Image)
Enable replication for RBD resource (Pool or Image)

Usage:

.. code-block:: none
microceph remote replication rbd enable <resource> [flags]
microceph replication rbd enable <resource> [flags]
Flags:

Expand All @@ -57,7 +57,7 @@ Usage:

.. code-block:: none
microceph remote replication rbd status <resource> [flags]
microceph replication rbd status <resource> [flags]
Flags:

Expand All @@ -74,7 +74,7 @@ Usage:

.. code-block:: none
microceph remote replication rbd list [flags]
microceph replication rbd list [flags]
.. code-block:: none
Expand All @@ -84,13 +84,13 @@ Usage:
``disable``
------------

Disable remote replication for RBD resource (Pool or Image)
Disable replication for RBD resource (Pool or Image)

Usage:

.. code-block:: none
microceph remote replication rbd disable <resource> [flags]
microceph replication rbd disable <resource> [flags]
.. code-block:: none
Expand All @@ -103,7 +103,7 @@ Promote local cluster to primary

.. code-block:: none
microceph remote replication rbd promote [flags]
microceph replication rbd promote [flags]
.. code-block:: none
Expand All @@ -119,7 +119,7 @@ Usage:

.. code-block:: none
microceph remote replication rbd demote [flags]
microceph replication rbd demote [flags]
.. code-block:: none
Expand Down
2 changes: 1 addition & 1 deletion microceph/cmd/microceph/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type cmdReplication struct {
func (c *cmdReplication) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "replication",
Short: "manage remote replication",
Short: "manage replication to remote clusters",
}

// Replication RBD commands
Expand Down
2 changes: 1 addition & 1 deletion microceph/cmd/microceph/replication_rbd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type cmdReplicationRbd struct {
func (c *cmdReplicationRbd) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "rbd",
Short: "manage RBD remote replication",
Short: "manage RBD replication to remote clusters",
}

// Replication enable command
Expand Down
2 changes: 1 addition & 1 deletion microceph/cmd/microceph/replication_rbd_configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type cmdReplicationConfigureRbd struct {
func (c *cmdReplicationConfigureRbd) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "configure <resource>",
Short: "Configure remote replication parameters for RBD resource (Pool or Image)",
Short: "Configure replication parameters for RBD resource (Pool or Image)",
RunE: c.Run,
}

Expand Down
2 changes: 1 addition & 1 deletion microceph/cmd/microceph/replication_rbd_disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type cmdReplicationDisableRbd struct {
func (c *cmdReplicationDisableRbd) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "disable <resource>",
Short: "Disable remote replication for RBD resource (Pool or Image)",
Short: "Disable replication for RBD resource (Pool or Image)",
RunE: c.Run,
}

Expand Down
2 changes: 1 addition & 1 deletion microceph/cmd/microceph/replication_rbd_enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type cmdReplicationEnableRbd struct {
func (c *cmdReplicationEnableRbd) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "enable <resource>",
Short: "Enable remote replication for RBD resource (Pool or Image)",
Short: "Enable replication for RBD resource (Pool or Image)",
RunE: c.Run,
}

Expand Down
9 changes: 5 additions & 4 deletions tests/scripts/actionutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,18 @@ function remote_enable_rbd_mirror_daemon() {
function remote_wait_for_secondary_to_sync() {
set -eux

# wait till images are synchronised
# wait till $1 images are synchronised
local threshold="${1?missing}"
count=0
for index in {1..100}; do
echo "Check run #$index"
list_output=$(lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd list --json")
echo $list_output
images=$(echo $list_output | jq .[].Images)
echo $images
img_one_count=$(echo $images | grep -c "image_one" || true)
img_one_count=$(echo $images | grep -c "image_" || true)
echo $img_one_count
if [[ $img_one_count -gt 0 ]] ; then
if [[ $img_one_count -eq $threshold ]] ; then
break
fi

Expand All @@ -275,7 +276,7 @@ function remote_wait_for_secondary_to_sync() {
sleep 30
done

if [count -eq 10] ; then
if [count -eq 100] ; then
echo "replication sync check timed out"
exit -1
fi
Expand Down

0 comments on commit 7ec932f

Please sign in to comment.