commit 8a5d326f09bd24d50dd6e4f008135870a1ebc167
Author: Jose A. Lopes <jabolopes@google.com>
Date:   Mon Feb 10 11:32:04 2014 +0100

    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: Jose A. Lopes <jabolopes@google.com>
    Reviewed-by: Helga Velroyen <helgav@google.com>

diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index fabc520..31c1b7a 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -1,7 +1,7 @@
 #
 #
 
-# 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",
diff --git a/lib/cmdlib/cluster.py b/lib/cmdlib/cluster.py
index b20036a..615fc07 100644
--- a/lib/cmdlib/cluster.py
+++ b/lib/cmdlib/cluster.py
@@ -1,7 +1,7 @@
 #
 #
 
-# 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
diff --git a/lib/objects.py b/lib/objects.py
index 2f3c005..b541898 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -1,7 +1,7 @@
 #
 #
 
-# 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.
diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs
index 348674c..bf3facc 100644
--- a/src/Ganeti/Objects.hs
+++ b/src/Ganeti/Objects.hs
@@ -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
diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs
index e74ec3c..d345ffc 100644
--- a/src/Ganeti/Query/Server.hs
+++ b/src/Ganeti/Query/Server.hs
@@ -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
diff --git a/test/py/cfgupgrade_unittest.py b/test/py/cfgupgrade_unittest.py
index 380faea..f422502 100755
--- a/test/py/cfgupgrade_unittest.py
+++ b/test/py/cfgupgrade_unittest.py
@@ -48,6 +48,7 @@ def GetMinimalConfig():
       "default_iallocator_params": {},
       "ndparams": {},
       "candidate_certs": {},
+      "instance_communication_network": "",
     },
     "instances": {},
     "networks": {},
diff --git a/tools/cfgupgrade b/tools/cfgupgrade
index 356024b..728eaa2 100755
--- a/tools/cfgupgrade
+++ b/tools/cfgupgrade
@@ -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"]
