|
24 | 24 | image12 = "mytestdevimage12"
|
25 | 25 | image13 = "mytestdevimage13"
|
26 | 26 | image14 = "mytestdevimage14"
|
| 27 | +image15 = "mytestdevimage15" |
| 28 | +image16 = "mytestdevimage16" |
| 29 | +image17 = "mytestdevimage17" |
| 30 | +image18 = "mytestdevimage18" |
27 | 31 | pool = "rbd"
|
28 | 32 | subsystem = "nqn.2016-06.io.spdk:cnode1"
|
29 | 33 | subsystem2 = "nqn.2016-06.io.spdk:cnode2"
|
|
33 | 37 | subsystem6 = "nqn.2016-06.io.spdk:cnode6"
|
34 | 38 | subsystem7 = "nqn.2016-06.io.spdk:cnode7"
|
35 | 39 | subsystem8 = "nqn.2016-06.io.spdk:cnode8"
|
| 40 | +subsystem9 = "nqn.2016-06.io.spdk:cnode9" |
36 | 41 | subsystemX = "nqn.2016-06.io.spdk:cnodeX"
|
37 | 42 | discovery_nqn = "nqn.2014-08.org.nvmexpress.discovery"
|
38 | 43 | serial = "Ceph00000000000001"
|
@@ -80,7 +85,7 @@ def gateway(config):
|
80 | 85 | config.config["gateway"]["group"] = group_name
|
81 | 86 | config.config["gateway"]["max_namespaces_with_netmask"] = "3"
|
82 | 87 | config.config["gateway"]["max_hosts_per_namespace"] = "3"
|
83 |
| - config.config["gateway"]["max_subsystems"] = "3" |
| 88 | + config.config["gateway"]["max_subsystems"] = "4" |
84 | 89 | config.config["gateway"]["max_namespaces"] = "12"
|
85 | 90 | config.config["gateway"]["max_namespaces_per_subsystem"] = "11"
|
86 | 91 | config.config["gateway"]["max_hosts_per_subsystem"] = "4"
|
@@ -170,7 +175,7 @@ def test_get_gateway_info(self, caplog, gateway):
|
170 | 175 | assert gw_info.spdk_version == spdk_ver
|
171 | 176 | assert gw_info.name == gw.gateway_name
|
172 | 177 | assert gw_info.hostname == gw.host_name
|
173 |
| - assert gw_info.max_subsystems == 3 |
| 178 | + assert gw_info.max_subsystems == 4 |
174 | 179 | assert gw_info.max_namespaces == 12
|
175 | 180 | assert gw_info.max_namespaces_per_subsystem == 11
|
176 | 181 | assert gw_info.max_hosts_per_subsystem == 4
|
@@ -1238,6 +1243,78 @@ def test_create_listener_on_discovery(self, caplog, listener, gateway):
|
1238 | 1243 | cli(["listener", "add", "--host-name", host_name] + listener)
|
1239 | 1244 | assert "Can't create a listener for a discovery subsystem" in caplog.text
|
1240 | 1245 |
|
| 1246 | + def test_list_namespaces_all_subsystems(self, caplog): |
| 1247 | + caplog.clear() |
| 1248 | + cli(["subsystem", "add", "--subsystem", subsystem9, "--no-group-append"]) |
| 1249 | + assert f"Adding subsystem {subsystem9}: Successful" in caplog.text |
| 1250 | + caplog.clear() |
| 1251 | + cli(["namespace", "del", "--subsystem", subsystem, "--nsid", "10"]) |
| 1252 | + assert f"Deleting namespace 10 from {subsystem}: Successful" in caplog.text |
| 1253 | + caplog.clear() |
| 1254 | + cli(["namespace", "del", "--subsystem", subsystem, "--nsid", "11"]) |
| 1255 | + assert f"Deleting namespace 11 from {subsystem}: Successful" in caplog.text |
| 1256 | + caplog.clear() |
| 1257 | + cli(["namespace", "del", "--subsystem", subsystem, "--nsid", "12"]) |
| 1258 | + assert f"Deleting namespace 12 from {subsystem}: Successful" in caplog.text |
| 1259 | + caplog.clear() |
| 1260 | + cli(["namespace", "add", "--subsystem", subsystem9, "--rbd-pool", pool, |
| 1261 | + "--rbd-image", image15, "--size", "16MB", "--rbd-create-image"]) |
| 1262 | + assert f"Adding namespace 1 to {subsystem9}: Successful" in caplog.text |
| 1263 | + caplog.clear() |
| 1264 | + cli(["namespace", "add", "--subsystem", subsystem9, "--rbd-pool", pool, |
| 1265 | + "--rbd-image", image16, "--size", "16MB", "--rbd-create-image"]) |
| 1266 | + assert f"Adding namespace 2 to {subsystem9}: Successful" in caplog.text |
| 1267 | + caplog.clear() |
| 1268 | + cli(["--format", "json", "namespace", "list"]) |
| 1269 | + assert '"subsystem_nqn": "*"' in caplog.text |
| 1270 | + assert f'"subsystem_nqn": "{subsystem}"' in caplog.text |
| 1271 | + assert f'"subsystem_nqn": "{subsystem9}"' in caplog.text |
| 1272 | + assert '"nsid": 1' in caplog.text |
| 1273 | + assert '"nsid": 2' in caplog.text |
| 1274 | + assert '"nsid": 6' in caplog.text |
| 1275 | + caplog.clear() |
| 1276 | + cli(["--format", "json", "namespace", "list", "--nsid", "1"]) |
| 1277 | + assert '"subsystem_nqn": "*"' in caplog.text |
| 1278 | + assert f'"subsystem_nqn": "{subsystem}"' in caplog.text |
| 1279 | + assert f'"subsystem_nqn": "{subsystem9}"' in caplog.text |
| 1280 | + assert '"nsid": 1' in caplog.text |
| 1281 | + assert '"nsid": 2' not in caplog.text |
| 1282 | + caplog.clear() |
| 1283 | + cli(["--format", "json", "namespace", "list", "--nsid", "6"]) |
| 1284 | + assert '"subsystem_nqn": "*"' in caplog.text |
| 1285 | + assert f'"subsystem_nqn": "{subsystem}"' in caplog.text |
| 1286 | + assert f'"subsystem_nqn": "{subsystem9}"' not in caplog.text |
| 1287 | + assert '"nsid": 6' in caplog.text |
| 1288 | + assert '"nsid": 1' not in caplog.text |
| 1289 | + assert '"nsid": 2' not in caplog.text |
| 1290 | + caplog.clear() |
| 1291 | + cli(["--format", "json", "namespace", "list", "--uuid", uuid]) |
| 1292 | + assert '"subsystem_nqn": "*"' in caplog.text |
| 1293 | + assert f'"subsystem_nqn": "{subsystem}"' in caplog.text |
| 1294 | + assert f'"subsystem_nqn": "{subsystem9}"' not in caplog.text |
| 1295 | + assert f'"uuid": "{uuid}"' in caplog.text |
| 1296 | + |
| 1297 | + def test_namespace_count_updated(self, caplog): |
| 1298 | + caplog.clear() |
| 1299 | + cli(["subsystem", "add", "--subsystem", subsystem5, "--no-group-append"]) |
| 1300 | + assert f"Adding subsystem {subsystem5}: Successful" in caplog.text |
| 1301 | + caplog.clear() |
| 1302 | + cli(["namespace", "add", "--subsystem", subsystem5, "--rbd-pool", pool, |
| 1303 | + "--rbd-image", image17, "--size", "16MB", "--rbd-create-image"]) |
| 1304 | + assert f"Adding namespace 1 to {subsystem5}: Successful" in caplog.text |
| 1305 | + caplog.clear() |
| 1306 | + cli(["namespace", "add", "--subsystem", subsystem5, "--rbd-pool", pool, |
| 1307 | + "--rbd-image", image18, "--size", "16MB", "--rbd-create-image"]) |
| 1308 | + assert f"Failure adding namespace to {subsystem5}: Maximal number of namespaces (12) " \ |
| 1309 | + f"has already been reached" in caplog.text |
| 1310 | + caplog.clear() |
| 1311 | + cli(["subsystem", "del", "--subsystem", subsystem9, "--force"]) |
| 1312 | + assert f"Deleting subsystem {subsystem9}: Successful" in caplog.text |
| 1313 | + caplog.clear() |
| 1314 | + cli(["namespace", "add", "--subsystem", subsystem5, "--rbd-pool", pool, |
| 1315 | + "--rbd-image", image18, "--size", "16MB", "--rbd-create-image"]) |
| 1316 | + assert f"Adding namespace 2 to {subsystem5}: Successful" in caplog.text |
| 1317 | + |
1241 | 1318 |
|
1242 | 1319 | class TestDelete:
|
1243 | 1320 | @pytest.mark.parametrize("host", host_list)
|
@@ -1392,6 +1469,9 @@ def test_delete_subsystem(self, caplog, gateway):
|
1392 | 1469 | cli(["subsystem", "del", "--subsystem", subsystem2])
|
1393 | 1470 | assert f"Deleting subsystem {subsystem2}: Successful" in caplog.text
|
1394 | 1471 | caplog.clear()
|
| 1472 | + cli(["subsystem", "del", "--subsystem", subsystem5, "--force"]) |
| 1473 | + assert f"Deleting subsystem {subsystem5}: Successful" in caplog.text |
| 1474 | + caplog.clear() |
1395 | 1475 | cli(["subsystem", "list"])
|
1396 | 1476 | assert "No subsystems" in caplog.text
|
1397 | 1477 |
|
@@ -1493,8 +1573,14 @@ def test_add_too_many_subsystem(self, caplog, gateway):
|
1493 | 1573 | assert f"Adding subsystem {subsystem6}: Successful" in caplog.text
|
1494 | 1574 | caplog.clear()
|
1495 | 1575 | cli(["subsystem", "add", "--subsystem", subsystem7, "--no-group-append"])
|
1496 |
| - assert f"Failure creating subsystem {subsystem7}: Maximal number of subsystems (3) has " \ |
| 1576 | + assert f"Adding subsystem {subsystem7}: Successful" in caplog.text |
| 1577 | + caplog.clear() |
| 1578 | + cli(["subsystem", "add", "--subsystem", subsystem8, "--no-group-append"]) |
| 1579 | + assert f"Failure creating subsystem {subsystem8}: Maximal number of subsystems (4) has " \ |
1497 | 1580 | f"already been reached" in caplog.text
|
| 1581 | + caplog.clear() |
| 1582 | + cli(["subsystem", "del", "--subsystem", subsystem7]) |
| 1583 | + assert f"Deleting subsystem {subsystem7}: Successful" in caplog.text |
1498 | 1584 |
|
1499 | 1585 | def test_too_many_hosts(self, caplog, gateway):
|
1500 | 1586 | caplog.clear()
|
|
0 commit comments