1336 |
1336 |
AssertCommand(["lvremove", "-f", "/".join([vgname, lvname1])], node=node_name)
|
1337 |
1337 |
AssertCommand(["lvremove", "-f", "/".join([vgname, lvname2])], node=node_name)
|
1338 |
1338 |
AssertClusterVerify()
|
|
1339 |
|
|
1340 |
|
|
1341 |
def TestInstanceCommunication():
|
|
1342 |
"""Tests instance communication"""
|
|
1343 |
master = qa_config.GetMasterNode()
|
|
1344 |
|
|
1345 |
# Check that the 'default' node group exists
|
|
1346 |
cmd = ["gnt-group", "list", "--no-headers", "-o", "name"]
|
|
1347 |
result_output = GetCommandOutput(master.primary, utils.ShellQuoteArgs(cmd))
|
|
1348 |
AssertEqual(result_output.strip(), "default", msg="Checking 'default' group")
|
|
1349 |
|
|
1350 |
# Check that no networks exist
|
|
1351 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "name"]
|
|
1352 |
result_output = GetCommandOutput(master.primary, utils.ShellQuoteArgs(cmd))
|
|
1353 |
AssertEqual(result_output.strip(), "", msg="Checking networks")
|
|
1354 |
|
|
1355 |
# Modify cluster parameter 'instance-communication-network' and
|
|
1356 |
# check whether the cluster creates the instance communication
|
|
1357 |
# network and connects it to the 'default' node group
|
|
1358 |
network_name = "mynetwork"
|
|
1359 |
|
|
1360 |
cmd = "gnt-cluster modify --instance-communication-network=%s" % network_name
|
|
1361 |
result_output = qa_utils.GetCommandOutput(master.primary, cmd)
|
|
1362 |
print result_output
|
|
1363 |
|
|
1364 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "name", network_name]
|
|
1365 |
result_output = qa_utils.GetCommandOutput(master.primary,
|
|
1366 |
utils.ShellQuoteArgs(cmd))
|
|
1367 |
AssertEqual(result_output.strip(), "mynetwork", msg="Checking 'mynetwork'")
|
|
1368 |
|
|
1369 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "group_list",
|
|
1370 |
network_name]
|
|
1371 |
result_output = qa_utils.GetCommandOutput(master.primary,
|
|
1372 |
utils.ShellQuoteArgs(cmd))
|
|
1373 |
AssertEqual(result_output.strip(), "default (routed, communication_rt)",
|
|
1374 |
msg="Checking network connected groups")
|
|
1375 |
|
|
1376 |
# Check that the network has the parameters necessary for instance
|
|
1377 |
# communication
|
|
1378 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "gateway",
|
|
1379 |
network_name]
|
|
1380 |
result_output = qa_utils.GetCommandOutput(master.primary,
|
|
1381 |
utils.ShellQuoteArgs(cmd))
|
|
1382 |
AssertEqual(result_output.strip(), "-", msg="Checking gateway")
|
|
1383 |
|
|
1384 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "gateway6",
|
|
1385 |
network_name]
|
|
1386 |
result_output = qa_utils.GetCommandOutput(master.primary,
|
|
1387 |
utils.ShellQuoteArgs(cmd))
|
|
1388 |
AssertEqual(result_output.strip(), "-", msg="Checking gateway6")
|
|
1389 |
|
|
1390 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "network",
|
|
1391 |
network_name]
|
|
1392 |
result_output = qa_utils.GetCommandOutput(master.primary,
|
|
1393 |
utils.ShellQuoteArgs(cmd))
|
|
1394 |
AssertEqual(result_output.strip(), constants.INSTANCE_COMMUNICATION_NETWORK4,
|
|
1395 |
msg="Checking network")
|
|
1396 |
|
|
1397 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "network6",
|
|
1398 |
network_name]
|
|
1399 |
result_output = qa_utils.GetCommandOutput(master.primary,
|
|
1400 |
utils.ShellQuoteArgs(cmd))
|
|
1401 |
AssertEqual(result_output.strip(), constants.INSTANCE_COMMUNICATION_NETWORK6,
|
|
1402 |
msg="Checking network6")
|
|
1403 |
|
|
1404 |
# Add a new group and check whether the instance communication
|
|
1405 |
# network connects to this new group
|
|
1406 |
#
|
|
1407 |
# We don't assume any particular group order and allow the output of
|
|
1408 |
# 'gnt-network list' to print the 'default' and 'mygroup' groups in
|
|
1409 |
# any order.
|
|
1410 |
group = "mygroup"
|
|
1411 |
|
|
1412 |
AssertCommand(["gnt-group", "add", group])
|
|
1413 |
|
|
1414 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "group_list",
|
|
1415 |
network_name]
|
|
1416 |
result_output = qa_utils.GetCommandOutput(master.primary,
|
|
1417 |
utils.ShellQuoteArgs(cmd))
|
|
1418 |
|
|
1419 |
try:
|
|
1420 |
r1 = "mygroup (routed, communication_rt)," \
|
|
1421 |
" default (routed, communication_rt)"
|
|
1422 |
AssertEqual(result_output.strip(), r1,
|
|
1423 |
msg="Checking network connected groups")
|
|
1424 |
except qa_error.Error:
|
|
1425 |
r2 = "default (routed, communication_rt)," \
|
|
1426 |
" mygroup (routed, communication_rt)"
|
|
1427 |
AssertEqual(result_output.strip(), r2,
|
|
1428 |
msg="Checking network connected groups")
|
|
1429 |
|
|
1430 |
# Modify cluster parameter 'instance-communication-network' to the
|
|
1431 |
# same value and check that nothing happens.
|
|
1432 |
cmd = "gnt-cluster modify --instance-communication-network=%s" % network_name
|
|
1433 |
result_output = qa_utils.GetCommandOutput(master.primary, cmd)
|
|
1434 |
print result_output
|
|
1435 |
|
|
1436 |
# Disable instance communication network, disconnect the instance
|
|
1437 |
# communication network and remove it, and remove the group
|
|
1438 |
cmd = "gnt-cluster modify --instance-communication-network="
|
|
1439 |
result_output = qa_utils.GetCommandOutput(master.primary, cmd)
|
|
1440 |
print result_output
|
|
1441 |
|
|
1442 |
cmd = ["gnt-network", "disconnect", network_name]
|
|
1443 |
AssertCommand(utils.ShellQuoteArgs(cmd))
|
|
1444 |
|
|
1445 |
cmd = ["gnt-network", "remove", network_name]
|
|
1446 |
AssertCommand(utils.ShellQuoteArgs(cmd))
|
|
1447 |
|
|
1448 |
cmd = ["gnt-group", "remove", group]
|
|
1449 |
AssertCommand(utils.ShellQuoteArgs(cmd))
|
|
1450 |
|
|
1451 |
# Check that the 'default' node group exists
|
|
1452 |
cmd = ["gnt-group", "list", "--no-headers", "-o", "name"]
|
|
1453 |
result_output = GetCommandOutput(master.primary, utils.ShellQuoteArgs(cmd))
|
|
1454 |
AssertEqual(result_output.strip(), "default", msg="Checking 'default' group")
|
|
1455 |
|
|
1456 |
# Check that no networks exist
|
|
1457 |
cmd = ["gnt-network", "list", "--no-headers", "-o", "name"]
|
|
1458 |
result_output = GetCommandOutput(master.primary, utils.ShellQuoteArgs(cmd))
|
|
1459 |
AssertEqual(result_output.strip(), "", msg="Checking networks")
|