Revision 6a343475
b/qa/qa_instance.py | ||
---|---|---|
33 | 33 |
import qa_utils |
34 | 34 |
import qa_error |
35 | 35 |
|
36 |
from qa_utils import AssertEqual, AssertNotEqual, StartSSH |
|
36 |
from qa_utils import AssertEqual, AssertNotEqual, AssertIn, StartSSH
|
|
37 | 37 |
|
38 | 38 |
|
39 | 39 |
def _GetDiskStatePath(disk): |
... | ... | |
61 | 61 |
|
62 | 62 |
AssertEqual(StartSSH(master['primary'], |
63 | 63 |
utils.ShellQuoteArgs(cmd)).wait(), 0) |
64 |
|
|
65 |
_CheckSsconfInstanceList(instance["name"]) |
|
66 |
|
|
64 | 67 |
return instance |
65 | 68 |
except: |
66 | 69 |
qa_config.ReleaseInstance(instance) |
... | ... | |
129 | 132 |
utils.ShellQuoteArgs(cmd)).wait(), 0) |
130 | 133 |
|
131 | 134 |
|
135 |
def _ReadSsconfInstanceList(): |
|
136 |
"""Reads ssconf_instance_list from the master node. |
|
137 |
|
|
138 |
""" |
|
139 |
master = qa_config.GetMasterNode() |
|
140 |
|
|
141 |
cmd = ["cat", utils.PathJoin(constants.DATA_DIR, |
|
142 |
"ssconf_%s" % constants.SS_INSTANCE_LIST)] |
|
143 |
|
|
144 |
return qa_utils.GetCommandOutput(master["primary"], |
|
145 |
utils.ShellQuoteArgs(cmd)).splitlines() |
|
146 |
|
|
147 |
|
|
148 |
def _CheckSsconfInstanceList(instance): |
|
149 |
"""Checks if a certain instance is in the ssconf instance list. |
|
150 |
|
|
151 |
@type instance: string |
|
152 |
@param instance: Instance name |
|
153 |
|
|
154 |
""" |
|
155 |
AssertIn(qa_utils.ResolveInstanceName(instance), |
|
156 |
_ReadSsconfInstanceList()) |
|
157 |
|
|
158 |
|
|
132 | 159 |
def TestInstanceRename(instance, rename_target): |
133 | 160 |
"""gnt-instance rename""" |
134 | 161 |
master = qa_config.GetMasterNode() |
... | ... | |
137 | 164 |
|
138 | 165 |
for name1, name2 in [(rename_source, rename_target), |
139 | 166 |
(rename_target, rename_source)]: |
167 |
_CheckSsconfInstanceList(name1) |
|
140 | 168 |
cmd = ['gnt-instance', 'rename', name1, name2] |
141 | 169 |
AssertEqual(StartSSH(master['primary'], |
142 | 170 |
utils.ShellQuoteArgs(cmd)).wait(), 0) |
171 |
_CheckSsconfInstanceList(name2) |
|
143 | 172 |
|
144 | 173 |
|
145 | 174 |
def TestInstanceFailover(instance): |
Also available in: Unified diff