projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
KVM: replace hardcoded network script path
[ganeti-local]
/
qa
/
qa_tags.py
diff --git
a/qa/qa_tags.py
b/qa/qa_tags.py
index
6f1cb29
..
ae19f2e
100644
(file)
--- a/
qa/qa_tags.py
+++ b/
qa/qa_tags.py
@@
-21,9
+21,11
@@
"""
from ganeti import utils
"""
from ganeti import utils
+from ganeti import constants
import qa_config
import qa_utils
import qa_config
import qa_utils
+import qa_rapi
from qa_utils import AssertEqual, StartSSH
from qa_utils import AssertEqual, StartSSH
@@
-31,13
+33,27
@@
from qa_utils import AssertEqual, StartSSH
_TEMP_TAG_NAMES = ["TEMP-Ganeti-QA-Tag%d" % i for i in range(3)]
_TEMP_TAG_RE = r'^TEMP-Ganeti-QA-Tag\d+$'
_TEMP_TAG_NAMES = ["TEMP-Ganeti-QA-Tag%d" % i for i in range(3)]
_TEMP_TAG_RE = r'^TEMP-Ganeti-QA-Tag\d+$'
+_KIND_TO_COMMAND = {
+ constants.TAG_CLUSTER: "gnt-cluster",
+ constants.TAG_NODE: "gnt-node",
+ constants.TAG_INSTANCE: "gnt-instance",
+ }
-def _TestTags(cmdfn):
+
+def _TestTags(kind, name):
"""Generic function for add-tags.
"""
master = qa_config.GetMasterNode()
"""Generic function for add-tags.
"""
master = qa_config.GetMasterNode()
+ def cmdfn(subcmd):
+ cmd = [_KIND_TO_COMMAND[kind], subcmd]
+
+ if kind != constants.TAG_CLUSTER:
+ cmd.append(name)
+
+ return cmd
+
cmd = cmdfn('add-tags') + _TEMP_TAG_NAMES
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
cmd = cmdfn('add-tags') + _TEMP_TAG_NAMES
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
@@
-50,6
+66,9
@@
def _TestTags(cmdfn):
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
+ if qa_rapi.Enabled():
+ qa_rapi.TestTags(kind, name, _TEMP_TAG_NAMES)
+
cmd = cmdfn('remove-tags') + _TEMP_TAG_NAMES
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
cmd = cmdfn('remove-tags') + _TEMP_TAG_NAMES
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
@@
-57,14
+76,14
@@
def _TestTags(cmdfn):
def TestClusterTags():
"""gnt-cluster tags"""
def TestClusterTags():
"""gnt-cluster tags"""
- _TestTags(lambda subcmd: ['gnt-cluster', subcmd])
+ _TestTags(constants.TAG_CLUSTER, "")
def TestNodeTags(node):
"""gnt-node tags"""
def TestNodeTags(node):
"""gnt-node tags"""
- _TestTags(lambda subcmd: ['gnt-node', subcmd, node['primary']])
+ _TestTags(constants.TAG_NODE, node["primary"])
def TestInstanceTags(instance):
"""gnt-instance tags"""
def TestInstanceTags(instance):
"""gnt-instance tags"""
- _TestTags(lambda subcmd: ['gnt-instance', subcmd, instance['name']])
+ _TestTags(constants.TAG_INSTANCE, instance["name"])