Commit 30fa4476 authored by Guido Trotter's avatar Guido Trotter

Merge branch 'stable-2.6' into devel-2.6

* stable-2.6:
  Add utility to format dictionary as key=value strings
  Remove fixed FIXME
  QA: Support master-netdev and default NIC parameters
  QA: Do not pass "--bridge" to "gnt-cluster init"
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parents 478a3308 63b883de
......@@ -538,9 +538,6 @@ class XenHypervisor(hv_base.BaseHypervisor):
raise errors.HypervisorError("Remote host %s not listening on port"
" %s, cannot migrate" % (target, port))
# FIXME: migrate must be upgraded for transitioning to "xl" (xen 4.1).
# This should be reworked in Ganeti 2.7
# ssh must recognize the key of the target host for the migration
args = [constants.XEN_CMD, "migrate"]
if constants.XEN_CMD == constants.XEN_CMD_XM:
args.extend(["-p", "%d" % port])
......@@ -588,3 +588,15 @@ def Truncate(text, length):
return text
return text[:length - len(_ASCII_ELLIPSIS)] + _ASCII_ELLIPSIS
def FormatKeyValue(data):
"""Formats a dictionary as "key=value" parameters.
The keys are sorted to have a stable order.
@type data: dict
@rtype: list of string
return ["%s=%s" % (key, value) for (key, value) in sorted(data.items())]
"# Note:": null,
"# This file is stored in the JSON format and does not support": null,
"# comments. As a work-around, comments are keys starting with a hash": null,
"# sign (#).": null,
"name": "xen-test",
"rename": "xen-test-rename",
"enabled-hypervisors": "xen-pvm",
......@@ -12,6 +17,15 @@
"os-hvp": {},
"primary_ip_version": 4,
"# Network interface for master role": null,
"#master-netdev": "xen-br0",
"# Default network interface parameters": null,
"#default-nicparams": {
"mode": "bridged",
"link": "xen-br0",
"os": "debian-etch",
"maxmem": "1024M",
"minmem": "512M",
......@@ -104,17 +104,21 @@ def TestClusterInit(rapi_user, rapi_secret):
for spec_val in ("min", "max", "std"):
spec = qa_config.get("ispec_%s_%s" %
(spec_type.replace('-', '_'), spec_val), None)
(spec_type.replace("-", "_"), spec_val), None)
if spec:
cmd.append("--specs-%s=%s=%d" % (spec_type, spec_val, spec))
if master.get("secondary", None):
cmd.append("--secondary-ip=%s" % master["secondary"])
bridge = qa_config.get("bridge", None)
if bridge:
cmd.append("--bridge=%s" % bridge)
cmd.append("--master-netdev=%s" % bridge)
master_netdev = qa_config.get("master-netdev", None)
if master_netdev:
cmd.append("--master-netdev=%s" % master_netdev)
nicparams = qa_config.get("default-nicparams", None)
if nicparams:
cmd.append("--nic-parameters=%s" %
......@@ -576,5 +576,16 @@ class TestTruncate(unittest.TestCase):
self.assertRaises(AssertionError, utils.Truncate, "", i)
class TestFormatKeyValue(unittest.TestCase):
def test(self):
self.assertEqual(utils.FormatKeyValue({}), [])
self.assertEqual(utils.FormatKeyValue({1: 2}), ["1=2"])
"zzz": "0",
"aaa": "1",
["aaa=1", "zzz=0"])
if __name__ == "__main__":
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