Commit fdbe29ee authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

gnt-debug, opcodes: Use constants for iallocator

Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent 2a9bc156
......@@ -129,8 +129,10 @@ def TestAllocator(opts, args):
disks = [{"size": utils.ParseUnit(val), "mode": 'w'}
for val in opts.disks.split(",")]
disks = [{
constants.IDISK_SIZE: utils.ParseUnit(val),
constants.IDISK_MODE: constants.DISK_RDWR,
} for val in opts.disks.split(",")]
except errors.UnitParseError, err:
ToStderr("Invalid disks parameter '%s': %s", opts.disks, err)
return 1
......@@ -142,7 +144,12 @@ def TestAllocator(opts, args):
for i in range(3):
if row[i] == '':
row[i] = None
nic_dict = [{"mac": v[0], "ip": v[1], "bridge": v[2]} for v in nics]
nic_dict = [{
constants.INIC_MAC: v[0],
constants.INIC_IP: v[1],
# The iallocator interface defines a "bridge" item
"bridge": v[2],
} for v in nics]
if opts.tags is None:
opts.tags = []
......@@ -1418,7 +1418,7 @@ class OpTestAllocator(OpCode):
("mode", ht.NoDefault, ht.TElemOf(constants.VALID_IALLOCATOR_MODES), None),
("name", ht.NoDefault, ht.TNonEmptyString, None),
("nics", ht.NoDefault, ht.TOr(ht.TNone, ht.TListOf(
ht.TDictOf(ht.TElemOf(["mac", "ip", "bridge"]),
ht.TDictOf(ht.TElemOf([constants.INIC_MAC, constants.INIC_IP, "bridge"]),
ht.TOr(ht.TNone, ht.TNonEmptyString)))), None),
("disks", ht.NoDefault, ht.TOr(ht.TNone, ht.TList), None),
("hypervisor", None, ht.TMaybeString, None),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment