]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common/ceph/deployment: Add resource limits to nvmeof configuration
authorGil Bregman <gbregman@il.ibm.com>
Tue, 19 Nov 2024 11:51:01 +0000 (13:51 +0200)
committerGil Bregman <gbregman@il.ibm.com>
Tue, 19 Nov 2024 11:51:01 +0000 (13:51 +0200)
Fixes https://tracker.ceph.com/issues/68967

Signed-off-by: Gil Bregman <gbregman@il.ibm.com>
src/python-common/ceph/deployment/service_spec.py

index 979c14f7d00fd07299f94b1adc3abcec126b45c7..1bfcd27a074b692888ff190d4a5aa4fc33313b7b 100644 (file)
@@ -1342,6 +1342,10 @@ class NvmeofServiceSpec(ServiceSpec):
                  ping_spdk_under_lock: Optional[bool] = False,
                  max_hosts_per_namespace: Optional[int] = 1,
                  max_namespaces_with_netmask: Optional[int] = 1000,
+                 max_subsystems: Optional[int] = 128,
+                 max_namespaces: Optional[int] = 1024,
+                 max_namespaces_per_subsystem: Optional[int] = 256,
+                 max_hosts_per_subsystem: Optional[int] = 32,
                  server_key: Optional[str] = None,
                  server_cert: Optional[str] = None,
                  client_key: Optional[str] = None,
@@ -1425,6 +1429,14 @@ class NvmeofServiceSpec(ServiceSpec):
         self.max_hosts_per_namespace = max_hosts_per_namespace
         #: ``max_namespaces_with_netmask`` max number of namespaces which are not auto visible
         self.max_namespaces_with_netmask = max_namespaces_with_netmask
+        #: ``max_subsystems`` max number of subsystems
+        self.max_subsystems = max_subsystems
+        #: ``max_namespaces`` max number of namespaces on all subsystems
+        self.max_namespaces = max_namespaces
+        #: ``max_namespaces_per_subsystem`` max number of namespaces per one subsystem
+        self.max_namespaces_per_subsystem = max_namespaces_per_subsystem
+        #: ``max_hosts_per_subsystem`` max number of hosts per subsystems
+        self.max_hosts_per_subsystem = max_hosts_per_subsystem
         #: ``allowed_consecutive_spdk_ping_failures`` # of ping failures before aborting gateway
         self.allowed_consecutive_spdk_ping_failures = allowed_consecutive_spdk_ping_failures
         #: ``spdk_ping_interval_in_seconds`` sleep interval in seconds between SPDK pings
@@ -1613,6 +1625,36 @@ class NvmeofServiceSpec(ServiceSpec):
         ):
             raise SpecValidationError("Log file directory backups can't be negative")
 
+        if (self.max_hosts_per_namespace and self.max_hosts_per_namespace < 0):
+            raise SpecValidationError("Max hosts per namespace can't be negative")
+
+        if (self.max_namespaces_with_netmask and self.max_namespaces_with_netmask < 0):
+            raise SpecValidationError("Max namespaces with netmask can't be negative")
+
+        if type(self.max_subsystems) != int:
+            raise SpecValidationError("Max subsystems must be an integer")
+
+        if self.max_subsystems <= 0:
+            raise SpecValidationError("Max subsystems must be greater than zero")
+
+        if type(self.max_namespaces) != int:
+            raise SpecValidationError("Max namespaces must be an integer")
+
+        if self.max_namespaces <= 0:
+            raise SpecValidationError("Max namespaces must be greater than zero")
+
+        if type(self.max_namespaces_per_subsystem) != int:
+            raise SpecValidationError("Max namespaces per subsystem must be an integer")
+
+        if self.max_namespaces_per_subsystem <= 0:
+            raise SpecValidationError("Max namespaces per subsystem must be greater than zero")
+
+        if type(self.max_hosts_per_subsystem) != int:
+            raise SpecValidationError("Max hosts per subsystem must be an integer")
+
+        if self.max_hosts_per_subsystem <= 0:
+            raise SpecValidationError("Max hosts per subsystem must be greater than zero")
+
         if (
             self.monitor_timeout
             and self.monitor_timeout < 0.0