Neat: reformat code using black

This commit is contained in:
Mehran Kholdi 2021-07-02 18:50:45 +04:30
parent 7717264801
commit 2fb84efb6d
2 changed files with 8 additions and 4 deletions

View File

@ -111,7 +111,8 @@ class RawFileNodeServicer(csi_pb2_grpc.NodeServicer):
return csi_pb2.NodeGetVolumeStatsResponse(
usage=[
csi_pb2.VolumeUsage(
total=stats["dev_size"], unit=csi_pb2.VolumeUsage.Unit.BYTES,
total=stats["dev_size"],
unit=csi_pb2.VolumeUsage.Unit.BYTES,
),
]
)
@ -184,7 +185,8 @@ class RawFileControllerServicer(csi_pb2_grpc.ControllerServicer):
)
run_on_node(
init_rawfile.as_cmd(volume_id=request.name, size=size), node=node_name,
init_rawfile.as_cmd(volume_id=request.name, size=size),
node=node_name,
)
return csi_pb2.CreateVolumeResponse(
@ -213,5 +215,6 @@ class RawFileControllerServicer(csi_pb2_grpc.ControllerServicer):
)
return csi_pb2.ControllerExpandVolumeResponse(
capacity_bytes=size, node_expansion_required=True,
capacity_bytes=size,
node_expansion_required=True,
)

View File

@ -53,6 +53,7 @@ def expand_rawfile(volume_id, size):
if rawfile_util.metadata(volume_id)["size"] >= size:
return
rawfile_util.patch_metadata(
volume_id, {"size": size},
volume_id,
{"size": size},
)
run(f"truncate -s {size} {img_file}")