From 72f0ef8e6823990930646649b577d9810034eccd Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Wed, 16 Feb 2011 12:19:04 +0000
Subject: [PATCH] Remove deprecated 'bridge' nic parameter

This has been a synonym for "link" since a few major versions.
Add a NEWS entry so we won't forget to mention it at release time.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 NEWS             |  2 ++
 lib/cmdlib.py    | 14 ++------------
 lib/constants.py |  2 --
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/NEWS b/NEWS
index 701e5b053..7901c3e20 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ Version 2.5.0 beta1
   to match the underlying LUXI interface
 - When creating file-based instances via RAPI, the ``file_driver``
   parameter no longer defaults to ``loop`` and must be specified
+- The deprecated "bridge" nic parameter is no longer supported. Use
+  "link" instead.
 
 
 Version 2.4.0 rc2
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 2e59a0b44..34a7f5956 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -7473,18 +7473,8 @@ class LUInstanceCreate(LogicalUnit):
                                      " in cluster" % mac,
                                      errors.ECODE_NOTUNIQUE)
 
-      # bridge verification
-      bridge = nic.get("bridge", None)
-      link = nic.get("link", None)
-      if bridge and link:
-        raise errors.OpPrereqError("Cannot pass 'bridge' and 'link'"
-                                   " at the same time", errors.ECODE_INVAL)
-      elif bridge and nic_mode == constants.NIC_MODE_ROUTED:
-        raise errors.OpPrereqError("Cannot pass 'bridge' on a routed nic",
-                                   errors.ECODE_INVAL)
-      elif bridge:
-        link = bridge
-
+      #  Build nic parameters
+      link = nic.get(constants.INIC_LINK, None)
       nicparams = {}
       if nic_mode_req:
         nicparams[constants.NIC_MODE] = nic_mode_req
diff --git a/lib/constants.py b/lib/constants.py
index 2bd73ddf7..31008f50a 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -746,9 +746,7 @@ INIC_MAC = "mac"
 INIC_IP = "ip"
 INIC_MODE = "mode"
 INIC_LINK = "link"
-INIC_BRIDGE = "bridge"
 INIC_PARAMS_TYPES = {
-  INIC_BRIDGE: VTYPE_STRING,
   INIC_IP: VTYPE_MAYBE_STRING,
   INIC_LINK: VTYPE_STRING,
   INIC_MAC: VTYPE_STRING,
-- 
GitLab