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

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
......@@ -670,50 +670,51 @@ type CandidateCertificates = Container String
-- * Cluster definitions
$(buildObject "Cluster" "cluster" $
[ simpleField "rsahostkeypub" [t| String |]
[ simpleField "rsahostkeypub" [t| String |]
, optionalField $
simpleField "dsahostkeypub" [t| String |]
, simpleField "highest_used_port" [t| Int |]
, simpleField "tcpudp_port_pool" [t| [Int] |]
, simpleField "mac_prefix" [t| String |]
simpleField "dsahostkeypub" [t| String |]
, simpleField "highest_used_port" [t| Int |]
, simpleField "tcpudp_port_pool" [t| [Int] |]
, simpleField "mac_prefix" [t| String |]
, optionalField $
simpleField "volume_group_name" [t| String |]
, simpleField "reserved_lvs" [t| [String] |]
simpleField "volume_group_name" [t| String |]
, simpleField "reserved_lvs" [t| [String] |]
, optionalField $
simpleField "drbd_usermode_helper" [t| String |]
, simpleField "master_node" [t| String |]
, simpleField "master_ip" [t| String |]
, simpleField "master_netdev" [t| String |]
, simpleField "master_netmask" [t| Int |]
, simpleField "use_external_mip_script" [t| Bool |]
, simpleField "cluster_name" [t| String |]
, simpleField "file_storage_dir" [t| String |]
, simpleField "shared_file_storage_dir" [t| String |]
, simpleField "gluster_storage_dir" [t| String |]
, simpleField "enabled_hypervisors" [t| [Hypervisor] |]
, simpleField "hvparams" [t| ClusterHvParams |]
, simpleField "os_hvp" [t| OsHvParams |]
, simpleField "beparams" [t| ClusterBeParams |]
, simpleField "osparams" [t| ClusterOsParams |]
, simpleField "osparams_private_cluster" [t| ClusterOsParamsPrivate |]
, simpleField "nicparams" [t| ClusterNicParams |]
, simpleField "ndparams" [t| FilledNDParams |]
, simpleField "diskparams" [t| DiskParams |]
, simpleField "candidate_pool_size" [t| Int |]
, simpleField "modify_etc_hosts" [t| Bool |]
, simpleField "modify_ssh_setup" [t| Bool |]
, simpleField "maintain_node_health" [t| Bool |]
, simpleField "uid_pool" [t| UidPool |]
, simpleField "default_iallocator" [t| String |]
, simpleField "default_iallocator_params" [t| IAllocatorParams |]
, simpleField "hidden_os" [t| [String] |]
, simpleField "blacklisted_os" [t| [String] |]
, simpleField "primary_ip_family" [t| IpFamily |]
, simpleField "prealloc_wipe_disks" [t| Bool |]
, simpleField "ipolicy" [t| FilledIPolicy |]
, simpleField "enabled_disk_templates" [t| [DiskTemplate] |]
, simpleField "candidate_certs" [t| CandidateCertificates |]
, simpleField "max_running_jobs" [t| Int |]
simpleField "drbd_usermode_helper" [t| String |]
, simpleField "master_node" [t| String |]
, simpleField "master_ip" [t| String |]
, simpleField "master_netdev" [t| String |]
, simpleField "master_netmask" [t| Int |]
, simpleField "use_external_mip_script" [t| Bool |]
, simpleField "cluster_name" [t| String |]
, simpleField "file_storage_dir" [t| String |]
, simpleField "shared_file_storage_dir" [t| String |]
, simpleField "gluster_storage_dir" [t| String |]
, simpleField "enabled_hypervisors" [t| [Hypervisor] |]
, simpleField "hvparams" [t| ClusterHvParams |]
, simpleField "os_hvp" [t| OsHvParams |]
, simpleField "beparams" [t| ClusterBeParams |]
, simpleField "osparams" [t| ClusterOsParams |]
, simpleField "osparams_private_cluster" [t| ClusterOsParamsPrivate |]
, simpleField "nicparams" [t| ClusterNicParams |]
, simpleField "ndparams" [t| FilledNDParams |]
, simpleField "diskparams" [t| DiskParams |]
, simpleField "candidate_pool_size" [t| Int |]
, simpleField "modify_etc_hosts" [t| Bool |]
, simpleField "modify_ssh_setup" [t| Bool |]
, simpleField "maintain_node_health" [t| Bool |]
, simpleField "uid_pool" [t| UidPool |]
, simpleField "default_iallocator" [t| String |]
, simpleField "default_iallocator_params" [t| IAllocatorParams |]
, simpleField "hidden_os" [t| [String] |]
, simpleField "blacklisted_os" [t| [String] |]
, simpleField "primary_ip_family" [t| IpFamily |]
, simpleField "prealloc_wipe_disks" [t| Bool |]
, simpleField "ipolicy" [t| FilledIPolicy |]
, 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