aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2023-07-10 13:56:09 +0300
committeralexvru <alexvru@ydb.tech>2023-07-10 13:56:09 +0300
commit6f7cd3430b8b442a97a4485c917d188ef9633e19 (patch)
treef6579fde1f0c70cb10ea80c98f0a53cd92ef59a6
parent47f000036640d78989cdb6de0e8b481855c37f0a (diff)
downloadydb-6f7cd3430b8b442a97a4485c917d188ef9633e19.tar.gz
Fix dstool protobuf refs KIKIMR-11082
-rw-r--r--ydb/apps/dstool/lib/common.py9
-rw-r--r--ydb/apps/dstool/lib/dstool_cmd_box_list.py2
-rw-r--r--ydb/apps/dstool/lib/dstool_cmd_cluster_workload_run.py2
-rw-r--r--ydb/apps/dstool/lib/dstool_cmd_device_list.py2
-rw-r--r--ydb/apps/dstool/lib/dstool_cmd_group_list.py4
-rw-r--r--ydb/apps/dstool/lib/dstool_cmd_group_virtual_create.py4
-rw-r--r--ydb/apps/dstool/lib/dstool_cmd_pdisk_add_by_serial.py5
-rw-r--r--ydb/apps/dstool/lib/dstool_cmd_pdisk_list.py2
-rw-r--r--ydb/apps/dstool/lib/table.py2
9 files changed, 18 insertions, 14 deletions
diff --git a/ydb/apps/dstool/lib/common.py b/ydb/apps/dstool/lib/common.py
index 637802b1e1..3c7f657ef3 100644
--- a/ydb/apps/dstool/lib/common.py
+++ b/ydb/apps/dstool/lib/common.py
@@ -20,6 +20,7 @@ from collections import defaultdict
import ydb.core.protos.grpc_pb2_grpc as kikimr_grpc
import ydb.core.protos.msgbus_pb2 as kikimr_msgbus
import ydb.core.protos.blobstorage_config_pb2 as kikimr_bsconfig
+import ydb.core.protos.blobstorage_base3_pb2 as kikimr_bs3
import ydb.core.protos.cms_pb2 as kikimr_cms
import typing
@@ -28,6 +29,10 @@ bad_hosts = set()
cache = {}
name_cache = {}
+EPDiskType = kikimr_bs3.EPDiskType
+EVirtualGroupState = kikimr_bs3.EVirtualGroupState
+TGroupDecommitStatus = kikimr_bs3.TGroupDecommitStatus
+
class EndpointInfo:
def __init__(self, protocol: str, host: str, port: int):
@@ -708,7 +713,7 @@ def message_to_string(m):
def add_pdisk_select_options(parser, specification=None):
- types = kikimr_bsconfig.EPDiskType.keys()
+ types = EPDiskType.keys()
name = 'PDisk selection options'
if specification is not None:
name += ' for ' + specification
@@ -751,7 +756,7 @@ def get_selected_pdisks(args, base_config):
if args.fqdn is None or any(fnmatch.fnmatchcase(node_id_to_host[pdisk.NodeId], fqdn) for fqdn in args.fqdn)
if args.pdisk_id is None or pdisk.PDiskId in args.pdisk_id
if args.path in [None, pdisk.Path]
- if args.type in [None, kikimr_bsconfig.EPDiskType.Name(pdisk.Type)]
+ if args.type in [None, EPDiskType.Name(pdisk.Type)]
}
diff --git a/ydb/apps/dstool/lib/dstool_cmd_box_list.py b/ydb/apps/dstool/lib/dstool_cmd_box_list.py
index c7f546cb99..cdfe644ed1 100644
--- a/ydb/apps/dstool/lib/dstool_cmd_box_list.py
+++ b/ydb/apps/dstool/lib/dstool_cmd_box_list.py
@@ -71,7 +71,7 @@ def do(args):
for disk_type, box in box_data.items():
row = {}
row['BoxId'] = box_id
- row['DiskType'] = kikimr_bsconfig.EPDiskType.Name(disk_type)
+ row['DiskType'] = common.EPDiskType.Name(disk_type)
for key, value in box.items():
row[key] = value
diff --git a/ydb/apps/dstool/lib/dstool_cmd_cluster_workload_run.py b/ydb/apps/dstool/lib/dstool_cmd_cluster_workload_run.py
index 3256aafcc3..3b48145db8 100644
--- a/ydb/apps/dstool/lib/dstool_cmd_cluster_workload_run.py
+++ b/ydb/apps/dstool/lib/dstool_cmd_cluster_workload_run.py
@@ -101,7 +101,7 @@ def do(args):
key = *vslot_id, *common.get_vdisk_id_json(vdisk['VDiskId'])
vdisk_status[key] = vdisk['Replicated'] and vdisk['VDiskState'] == 'OK'
except KeyError:
- common.print_if_not_quiet(args, 'Failed to fetch VDisk status for VSlotId %s' % vslot_id, file=sys.stderr)
+ common.print_if_not_quiet(args, 'Failed to fetch VDisk status for VSlotId %s' % (vslot_id,), file=sys.stderr)
error = True
if error:
common.print_if_not_quiet(args, 'Waiting for the next round...', file=sys.stdout)
diff --git a/ydb/apps/dstool/lib/dstool_cmd_device_list.py b/ydb/apps/dstool/lib/dstool_cmd_device_list.py
index ed3391c9d5..9347591b08 100644
--- a/ydb/apps/dstool/lib/dstool_cmd_device_list.py
+++ b/ydb/apps/dstool/lib/dstool_cmd_device_list.py
@@ -49,7 +49,7 @@ def do(args):
row['NodeId'] = device.NodeId
row['FQDN'] = node_to_fqdn[device.NodeId]
row['Path'] = device.Path
- row['Type'] = kikimr_bsconfig.EPDiskType.Name(device.Type)
+ row['Type'] = common.EPDiskType.Name(device.Type)
row['BoxId'] = device.BoxId
row['Guid'] = device.Guid if device.Guid > 0 else 'NULL'
diff --git a/ydb/apps/dstool/lib/dstool_cmd_group_list.py b/ydb/apps/dstool/lib/dstool_cmd_group_list.py
index 2d988e9924..dc2c7cf796 100644
--- a/ydb/apps/dstool/lib/dstool_cmd_group_list.py
+++ b/ydb/apps/dstool/lib/dstool_cmd_group_list.py
@@ -91,11 +91,11 @@ def do(args):
group_stat['SeenOperational'] = group.SeenOperational
if group.VirtualGroupInfo:
- group_stat['VirtualGroupState'] = kikimr_bsconfig.EVirtualGroupState.Name(group.VirtualGroupInfo.State)
+ group_stat['VirtualGroupState'] = common.EVirtualGroupState.Name(group.VirtualGroupInfo.State)
group_stat['VirtualGroupName'] = group.VirtualGroupInfo.Name
group_stat['BlobDepotId'] = group.VirtualGroupInfo.BlobDepotId
group_stat['ErrorReason'] = group.VirtualGroupInfo.ErrorReason
- group_stat['DecommitStatus'] = kikimr_bsconfig.TGroupDecommitStatus.E.Name(group.VirtualGroupInfo.DecommitStatus)
+ group_stat['DecommitStatus'] = common.TGroupDecommitStatus.E.Name(group.VirtualGroupInfo.DecommitStatus)
group_stat['UsedSize'] = 0
group_stat['TotalSize'] = 0
diff --git a/ydb/apps/dstool/lib/dstool_cmd_group_virtual_create.py b/ydb/apps/dstool/lib/dstool_cmd_group_virtual_create.py
index bf59e87395..6334d6fe6c 100644
--- a/ydb/apps/dstool/lib/dstool_cmd_group_virtual_create.py
+++ b/ydb/apps/dstool/lib/dstool_cmd_group_virtual_create.py
@@ -63,9 +63,9 @@ def do(args):
for group in base_config.Group:
if group.VirtualGroupInfo.Name in names_remaining:
- if group.VirtualGroupInfo.State == common.kikimr_bsconfig.EVirtualGroupState.WORKING:
+ if group.VirtualGroupInfo.State == common.EVirtualGroupState.WORKING:
names_remaining.remove(group.VirtualGroupInfo.Name)
- elif group.VirtualGroupInfo.State == common.kikimr_bsconfig.EVirtualGroupState.CREATE_FAILED:
+ elif group.VirtualGroupInfo.State == common.EVirtualGroupState.CREATE_FAILED:
names_remaining.remove(group.VirtualGroupInfo.Name)
errors.append(f'{group.VirtualGroupInfo.Name}: {group.ErrorReason}')
diff --git a/ydb/apps/dstool/lib/dstool_cmd_pdisk_add_by_serial.py b/ydb/apps/dstool/lib/dstool_cmd_pdisk_add_by_serial.py
index 8e970d3652..9f56b929ff 100644
--- a/ydb/apps/dstool/lib/dstool_cmd_pdisk_add_by_serial.py
+++ b/ydb/apps/dstool/lib/dstool_cmd_pdisk_add_by_serial.py
@@ -1,6 +1,5 @@
from google.protobuf import text_format
import ydb.apps.dstool.lib.common as common
-import ydb.core.protos.blobstorage_config_pb2 as kikimr_bsconfig
import sys
description = 'Add disk to storage box by serial number'
@@ -10,7 +9,7 @@ def add_options(p):
p.add_argument('--serial', type=str, required=True, help='Disk serial number')
p.add_argument('--box', type=int, required=True, help='Box of PDisk')
p.add_argument('--kind', type=int, help='Kind of PDisk')
- types = kikimr_bsconfig.EPDiskType.keys()
+ types = common.EPDiskType.keys()
p.add_argument('--pdisk-type', type=str, choices=types, default='UNKNOWN_TYPE', help='Type of PDisk')
p.add_argument('--pdisk-config', type=str, metavar='TEXT_PROTOBUF', help='Proto config for PDisk')
common.add_basic_format_options(p)
@@ -24,7 +23,7 @@ def create_request(args):
if args.kind:
cmd.Kind = args.kind
if args.pdisk_type:
- cmd.PDiskType = kikimr_bsconfig.EPDiskType.Value(args.pdisk_type)
+ cmd.PDiskType = common.EPDiskType.Value(args.pdisk_type)
if args.pdisk_config:
text_format.Parse(args.pdisk_config, cmd.PDiskConfig)
return request
diff --git a/ydb/apps/dstool/lib/dstool_cmd_pdisk_list.py b/ydb/apps/dstool/lib/dstool_cmd_pdisk_list.py
index a29627382d..b71780ddd5 100644
--- a/ydb/apps/dstool/lib/dstool_cmd_pdisk_list.py
+++ b/ydb/apps/dstool/lib/dstool_cmd_pdisk_list.py
@@ -83,7 +83,7 @@ def do(args):
row['Path'] = pdisk.Path
row['Status'] = kikimr_bsconfig.EDriveStatus.Name(pdisk.DriveStatus)
row['DecommitStatus'] = kikimr_bsconfig.EDecommitStatus.Name(pdisk.DecommitStatus)
- row['Type'] = kikimr_bsconfig.EPDiskType.Name(pdisk.Type)
+ row['Type'] = common.EPDiskType.Name(pdisk.Type)
row['BoxId'] = pdisk.BoxId
row['Kind'] = pdisk.Kind
row['Guid'] = pdisk.Guid
diff --git a/ydb/apps/dstool/lib/table.py b/ydb/apps/dstool/lib/table.py
index 8c9659d83c..a059e8c99b 100644
--- a/ydb/apps/dstool/lib/table.py
+++ b/ydb/apps/dstool/lib/table.py
@@ -34,7 +34,7 @@ class TableOutput(object):
if value == 'bytes':
cell = f'{common.bytes_string(cell)}'
elif value == '%':
- cell = '{0:.1%}'.format(cell)if cell is not None else 'None'
+ cell = '{0:.1%}'.format(cell) if cell is not None else 'None'
else:
assert False
row[key] = cell