Revision f346a7d9
b/qa/qa-sample.json | ||
---|---|---|
45 | 45 |
|
46 | 46 |
"instances": [ |
47 | 47 |
{ |
48 |
"name": "xen-test-inst1" |
|
48 |
"name": "xen-test-inst1", |
|
49 |
|
|
50 |
"# Static MAC address": null, |
|
51 |
"#nic.mac/0": "AA:00:00:11:11:11" |
|
49 | 52 |
}, |
50 | 53 |
{ |
51 |
"name": "xen-test-inst2" |
|
54 |
"name": "xen-test-inst2", |
|
55 |
|
|
56 |
"# Static MAC address": null, |
|
57 |
"#nic.mac/0": "AA:00:00:22:22:22" |
|
52 | 58 |
} |
53 | 59 |
], |
54 | 60 |
|
b/qa/qa_config.py | ||
---|---|---|
1 | 1 |
# |
2 | 2 |
# |
3 | 3 |
|
4 |
# Copyright (C) 2007, 2011 Google Inc. |
|
4 |
# Copyright (C) 2007, 2011, 2012 Google Inc.
|
|
5 | 5 |
# |
6 | 6 |
# This program is free software; you can redistribute it and/or modify |
7 | 7 |
# it under the terms of the GNU General Public License as published by |
... | ... | |
154 | 154 |
return cfg.get(_INSTANCE_CHECK_KEY, None) |
155 | 155 |
|
156 | 156 |
|
157 |
def GetInstanceNicMac(inst, default=None): |
|
158 |
"""Returns MAC address for instance's network interface. |
|
159 |
|
|
160 |
""" |
|
161 |
return inst.get("nic.mac/0", default) |
|
162 |
|
|
163 |
|
|
157 | 164 |
def GetMasterNode(): |
158 | 165 |
return cfg["nodes"][0] |
159 | 166 |
|
b/qa/qa_instance.py | ||
---|---|---|
42 | 42 |
return "/sys/block/%s/device/state" % disk |
43 | 43 |
|
44 | 44 |
|
45 |
def _GetGenericAddParameters(): |
|
45 |
def _GetGenericAddParameters(inst):
|
|
46 | 46 |
params = ["-B"] |
47 | 47 |
params.append("%s=%s,%s=%s" % (constants.BE_MINMEM, |
48 | 48 |
qa_config.get(constants.BE_MINMEM), |
... | ... | |
50 | 50 |
qa_config.get(constants.BE_MAXMEM))) |
51 | 51 |
for idx, size in enumerate(qa_config.get("disk")): |
52 | 52 |
params.extend(["--disk", "%s:size=%s" % (idx, size)]) |
53 |
|
|
54 |
# Set static MAC address if configured |
|
55 |
nic0_mac = qa_config.GetInstanceNicMac(inst) |
|
56 |
if nic0_mac: |
|
57 |
params.extend(["--net", "0:mac=%s" % nic0_mac]) |
|
58 |
|
|
53 | 59 |
return params |
54 | 60 |
|
55 | 61 |
|
... | ... | |
60 | 66 |
"--os-type=%s" % qa_config.get("os"), |
61 | 67 |
"--disk-template=%s" % disk_template, |
62 | 68 |
"--node=%s" % node] + |
63 |
_GetGenericAddParameters()) |
|
69 |
_GetGenericAddParameters(instance))
|
|
64 | 70 |
cmd.append(instance["name"]) |
65 | 71 |
|
66 | 72 |
AssertCommand(cmd) |
... | ... | |
412 | 418 |
cmd = (["gnt-backup", "import", |
413 | 419 |
"--disk-template=plain", |
414 | 420 |
"--no-ip-check", |
415 |
"--net", "0:mac=generate", |
|
416 | 421 |
"--src-node=%s" % expnode["primary"], |
417 | 422 |
"--src-dir=%s/%s" % (constants.EXPORT_DIR, name), |
418 | 423 |
"--node=%s" % node["primary"]] + |
419 |
_GetGenericAddParameters()) |
|
424 |
_GetGenericAddParameters(newinst))
|
|
420 | 425 |
cmd.append(newinst["name"]) |
421 | 426 |
AssertCommand(cmd) |
422 | 427 |
|
b/qa/qa_rapi.py | ||
---|---|---|
553 | 553 |
try: |
554 | 554 |
disk_sizes = [utils.ParseUnit(size) for size in qa_config.get("disk")] |
555 | 555 |
disks = [{"size": size} for size in disk_sizes] |
556 |
nics = [{}] |
|
556 |
nic0_mac = qa_config.GetInstanceNicMac(instance, |
|
557 |
default=constants.VALUE_GENERATE) |
|
558 |
nics = [{ |
|
559 |
constants.INIC_MAC: nic0_mac, |
|
560 |
}] |
|
557 | 561 |
|
558 | 562 |
beparams = { |
559 | 563 |
constants.BE_MAXMEM: utils.ParseUnit(qa_config.get(constants.BE_MAXMEM)), |
Also available in: Unified diff