Revision 0ad1ea40 test/ganeti.cmdlib_unittest.py
b/test/ganeti.cmdlib_unittest.py | ||
---|---|---|
40 | 40 |
from ganeti import objects |
41 | 41 |
from ganeti import compat |
42 | 42 |
from ganeti import rpc |
43 |
from ganeti.hypervisor import hv_xen |
|
43 | 44 |
|
44 | 45 |
import testutils |
45 | 46 |
import mocks |
... | ... | |
289 | 290 |
errors = [] |
290 | 291 |
master_name = "master.example.com" |
291 | 292 |
nodeinfo = [ |
292 |
objects.Node(name=master_name, offline=False), |
|
293 |
objects.Node(name="node2.example.com", offline=False), |
|
294 |
objects.Node(name="node3.example.com", master_candidate=True), |
|
295 |
objects.Node(name="node4.example.com", offline=False), |
|
296 |
objects.Node(name="nodata.example.com"), |
|
293 |
objects.Node(name=master_name, offline=False, vm_capable=True), |
|
294 |
objects.Node(name="node2.example.com", offline=False, vm_capable=True), |
|
295 |
objects.Node(name="node3.example.com", master_candidate=True, |
|
296 |
vm_capable=False), |
|
297 |
objects.Node(name="node4.example.com", offline=False, vm_capable=True), |
|
298 |
objects.Node(name="nodata.example.com", offline=False, vm_capable=True), |
|
297 | 299 |
objects.Node(name="offline.example.com", offline=True), |
298 | 300 |
] |
299 | 301 |
cluster = objects.Cluster(modify_etc_hosts=True, |
... | ... | |
301 | 303 |
files_all = set([ |
302 | 304 |
constants.CLUSTER_DOMAIN_SECRET_FILE, |
303 | 305 |
constants.RAPI_CERT_FILE, |
306 |
constants.RAPI_USERS_FILE, |
|
304 | 307 |
]) |
305 |
files_all_opt = set([
|
|
308 |
files_opt = set([ |
|
306 | 309 |
constants.RAPI_USERS_FILE, |
310 |
hv_xen.XL_CONFIG_FILE, |
|
311 |
constants.VNC_PASSWORD_FILE, |
|
307 | 312 |
]) |
308 | 313 |
files_mc = set([ |
309 | 314 |
constants.CLUSTER_CONF_FILE, |
310 | 315 |
]) |
311 |
files_vm = set() |
|
316 |
files_vm = set([ |
|
317 |
hv_xen.XEND_CONFIG_FILE, |
|
318 |
hv_xen.XL_CONFIG_FILE, |
|
319 |
constants.VNC_PASSWORD_FILE, |
|
320 |
]) |
|
312 | 321 |
nvinfo = { |
313 | 322 |
master_name: rpc.RpcResult(data=(True, { |
314 | 323 |
constants.NV_FILELIST: { |
315 | 324 |
constants.CLUSTER_CONF_FILE: "82314f897f38b35f9dab2f7c6b1593e0", |
316 | 325 |
constants.RAPI_CERT_FILE: "babbce8f387bc082228e544a2146fee4", |
317 | 326 |
constants.CLUSTER_DOMAIN_SECRET_FILE: "cds-47b5b3f19202936bb4", |
327 |
hv_xen.XEND_CONFIG_FILE: "b4a8a824ab3cac3d88839a9adeadf310", |
|
328 |
hv_xen.XL_CONFIG_FILE: "77935cee92afd26d162f9e525e3d49b9" |
|
318 | 329 |
}})), |
319 | 330 |
"node2.example.com": rpc.RpcResult(data=(True, { |
320 | 331 |
constants.NV_FILELIST: { |
321 | 332 |
constants.RAPI_CERT_FILE: "97f0356500e866387f4b84233848cc4a", |
333 |
hv_xen.XEND_CONFIG_FILE: "b4a8a824ab3cac3d88839a9adeadf310", |
|
322 | 334 |
} |
323 | 335 |
})), |
324 | 336 |
"node3.example.com": rpc.RpcResult(data=(True, { |
... | ... | |
333 | 345 |
constants.CLUSTER_CONF_FILE: "conf-a6d4b13e407867f7a7b4f0f232a8f527", |
334 | 346 |
constants.CLUSTER_DOMAIN_SECRET_FILE: "cds-47b5b3f19202936bb4", |
335 | 347 |
constants.RAPI_USERS_FILE: "rapiusers-ea3271e8d810ef3", |
348 |
hv_xen.XL_CONFIG_FILE: "77935cee92afd26d162f9e525e3d49b9" |
|
336 | 349 |
} |
337 | 350 |
})), |
338 | 351 |
"nodata.example.com": rpc.RpcResult(data=(True, {})), |
... | ... | |
342 | 355 |
|
343 | 356 |
self._VerifyFiles(compat.partial(self._FakeErrorIf, errors), nodeinfo, |
344 | 357 |
master_name, nvinfo, |
345 |
(files_all, files_all_opt, files_mc, files_vm))
|
|
358 |
(files_all, files_opt, files_mc, files_vm)) |
|
346 | 359 |
self.assertEqual(sorted(errors), sorted([ |
347 | 360 |
(None, ("File %s found with 2 different checksums (variant 1 on" |
348 | 361 |
" node2.example.com, node3.example.com, node4.example.com;" |
... | ... | |
351 | 364 |
constants.CLUSTER_DOMAIN_SECRET_FILE)), |
352 | 365 |
(None, ("File %s should not exist on node(s) node4.example.com" % |
353 | 366 |
constants.CLUSTER_CONF_FILE)), |
367 |
(None, ("File %s is missing from node(s) node4.example.com" % |
|
368 |
hv_xen.XEND_CONFIG_FILE)), |
|
354 | 369 |
(None, ("File %s is missing from node(s) node3.example.com" % |
355 | 370 |
constants.CLUSTER_CONF_FILE)), |
356 | 371 |
(None, ("File %s found with 2 different checksums (variant 1 on" |
... | ... | |
359 | 374 |
(None, ("File %s is optional, but it must exist on all or no nodes (not" |
360 | 375 |
" found on master.example.com, node2.example.com," |
361 | 376 |
" node3.example.com)" % constants.RAPI_USERS_FILE)), |
377 |
(None, ("File %s is optional, but it must exist on all or no nodes (not" |
|
378 |
" found on node2.example.com)" % hv_xen.XL_CONFIG_FILE)), |
|
362 | 379 |
("nodata.example.com", "Node did not return file checksum data"), |
363 | 380 |
])) |
364 | 381 |
|
Also available in: Unified diff