Skip to content

Commit 2e1e764

Browse files
committed
Allow adding listeners with hostname mismatch
Signed-off-by: Barak Davidov <barakda@il.ibm.com>
1 parent 25ec5f9 commit 2e1e764

File tree

10 files changed

+241
-249
lines changed

10 files changed

+241
-249
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Globals
2-
VERSION="1.3.3"
2+
VERSION="1.3.4"
33
CEPH_VERSION="19.2.0"
44
SPDK_VERSION="24.01"
55
CONTAINER_REGISTRY="quay.io/ceph"
@@ -71,7 +71,7 @@ CEPH_SHA=latest
7171
CEPH_DEVEL_MGR_PATH=../ceph
7272

7373
# Atom
74-
ATOM_SHA=3c0b7531fd1022d97d5600a8ead51992e2a40ec0
74+
ATOM_SHA=7522d1bf5c3e1484965c0f5b8316c13bca463065
7575

7676
# Demo settings
7777
RBD_POOL=rbd

.github/workflows/build-container.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -846,33 +846,22 @@ jobs:
846846
atom:
847847
needs: [build, build-ceph]
848848
if: github.repository == 'ceph/ceph-nvmeof'
849-
runs-on: ibmcloud-1
849+
runs-on: atomRunner
850850
steps:
851851
- name: Checkout code
852852
uses: actions/checkout@v4
853853

854-
- name: Atom env initialization
855-
run: |
856-
. .env
857-
ACTION_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
858-
./tests/atom/atomEnvInit.sh $ATOM_SHA $ACTION_URL
859-
860854
- name: Download container images
861855
uses: actions/download-artifact@v4
862856
with:
863857
pattern: container_images_nvmeof
864858
merge-multiple: true
865859

