From fb1047eb10ea17fb893ecf60158ea0a426f21d58 Mon Sep 17 00:00:00 2001 From: subhamkrai Date: Thu, 24 Jul 2025 12:27:52 +0530 Subject: [PATCH] rbdmirror: with multus gen file on remote container In case of RDR with multus, the file which contains peer connection details need to generated on mgr proxy remote since rbd commands in multus, commands are run via mgr proxy container and not the rook operator pod. Co-Authored-by: Madhu Rajanna Signed-off-by: subhamkrai --- pkg/daemon/ceph/client/mirror.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/daemon/ceph/client/mirror.go b/pkg/daemon/ceph/client/mirror.go index fa1c2b7ba..96c5b54c5 100644 --- a/pkg/daemon/ceph/client/mirror.go +++ b/pkg/daemon/ceph/client/mirror.go @@ -85,6 +85,20 @@ func ImportRBDMirrorBootstrapPeer(context *clusterd.Context, clusterInfo *Cluste return err }() //nolint // we don't want to return here + if clusterInfo.NetworkSpec.IsMultus() { + err = context.RemoteExecutor.CopyLocalFileToContainer(clusterInfo.Context, ProxyAppLabel, CommandProxyInitContainerName, clusterInfo.Namespace, tokenFilePath.Name(), tokenFilePath.Name()) + if err != nil { + return err + } + defer func() { + // cleanup copied file in remote container + _, stdErr, cleanupErr := context.RemoteExecutor.ExecCommandInContainerWithFullOutput(clusterInfo.Context, ProxyAppLabel, CommandProxyInitContainerName, clusterInfo.Namespace, []string{"rm", tokenFilePath.Name()}...) + if cleanupErr != nil { + logger.Errorf("failed to cleanup remote file %q: %s - %s", tokenFilePath.Name(), cleanupErr, stdErr) + } + }() + } + // Build command args := []string{"mirror", "pool", "peer", "bootstrap", "import", poolName, tokenFilePath.Name()} if direction != "" {