projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add check for duplicate MACs in instance add
[ganeti-local]
/
qa
/
qa_config.py
diff --git
a/qa/qa_config.py
b/qa/qa_config.py
index
bf176ba
..
4afe253
100644
(file)
--- a/
qa/qa_config.py
+++ b/
qa/qa_config.py
@@
-1,3
+1,6
@@
+#
+#
+
# Copyright (C) 2007 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# Copyright (C) 2007 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
@@
-21,7
+24,7
@@
"""
"""
-import yaml
+import simplejson
import qa_error
import qa_error
@@
-38,7
+41,7
@@
def Load(path):
f = open(path, 'r')
try:
f = open(path, 'r')
try:
- cfg = yaml.load(f.read())
+ cfg = simplejson.load(f)
finally:
f.close()
finally:
f.close()
@@
-50,6
+53,9
@@
def Validate():
raise qa_error.Error("Need at least one node")
if len(cfg['instances']) < 1:
raise qa_error.Error("Need at least one instance")
raise qa_error.Error("Need at least one node")
if len(cfg['instances']) < 1:
raise qa_error.Error("Need at least one instance")
+ if len(cfg["disk"]) != len(cfg["disk-growth"]):
+ raise qa_error.Error("Config options 'disk' and 'disk-growth' must have"
+ " the same number of items")
def get(name, default=None):
def get(name, default=None):
@@
-96,6
+102,8
@@
def AcquireNode(exclude=None):
# TODO: Maybe combine filters
if exclude is None:
nodes = cfg['nodes'][:]
# TODO: Maybe combine filters
if exclude is None:
nodes = cfg['nodes'][:]
+ elif isinstance(exclude, (list, tuple)):
+ nodes = filter(lambda node: node not in exclude, cfg['nodes'])
else:
nodes = filter(lambda node: node != exclude, cfg['nodes'])
else:
nodes = filter(lambda node: node != exclude, cfg['nodes'])