Skip to content

Commit bc3abd2

Browse files
committed
python-common/service_spec: add kmip fields to NFS spec
The KMIP block will take the form KMIP { HOST { addr = kmip-host-1.example.com; } cert = /etc/ganesha/kmip/cert.pem; key = /etc/ganesha/kmip/key.pem; ca = /etc/ganesha/kmip/ca.pem; } this commit adds the 4 fields that will populate the block Signed-off-by: Adam King <[email protected]> (cherry picked from commit 5301120) Conflicts: src/python-common/ceph/deployment/service_spec.py Resolves: rhbz#2373703
1 parent 53ba9b1 commit bc3abd2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/python-common/ceph/deployment/service_spec.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
import fnmatch
24
import os
35
import re
@@ -1221,6 +1223,10 @@ def __init__(self,
12211223
idmap_conf: Optional[Dict[str, Dict[str, str]]] = None,
12221224
custom_configs: Optional[List[CustomConfig]] = None,
12231225
enable_virtual_server: bool = False,
1226+
kmip_cert: Optional[str] = None,
1227+
kmip_key: Optional[str] = None,
1228+
kmip_ca_cert: Optional[str] = None,
1229+
kmip_host_list: Optional[List[str]] = None,
12241230
):
12251231
assert service_type == 'nfs'
12261232
super(NFSServiceSpec, self).__init__(
@@ -1245,6 +1251,10 @@ def __init__(self,
12451251
self.idmap_conf = idmap_conf
12461252
self.enable_nlm = enable_nlm
12471253
self.enable_virtual_server = enable_virtual_server
1254+
self.kmip_cert = kmip_cert
1255+
self.kmip_key = kmip_key
1256+
self.kmip_ca_cert = kmip_ca_cert
1257+
self.kmip_host_list = kmip_host_list
12481258

12491259
def get_port_start(self) -> List[int]:
12501260
if self.port:
@@ -1262,6 +1272,18 @@ def validate(self) -> None:
12621272
raise SpecValidationError("Invalid NFS spec: Cannot set virtual_ip and "
12631273
f"{'ip_addrs' if self.ip_addrs else 'networks'} fields")
12641274

1275+
kmip_field_names = [
1276+
'kmip_cert',
1277+
'kmip_key',
1278+
'kmip_ca_cert',
1279+
'kmip_host_list'
1280+
]
1281+
kmip_fields = [getattr(self, kmip_field) for kmip_field in kmip_field_names]
1282+
if any(kmip_fields) and not all(kmip_fields):
1283+
raise SpecValidationError(
1284+
f'Either none or all of {kmip_field_names} attrbutes must be set'
1285+
)
1286+
12651287

12661288
yaml.add_representer(NFSServiceSpec, ServiceSpec.yaml_representer)
12671289

0 commit comments

Comments
 (0)