From 1bdcacd932076b7e35ed65d16b0e4deef990f7bb Mon Sep 17 00:00:00 2001 From: Chin-Ya Huang Date: Mon, 26 Aug 2024 10:41:34 +0800 Subject: [PATCH] chore: remove BackupRestoreFinish longhorn/longhorn-6613 Signed-off-by: Chin-Ya Huang --- pkg/client/proxy_backup.go | 30 ------------------------------ pkg/proxy/backup.go | 35 ----------------------------------- pkg/proxy/proxy.go | 1 - 3 files changed, 66 deletions(-) diff --git a/pkg/client/proxy_backup.go b/pkg/client/proxy_backup.go index 2bb97e53f..1334e7464 100644 --- a/pkg/client/proxy_backup.go +++ b/pkg/client/proxy_backup.go @@ -182,36 +182,6 @@ func (c *ProxyClient) BackupRestore(dataEngine, engineName, volumeName, serviceA return nil } -func (c *ProxyClient) BackupRestoreFinish(dataEngine, engineName, volumeName, serviceAddress string) error { - input := map[string]string{ - "engineName": engineName, - "volumeName": volumeName, - "serviceAddress": serviceAddress, - } - if err := validateProxyMethodParameters(input); err != nil { - return errors.Wrap(err, "failed to finishing backup restoration") - } - - driver, ok := rpc.DataEngine_value[getDataEngine(dataEngine)] - if !ok { - return fmt.Errorf("failed to finishing backup restoration: invalid data engine %v", dataEngine) - } - - req := &rpc.EngineBackupRestoreFinishRequest{ - ProxyEngineRequest: &rpc.ProxyEngineRequest{ - Address: serviceAddress, - EngineName: engineName, - // nolint:all replaced with DataEngine - BackendStoreDriver: rpc.BackendStoreDriver(driver), - DataEngine: rpc.DataEngine(driver), - // This is the name we will use for validation when communicating with the restoring engine. - VolumeName: volumeName, - }, - } - _, err := c.service.BackupRestoreFinish(getContextWithGRPCTimeout(c.ctx), req) - return err -} - func (c *ProxyClient) BackupRestoreStatus(dataEngine, engineName, volumeName, serviceAddress string) (status map[string]*BackupRestoreStatus, err error) { input := map[string]string{ "engineName": engineName, diff --git a/pkg/proxy/backup.go b/pkg/proxy/backup.go index 08af3b0f4..aadbc8077 100644 --- a/pkg/proxy/backup.go +++ b/pkg/proxy/backup.go @@ -309,41 +309,6 @@ func (ops V2DataEngineProxyOps) BackupRestore(ctx context.Context, req *rpc.Engi }) } -func (p *Proxy) BackupRestoreFinish(ctx context.Context, req *rpc.EngineBackupRestoreFinishRequest) (resp *emptypb.Empty, err error) { - log := logrus.WithFields(logrus.Fields{ - "serviceURL": req.ProxyEngineRequest.Address, - "engineName": req.ProxyEngineRequest.EngineName, - "volumeName": req.ProxyEngineRequest.VolumeName, - "dataEngine": req.ProxyEngineRequest.DataEngine, - }) - log.Info("Finishing backup restoration") - - ops, ok := p.ops[req.ProxyEngineRequest.DataEngine] - if !ok { - return nil, grpcstatus.Errorf(grpccodes.Unimplemented, "unsupported data engine %v", req.ProxyEngineRequest.DataEngine) - } - return ops.BackupRestoreFinish(ctx, req) -} - -func (ops V1DataEngineProxyOps) BackupRestoreFinish(ctx context.Context, req *rpc.EngineBackupRestoreFinishRequest) (*emptypb.Empty, error) { - // TODO: implement this - return nil, grpcstatus.Errorf(grpccodes.Unimplemented, "not implemented") -} - -func (ops V2DataEngineProxyOps) BackupRestoreFinish(ctx context.Context, req *rpc.EngineBackupRestoreFinishRequest) (*emptypb.Empty, error) { - c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address) - if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error()) - } - defer c.Close() - - err = c.EngineBackupRestoreFinish(req.ProxyEngineRequest.EngineName) - if err != nil { - return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to finish backup restoration").Error()) - } - return &emptypb.Empty{}, nil -} - func (p *Proxy) BackupRestoreStatus(ctx context.Context, req *rpc.ProxyEngineRequest) (resp *rpc.EngineBackupRestoreStatusProxyResponse, err error) { log := logrus.WithFields(logrus.Fields{ "serviceURL": req.Address, diff --git a/pkg/proxy/proxy.go b/pkg/proxy/proxy.go index 98989b8d8..a39e27516 100644 --- a/pkg/proxy/proxy.go +++ b/pkg/proxy/proxy.go @@ -46,7 +46,6 @@ type ProxyOps interface { SnapshotBackup(context.Context, *rpc.EngineSnapshotBackupRequest, map[string]string, []string) (*rpc.EngineSnapshotBackupProxyResponse, error) SnapshotBackupStatus(context.Context, *rpc.EngineSnapshotBackupStatusRequest) (*rpc.EngineSnapshotBackupStatusProxyResponse, error) BackupRestore(context.Context, *rpc.EngineBackupRestoreRequest, map[string]string) error - BackupRestoreFinish(context.Context, *rpc.EngineBackupRestoreFinishRequest) (*emptypb.Empty, error) BackupRestoreStatus(context.Context, *rpc.ProxyEngineRequest) (*rpc.EngineBackupRestoreStatusProxyResponse, error) }