Signed-off-by: Dimitris Aragiorgis <[email protected]> --- Hi,
this patch is a fix on top of the last one. I hope this covers all the
issues you mentioned (sorry for the lint errors).
May I ask why AquireInstance() returns an inst with _template None? This
way I have to manually set the template inside the test (via
qa_config.SetInstanceTemplate). I used qa_config.get("os") to get the
support os. Correct?
Do you want me to sent the whole patch again or you are willing to
squash it?
Thanks a lot,
dimara
qa/qa_network.py | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/qa/qa_network.py b/qa/qa_network.py
index 29dd8dc..0148bbb 100644
--- a/qa/qa_network.py
+++ b/qa/qa_network.py
@@ -27,7 +27,7 @@ import qa_config
import qa_utils
from qa_utils import AssertCommand
-
+from ganeti import constants
TEST_NET_1 = "192.0.2.0/24"
TEST_NET_2 = "198.51.100.0/24"
@@ -50,6 +50,7 @@ IP2_IN_NET_1 = "192.0.2.70"
IP_IN_NET_2 = "198.51.100.82"
IP_IN_NET_3 = "203.0.113.118"
+
def GetNicParams():
default_mode = "bridged"
default_link = "br0"
@@ -89,13 +90,20 @@ def RemoveInstance(instance):
qa_config.ReleaseInstance(instance)
+def GetInstance():
+ inst = qa_config.AcquireInstance()
+ qa_config.SetInstanceTemplate(inst, constants.DT_PLAIN)
+ return inst
+
+
def LaunchInstance(instance, mac=None, ip=None, network=None,
mode=None, link=None, fail=False):
name = instance["name"]
+ templ = qa_config.GetInstanceTemplate(instance)
net = GetNetOption(0, None, mac, ip, network, mode, link)
- AssertCommand(["gnt-instance", "add", "-o", "debootstrap+default",
- "-t", "file", "--disk", "0:size=1G", "--net", net,
+ AssertCommand(["gnt-instance", "add", "-o", qa_config.get("os"),
+ "-t", templ, "--disk", "0:size=1G", "--net", net,
"--no-name-check", "--no-ip-check", "--no-install", name],
fail=fail)
@@ -219,7 +227,7 @@ def TestNetworkConnect():
# Network still connected
AssertCommand(["gnt-network", "remove", network1], fail=True)
- instance1 = qa_config.AcquireInstance()
+ instance1 = GetInstance()
# Add instance inside the network
LaunchInstance(instance1, ip="pool", network=network1)
# Conflicting IP, at least one instance belongs to the network
@@ -230,7 +238,7 @@ def TestNetworkConnect():
# This should only produce a warning.
AssertCommand(["gnt-network", "disconnect", network1])
- instance1 = qa_config.AcquireInstance()
+ instance1 = GetInstance()
# TODO: add conflicting image.
LaunchInstance(instance1, ip=IP_IN_NET_2)
# Conflicting IPs
@@ -262,7 +270,6 @@ def TestInstanceAddAndNetAdd():
AssertCommand(["gnt-network", "add", "--network", TEST_NET_2, network2])
AssertCommand(["gnt-network", "connect", network2, "routed", "rt5000"])
-
# (mac, ip, network, mode, link)
success_cases = [
(None, None, None, None, None), # random mac and default nicparams
@@ -271,11 +278,11 @@ def TestInstanceAddAndNetAdd():
# TODO: include this use case with --no-conflicts-check
# just add an extra field in Launch|ModifyInstance
#(None, "192.168.1.6", None, None, None), # IP but no net
- (None, None, network1, None, None) # nicparams/mac inherited by network
+ (None, None, network1, None, None), # nicparams/mac inherited by network
]
for (mac, ip, network, mode, link) in success_cases:
- instance1 = qa_config.AcquireInstance()
+ instance1 = GetInstance()
LaunchInstance(instance1, mac, ip, network, mode, link)
ModifyInstance(instance1, idx=-1, action="add", mac=mac,
ip=ip, network=network, mode=mode, link=link)
@@ -289,11 +296,11 @@ def TestInstanceAddAndNetAdd():
(None, IP_IN_NET_2, None, None, None), # conflicting IP
(None, None, None, "routed", None), # routed with no IP
(None, "pool", network1, "routed", None), # nicparams along with network
- (None, "pool", network1, None, deflink)
+ (None, "pool", network1, None, deflink),
]
- instance1 = qa_config.AcquireInstance()
- instance2 = qa_config.AcquireInstance()
+ instance1 = GetInstance()
+ instance2 = GetInstance()
LaunchInstance(instance2)
for (mac, ip, network, mode, link) in fail_cases:
LaunchInstance(instance1, mac=mac, ip=ip, network=network,
@@ -329,10 +336,10 @@ def TestInstanceNetMod():
(None, IP2_IN_NET_1, network1, None, None), # IP inside network
#TODO: include this use case with --no-conflickts-check
#(None, IP2_IN_NET_1, None, None, None), # IP but no net
- (None, None, network1, None, None) # nicparams/mac inherited by network
+ (None, None, network1, None, None), # nicparams/mac inherited by network
]
- instance1 = qa_config.AcquireInstance()
+ instance1 = GetInstance()
LaunchInstance(instance1)
for (mac, ip, network, mode, link) in success_cases:
ModifyInstance(instance1, idx=0, action="modify", mac=mac,
--
1.7.10.4
signature.asc
Description: Digital signature