866-
- name: Load container images
867-
run: |
868-
docker load < nvmeof.tar
869-
docker load < nvmeof-cli.tar
870-
871860
- name: Cluster build and Atom tests run
872-
if: always() || failure()
873861
run: |
874862
. .env
875-
./tests/atom/clusterBuildTestsRun.sh $NVMEOF_VERSION $CEPH_SHA $ATOM_SHA
863+
ACTION_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
864+
./tests/atom/clusterBuildTestsRun.sh $NVMEOF_VERSION $CEPH_SHA $ATOM_SHA $ACTION_URL
876865
877866
- name: Atom artifact build
878867
if: always()
@@ -882,7 +871,7 @@ jobs:
882871
if: always()
883872
with:
884873
name: atom-artifact
885-
path: /tmp/artifact/*
874+
path: /home/cephnvme/artifact.tar.gz
886875

887876
push-images-to-ceph-registry:
888877
if: github.event_name == 'release'

control/cli.py

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def stub(self):
207207

208208
def connect(self, args, host, port, client_key, client_cert, server_cert):
209209
"""Connects to server and sets stub."""
210-
out_func, err_func = self.get_output_functions(args)
210+
out_func, err_func, _ = self.get_output_functions(args)
211211
if args.format == "json" or args.format == "yaml" or args.format == "python":
212212
out_func = None
213213

@@ -259,17 +259,17 @@ def format_adrfam(self, adrfam):
259259

260260
def get_output_functions(self, args):
261261
if args.output == "log":
262-
return (self.logger.info, self.logger.error)
262+
return (self.logger.info, self.logger.error, self.logger.warning)
263263
elif args.output == "stdio":
264-
return (print, errprint)
264+
return (print, errprint, errprint)
265265
else:
266266
self.cli.parser.error("invalid --output value")
267267

268268
@cli.cmd()
269269
def version(self, args):
270270
"""Get CLI version"""
271271
rc = 0
272-
out_func, err_func = self.get_output_functions(args)
272+
out_func, err_func, _ = self.get_output_functions(args)
273273
errmsg = ""
274274
ver = os.getenv("NVMEOF_VERSION")
275275
if not ver:
@@ -336,7 +336,7 @@ def gw_get_info(self):
336336
def gw_info(self, args):
337337
"""Get gateway's information"""
338338

339-
out_func, err_func = self.get_output_functions(args)
339+
out_func, err_func, _ = self.get_output_functions(args)
340340
try:
341341
gw_info = self.gw_get_info()
342342
except Exception as ex:
@@ -386,7 +386,7 @@ def gw_info(self, args):
386386
def gw_version(self, args):
387387
"""Get gateway's version"""
388388

389-
out_func, err_func = self.get_output_functions(args)
389+
out_func, err_func, _ = self.get_output_functions(args)
390390
try:
391391
gw_info = self.gw_get_info()
392392
except Exception as ex:
@@ -418,7 +418,7 @@ def gw_version(self, args):
418418
def gw_get_log_level(self, args):
419419
"""Get gateway's log level"""
420420

421-
out_func, err_func = self.get_output_functions(args)
421+
out_func, err_func, _ = self.get_output_functions(args)
422422
req = pb2.get_gateway_log_level_req()
423423
try:
424424
ret = self.stub.get_gateway_log_level(req)
@@ -451,7 +451,7 @@ def gw_get_log_level(self, args):
451451
def gw_set_log_level(self, args):
452452
"""Set gateway's log level"""
453453

454-
out_func, err_func = self.get_output_functions(args)
454+
out_func, err_func, _ = self.get_output_functions(args)
455455
log_level = None
456456

457457
if args.level:
@@ -516,7 +516,7 @@ def gw(self, args):
516516
def spdk_log_level_disable(self, args):
517517
"""Disable SPDK nvmf log flags"""
518518

519-
out_func, err_func = self.get_output_functions(args)
519+
out_func, err_func, _ = self.get_output_functions(args)
520520

521521
req = pb2.disable_spdk_nvmf_logs_req()
522522
try:
@@ -550,7 +550,7 @@ def spdk_log_level_disable(self, args):
550550
def spdk_log_level_get(self, args):
551551
"""Get SPDK log levels and nvmf log flags"""
552552

553-
out_func, err_func = self.get_output_functions(args)
553+
out_func, err_func, _ = self.get_output_functions(args)
554554

555555
req = pb2.get_spdk_nvmf_log_flags_and_level_req()
556556
try:
@@ -591,7 +591,7 @@ def spdk_log_level_set(self, args):
591591
rc = 0
592592
errmsg = ""
593593

594-
out_func, err_func = self.get_output_functions(args)
594+
out_func, err_func, _ = self.get_output_functions(args)
595595
log_level = None
596596
print_level = None
597597

@@ -662,7 +662,7 @@ def spdk_log_level(self, args):
662662
def subsystem_add(self, args):
663663
"""Create a subsystem"""
664664

665-
out_func, err_func = self.get_output_functions(args)
665+
out_func, err_func, _ = self.get_output_functions(args)
666666
if args.max_namespaces == None:
667667
args.max_namespaces = 256
668668
if args.max_namespaces <= 0:
@@ -715,7 +715,7 @@ def subsystem_add(self, args):
715715
def subsystem_del(self, args):
716716
"""Delete a subsystem"""
717717

718-
out_func, err_func = self.get_output_functions(args)
718+
out_func, err_func, _ = self.get_output_functions(args)
719719
if args.subsystem == GatewayUtils.DISCOVERY_NQN:
720720
self.cli.parser.error("Can't delete a discovery subsystem")
721721

@@ -751,7 +751,7 @@ def subsystem_del(self, args):
751751
def subsystem_list(self, args):
752752
"""List subsystems"""
753753

754-
out_func, err_func = self.get_output_functions(args)
754+
out_func, err_func, _ = self.get_output_functions(args)
755755

756756
subsystems = None
757757
try:
@@ -849,7 +849,7 @@ def subsystem(self, args):
849849
def listener_add(self, args):
850850
"""Create a listener"""
851851

852-
out_func, err_func = self.get_output_functions(args)
852+
out_func, err_func, wrn_func = self.get_output_functions(args)
853853

854854
if args.trsvcid == None:
855855
args.trsvcid = 4420
@@ -872,6 +872,7 @@ def listener_add(self, args):
872872
traddr=traddr,
873873
trsvcid=args.trsvcid,
874874
secure=args.secure,
875+
verify_host_name=args.verify_host_name
875876
)
876877

877878
try:
@@ -880,9 +881,15 @@ def listener_add(self, args):
880881
ret = pb2.req_status(status = errno.EINVAL,
881882
error_message = f"Failure adding {args.subsystem} listener at {traddr}:{args.trsvcid}:\n{ex}")
882883

884+
orig_status = ret.status
885+
if ret.status == errno.EREMOTE:
886+
ret.status = 0
887+
883888
if args.format == "text" or args.format == "plain":
884-
if ret.status == 0:
889+
if orig_status == 0:
885890
out_func(f"Adding {args.subsystem} listener at {traddr}:{args.trsvcid}: Successful")
891+
elif orig_status == errno.EREMOTE:
892+
wrn_func(f"Adding {args.subsystem} listener at {traddr}:{args.trsvcid}: listener will only be active when appropriate gateway is up")
886893
else:
887894
err_func(f"{ret.error_message}")
888895
elif args.format == "json" or args.format == "yaml":
@@ -906,7 +913,7 @@ def listener_add(self, args):
906913
def listener_del(self, args):
907914
"""Delete a listener"""
908915

909-
out_func, err_func = self.get_output_functions(args)
916+
out_func, err_func, _ = self.get_output_functions(args)
910917
if args.trsvcid <= 0:
911918
self.cli.parser.error("trsvcid value must be positive")
912919
elif args.trsvcid > 0xffff:
@@ -964,7 +971,7 @@ def listener_del(self, args):
964971
def listener_list(self, args):
965972
"""List listeners"""
966973

967-
out_func, err_func = self.get_output_functions(args)
974+
out_func, err_func, _ = self.get_output_functions(args)
968975
listeners_info = None
969976
try:
970977
listeners_info = self.stub.list_listeners(pb2.list_listeners_req(subsystem=args.subsystem))
@@ -1015,6 +1022,7 @@ def listener_list(self, args):
10151022
]
10161023
listener_add_args = listener_common_args + [
10171024
argument("--host-name", "-t", help="Host name", required=True),
1025+
argument("--verify-host-name", "-y", help="Fail in case the listener's host name is different than the gateway's", action='store_true', required=False),
10181026
argument("--traddr", "-a", help="NVMe host IP", required=True),
10191027
argument("--trsvcid", "-s", help="Port number", type=int, required=False),
10201028
argument("--adrfam", "-f", help="Address family", default="", choices=get_enum_keys_list(pb2.AddressFamily)),
@@ -1051,7 +1059,7 @@ def host_add(self, args):
10511059

10521060
rc = 0
10531061
ret_list = []
1054-
out_func, err_func = self.get_output_functions(args)
1062+
out_func, err_func, _ = self.get_output_functions(args)
10551063

10561064
if args.psk:
10571065
if len(args.psk) > len(args.host_nqn):
@@ -1119,7 +1127,7 @@ def host_del(self, args):
11191127

11201128
rc = 0
11211129
ret_list = []
1122-
out_func, err_func = self.get_output_functions(args)
1130+
out_func, err_func, _ = self.get_output_functions(args)
11231131
for one_host_nqn in args.host_nqn:
11241132
req = pb2.remove_host_req(subsystem_nqn=args.subsystem, host_nqn=one_host_nqn)
11251133

@@ -1167,7 +1175,7 @@ def host_del(self, args):
11671175
def host_list(self, args):
11681176
"""List a host for a subsystem."""
11691177

1170-
out_func, err_func = self.get_output_functions(args)
1178+
out_func, err_func, _ = self.get_output_functions(args)
11711179

11721180
hosts_info = None
11731181
try:
@@ -1246,7 +1254,7 @@ def host(self, args):
12461254
def connection_list(self, args):
12471255
"""List connections for a subsystem."""
12481256

1249-
out_func, err_func = self.get_output_functions(args)
1257+
out_func, err_func, _ = self.get_output_functions(args)
12501258
connections_info = None
12511259
try:
12521260
connections_info = self.stub.list_connections(pb2.list_connections_req(subsystem=args.subsystem))
@@ -1318,7 +1326,7 @@ def ns_add(self, args):
13181326
"""Adds a namespace to a subsystem."""
13191327

13201328
img_size = 0
1321-
out_func, err_func = self.get_output_functions(args)
1329+
out_func, err_func, _ = self.get_output_functions(args)
13221330
if args.block_size == None:
13231331
args.block_size = 512
13241332
if args.block_size <= 0:
@@ -1386,7 +1394,7 @@ def ns_add(self, args):
13861394
def ns_del(self, args):
13871395
"""Deletes a namespace from a subsystem."""
13881396

1389-
out_func, err_func = self.get_output_functions(args)
1397+
out_func, err_func, _ = self.get_output_functions(args)
13901398
if args.nsid <= 0:
13911399
self.cli.parser.error("nsid value must be positive")
13921400

@@ -1422,7 +1430,7 @@ def ns_resize(self, args):
14221430
"""Resizes a namespace."""
14231431

14241432
ns_size = 0
1425-
out_func, err_func = self.get_output_functions(args)
1433+
out_func, err_func, _ = self.get_output_functions(args)
14261434
if args.nsid <= 0:
14271435
self.cli.parser.error("nsid value must be positive")
14281436
ns_size = self.get_size_in_bytes(args.size)
@@ -1509,7 +1517,7 @@ def get_size_in_bytes(self, sz):
15091517
def ns_list(self, args):
15101518
"""Lists namespaces on a subsystem."""
15111519

1512-
out_func, err_func = self.get_output_functions(args)
1520+
out_func, err_func, _ = self.get_output_functions(args)
15131521
if args.nsid != None and args.nsid <= 0:
15141522
self.cli.parser.error("nsid value must be positive")
15151523

@@ -1598,7 +1606,7 @@ def ns_list(self, args):
15981606
def ns_get_io_stats(self, args):
15991607
"""Get namespace IO statistics."""
16001608

1601-
out_func, err_func = self.get_output_functions(args)
1609+
out_func, err_func, _ = self.get_output_functions(args)
16021610
if args.nsid <= 0:
16031611
self.cli.parser.error("nsid value must be positive")
16041612

@@ -1702,7 +1710,7 @@ def ns_get_io_stats(self, args):
17021710
def ns_change_load_balancing_group(self, args):
17031711
"""Change namespace load balancing group."""
17041712

1705-
out_func, err_func = self.get_output_functions(args)
1713+
out_func, err_func, _ = self.get_output_functions(args)
17061714
if args.nsid <= 0:
17071715
self.cli.parser.error("nsid value must be positive")
17081716
if args.load_balancing_group <= 0:
@@ -1747,7 +1755,7 @@ def get_qos_limit_str_value(self, qos_limit):
17471755
def ns_set_qos(self, args):
17481756
"""Set namespace QOS limits."""
17491757

1750-
out_func, err_func = self.get_output_functions(args)
1758+
out_func, err_func, _ = self.get_output_functions(args)
17511759
if args.nsid <= 0:
17521760
self.cli.parser.error("nsid value must be positive")
17531761
if args.rw_ios_per_second == None and args.rw_megabytes_per_second == None and args.r_megabytes_per_second == None and args.w_megabytes_per_second == None:
@@ -1870,7 +1878,7 @@ def namespace(self, args):
18701878
@cli.cmd()
18711879
def get_subsystems(self, args):
18721880
"""Get subsystems"""
1873-
out_func, err_func = self.get_output_functions(args)
1881+
out_func, err_func, _ = self.get_output_functions(args)
18741882

18751883
subsystems = self.stub.get_subsystems(pb2.get_subsystems_req())
18761884
if args.format == "python":

0 commit comments

Comments
 (0)