Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue-1657: remove 'resize device' handler #2028

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions cloud/blockstore/apps/client/lib/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "query_available_storage.h"
#include "read_blocks.h"
#include "refresh_endpoint.h"
#include "resize_device.h"
#include "resize_volume.h"
#include "resume_device.h"
#include "start_endpoint.h"
Expand Down Expand Up @@ -85,7 +84,6 @@ struct THandlerFactory
{ "queryavailablestorage", NewQueryAvailableStorageCommand },
{ "readblocks", NewReadBlocksCommand },
{ "refreshendpoint", NewRefreshEndpointCommand },
{ "resizedevice", NewResizeDeviceCommand },
{ "resizevolume", NewResizeVolumeCommand },
{ "restorevolume", NewRestoreVolumeCommand },
{ "resumedevice", NewResumeDeviceCommand },
Expand Down
89 changes: 0 additions & 89 deletions cloud/blockstore/apps/client/lib/resize_device.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions cloud/blockstore/apps/client/lib/resize_device.h

This file was deleted.

1 change: 0 additions & 1 deletion cloud/blockstore/apps/client/lib/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ SRCS(
query_available_storage.cpp
read_blocks.cpp
refresh_endpoint.cpp
resize_device.cpp
resize_volume.cpp
resume_device.cpp
start_endpoint.cpp
Expand Down
19 changes: 0 additions & 19 deletions cloud/blockstore/libs/endpoints/endpoint_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,25 +1606,6 @@ void TEndpointManager::DetachFileDevice(const TString& device)
}
}

NProto::TResizeDeviceResponse TEndpointManager::DoResizeDevice(
TCallContextPtr ctx,
std::shared_ptr<NProto::TResizeDeviceRequest> request)
{
Y_UNUSED(ctx);
const auto& socketPath = request->GetUnixSocketPath();
const auto& deviceSize = request->GetDeviceSizeInBytes();

auto it = Endpoints.find(socketPath);
if (it == Endpoints.end()) {
return TErrorResponse(
E_NOT_FOUND,
TStringBuilder()
<< "endpoint " << socketPath.Quote() << " not started");
}

return TErrorResponse(it->second.Device->Resize(deviceSize).GetValueSync());
}

////////////////////////////////////////////////////////////////////////////////

TFuture<NProto::TStartEndpointResponse> TRestoringClient::StartEndpoint(
Expand Down
65 changes: 0 additions & 65 deletions cloud/blockstore/libs/endpoints/endpoint_manager_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,16 +498,6 @@ TFuture<NProto::TListEndpointsResponse> ListEndpoints(
std::make_shared<NProto::TListEndpointsRequest>());
}

TFuture<NProto::TResizeDeviceResponse> ResizeDevice(
IEndpointManager& endpointManager, const TString& unixSocketPath, ui64 deviceSize)
{
auto request = std::make_shared<NProto::TResizeDeviceRequest>();
request->SetUnixSocketPath(unixSocketPath);
request->SetDeviceSizeInBytes(deviceSize);
return endpointManager.ResizeDevice(
MakeIntrusive<TCallContext>(), request);
}

} // namespace

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1846,61 +1836,6 @@ Y_UNIT_TEST_SUITE(TEndpointManagerTest)
UNIT_ASSERT(!HasError(response));
}
}

Y_UNIT_TEST(ShouldResizeDevice)
{
TTempDir dir;
auto socketPath = dir.Path() / "testSocket";
TString diskId = "testDiskId";
auto ipcType = NProto::IPC_GRPC;

TBootstrap bootstrap;
TMap<TString, NProto::TMountVolumeRequest> mountedVolumes;
bootstrap.Service = CreateTestService(mountedVolumes);

auto grpcListener =
CreateSocketEndpointListener(bootstrap.Logging, 16, MODE0660);
grpcListener->SetClientStorageFactory(CreateClientStorageFactoryStub());
bootstrap.EndpointListeners = {{NProto::IPC_GRPC, grpcListener}};

auto manager = CreateEndpointManager(bootstrap);
bootstrap.Start();

NProto::TStartEndpointRequest request;
SetDefaultHeaders(request);
request.SetUnixSocketPath(socketPath.GetPath());
request.SetDiskId(diskId);
request.SetClientId(TestClientId);
request.SetIpcType(ipcType);

socketPath.DeleteIfExists();
UNIT_ASSERT(!socketPath.Exists());

{
auto future = StartEndpoint(*manager, request);
auto response = future.GetValue(TDuration::Seconds(5));
UNIT_ASSERT_C(!HasError(response), response.GetError());
}

const auto deviceSize = 1000u;
{
auto future =
ResizeDevice(*manager, "invalid/path/socket", deviceSize);
auto response = future.GetValue(TDuration::Seconds(5));
UNIT_ASSERT(HasError(response));
const auto& resizeError = response.GetError();
UNIT_ASSERT_EQUAL_C(
E_NOT_FOUND,
resizeError.GetCode(),
resizeError.GetMessage());
}

{
auto future = ResizeDevice(*manager, socketPath, deviceSize);
auto response = future.GetValue(TDuration::Seconds(5));
UNIT_ASSERT_C(!HasError(response), response.GetError());
}
}
}

} // namespace NCloud::NBlockStore::NServer
1 change: 0 additions & 1 deletion cloud/blockstore/libs/service/auth_scheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ TPermissionList GetRequestPermissions(EBlockStoreRequest requestType)
case EBlockStoreRequest::StopEndpoint:
case EBlockStoreRequest::KickEndpoint:
case EBlockStoreRequest::RefreshEndpoint:
case EBlockStoreRequest::ResizeDevice:
return CreatePermissionList({EPermission::Update});

