From c8fcde472922e4ee664d904e0bf1a583f1d5040d Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 8 Jun 2009 11:32:51 +0100
Subject: [PATCH] Cluster: add nicparams, and update them on upgrade

This also migrates the default bridge from the cluster object to the nic
params, at load time. Since we don't support changing the default bridge
after cluster init, this is ok for now. In the future we'll make
gnt-cluster init --bridge to the right thing, after the nic parameter
implementation is finished.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/objects.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/objects.py b/lib/objects.py
index 73f89d1af..64b4418b3 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -784,6 +784,7 @@ class Cluster(TaggableObject):
     "enabled_hypervisors",
     "hvparams",
     "beparams",
+    "nicparams",
     "candidate_pool_size",
     "modify_etc_hosts",
     ]
@@ -801,6 +802,12 @@ class Cluster(TaggableObject):
 
     self.beparams = UpgradeGroupedParams(self.beparams,
                                          constants.BEC_DEFAULTS)
+    migrate_default_bridge = not self.nicparams
+    self.nicparams = UpgradeGroupedParams(self.nicparams,
+                                          constants.NICC_DEFAULTS)
+    if migrate_default_bridge:
+      self.nicparams[constants.PP_DEFAULT][constants.NIC_LINK] = \
+        self.default_bridge
 
     if self.modify_etc_hosts is None:
       self.modify_etc_hosts = True
-- 
GitLab