Skip to content

Commit

Permalink
feat(backuptarget): add cleanup all mounts grpc function
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 5741

Signed-off-by: Jack Lin <jack.lin@suse.com>
  • Loading branch information
ChanYiLin authored and David Ko committed Nov 17, 2023
1 parent 4b991a5 commit 055db7e
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 155 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def __init__(self, channel):
request_serializer=github_dot_com_dot_longhorn_dot_longhorn__instance__manager_dot_pkg_dot_imrpc_dot_proxy__pb2.ProxyEngineRequest.SerializeToString,
response_deserializer=github_dot_com_dot_longhorn_dot_longhorn__instance__manager_dot_pkg_dot_imrpc_dot_proxy__pb2.EngineBackupRestoreStatusProxyResponse.FromString,
)
self.CleanupBackupMountPoints = channel.unary_unary(
'/imrpc.ProxyEngineService/CleanupBackupMountPoints',
request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
self.ReplicaAdd = channel.unary_unary(
'/imrpc.ProxyEngineService/ReplicaAdd',
request_serializer=github_dot_com_dot_longhorn_dot_longhorn__instance__manager_dot_pkg_dot_imrpc_dot_proxy__pb2.EngineReplicaAddRequest.SerializeToString,
Expand Down Expand Up @@ -296,6 +301,13 @@ def BackupRestoreStatus(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def CleanupBackupMountPoints(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ReplicaAdd(self, request, context):
# missing associated documentation comment in .proto file
pass
Expand Down Expand Up @@ -448,6 +460,11 @@ def add_ProxyEngineServiceServicer_to_server(servicer, server):
request_deserializer=github_dot_com_dot_longhorn_dot_longhorn__instance__manager_dot_pkg_dot_imrpc_dot_proxy__pb2.ProxyEngineRequest.FromString,
response_serializer=github_dot_com_dot_longhorn_dot_longhorn__instance__manager_dot_pkg_dot_imrpc_dot_proxy__pb2.EngineBackupRestoreStatusProxyResponse.SerializeToString,
),
'CleanupBackupMountPoints': grpc.unary_unary_rpc_method_handler(
servicer.CleanupBackupMountPoints,
request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
),
'ReplicaAdd': grpc.unary_unary_rpc_method_handler(
servicer.ReplicaAdd,
request_deserializer=github_dot_com_dot_longhorn_dot_longhorn__instance__manager_dot_pkg_dot_imrpc_dot_proxy__pb2.EngineReplicaAddRequest.FromString,
Expand Down
9 changes: 9 additions & 0 deletions pkg/client/proxy_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@ import (
"encoding/json"
"fmt"

"github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"

rpc "github.com/longhorn/longhorn-instance-manager/pkg/imrpc"
)

func (c *ProxyClient) CleanupBackupMountPoints() (err error) {
_, err = c.service.CleanupBackupMountPoints(getContextWithGRPCTimeout(c.ctx), &empty.Empty{})
if err != nil {
return err
}
return nil
}

func (c *ProxyClient) SnapshotBackup(backendStoreDriver, engineName, volumeName, serviceAddress, backupName,
snapshotName, backupTarget, backingImageName, backingImageChecksum, compressionMethod string, concurrentLimit int,
storageClassName string, labels map[string]string, envs []string) (backupID, replicaAddress string, err error) {
Expand Down
Loading

0 comments on commit 055db7e

Please sign in to comment.