Skip to content

Commit

Permalink
fix(storage): change of nvme names
Browse files Browse the repository at this point in the history
Instead of full resource names, relative resource names are used.

Signed-off-by: Artsiom Koltun <[email protected]>
  • Loading branch information
artek-koltun committed Feb 8, 2024
1 parent 9659be6 commit c1ffb21
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions pydpu/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __repr__(self) -> str:

def __init__(self, nqn: str, model="OPI Model", serial="OPI SN", ns=10) -> None:
self.id = "opi-" + str(uuid.uuid1())
self.fullname = "//storage.opiproject.org/subsystems/" + str(self.id)
self.name = "nvmeSubsystems/" + str(self.id)
self.nqn = nqn
self.model = model
self.serial = serial
Expand Down Expand Up @@ -54,7 +54,7 @@ def update(self, address):
request=frontend_nvme_pb2.UpdateNvmeSubsystemRequest(
update_mask=field_mask_pb2.FieldMask(paths=["*"]),
nvme_subsystem=frontend_nvme_pb2.NvmeSubsystem(
name=self.fullname,
name=self.name,
spec=frontend_nvme_pb2.NvmeSubsystemSpec(
model_number=self.model,
serial_number=self.serial,
Expand All @@ -79,7 +79,7 @@ def delete(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.DeleteNvmeSubsystem(
request=frontend_nvme_pb2.DeleteNvmeSubsystemRequest(
name=self.fullname,
name=self.name,
)
)
return res
Expand All @@ -89,7 +89,7 @@ def get(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.GetNvmeSubsystem(
request=frontend_nvme_pb2.GetNvmeSubsystemRequest(
name=self.fullname,
name=self.name,
)
)
return res
Expand All @@ -99,7 +99,7 @@ def stats(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.StatsNvmeSubsystem(
request=frontend_nvme_pb2.StatsNvmeSubsystemRequest(
name=self.fullname,
name=self.name,
)
)
return res
Expand Down Expand Up @@ -137,7 +137,7 @@ def __init__(
max_ncq: int = 0,
) -> None:
self.id = "opi-" + str(uuid.uuid1())
self.fullname = "//storage.opiproject.org/subsystems/{}/controllers{}".format(
self.name = "nvmeSubsystems/{}/nvmeControllers{}".format(
subsystem.id, self.id
)
self.subsystem = subsystem
Expand All @@ -153,7 +153,7 @@ def create(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.CreateNvmeController(
request=frontend_nvme_pb2.CreateNvmeControllerRequest(
parent=str(self.subsystem.fullname),
parent=str(self.subsystem.name),
nvme_controller_id=str(self.id),
nvme_controller=frontend_nvme_pb2.NvmeController(
spec=frontend_nvme_pb2.NvmeControllerSpec(
Expand Down Expand Up @@ -183,7 +183,7 @@ def update(self, address):
request=frontend_nvme_pb2.UpdateNvmeControllerRequest(
update_mask=field_mask_pb2.FieldMask(paths=["*"]),
nvme_controller=frontend_nvme_pb2.NvmeController(
name=self.fullname,
name=self.name,
spec=frontend_nvme_pb2.NvmeControllerSpec(
pcie_id=opicommon_pb2.PciEndpoint(
physical_function=1, virtual_function=2, port_id=3
Expand All @@ -204,7 +204,7 @@ def list(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.ListNvmeControllers(
request=frontend_nvme_pb2.ListNvmeControllersRequest(
parent=str(self.subsystem.fullname)
parent=str(self.subsystem.name)
)
)
return res
Expand All @@ -214,7 +214,7 @@ def delete(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.DeleteNvmeController(
request=frontend_nvme_pb2.DeleteNvmeControllerRequest(
name=self.fullname,
name=self.name,
)
)
return res
Expand All @@ -224,7 +224,7 @@ def get(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.GetNvmeController(
request=frontend_nvme_pb2.GetNvmeControllerRequest(
name=self.fullname,
name=self.name,
)
)
return res
Expand All @@ -234,7 +234,7 @@ def stats(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.StatsNvmeController(
request=frontend_nvme_pb2.StatsNvmeControllerRequest(
name=self.fullname,
name=self.name,
)
)
return res
Expand All @@ -252,7 +252,7 @@ def __repr__(self) -> str:

def __init__(self, subsystem: NvmeSubsystem, volume: str) -> None:
self.id = "opi-" + str(uuid.uuid1())
self.fullname = "//storage.opiproject.org/subsystems/{}/namespaces{}".format(
self.name = "nvmeSubsystems/{}/nvmeNamespaces{}".format(
subsystem.id, self.id
)
self.subsystem = subsystem
Expand All @@ -263,7 +263,7 @@ def create(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.CreateNvmeNamespace(
request=frontend_nvme_pb2.CreateNvmeNamespaceRequest(
parent=str(self.subsystem.fullname),
parent=str(self.subsystem.name),
nvme_namespace_id=str(self.id),
nvme_namespace=frontend_nvme_pb2.NvmeNamespace(
spec=frontend_nvme_pb2.NvmeNamespaceSpec(
Expand All @@ -285,7 +285,7 @@ def update(self, address):
request=frontend_nvme_pb2.UpdateNvmeNamespaceRequest(
update_mask=field_mask_pb2.FieldMask(paths=["*"]),
nvme_namespace=frontend_nvme_pb2.NvmeNamespace(
name=self.fullname,
name=self.name,
spec=frontend_nvme_pb2.NvmeNamespaceSpec(
volume_name_ref="Malloc1",
uuid="1b4e28ba-2fa1-11d2-883f-b9a761bde3fb",
Expand All @@ -303,7 +303,7 @@ def list(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.ListNvmeNamespaces(
request=frontend_nvme_pb2.ListNvmeNamespacesRequest(
parent=str(self.subsystem.fullname)
parent=str(self.subsystem.name)
)
)
return res
Expand All @@ -313,7 +313,7 @@ def delete(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.DeleteNvmeNamespace(
request=frontend_nvme_pb2.DeleteNvmeNamespaceRequest(
name=self.fullname,
name=self.name,
)
)
return res
Expand All @@ -323,7 +323,7 @@ def get(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.GetNvmeNamespace(
request=frontend_nvme_pb2.GetNvmeNamespaceRequest(
name=self.fullname,
name=self.name,
)
)
return res
Expand All @@ -333,7 +333,7 @@ def stats(self, address):
stub = frontend_nvme_pb2_grpc.FrontendNvmeServiceStub(channel)
res = stub.StatsNvmeNamespace(
request=frontend_nvme_pb2.StatsNvmeNamespaceRequest(
name=self.fullname,
name=self.name,
)
)
return res

0 comments on commit c1ffb21

Please sign in to comment.