aboutsummaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0002-deploy-add-support-for-multiple-bridges.patch
blob: 379fc57a85de0e6412dcbdb9147033854762da3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From dfc83244874060c4052bc3d29c256fa1bd52687d Mon Sep 17 00:00:00 2001
From: Josep Puigdemont <josep.puigdemont@enea.com>
Date: Fri, 6 May 2016 04:32:06 +0200
Subject: [PATCH] deploy: add support for multiple bridges

deploy.py:
Some Fuel VMs may need more than one network interface. To be able to
provide that, we now allow the user to specify the "-b" paramter
(bridge) multiple times, creating a new NIC for each one of them.

The NICs are created in the same order as they are given in the command
line.

There is no change in behavior from earlier versions, pxebr will still
be the default bridge if none is specified in the command line.

deploy.sh:
To reflect the new capabilities of deploy.py, we introduce the
possibility to specify -B more than once in deploy.sh, and honor that
when calling deploy.py. We also make it possible to specify a comma
separated list of bridges, as in: -B br1,br2.

Change-Id: I1a0100f2cfe755ec6adfeedafb391c2357f46f51
Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
---
 ci/deploy.sh                        | 11 +++++++----
 deploy/deploy.py                    | 10 +++++++---
 deploy/environments/virtual_fuel.py |  3 ++-
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/ci/deploy.sh b/ci/deploy.sh
index c7a1d18..4e4586c 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -58,7 +58,10 @@ and provides a fairly simple mechanism to execute a deployment.
 Input parameters to the build script is:
 -b Base URI to the configuration directory (needs to be provided in a URI
    style, it can be a local resource: file:// or a remote resource http(s)://)
--B PXE Bridge for booting of Fuel master, default is pxebr
+-B PXE Bridge for booting of Fuel master. It can be specified several times,
+   or as a comma separated list of bridges, or both: -B br1 -B br2,br3
+   One NIC connected to each specified bridge will be created in the Fuel VM,
+   in the same order as provided in the command line. The default is pxebr.
 -d Dry-run - Produces deploy config files (config/dea.yaml and
    config/dha.yaml), but does not execute deploy
 -f Deploy on existing Fuel master
@@ -135,9 +138,9 @@ do
             fi
             ;;
         B)
-            if [[ ${OPTARG} ]]; then
-                PXE_BRIDGE="-b ${OPTARG}"
-            fi
+            for bridge in ${OPTARG//,/ }; do
+                PXE_BRIDGE+=" -b $bridge"
+            done
             ;;
         d)
             DRY_RUN=1
diff --git a/deploy/deploy.py b/deploy/deploy.py
index 8064af9..56e5bd5 100755
--- a/deploy/deploy.py
+++ b/deploy/deploy.py
@@ -318,8 +318,8 @@ def parse_arguments():
     parser.add_argument('-s', dest='storage_dir', action='store',
                         default='%s/images' % CWD,
                         help='Storage Directory [default: images]')
-    parser.add_argument('-b', dest='pxe_bridge', action='store',
-                        default='pxebr',
+    parser.add_argument('-b', dest='pxe_bridge', action='append',
+                        default=[],
                         help='Linux Bridge for booting up the Fuel Master VM '
                              '[default: pxebr]')
     parser.add_argument('-p', dest='fuel_plugins_dir', action='store',
@@ -341,6 +341,9 @@ def parse_arguments():
     args = parser.parse_args()
     log(args)
 
+    if not args.pxe_bridge:
+        args.pxe_bridge = ['pxebr']
+
     check_file_exists(args.dha_file)
 
     check_dir_exists(os.path.dirname(args.deploy_log))
@@ -355,7 +358,8 @@ def parse_arguments():
         check_file_exists(iso_abs_path)
         log('Using image directory: %s' % args.storage_dir)
         create_dir_if_not_exists(args.storage_dir)
-        check_bridge(args.pxe_bridge, args.dha_file)
+        for bridge in args.pxe_bridge:
+            check_bridge(bridge, args.dha_file)
 
 
     kwargs = {'no_fuel': args.no_fuel, 'fuel_only': args.fuel_only,
diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py
index 5a86c97..b1a76e4 100644
--- a/deploy/environments/virtual_fuel.py
+++ b/deploy/environments/virtual_fuel.py
@@ -125,7 +125,8 @@ class VirtualFuel(ExecutionEnvironment):
         disk_path = self.create_image(disk_path, disk_size)
 
         self.del_vm_nics()
-        self.add_vm_nic(self.pxe_bridge)
+        for bridge in self.pxe_bridge:
+            self.add_vm_nic(bridge)
         self.update_vm_template_file()
 
         vm_definition_overwrite = self.dha.get_vm_definition('fuel')
-- 
2.5.5