case EBlockStoreRequest::ListEndpoints:
Expand Down
1 change: 0 additions & 1 deletion cloud/blockstore/libs/service/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ using TWriteBlocksLocalResponse = TWriteBlocksResponse;
xxx(ListKeyrings, __VA_ARGS__) \
xxx(DescribeEndpoint, __VA_ARGS__) \
xxx(RefreshEndpoint, __VA_ARGS__) \
xxx(ResizeDevice, __VA_ARGS__) \
// BLOCKSTORE_ENDPOINT_SERVICE

#define BLOCKSTORE_GRPC_SERVICE(xxx, ...) \
Expand Down
1 change: 0 additions & 1 deletion cloud/blockstore/libs/service/request_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ constexpr bool IsControlRequest(EBlockStoreRequest requestType)
case EBlockStoreRequest::DescribeEndpoint:
case EBlockStoreRequest::RefreshEndpoint:
case EBlockStoreRequest::QueryAgentsInfo:
case EBlockStoreRequest::ResizeDevice:
return true;
case EBlockStoreRequest::MAX:
Y_DEBUG_ABORT_UNLESS(false);
Expand Down
7 changes: 0 additions & 7 deletions cloud/blockstore/public/api/grpc/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,6 @@ service TBlockStoreService
};
}

rpc ResizeDevice(TResizeDeviceRequest) returns (TResizeDeviceResponse) {
option (google.api.http) = {
post: "/resize_device"
body: "*"
};
}

//
// Disk Registry config.
//
Expand Down
19 changes: 0 additions & 19 deletions cloud/blockstore/public/api/protos/endpoints.proto
Original file line number Diff line number Diff line change
Expand Up @@ -333,25 +333,6 @@ message TListProxyEndpointsResponse
repeated TProxyEndpoint Endpoints = 2;
}

message TResizeDeviceRequest
{
// Optional request headers.
THeaders Headers = 1;

// Unix socket path of the endpoint associated with the device being resized
string UnixSocketPath = 2;

// New size in bytes.
uint64 DeviceSizeInBytes = 3;
}

message TResizeDeviceResponse
{
// Optional error, set only if error happened.
NCloud.NProto.TError Error = 1;
}


message TResizeProxyDeviceRequest
{
// Optional request headers.
Expand Down
8 changes: 0 additions & 8 deletions cloud/blockstore/public/sdk/go/client/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,6 @@ func (client *discoveryClient) RefreshEndpoint(
panic("not implemented")
}

func (client *discoveryClient) ResizeDevice(
ctx context.Context,
req *protos.TResizeDeviceRequest,
) (*protos.TResizeDeviceResponse, error) {

panic("not implemented")
}

func (client *discoveryClient) CreateCheckpoint(
ctx context.Context,
req *protos.TCreateCheckpointRequest,
Expand Down
16 changes: 0 additions & 16 deletions cloud/blockstore/public/sdk/go/client/durable.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,22 +704,6 @@ func (client *durableClient) QueryAgentsInfo(
return resp.(*protos.TQueryAgentsInfoResponse), err
}

func (client *durableClient) ResizeDevice(
ctx context.Context,
req *protos.TResizeDeviceRequest,
) (*protos.TResizeDeviceResponse, error) {

resp, err := client.executeRequest(
ctx,
req,
func(ctx context.Context) (response, error) {
return client.impl.ResizeDevice(ctx, req)
},
)

return resp.(*protos.TResizeDeviceResponse), err
}

////////////////////////////////////////////////////////////////////////////////

type DurableClientOpts struct {
Expand Down
18 changes: 0 additions & 18 deletions cloud/blockstore/public/sdk/go/client/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,24 +848,6 @@ func (client *grpcClient) QueryAgentsInfo(
return resp.(*protos.TQueryAgentsInfoResponse), err
}

func (client *grpcClient) ResizeDevice(
ctx context.Context,
req *protos.TResizeDeviceRequest,
) (*protos.TResizeDeviceResponse, error) {

if req.Headers == nil {
req.Headers = &protos.THeaders{}
}
resp, err := client.executeRequest(
ctx,
req,
func(ctx context.Context) (response, error) {
return client.impl.ResizeDevice(ctx, req)
})

return resp.(*protos.TResizeDeviceResponse), err
}

////////////////////////////////////////////////////////////////////////////////

type GrpcClientOpts struct {
Expand Down
9 changes: 0 additions & 9 deletions cloud/blockstore/public/sdk/go/client/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,4 @@ type ClientIface interface {
ctx context.Context,
req *protos.TQueryAgentsInfoRequest,
) (*protos.TQueryAgentsInfoResponse, error)

//
// Resize NBD Device.
//

ResizeDevice(
ctx context.Context,
req *protos.TResizeDeviceRequest,
) (*protos.TResizeDeviceResponse, error)
}
Loading