diff --git a/cluster/etcd.go b/cluster/etcd.go index 5c082f5a..5e027335 100644 --- a/cluster/etcd.go +++ b/cluster/etcd.go @@ -130,8 +130,10 @@ func (c *Cluster) PrepareBackup(ctx context.Context, snapshotPath string) error func (c *Cluster) RestoreEtcdSnapshot(ctx context.Context, snapshotPath string) error { // Start restore process on all etcd hosts initCluster := services.GetEtcdInitialCluster(c.EtcdHosts) + backupImage := c.getBackupImage() for _, host := range c.EtcdHosts { - if err := services.RestoreEtcdSnapshot(ctx, host, c.PrivateRegistriesMap, c.SystemImages.Etcd, snapshotPath, initCluster, c.Services.Etcd); err != nil { + if err := services.RestoreEtcdSnapshot(ctx, host, c.PrivateRegistriesMap, c.SystemImages.Etcd, backupImage, + snapshotPath, initCluster, c.Services.Etcd); err != nil { return fmt.Errorf("[etcd] Failed to restore etcd snapshot: %v", err) } } @@ -141,7 +143,8 @@ func (c *Cluster) RestoreEtcdSnapshot(ctx context.Context, snapshotPath string) func (c *Cluster) RemoveEtcdSnapshot(ctx context.Context, snapshotName string) error { backupImage := c.getBackupImage() for _, host := range c.EtcdHosts { - if err := services.RunEtcdSnapshotRemove(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotName, false, c.Services.Etcd); err != nil { + if err := services.RunEtcdSnapshotRemove(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotName, + false, c.Services.Etcd); err != nil { return err } } diff --git a/services/etcd.go b/services/etcd.go index 0e4851c8..6ea4e837 100644 --- a/services/etcd.go +++ b/services/etcd.go @@ -435,7 +435,8 @@ func DownloadEtcdSnapshotFromS3(ctx context.Context, etcdHost *hosts.Host, prsMa return docker.RemoveContainer(ctx, etcdHost.DClient, etcdHost.Address, EtcdDownloadBackupContainerName) } -func RestoreEtcdSnapshot(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, etcdRestoreImage, snapshotName, initCluster string, es v3.ETCDService) error { +func RestoreEtcdSnapshot(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, + etcdRestoreImage, etcdBackupImage, snapshotName, initCluster string, es v3.ETCDService) error { log.Infof(ctx, "[etcd] Restoring [%s] snapshot on etcd host [%s]", snapshotName, etcdHost.Address) nodeName := pki.GetCrtNameForHost(etcdHost, pki.EtcdCertName) snapshotPath := fmt.Sprintf("%s%s", EtcdSnapshotPath, snapshotName) @@ -494,7 +495,7 @@ func RestoreEtcdSnapshot(ctx context.Context, etcdHost *hosts.Host, prsMap map[s if err := docker.RemoveContainer(ctx, etcdHost.DClient, etcdHost.Address, EtcdRestoreContainerName); err != nil { return err } - return RunEtcdSnapshotRemove(ctx, etcdHost, prsMap, etcdRestoreImage, snapshotName, true, es) + return RunEtcdSnapshotRemove(ctx, etcdHost, prsMap, etcdBackupImage, snapshotName, true, es) } func RunEtcdSnapshotRemove(ctx context.Context, etcdHost *hosts.Host, prsMap map[string]v3.PrivateRegistry, etcdSnapshotImage string, name string, cleanupRestore bool, es v3.ETCDService) error {