fix resync to find peers by deployment ID instead of site names (#4884)
The site names may vary if configured on UI. The Deployment ID is immutable and can be used instead in replicate resync commands.
This commit is contained in:
@@ -92,9 +92,14 @@ func mainAdminReplicateResyncCancel(ctx *cli.Context) error {
|
||||
fatalIf(err, "Unable to initialize admin connection.")
|
||||
info, e := client.SiteReplicationInfo(globalContext)
|
||||
fatalIf(probe.NewError(e), "Unable to fetch site replication info.")
|
||||
|
||||
peerClient := getClient(args.Get(1))
|
||||
peerAdmInfo, e := peerClient.ServerInfo(globalContext)
|
||||
fatalIf(probe.NewError(e), "Unable to fetch server info of the peer.")
|
||||
|
||||
var peer madmin.PeerInfo
|
||||
for _, site := range info.Sites {
|
||||
if args[1] == site.Name {
|
||||
if peerAdmInfo.DeploymentID == site.DeploymentID {
|
||||
peer = site
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,15 +87,20 @@ func mainAdminReplicateResyncStart(ctx *cli.Context) error {
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
|
||||
// Create a new MinIO Admin Client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
client, err := newAdminClient(args.Get(0))
|
||||
fatalIf(err, "Unable to initialize admin connection.")
|
||||
info, e := client.SiteReplicationInfo(globalContext)
|
||||
fatalIf(probe.NewError(e), "Unable to fetch site replication info.")
|
||||
|
||||
peerClient := getClient(args.Get(1))
|
||||
peerAdmInfo, e := peerClient.ServerInfo(globalContext)
|
||||
fatalIf(probe.NewError(e), "Unable to fetch server info of the peer.")
|
||||
|
||||
var peer madmin.PeerInfo
|
||||
for _, site := range info.Sites {
|
||||
if args[1] == site.Name {
|
||||
if peerAdmInfo.DeploymentID == site.DeploymentID {
|
||||
peer = site
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,9 +86,14 @@ func mainAdminReplicationResyncStatus(ctx *cli.Context) error {
|
||||
console.Colorize("ResyncMessage", "SiteReplication is not enabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
peerClient := getClient(args.Get(1))
|
||||
peerAdmInfo, e := peerClient.ServerInfo(globalContext)
|
||||
fatalIf(probe.NewError(e), "Unable to fetch server info of the peer.")
|
||||
|
||||
var peer madmin.PeerInfo
|
||||
for _, site := range info.Sites {
|
||||
if args[1] == site.Name {
|
||||
if peerAdmInfo.DeploymentID == site.DeploymentID {
|
||||
peer = site
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user