# -*- coding: utf-8 -*-
+# pylint: disable=too-many-lines
import logging
from typing import Any, Dict, List, Optional
@NvmeofCLICommand("nvmeof spdk_log_level get", model.SpdkNvmfLogFlagsAndLevelInfo)
@convert_to_model(model.SpdkNvmfLogFlagsAndLevelInfo)
@handle_nvmeof_error
- def get_spdk_log_level(self, all_log_flags: Optional[bool] = None,
- gw_group: Optional[str] = None, traddr: Optional[str] = None):
+ def get_spdk_log_level(
+ self, all_log_flags: Optional[bool] = None,
+ gw_group: Optional[str] = None, traddr: Optional[str] = None
+ ):
spdk_log_level = NVMeoFClient(gw_group=gw_group,
traddr=traddr).stub.get_spdk_nvmf_log_flags_and_level(
NVMeoFClient.pb2.get_spdk_nvmf_log_flags_and_level_req(all_log_flags=all_log_flags)
@NvmeofCLICommand("nvmeof spdk_log_level disable", model.RequestStatus)
@convert_to_model(model.RequestStatus)
@handle_nvmeof_error
- def disable_spdk_log_level(self, extra_log_flags: Optional[List[str]] = None,
- gw_group: Optional[str] = None,
- traddr: Optional[str] = None):
+ def disable_spdk_log_level(
+ self, extra_log_flags: Optional[List[str]] = None,
+ gw_group: Optional[str] = None,
+ traddr: Optional[str] = None
+ ):
spdk_log_level = NVMeoFClient(gw_group=gw_group,
traddr=traddr).stub.disable_spdk_nvmf_logs(
NVMeoFClient.pb2.disable_spdk_nvmf_logs_req(extra_log_flags=extra_log_flags)
@NvmeofCLICommand("nvmeof host list", model.HostsInfo)
@convert_to_model(model.HostsInfo, finalize=_update_hosts)
@handle_nvmeof_error
- def list(self, nqn: str, clear_alerts: Optional[bool],
- gw_group: Optional[str] = None, traddr: Optional[str] = None):
+ def list(
+ self, nqn: str, clear_alerts: Optional[bool],
+ gw_group: Optional[str] = None, traddr: Optional[str] = None
+ ):
return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.list_hosts(
NVMeoFClient.pb2.list_hosts_req(subsystem=nqn, clear_alerts=clear_alerts)
)
NVMeoFClient.pb2.remove_host_req(subsystem_nqn=nqn, host_nqn=host_nqn)
)
+ @EndpointDoc(
+ "Change host DH-HMAC-CHAP key",
+ parameters={
+ "nqn": Param(str, "NVMeoF subsystem NQN"),
+ "host_nqn": Param(str, 'NVMeoF host NQN'),
+ "dhchap_key": Param(str, 'Host DH-HMAC-CHAP key'),
+ "gw_group": Param(str, "NVMeoF gateway group", True, None),
+ },
+ )
+ @empty_response
+ @NvmeofCLICommand("nvmeof host change_key", model.RequestStatus)
+ @convert_to_model(model.RequestStatus)
+ @handle_nvmeof_error
+ def change_key(
+ self, nqn: str, host_nqn: str, dhchap_key: str,
+ gw_group: Optional[str] = None, traddr: Optional[str] = None
+ ):
+ return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.change_host_key(
+ NVMeoFClient.pb2.change_host_key_req(subsystem_nqn=nqn,
+ host_nqn=host_nqn,
+ dhchap_key=dhchap_key)
+ )
+
+ @EndpointDoc(
+ "Delete host DH-HMAC-CHAP key",
+ parameters={
+ "nqn": Param(str, "NVMeoF subsystem NQN"),
+ "host_nqn": Param(str, 'NVMeoF host NQN.'),
+ "gw_group": Param(str, "NVMeoF gateway group", True, None),
+ },
+ )
+ @empty_response
+ @NvmeofCLICommand("nvmeof host del_key", model.RequestStatus)
+ @convert_to_model(model.RequestStatus)
+ @handle_nvmeof_error
+ def del_key(
+ self, nqn: str, host_nqn: str, gw_group: Optional[str] = None,
+ traddr: Optional[str] = None
+ ):
+ return NVMeoFClient(gw_group=gw_group, traddr=traddr).stub.change_host_key(
+ NVMeoFClient.pb2.change_host_key_req(subsystem_nqn=nqn,
+ host_nqn=host_nqn,
+ dhchap_key=None)
+ )
+
@APIRouter("/nvmeof/subsystem/{nqn}/connection", Scope.NVME_OF)
@APIDoc("NVMe-oF Subsystem Connection Management API", "NVMe-oF Subsystem Connection")
class NVMeoFConnection(RESTController):
/api/nvmeof/spdk/log_level:
get:
parameters:
+ - allowEmptyValue: true
+ in: query
+ name: all_log_flags
+ schema:
+ type: string
- allowEmptyValue: true
in: query
name: gw_group
application/json:
schema:
properties:
+ extra_log_flags:
+ type: string
gw_group:
type: string
log_level:
application/json:
schema:
properties:
+ extra_log_flags:
+ type: string
gw_group:
type: string
traddr:
/api/nvmeof/subsystem/{nqn}/connection:
get:
parameters:
- - description: NVMeoF subsystem NQN
+ - allowEmptyValue: true
+ description: NVMeoF subsystem NQN
in: path
name: nqn
- required: true
schema:
type: string
- allowEmptyValue: true
required: true
schema:
type: string
+ - description: Clear any host alert signal after getting its value
+ in: query
+ name: clear_alerts
+ required: true
+ schema:
+ type: boolean
- allowEmptyValue: true
description: NVMeoF gateway group
in: query
default: true
description: Create RBD image
type: boolean
+ disable_auto_resize:
+ default: false
+ type: integer
force:
default: false
description: Force create namespace even it image is used by other
default: rbd
description: RBD pool name
type: string
+ read_only:
+ default: false
+ type: boolean
size:
default: 1024
description: RBD image size
summary: Update an existing NVMeoF namespace
tags:
- NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/add_host:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ force:
+ description: Allow adding the host to the namespace even if the
+ host has no access to the subsystem
+ type: boolean
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ host_nqn:
+ description: NVMeoF host NQN. Use "*" to allow any host.
+ type: string
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ required:
+ - host_nqn
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: Adds a host to the specified NVMeoF namespace
+ tags:
+ - NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/change_load_balancing_group:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ load_balancing_group:
+ description: Load balancing group
+ type: integer
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: set the load balancing group for specified NVMeoF namespace
+ tags:
+ - NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/change_visibility:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ auto_visible:
+ description: True if visible to all hosts
+ type: boolean
+ force:
+ default: false
+ type: boolean
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ required:
+ - auto_visible
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: changes the visibility of the specified NVMeoF namespace to all or
+ selected hosts
+ tags:
+ - NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/del_host:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ host_nqn:
+ description: NVMeoF host NQN. Use "*" to allow any host.
+ type: string
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ required:
+ - host_nqn
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: Removes a host from the specified NVMeoF namespace
+ tags:
+ - NVMe-oF Subsystem Namespace
/api/nvmeof/subsystem/{nqn}/namespace/{nsid}/io_stats:
get:
parameters:
summary: Get IO stats from specified NVMeoF namespace
tags:
- NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/refresh_size:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: refresh the specified NVMeoF namespace to current RBD image size
+ tags:
+ - NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/resize:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ rbd_image_size:
+ description: RBD image size
+ type: integer
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ required:
+ - rbd_image_size
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: resize the specified NVMeoF namespace
+ tags:
+ - NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/set_auto_resize:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ auto_resize_enabled:
+ description: Enable or disable auto resize of namespace when RBD
+ image is resized
+ type: boolean
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ required:
+ - auto_resize_enabled
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: Enable or disable namespace auto resize when RBD image is resized
+ tags:
+ - NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/set_qos:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ force:
+ default: false
+ description: Set QOS limits even if they were changed by RBD
+ type: boolean
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ r_mbytes_per_second:
+ description: Read MB/s
+ type: integer
+ rw_ios_per_second:
+ description: Read/Write IOPS
+ type: integer
+ rw_mbytes_per_second:
+ description: Read/Write MB/s
+ type: integer
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ w_mbytes_per_second:
+ description: Write MB/s
+ type: integer
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: set QOS for specified NVMeoF namespace
+ tags:
+ - NVMe-oF Subsystem Namespace
+ /api/nvmeof/subsystem/{nqn}/namespace/{nsid}/set_rbd_trash_image:
+ put:
+ parameters:
+ - description: NVMeoF subsystem NQN
+ in: path
+ name: nqn
+ required: true
+ schema:
+ type: string
+ - description: NVMeoF Namespace ID
+ in: path
+ name: nsid
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ gw_group:
+ description: NVMeoF gateway group
+ type: string
+ rbd_trash_image_on_delete:
+ description: True if active
+ type: boolean
+ traddr:
+ description: NVMeoF gateway address
+ type: string
+ required:
+ - rbd_trash_image_on_delete
+ type: object
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource updated.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: changes the trash image on delete of the specified NVMeoF namespace
+ to all or selected hosts
+ tags:
+ - NVMe-oF Subsystem Namespace
/api/osd:
get:
parameters: