Skip to content

Commit

Permalink
Make remote replication CLI conformant to CLI guidelines (#456)
Browse files Browse the repository at this point in the history
# Description
Modify `remote replication` CLI to `replication` CLI.

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] CleanCode (Code refactor, test updates, does not introduce
functional changes)
- [ ] Documentation update (Doc only change)

## How Has This Been Tested?
Using CI

## Contributor's Checklist

Please check that you have:

- [x] self-reviewed the code in this PR.
- [ ] added code comments, particularly in hard-to-understand areas.
- [x] updated the user documentation with corresponding changes.
- [ ] modified tests to verify effectiveness of this change.

---------

Signed-off-by: utkarsh bhatt <[email protected]>
  • Loading branch information
UtkarshBhatthere authored Nov 8, 2024
1 parent c148cea commit ad8b261
Show file tree
Hide file tree
Showing 20 changed files with 247 additions and 186 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 enable rbd 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 status rbd 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 list rbd
+-----------+------------+------------+---------------------+
| 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 disable rbd pool_one
sudo microceph replication list rbd
+-----------+------------+------------+---------------------+
| 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 disable rbd pool_two/image_two
sudo microceph replication list rbd
+-----------+------------+------------+---------------------+
| 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 list rbd
+-----------+------------+------------+---------------------+
| 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 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 status rbd 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 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 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``
=============================

Usage:

.. code-block:: none
microceph remote replication rbd [command]
microceph replication [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 enable rbd <resource> [flags]
Flags:

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

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

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

.. code-block:: none
microceph remote replication rbd list [flags]
microceph replication list rbd [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 disable rbd <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 promote [flags]
.. code-block:: none
Expand All @@ -119,7 +119,7 @@ Usage:

.. code-block:: none
microceph remote replication rbd demote [flags]
microceph replication demote [flags]
.. code-block:: none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// Sends replication request for creating, deleting, getting, and listing remote replication.
func SendRemoteReplicationRequest(ctx context.Context, c *microCli.Client, data types.ReplicationRequest) (string, error) {
func SendReplicationRequest(ctx context.Context, c *microCli.Client, data types.ReplicationRequest) (string, error) {
var err error
var resp string
queryCtx, cancel := context.WithTimeout(ctx, time.Second*120)
Expand Down
4 changes: 4 additions & 0 deletions microceph/cmd/microceph/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func main() {
var cmdRemote = cmdRemote{common: &commonCmd}
app.AddCommand(cmdRemote.Command())

// Replication command
var cmdReplication = cmdReplication{common: &commonCmd}
app.AddCommand(cmdReplication.Command())

var cmdDisk = cmdDisk{common: &commonCmd}
app.AddCommand(cmdDisk.Command())

Expand Down
3 changes: 0 additions & 3 deletions microceph/cmd/microceph/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ func (c *cmdRemote) Command() *cobra.Command {
// Remove subcommand
remoteRemoveCmd := cmdRemoteRemove{common: c.common}
cmd.AddCommand(remoteRemoveCmd.Command())
// Replication subcommand
remoteReplicationCmd := cmdRemoteReplication{common: c.common}
cmd.AddCommand(remoteReplicationCmd.Command())

// Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706
cmd.Args = cobra.NoArgs
Expand Down
22 changes: 0 additions & 22 deletions microceph/cmd/microceph/remote_replication.go

This file was deleted.

46 changes: 0 additions & 46 deletions microceph/cmd/microceph/remote_replication_rbd.go

This file was deleted.

Loading

0 comments on commit ad8b261

Please sign in to comment.