diff --git a/delfin/api/v1/storage_host_initiators.py b/delfin/api/v1/storage_host_initiators.py index 1a47356f2..0780bc592 100644 --- a/delfin/api/v1/storage_host_initiators.py +++ b/delfin/api/v1/storage_host_initiators.py @@ -24,7 +24,7 @@ class StorageHostInitiatorController(wsgi.Controller): def __init__(self): super(StorageHostInitiatorController, self).__init__() self.search_options = ['name', 'status', 'wwn', 'id', 'storage_id', - 'native_storage_host_id', + 'type', 'native_storage_host_id', 'native_storage_host_initiator_id'] def _get_storage_host_initiator_search_options(self): diff --git a/delfin/drivers/fake_storage/__init__.py b/delfin/drivers/fake_storage/__init__.py index d94ba77ee..1aed75a06 100644 --- a/delfin/drivers/fake_storage/__init__.py +++ b/delfin/drivers/fake_storage/__init__.py @@ -861,6 +861,11 @@ def list_storage_host_initiators(self, ctx): MIN_STORAGE_HOST_INITIATORS, MAX_STORAGE_HOST_INITIATORS) LOG.info("###########fake_storage_host_initiators for %s: %d" % (self.storage_id, rd_storage_host_initiators_count)) + initiator_type = list(constants.InitiatorType.ALL) + initiator_type_len = len(constants.InitiatorType.ALL) - 1 + initiator_status = list(constants.InitiatorStatus.ALL) + initiator_status_len = len(constants.InitiatorStatus.ALL) - 1 + storage_host_initiators_list = [] for idx in range(rd_storage_host_initiators_count): f = { @@ -871,7 +876,10 @@ def list_storage_host_initiators(self, ctx): "native_storage_host_initiator_id": "storage_host_initiator_" + str(idx), "wwn": "wwn_" + str(idx), - "status": "Normal", + "type": initiator_type[ + random.randint(0, initiator_type_len)], + "status": initiator_status[ + random.randint(0, initiator_status_len)], "native_storage_host_id": "storage_host_" + str(idx), } storage_host_initiators_list.append(f) diff --git a/openapi-spec/swagger.yaml b/openapi-spec/swagger.yaml index 538ac832e..a84ce3231 100644 --- a/openapi-spec/swagger.yaml +++ b/openapi-spec/swagger.yaml @@ -2430,6 +2430,21 @@ paths: explode: true schema: type: string + - name: type + in: query + description: The storage host initiator type + required: false + style: form + explode: true + schema: + type: string + enum: + - fc + - iscsi + - roce + - nvm-of + - sas + - unknown - name: status in: query description: The storage host initiator status @@ -4233,6 +4248,17 @@ components: type: string readOnly: true example: "storage host initiator" + type: + type: string + readOnly: true + enum: + - fc + - iscsi + - roce + - nvm-of + - sas + - unknown + example: fc wwn: type: string readOnly: true @@ -4435,11 +4461,6 @@ components: readOnly: true description: Actual ID of the volume in the storage backend. example: volume_0 - native_port_id: - type: string - readOnly: true - description: Actual ID of the port in the storage backend. - example: port_0 StorageBackendAlertSync: type: object properties: