diff --git a/cloud/disk_manager/api/filesystem_service.proto b/cloud/disk_manager/api/filesystem_service.proto index fe557c0fb18..c5f3792baac 100644 --- a/cloud/disk_manager/api/filesystem_service.proto +++ b/cloud/disk_manager/api/filesystem_service.proto @@ -24,10 +24,10 @@ service FilesystemService { rpc DescribeModel(DescribeFilesystemModelRequest) returns (FilesystemModel) {} } -enum FilesystemStorageKind { - FILESYSTEM_STORAGE_KIND_UNSPECIFIED = 0; - FILESYSTEM_STORAGE_KIND_HDD = 1; - FILESYSTEM_STORAGE_KIND_SSD = 2; +enum FilesystemKind { + FILESYSTEM_KIND_UNSPECIFIED = 0; + FILESYSTEM_KIND_HDD = 1; + FILESYSTEM_KIND_SSD = 2; } message FilesystemId { @@ -46,7 +46,7 @@ message FilesystemModel { int64 block_size = 1; int64 size = 2; int64 channels_count = 3; - FilesystemStorageKind storage_kind = 4; + FilesystemKind kind = 4; FilesystemPerformanceProfile performance_profile = 5; } @@ -56,7 +56,7 @@ message CreateFilesystemRequest { string folder_id = 3; int64 block_size = 4; int64 size = 5; - FilesystemStorageKind storage_kind = 6; + FilesystemKind kind = 6; } message DeleteFilesystemRequest { @@ -76,5 +76,5 @@ message DescribeFilesystemModelRequest { string zone_id = 1; int64 block_size = 2; int64 size = 3; - FilesystemStorageKind storage_kind = 4; + FilesystemKind kind = 4; } diff --git a/cloud/disk_manager/internal/pkg/clients/nfs/client.go b/cloud/disk_manager/internal/pkg/clients/nfs/client.go index 65321674ca9..c8c13ec7a13 100644 --- a/cloud/disk_manager/internal/pkg/clients/nfs/client.go +++ b/cloud/disk_manager/internal/pkg/clients/nfs/client.go @@ -18,13 +18,13 @@ const ( ) func getStorageMediaKind( - kind types.FilesystemStorageKind, + kind types.FilesystemKind, ) (coreprotos.EStorageMediaKind, error) { switch kind { - case types.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_SSD: + case types.FilesystemKind_FILESYSTEM_KIND_SSD: return coreprotos.EStorageMediaKind_STORAGE_MEDIA_SSD, nil - case types.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_HDD: + case types.FilesystemKind_FILESYSTEM_KIND_HDD: return coreprotos.EStorageMediaKind_STORAGE_MEDIA_HDD, nil default: return 0, errors.NewNonRetriableErrorf( @@ -108,7 +108,7 @@ func (c *client) Create( params CreateFilesystemParams, ) error { - mediaKind, err := getStorageMediaKind(params.StorageKind) + mediaKind, err := getStorageMediaKind(params.Kind) if err != nil { return err } @@ -196,7 +196,7 @@ func (c *client) DescribeModel( ctx context.Context, blocksCount uint64, blockSize uint32, - kind types.FilesystemStorageKind, + kind types.FilesystemKind, ) (FilesystemModel, error) { mediaKind, err := getStorageMediaKind(kind) diff --git a/cloud/disk_manager/internal/pkg/clients/nfs/interface.go b/cloud/disk_manager/internal/pkg/clients/nfs/interface.go index 26fc21f1f21..1e6c8279ea7 100644 --- a/cloud/disk_manager/internal/pkg/clients/nfs/interface.go +++ b/cloud/disk_manager/internal/pkg/clients/nfs/interface.go @@ -13,7 +13,7 @@ type CreateFilesystemParams struct { CloudID string BlockSize uint32 BlocksCount uint64 - StorageKind types.FilesystemStorageKind + Kind types.FilesystemKind } type FilesystemPerformanceProfile struct { @@ -27,7 +27,7 @@ type FilesystemModel struct { BlockSize uint32 BlocksCount uint64 ChannelsCount uint32 - Kind types.FilesystemStorageKind + Kind types.FilesystemKind PerformanceProfile FilesystemPerformanceProfile } @@ -42,22 +42,15 @@ type Client interface { params CreateFilesystemParams, ) error - Delete( - ctx context.Context, - filesystemID string, - ) error + Delete(ctx context.Context, filesystemID string) error - Resize( - ctx context.Context, - filesystemID string, - size uint64, - ) error + Resize(ctx context.Context, filesystemID string, size uint64) error DescribeModel( ctx context.Context, blocksCount uint64, blockSize uint32, - kind types.FilesystemStorageKind, + kind types.FilesystemKind, ) (FilesystemModel, error) } diff --git a/cloud/disk_manager/internal/pkg/clients/nfs/mocks/client_mock.go b/cloud/disk_manager/internal/pkg/clients/nfs/mocks/client_mock.go index 1a86ccaf08e..9041c1d5906 100644 --- a/cloud/disk_manager/internal/pkg/clients/nfs/mocks/client_mock.go +++ b/cloud/disk_manager/internal/pkg/clients/nfs/mocks/client_mock.go @@ -52,7 +52,7 @@ func (c *ClientMock) DescribeModel( ctx context.Context, blocksCount uint64, blockSize uint32, - kind types.FilesystemStorageKind, + kind types.FilesystemKind, ) (nfs.FilesystemModel, error) { args := c.Called(ctx, blocksCount, blockSize, kind) diff --git a/cloud/disk_manager/internal/pkg/facade/filesystem_service_test/filesystem_service_test.go b/cloud/disk_manager/internal/pkg/facade/filesystem_service_test/filesystem_service_test.go index edc6f76b2c4..7bdddeda781 100644 --- a/cloud/disk_manager/internal/pkg/facade/filesystem_service_test/filesystem_service_test.go +++ b/cloud/disk_manager/internal/pkg/facade/filesystem_service_test/filesystem_service_test.go @@ -26,9 +26,9 @@ func TestFilesystemServiceCreateEmptyFilesystem(t *testing.T) { ZoneId: "zone-a", FilesystemId: filesystemID, }, - BlockSize: 4096, - Size: 4096000, - StorageKind: disk_manager.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_HDD, + BlockSize: 4096, + Size: 4096000, + Kind: disk_manager.FilesystemKind_FILESYSTEM_KIND_HDD, }) require.NoError(t, err) require.NotEmpty(t, operation) diff --git a/cloud/disk_manager/internal/pkg/services/filesystem/create_filesystem_task.go b/cloud/disk_manager/internal/pkg/services/filesystem/create_filesystem_task.go index ef9dfa4f688..73b98d43956 100644 --- a/cloud/disk_manager/internal/pkg/services/filesystem/create_filesystem_task.go +++ b/cloud/disk_manager/internal/pkg/services/filesystem/create_filesystem_task.go @@ -55,7 +55,7 @@ func (t *createFilesystemTask) Run( ZoneID: t.request.Filesystem.ZoneId, BlocksCount: t.request.BlocksCount, BlockSize: t.request.BlockSize, - Kind: fsKindToString(t.request.StorageKind), + Kind: fsKindToString(t.request.Kind), CloudID: t.request.CloudId, FolderID: t.request.FolderId, @@ -80,7 +80,7 @@ func (t *createFilesystemTask) Run( FolderID: t.request.FolderId, BlocksCount: t.request.BlocksCount, BlockSize: t.request.BlockSize, - StorageKind: t.request.StorageKind, + Kind: t.request.Kind, }) if err != nil { return err diff --git a/cloud/disk_manager/internal/pkg/services/filesystem/protos/create_filesystem_task.proto b/cloud/disk_manager/internal/pkg/services/filesystem/protos/create_filesystem_task.proto index 2c4ff234da0..3726f7a8c02 100644 --- a/cloud/disk_manager/internal/pkg/services/filesystem/protos/create_filesystem_task.proto +++ b/cloud/disk_manager/internal/pkg/services/filesystem/protos/create_filesystem_task.proto @@ -16,7 +16,7 @@ message CreateFilesystemRequest { string FolderId = 4; uint32 BlockSize = 5; uint64 BlocksCount = 6; - types.FilesystemStorageKind StorageKind = 7; + types.FilesystemKind Kind = 7; } message CreateFilesystemTaskState {} diff --git a/cloud/disk_manager/internal/pkg/services/filesystem/service.go b/cloud/disk_manager/internal/pkg/services/filesystem/service.go index f3f27545edd..cfe4a1fe44e 100644 --- a/cloud/disk_manager/internal/pkg/services/filesystem/service.go +++ b/cloud/disk_manager/internal/pkg/services/filesystem/service.go @@ -34,24 +34,24 @@ func getBlocksCountForSize(size uint64, blockSize uint32) (uint64, error) { return size / uint64(blockSize), nil } -func fsKindToString(kind types.FilesystemStorageKind) string { +func fsKindToString(kind types.FilesystemKind) string { switch kind { - case types.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_SSD: + case types.FilesystemKind_FILESYSTEM_KIND_SSD: return "ssd" - case types.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_HDD: + case types.FilesystemKind_FILESYSTEM_KIND_HDD: return "hdd" } return "unknown" } -func prepareFilesystemKind(kind disk_manager.FilesystemStorageKind) (types.FilesystemStorageKind, error) { +func prepareFilesystemKind(kind disk_manager.FilesystemKind) (types.FilesystemKind, error) { switch kind { - case disk_manager.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_UNSPECIFIED: + case disk_manager.FilesystemKind_FILESYSTEM_KIND_UNSPECIFIED: fallthrough - case disk_manager.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_HDD: - return types.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_HDD, nil - case disk_manager.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_SSD: - return types.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_SSD, nil + case disk_manager.FilesystemKind_FILESYSTEM_KIND_HDD: + return types.FilesystemKind_FILESYSTEM_KIND_HDD, nil + case disk_manager.FilesystemKind_FILESYSTEM_KIND_SSD: + return types.FilesystemKind_FILESYSTEM_KIND_SSD, nil default: return 0, errors.NewInvalidArgumentError( "unknown filesystem storage kind %v", @@ -105,7 +105,7 @@ func (s *service) CreateFilesystem( return "", err } - kind, err := prepareFilesystemKind(req.StorageKind) + kind, err := prepareFilesystemKind(req.Kind) if err != nil { return "", err } @@ -123,7 +123,7 @@ func (s *service) CreateFilesystem( FolderId: req.FolderId, BlockSize: blockSize, BlocksCount: blocksCount, - StorageKind: kind, + Kind: kind, }, ) } @@ -218,7 +218,7 @@ func (s *service) DescribeFilesystemModel( blockSize = s.config.GetDefaultBlockSize() } - kind, err := prepareFilesystemKind(req.StorageKind) + kind, err := prepareFilesystemKind(req.Kind) if err != nil { return nil, err } @@ -242,7 +242,7 @@ func (s *service) DescribeFilesystemModel( BlockSize: int64(model.BlockSize), Size: int64(uint64(model.BlockSize) * model.BlocksCount), ChannelsCount: int64(model.ChannelsCount), - StorageKind: req.StorageKind, + Kind: req.Kind, PerformanceProfile: &disk_manager.FilesystemPerformanceProfile{ MaxReadBandwidth: int64(model.PerformanceProfile.MaxReadBandwidth), MaxReadIops: int64(model.PerformanceProfile.MaxReadIops), diff --git a/cloud/disk_manager/internal/pkg/services/filesystem/tests/filesystem_test.go b/cloud/disk_manager/internal/pkg/services/filesystem/tests/filesystem_test.go index 7fce48d03ce..7be0d1e59cc 100644 --- a/cloud/disk_manager/internal/pkg/services/filesystem/tests/filesystem_test.go +++ b/cloud/disk_manager/internal/pkg/services/filesystem/tests/filesystem_test.go @@ -291,9 +291,9 @@ func TestCreateDeleteFilesystem(t *testing.T) { ZoneId: "zone", FilesystemId: "filesystem", }, - CloudId: "cloud", - FolderId: "folder", - StorageKind: disk_manager.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_HDD, + CloudId: "cloud", + FolderId: "folder", + Kind: disk_manager.FilesystemKind_FILESYSTEM_KIND_HDD, }) require.NoError(t, err) require.NotEmpty(t, taskID) @@ -331,9 +331,9 @@ func TestCreateResizeFilesystem(t *testing.T) { ZoneId: "zone", FilesystemId: "filesystem", }, - CloudId: "cloud", - FolderId: "folder", - StorageKind: disk_manager.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_HDD, + CloudId: "cloud", + FolderId: "folder", + Kind: disk_manager.FilesystemKind_FILESYSTEM_KIND_HDD, }) require.NoError(t, err) require.NotEmpty(t, taskID) @@ -379,10 +379,10 @@ func TestDescribeModel(t *testing.T) { reqCtx := getRequestContext(t, ctx) model, err := service.DescribeFilesystemModel(reqCtx, &disk_manager.DescribeFilesystemModelRequest{ - ZoneId: "zone", - BlockSize: 4096, - Size: 100500 * 4096, - StorageKind: disk_manager.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_SSD, + ZoneId: "zone", + BlockSize: 4096, + Size: 100500 * 4096, + Kind: disk_manager.FilesystemKind_FILESYSTEM_KIND_SSD, }) require.NoError(t, err) @@ -391,7 +391,7 @@ func TestDescribeModel(t *testing.T) { require.Equal(t, model.Size, int64(100500*4096)) require.Equal(t, model.BlockSize, int64(4096)) require.NotEqual(t, model.ChannelsCount, int64(0)) - require.Equal(t, model.StorageKind, disk_manager.FilesystemStorageKind_FILESYSTEM_STORAGE_KIND_SSD) + require.Equal(t, model.Kind, disk_manager.FilesystemKind_FILESYSTEM_KIND_SSD) require.NotEqual(t, model.PerformanceProfile.MaxReadBandwidth, int64(0)) require.NotEqual(t, model.PerformanceProfile.MaxReadIops, int64(0)) diff --git a/cloud/disk_manager/internal/pkg/types/types.proto b/cloud/disk_manager/internal/pkg/types/types.proto index 6cfcc5caed8..b2ea18ad039 100644 --- a/cloud/disk_manager/internal/pkg/types/types.proto +++ b/cloud/disk_manager/internal/pkg/types/types.proto @@ -58,7 +58,7 @@ message DiskPool { //////////////////////////////////////////////////////////////////////////////// -enum FilesystemStorageKind { - FILESYSTEM_STORAGE_KIND_SSD = 0; - FILESYSTEM_STORAGE_KIND_HDD = 1; +enum FilesystemKind { + FILESYSTEM_KIND_SSD = 0; + FILESYSTEM_KIND_HDD = 1; }