diff --git a/microceph/client/remote_replication.go b/microceph/client/replication.go similarity index 90% rename from microceph/client/remote_replication.go rename to microceph/client/replication.go index 80929849..4f3b0519 100644 --- a/microceph/client/remote_replication.go +++ b/microceph/client/replication.go @@ -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) diff --git a/microceph/cmd/microceph/main.go b/microceph/cmd/microceph/main.go index 8c7f6f2f..f622d1b7 100644 --- a/microceph/cmd/microceph/main.go +++ b/microceph/cmd/microceph/main.go @@ -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()) diff --git a/microceph/cmd/microceph/remote.go b/microceph/cmd/microceph/remote.go index b634d1d1..006b855d 100644 --- a/microceph/cmd/microceph/remote.go +++ b/microceph/cmd/microceph/remote.go @@ -23,11 +23,8 @@ 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 + // Workaround for subcommand usage errors. See: https://github.com/spf13/cobra/issues/706 cmd.Args = cobra.NoArgs cmd.Run = func(cmd *cobra.Command, args []string) { _ = cmd.Usage() } diff --git a/microceph/cmd/microceph/remote_replication.go b/microceph/cmd/microceph/replication.go similarity index 61% rename from microceph/cmd/microceph/remote_replication.go rename to microceph/cmd/microceph/replication.go index 0b9c3ab7..abf5d596 100644 --- a/microceph/cmd/microceph/remote_replication.go +++ b/microceph/cmd/microceph/replication.go @@ -4,18 +4,18 @@ import ( "github.com/spf13/cobra" ) -type cmdRemoteReplication struct { +type cmdReplication struct { common *CmdControl } -func (c *cmdRemoteReplication) Command() *cobra.Command { +func (c *cmdReplication) Command() *cobra.Command { cmd := &cobra.Command{ Use: "replication", Short: "manage remote replication", } // Replication RBD commands - replicationRbdCmd := cmdRemoteReplicationRbd{common: c.common} + replicationRbdCmd := cmdReplicationRbd{common: c.common} cmd.AddCommand(replicationRbdCmd.Command()) return cmd diff --git a/microceph/cmd/microceph/remote_replication_rbd.go b/microceph/cmd/microceph/replication_rbd.go similarity index 56% rename from microceph/cmd/microceph/remote_replication_rbd.go rename to microceph/cmd/microceph/replication_rbd.go index cadfe3c4..9043e35b 100644 --- a/microceph/cmd/microceph/remote_replication_rbd.go +++ b/microceph/cmd/microceph/replication_rbd.go @@ -4,42 +4,42 @@ import ( "github.com/spf13/cobra" ) -type cmdRemoteReplicationRbd struct { +type cmdReplicationRbd struct { common *CmdControl } -func (c *cmdRemoteReplicationRbd) Command() *cobra.Command { +func (c *cmdReplicationRbd) Command() *cobra.Command { cmd := &cobra.Command{ Use: "rbd", Short: "manage RBD remote replication", } // Replication enable command - remoteReplicationRbdEnableCmd := cmdRemoteReplicationEnableRbd{common: c.common} + remoteReplicationRbdEnableCmd := cmdReplicationEnableRbd{common: c.common} cmd.AddCommand(remoteReplicationRbdEnableCmd.Command()) // Replication disable command - remoteReplicationRbdDisableCmd := cmdRemoteReplicationDisableRbd{common: c.common} + remoteReplicationRbdDisableCmd := cmdReplicationDisableRbd{common: c.common} cmd.AddCommand(remoteReplicationRbdDisableCmd.Command()) // Replication list command - remoteReplicationRbdListCmd := cmdRemoteReplicationListRbd{common: c.common} + remoteReplicationRbdListCmd := cmdReplicationListRbd{common: c.common} cmd.AddCommand(remoteReplicationRbdListCmd.Command()) // Replication status command - remoteReplicationRbdStatusCmd := cmdRemoteReplicationStatusRbd{common: c.common} + remoteReplicationRbdStatusCmd := cmdReplicationStatusRbd{common: c.common} cmd.AddCommand(remoteReplicationRbdStatusCmd.Command()) // Replication configure command - remoteReplicationRbdConfigureCmd := cmdRemoteReplicationConfigureRbd{common: c.common} + remoteReplicationRbdConfigureCmd := cmdReplicationConfigureRbd{common: c.common} cmd.AddCommand(remoteReplicationRbdConfigureCmd.Command()) // Replication promote command - remoteReplicationRbdPromoteCmd := cmdRemoteReplicationPromoteRbd{common: c.common} + remoteReplicationRbdPromoteCmd := cmdReplicationPromoteRbd{common: c.common} cmd.AddCommand(remoteReplicationRbdPromoteCmd.Command()) // Replication demote command - remoteReplicationRbdDemoteCmd := cmdRemoteReplicationDemoteRbd{common: c.common} + remoteReplicationRbdDemoteCmd := cmdReplicationDemoteRbd{common: c.common} cmd.AddCommand(remoteReplicationRbdDemoteCmd.Command()) return cmd diff --git a/microceph/cmd/microceph/remote_replication_rbd_configure.go b/microceph/cmd/microceph/replication_rbd_configure.go similarity index 74% rename from microceph/cmd/microceph/remote_replication_rbd_configure.go rename to microceph/cmd/microceph/replication_rbd_configure.go index c3b1bb70..1f554be3 100644 --- a/microceph/cmd/microceph/remote_replication_rbd_configure.go +++ b/microceph/cmd/microceph/replication_rbd_configure.go @@ -9,12 +9,12 @@ import ( "github.com/spf13/cobra" ) -type cmdRemoteReplicationConfigureRbd struct { +type cmdReplicationConfigureRbd struct { common *CmdControl schedule string } -func (c *cmdRemoteReplicationConfigureRbd) Command() *cobra.Command { +func (c *cmdReplicationConfigureRbd) Command() *cobra.Command { cmd := &cobra.Command{ Use: "configure ", Short: "Configure remote replication parameters for RBD resource (Pool or Image)", @@ -25,7 +25,7 @@ func (c *cmdRemoteReplicationConfigureRbd) Command() *cobra.Command { return cmd } -func (c *cmdRemoteReplicationConfigureRbd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdReplicationConfigureRbd) Run(cmd *cobra.Command, args []string) error { if len(args) != 1 { return cmd.Help() } @@ -45,7 +45,7 @@ func (c *cmdRemoteReplicationConfigureRbd) Run(cmd *cobra.Command, args []string return err } - _, err = client.SendRemoteReplicationRequest(context.Background(), cli, payload) + _, err = client.SendReplicationRequest(context.Background(), cli, payload) if err != nil { return err } @@ -53,7 +53,7 @@ func (c *cmdRemoteReplicationConfigureRbd) Run(cmd *cobra.Command, args []string return nil } -func (c *cmdRemoteReplicationConfigureRbd) prepareRbdPayload(requestType types.ReplicationRequestType, args []string) (types.RbdReplicationRequest, error) { +func (c *cmdReplicationConfigureRbd) prepareRbdPayload(requestType types.ReplicationRequestType, args []string) (types.RbdReplicationRequest, error) { pool, image, err := types.GetPoolAndImageFromResource(args[0]) if err != nil { return types.RbdReplicationRequest{}, err diff --git a/microceph/cmd/microceph/remote_replication_rbd_demote.go b/microceph/cmd/microceph/replication_rbd_demote.go similarity index 74% rename from microceph/cmd/microceph/remote_replication_rbd_demote.go rename to microceph/cmd/microceph/replication_rbd_demote.go index 8be123b5..61ee5cc0 100644 --- a/microceph/cmd/microceph/remote_replication_rbd_demote.go +++ b/microceph/cmd/microceph/replication_rbd_demote.go @@ -9,13 +9,13 @@ import ( "github.com/spf13/cobra" ) -type cmdRemoteReplicationDemoteRbd struct { +type cmdReplicationDemoteRbd struct { common *CmdControl remoteName string isForce bool } -func (c *cmdRemoteReplicationDemoteRbd) Command() *cobra.Command { +func (c *cmdReplicationDemoteRbd) Command() *cobra.Command { cmd := &cobra.Command{ Use: "demote", Short: "Demote a primary cluster to non-primary status", @@ -28,7 +28,7 @@ func (c *cmdRemoteReplicationDemoteRbd) Command() *cobra.Command { return cmd } -func (c *cmdRemoteReplicationDemoteRbd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdReplicationDemoteRbd) Run(cmd *cobra.Command, args []string) error { if len(args) != 0 { return cmd.Help() } @@ -48,7 +48,7 @@ func (c *cmdRemoteReplicationDemoteRbd) Run(cmd *cobra.Command, args []string) e return err } - _, err = client.SendRemoteReplicationRequest(context.Background(), cli, payload) + _, err = client.SendReplicationRequest(context.Background(), cli, payload) if err != nil { return err } @@ -56,7 +56,7 @@ func (c *cmdRemoteReplicationDemoteRbd) Run(cmd *cobra.Command, args []string) e return nil } -func (c *cmdRemoteReplicationDemoteRbd) prepareRbdPayload(requestType types.ReplicationRequestType) (types.RbdReplicationRequest, error) { +func (c *cmdReplicationDemoteRbd) prepareRbdPayload(requestType types.ReplicationRequestType) (types.RbdReplicationRequest, error) { retReq := types.RbdReplicationRequest{ RemoteName: c.remoteName, RequestType: requestType, diff --git a/microceph/cmd/microceph/remote_replication_rbd_disable.go b/microceph/cmd/microceph/replication_rbd_disable.go similarity index 73% rename from microceph/cmd/microceph/remote_replication_rbd_disable.go rename to microceph/cmd/microceph/replication_rbd_disable.go index 89c56f7a..f8eeb391 100644 --- a/microceph/cmd/microceph/remote_replication_rbd_disable.go +++ b/microceph/cmd/microceph/replication_rbd_disable.go @@ -9,12 +9,12 @@ import ( "github.com/spf13/cobra" ) -type cmdRemoteReplicationDisableRbd struct { +type cmdReplicationDisableRbd struct { common *CmdControl isForce bool } -func (c *cmdRemoteReplicationDisableRbd) Command() *cobra.Command { +func (c *cmdReplicationDisableRbd) Command() *cobra.Command { cmd := &cobra.Command{ Use: "disable ", Short: "Disable remote replication for RBD resource (Pool or Image)", @@ -25,7 +25,7 @@ func (c *cmdRemoteReplicationDisableRbd) Command() *cobra.Command { return cmd } -func (c *cmdRemoteReplicationDisableRbd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdReplicationDisableRbd) Run(cmd *cobra.Command, args []string) error { if len(args) != 1 { return cmd.Help() } @@ -45,11 +45,11 @@ func (c *cmdRemoteReplicationDisableRbd) Run(cmd *cobra.Command, args []string) return err } - _, err = client.SendRemoteReplicationRequest(context.Background(), cli, payload) + _, err = client.SendReplicationRequest(context.Background(), cli, payload) return err } -func (c *cmdRemoteReplicationDisableRbd) prepareRbdPayload(requestType types.ReplicationRequestType, args []string) (types.RbdReplicationRequest, error) { +func (c *cmdReplicationDisableRbd) prepareRbdPayload(requestType types.ReplicationRequestType, args []string) (types.RbdReplicationRequest, error) { pool, image, err := types.GetPoolAndImageFromResource(args[0]) if err != nil { return types.RbdReplicationRequest{}, err diff --git a/microceph/cmd/microceph/remote_replication_rbd_enable.go b/microceph/cmd/microceph/replication_rbd_enable.go similarity index 81% rename from microceph/cmd/microceph/remote_replication_rbd_enable.go rename to microceph/cmd/microceph/replication_rbd_enable.go index e6fae002..67cda541 100644 --- a/microceph/cmd/microceph/remote_replication_rbd_enable.go +++ b/microceph/cmd/microceph/replication_rbd_enable.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cobra" ) -type cmdRemoteReplicationEnableRbd struct { +type cmdReplicationEnableRbd struct { common *CmdControl remoteName string repType string @@ -17,7 +17,7 @@ type cmdRemoteReplicationEnableRbd struct { skipAutoEnable bool } -func (c *cmdRemoteReplicationEnableRbd) Command() *cobra.Command { +func (c *cmdReplicationEnableRbd) Command() *cobra.Command { cmd := &cobra.Command{ Use: "enable ", Short: "Enable remote replication for RBD resource (Pool or Image)", @@ -32,7 +32,7 @@ func (c *cmdRemoteReplicationEnableRbd) Command() *cobra.Command { return cmd } -func (c *cmdRemoteReplicationEnableRbd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdReplicationEnableRbd) Run(cmd *cobra.Command, args []string) error { if len(args) != 1 { return cmd.Help() } @@ -52,7 +52,7 @@ func (c *cmdRemoteReplicationEnableRbd) Run(cmd *cobra.Command, args []string) e return err } - _, err = client.SendRemoteReplicationRequest(context.Background(), cli, payload) + _, err = client.SendReplicationRequest(context.Background(), cli, payload) if err != nil { return err } @@ -60,7 +60,7 @@ func (c *cmdRemoteReplicationEnableRbd) Run(cmd *cobra.Command, args []string) e return nil } -func (c *cmdRemoteReplicationEnableRbd) prepareRbdPayload(requestType types.ReplicationRequestType, args []string) (types.RbdReplicationRequest, error) { +func (c *cmdReplicationEnableRbd) prepareRbdPayload(requestType types.ReplicationRequestType, args []string) (types.RbdReplicationRequest, error) { pool, image, err := types.GetPoolAndImageFromResource(args[0]) if err != nil { return types.RbdReplicationRequest{}, err diff --git a/microceph/cmd/microceph/remote_replication_rbd_list.go b/microceph/cmd/microceph/replication_rbd_list.go similarity index 79% rename from microceph/cmd/microceph/remote_replication_rbd_list.go rename to microceph/cmd/microceph/replication_rbd_list.go index 6b7f5d8f..b0d779ec 100644 --- a/microceph/cmd/microceph/remote_replication_rbd_list.go +++ b/microceph/cmd/microceph/replication_rbd_list.go @@ -15,13 +15,13 @@ import ( "golang.org/x/crypto/ssh/terminal" ) -type cmdRemoteReplicationListRbd struct { +type cmdReplicationListRbd struct { common *CmdControl poolName string json bool } -func (c *cmdRemoteReplicationListRbd) Command() *cobra.Command { +func (c *cmdReplicationListRbd) Command() *cobra.Command { cmd := &cobra.Command{ Use: "list", Short: "List all configured remotes replication pairs.", @@ -33,7 +33,7 @@ func (c *cmdRemoteReplicationListRbd) Command() *cobra.Command { return cmd } -func (c *cmdRemoteReplicationListRbd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdReplicationListRbd) Run(cmd *cobra.Command, args []string) error { if len(args) != 0 { return cmd.Help() } @@ -53,7 +53,7 @@ func (c *cmdRemoteReplicationListRbd) Run(cmd *cobra.Command, args []string) err return err } - resp, err := client.SendRemoteReplicationRequest(context.Background(), cli, payload) + resp, err := client.SendReplicationRequest(context.Background(), cli, payload) if err != nil { return err } @@ -63,10 +63,10 @@ func (c *cmdRemoteReplicationListRbd) Run(cmd *cobra.Command, args []string) err return nil } - return printRemoteReplicationList(resp) + return printReplicationList(resp) } -func (c *cmdRemoteReplicationListRbd) prepareRbdPayload(requestType types.ReplicationRequestType) (types.RbdReplicationRequest, error) { +func (c *cmdReplicationListRbd) prepareRbdPayload(requestType types.ReplicationRequestType) (types.RbdReplicationRequest, error) { // list fetches ALL POOLS if pool name is empty. retReq := types.RbdReplicationRequest{ SourcePool: c.poolName, @@ -77,7 +77,7 @@ func (c *cmdRemoteReplicationListRbd) prepareRbdPayload(requestType types.Replic return retReq, nil } -func printRemoteReplicationList(response string) error { +func printReplicationList(response string) error { var resp types.RbdPoolList err := json.Unmarshal([]byte(response), &resp) if err != nil { diff --git a/microceph/cmd/microceph/remote_replication_rbd_promote.go b/microceph/cmd/microceph/replication_rbd_promote.go similarity index 74% rename from microceph/cmd/microceph/remote_replication_rbd_promote.go rename to microceph/cmd/microceph/replication_rbd_promote.go index 1603fd7e..a01aed52 100644 --- a/microceph/cmd/microceph/remote_replication_rbd_promote.go +++ b/microceph/cmd/microceph/replication_rbd_promote.go @@ -9,13 +9,13 @@ import ( "github.com/spf13/cobra" ) -type cmdRemoteReplicationPromoteRbd struct { +type cmdReplicationPromoteRbd struct { common *CmdControl remoteName string isForce bool } -func (c *cmdRemoteReplicationPromoteRbd) Command() *cobra.Command { +func (c *cmdReplicationPromoteRbd) Command() *cobra.Command { cmd := &cobra.Command{ Use: "promote", Short: "Promote a non-primary cluster to primary status", @@ -28,7 +28,7 @@ func (c *cmdRemoteReplicationPromoteRbd) Command() *cobra.Command { return cmd } -func (c *cmdRemoteReplicationPromoteRbd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdReplicationPromoteRbd) Run(cmd *cobra.Command, args []string) error { if len(args) != 0 { return cmd.Help() } @@ -48,7 +48,7 @@ func (c *cmdRemoteReplicationPromoteRbd) Run(cmd *cobra.Command, args []string) return err } - _, err = client.SendRemoteReplicationRequest(context.Background(), cli, payload) + _, err = client.SendReplicationRequest(context.Background(), cli, payload) if err != nil { return err } @@ -56,7 +56,7 @@ func (c *cmdRemoteReplicationPromoteRbd) Run(cmd *cobra.Command, args []string) return nil } -func (c *cmdRemoteReplicationPromoteRbd) prepareRbdPayload(requestType types.ReplicationRequestType) (types.RbdReplicationRequest, error) { +func (c *cmdReplicationPromoteRbd) prepareRbdPayload(requestType types.ReplicationRequestType) (types.RbdReplicationRequest, error) { retReq := types.RbdReplicationRequest{ RemoteName: c.remoteName, RequestType: requestType, diff --git a/microceph/cmd/microceph/remote_replication_rbd_status.go b/microceph/cmd/microceph/replication_rbd_status.go similarity index 88% rename from microceph/cmd/microceph/remote_replication_rbd_status.go rename to microceph/cmd/microceph/replication_rbd_status.go index 17e0ccb7..70bb8f93 100644 --- a/microceph/cmd/microceph/remote_replication_rbd_status.go +++ b/microceph/cmd/microceph/replication_rbd_status.go @@ -16,12 +16,12 @@ import ( "golang.org/x/crypto/ssh/terminal" ) -type cmdRemoteReplicationStatusRbd struct { +type cmdReplicationStatusRbd struct { common *CmdControl json bool } -func (c *cmdRemoteReplicationStatusRbd) Command() *cobra.Command { +func (c *cmdReplicationStatusRbd) Command() *cobra.Command { cmd := &cobra.Command{ Use: "status ", Short: "Show RBD resource (Pool or Image) replication status", @@ -32,7 +32,7 @@ func (c *cmdRemoteReplicationStatusRbd) Command() *cobra.Command { return cmd } -func (c *cmdRemoteReplicationStatusRbd) Run(cmd *cobra.Command, args []string) error { +func (c *cmdReplicationStatusRbd) Run(cmd *cobra.Command, args []string) error { if len(args) != 1 { return cmd.Help() } @@ -52,7 +52,7 @@ func (c *cmdRemoteReplicationStatusRbd) Run(cmd *cobra.Command, args []string) e return err } - resp, err := client.SendRemoteReplicationRequest(context.Background(), cli, payload) + resp, err := client.SendReplicationRequest(context.Background(), cli, payload) if err != nil { return err } @@ -62,10 +62,10 @@ func (c *cmdRemoteReplicationStatusRbd) Run(cmd *cobra.Command, args []string) e return nil } - return printRemoteReplicationStatusTable(payload.ResourceType, resp) + return printReplicationStatusTable(payload.ResourceType, resp) } -func (c *cmdRemoteReplicationStatusRbd) prepareRbdPayload(requestType types.ReplicationRequestType, args []string) (types.RbdReplicationRequest, error) { +func (c *cmdReplicationStatusRbd) prepareRbdPayload(requestType types.ReplicationRequestType, args []string) (types.RbdReplicationRequest, error) { pool, image, err := types.GetPoolAndImageFromResource(args[0]) if err != nil { return types.RbdReplicationRequest{}, err @@ -81,7 +81,7 @@ func (c *cmdRemoteReplicationStatusRbd) prepareRbdPayload(requestType types.Repl return retReq, nil } -func printRemoteReplicationStatusTable(ResourceType types.RbdResourceType, response string) error { +func printReplicationStatusTable(ResourceType types.RbdResourceType, response string) error { var err error // start table object diff --git a/tests/scripts/actionutils.sh b/tests/scripts/actionutils.sh index a97fc324..1bc81d13 100755 --- a/tests/scripts/actionutils.sh +++ b/tests/scripts/actionutils.sh @@ -241,11 +241,11 @@ function remote_configure_rbd_mirroring() { lxc exec node-wrk1 -- sh -c "microceph.rbd create --size 512 pool_two/image_two" # enable mirroring on pool_one - lxc exec node-wrk0 -- sh -c "microceph remote replication rbd enable pool_one --remote siteb" + lxc exec node-wrk0 -- sh -c "microceph replication rbd enable pool_one --remote siteb" # enable mirroring on pool_two images - lxc exec node-wrk0 -- sh -c "microceph remote replication rbd enable pool_two/image_one --type journal --remote siteb" - lxc exec node-wrk0 -- sh -c "microceph remote replication rbd enable pool_two/image_two --type snapshot --remote siteb" + lxc exec node-wrk0 -- sh -c "microceph replication rbd enable pool_two/image_one --type journal --remote siteb" + lxc exec node-wrk0 -- sh -c "microceph replication rbd enable pool_two/image_two --type snapshot --remote siteb" } function remote_enable_rbd_mirror_daemon() { @@ -260,7 +260,7 @@ function remote_wait_for_secondary_to_sync() { count=0 for index in {1..100}; do echo "Check run #$index" - list_output=$(lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd list --json") + 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 @@ -276,7 +276,7 @@ function remote_wait_for_secondary_to_sync() { done if [count -eq 10] ; then - echo "Remote replication sync check timed out" + echo "replication sync check timed out" exit -1 fi } @@ -284,32 +284,32 @@ function remote_wait_for_secondary_to_sync() { function remote_verify_rbd_mirroring() { set -eux - lxc exec node-wrk0 -- sh -c "sudo microceph remote replication rbd list" - lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd list" - lxc exec node-wrk0 -- sh -c "sudo microceph remote replication rbd list" | grep "pool_one.*image_one" - lxc exec node-wrk1 -- sh -c "sudo microceph remote replication rbd list" | grep "pool_one.*image_two" - lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd list" | grep "pool_two.*image_one" - lxc exec node-wrk3 -- sh -c "sudo microceph remote replication rbd list" | grep "pool_two.*image_two" + lxc exec node-wrk0 -- sh -c "sudo microceph replication rbd list" + lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd list" + lxc exec node-wrk0 -- sh -c "sudo microceph replication rbd list" | grep "pool_one.*image_one" + lxc exec node-wrk1 -- sh -c "sudo microceph replication rbd list" | grep "pool_one.*image_two" + lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd list" | grep "pool_two.*image_one" + lxc exec node-wrk3 -- sh -c "sudo microceph replication rbd list" | grep "pool_two.*image_two" } function remote_failover_to_siteb() { set -eux # check images are secondary on siteb - img_count=$(lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd list --json" | grep -c "\"is_primary\":false") + img_count=$(lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd list --json" | grep -c "\"is_primary\":false") if [[ $img_count -lt 1 ]]; then echo "Site B has $img_count secondary images" exit -1 fi # promote site b to primary - lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd promote --remote sitea --yes-i-really-mean-it" + lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd promote --remote sitea --yes-i-really-mean-it" # wait for the site images to show as primary is_primary_count=0 for index in {1..100}; do echo "Check run #$index" - list_output=$(lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd list --json") + 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 @@ -328,13 +328,13 @@ function remote_failover_to_siteb() { fi # resolve the split brain situation by demoting the old primary. - lxc exec node-wrk0 -- sh -c "sudo microceph remote replication rbd demote --remote siteb --yes-i-really-mean-it" + lxc exec node-wrk0 -- sh -c "sudo microceph replication rbd demote --remote siteb --yes-i-really-mean-it" # wait for the site images to show as non-primary is_primary_count=0 for index in {1..100}; do echo "Check run #$index" - list_output=$(lxc exec node-wrk0 -- sh -c "sudo microceph remote replication rbd list --json") + list_output=$(lxc exec node-wrk0 -- sh -c "sudo microceph replication rbd list --json") echo $list_output images=$(echo $list_output | jq .[].Images) echo $images @@ -356,14 +356,14 @@ function remote_failover_to_siteb() { function remote_disable_rbd_mirroring() { set -eux # check disables fail for image mirroring pools with images currently being mirrored - lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd disable pool_two 2>&1 || true" | grep "in Image mirroring mode" + lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd disable pool_two 2>&1 || true" | grep "in Image mirroring mode" # disable both images in pool_two and then disable pool_two - lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd disable pool_two/image_one" - lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd disable pool_two/image_two" - lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd disable pool_two" + lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd disable pool_two/image_one" + lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd disable pool_two/image_two" + lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd disable pool_two" # disable pool one - lxc exec node-wrk2 -- sh -c "sudo microceph remote replication rbd disable pool_one" + lxc exec node-wrk2 -- sh -c "sudo microceph replication rbd disable pool_one" } function remote_remove_and_verify() {