Commit 8a5d326f authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Add 'instance_communication_parameter' to 'Cluster'



* Add parameter 'instance_communication_parameter' to the Python
  'ganeti.objects.Cluster' and the Haskell 'Ganeti.Objects.Cluster'.

* Update Haskell 'QueryClusterInfo' to return also the
  'instance_communication_network' parameter.

* Update Python 'LUClusterQuery' to return also the
  'instance_communication_network' parameter.

* Update Python 'ShowClusterConfig' to include information about the
  'instance_commuication_network' parameter

* Update 'ganeti.objects.Cluster.UpgradeConfig' to ugprade also
  'instance_communication_network' parameter to the empty string, if
  unspecified.

* Update the configuration upgrade tool (i.e., 'tools/cfgupgrade') to
  handle upgrading of the 'instance_communication_network' parameter
  as well as downgrading.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent a987c040
#
#
# Copyright (C) 2006, 2007, 2010, 2011, 2012, 2013 Google Inc.
# Copyright (C) 2006, 2007, 2010, 2011, 2012, 2013, 2014 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -540,6 +540,8 @@ def ShowClusterConfig(opts, args):
utils.CommaJoin(pathutils.ES_SEARCH_PATH)),
("enabled disk templates",
utils.CommaJoin(result["enabled_disk_templates"])),
("instance communication network",
result["instance_communication_network"]),
]),
("Default node parameters",
......
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -417,6 +417,7 @@ class LUClusterQuery(NoHooksLU):
"hidden_os": cluster.hidden_os,
"blacklisted_os": cluster.blacklisted_os,
"enabled_disk_templates": cluster.enabled_disk_templates,
"instance_communication_network": cluster.instance_communication_network,
}
return result
......
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -1596,6 +1596,7 @@ class Cluster(TaggableObject):
"enabled_disk_templates",
"candidate_certs",
"max_running_jobs",
"instance_communication_network",
] + _TIMESTAMPS + _UUID
def UpgradeConfig(self):
......@@ -1730,6 +1731,9 @@ class Cluster(TaggableObject):
if self.max_running_jobs is None:
self.max_running_jobs = constants.LUXID_MAXIMAL_RUNNING_JOBS_DEFAULT
if self.instance_communication_network is None:
self.instance_communication_network = ""
@property
def primary_hypervisor(self):
"""The first hypervisor is the primary.
......
......@@ -9,7 +9,7 @@ commented out below.
{-
Copyright (C) 2011, 2012, 2013 Google Inc.
Copyright (C) 2011, 2012, 2013, 2014 Google Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -714,6 +714,7 @@ $(buildObject "Cluster" "cluster" $
, simpleField "enabled_disk_templates" [t| [DiskTemplate] |]
, simpleField "candidate_certs" [t| CandidateCertificates |]
, simpleField "max_running_jobs" [t| Int |]
, simpleField "instance_communication_network" [t| String |]
]
++ timeStampFields
++ uuidFields
......
......@@ -4,7 +4,7 @@
{-
Copyright (C) 2012, 2013 Google Inc.
Copyright (C) 2012, 2013, 2014 Google Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -166,6 +166,8 @@ handleCall _ _ cdata QueryClusterInfo =
, ("hidden_os", showJSON $ clusterHiddenOs cluster)
, ("blacklisted_os", showJSON $ clusterBlacklistedOs cluster)
, ("enabled_disk_templates", showJSON diskTemplates)
, ("instance_communication_network",
showJSON (clusterInstanceCommunicationNetwork cluster))
]
in case master of
......
......@@ -48,6 +48,7 @@ def GetMinimalConfig():
"default_iallocator_params": {},
"ndparams": {},
"candidate_certs": {},
"instance_communication_network": "",
},
"instances": {},
"networks": {},
......
......@@ -152,6 +152,8 @@ def UpgradeCluster(config_data):
cluster["default_iallocator_params"] = {}
if not "candidate_certs" in cluster:
cluster["candidate_certs"] = {}
cluster["instance_communication_network"] = \
cluster.get("instance_communication_network", "")
def UpgradeGroups(config_data):
......@@ -410,11 +412,15 @@ def DowngradeCluster(config_data):
if "osparams_private_cluster" in cluster:
del cluster["osparams_private_cluster"]
if "instance_communication_network" in cluster:
del cluster["instance_communication_network"]
def DowngradeInstances(config_data):
instances = config_data.get("instances", None)
if instances is None:
raise Error("Cannot find the 'instances' key in the configuration")
for (_, iobj) in instances.items():
if "osparams_private" in iobj:
del iobj["osparams_private"]
......
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