submodule: yardstick.
[armband.git] / patches / opnfv-fuel / 0002-deploy-add-support-for-multiple-bridges.patch
1 From dfc83244874060c4052bc3d29c256fa1bd52687d Mon Sep 17 00:00:00 2001
2 From: Josep Puigdemont <josep.puigdemont@enea.com>
3 Date: Fri, 6 May 2016 04:32:06 +0200
4 Subject: [PATCH] deploy: add support for multiple bridges
5
6 deploy.py:
7 Some Fuel VMs may need more than one network interface. To be able to
8 provide that, we now allow the user to specify the "-b" paramter
9 (bridge) multiple times, creating a new NIC for each one of them.
10
11 The NICs are created in the same order as they are given in the command
12 line.
13
14 There is no change in behavior from earlier versions, pxebr will still
15 be the default bridge if none is specified in the command line.
16
17 deploy.sh:
18 To reflect the new capabilities of deploy.py, we introduce the
19 possibility to specify -B more than once in deploy.sh, and honor that
20 when calling deploy.py. We also make it possible to specify a comma
21 separated list of bridges, as in: -B br1,br2.
22
23 Change-Id: I1a0100f2cfe755ec6adfeedafb391c2357f46f51
24 Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
25 ---
26  ci/deploy.sh                        | 11 +++++++----
27  deploy/deploy.py                    | 10 +++++++---
28  deploy/environments/virtual_fuel.py |  3 ++-
29  3 files changed, 16 insertions(+), 8 deletions(-)
30
31 diff --git a/ci/deploy.sh b/ci/deploy.sh
32 index c7a1d18..4e4586c 100755
33 --- a/ci/deploy.sh
34 +++ b/ci/deploy.sh
35 @@ -58,7 +58,10 @@ and provides a fairly simple mechanism to execute a deployment.
36  Input parameters to the build script is:
37  -b Base URI to the configuration directory (needs to be provided in a URI
38     style, it can be a local resource: file:// or a remote resource http(s)://)
39 --B PXE Bridge for booting of Fuel master, default is pxebr
40 +-B PXE Bridge for booting of Fuel master. It can be specified several times,
41 +   or as a comma separated list of bridges, or both: -B br1 -B br2,br3
42 +   One NIC connected to each specified bridge will be created in the Fuel VM,
43 +   in the same order as provided in the command line. The default is pxebr.
44  -d Dry-run - Produces deploy config files (config/dea.yaml and
45     config/dha.yaml), but does not execute deploy
46  -f Deploy on existing Fuel master
47 @@ -135,9 +138,9 @@ do
48              fi
49              ;;
50          B)
51 -            if [[ ${OPTARG} ]]; then
52 -                PXE_BRIDGE="-b ${OPTARG}"
53 -            fi
54 +            for bridge in ${OPTARG//,/ }; do
55 +                PXE_BRIDGE+=" -b $bridge"
56 +            done
57              ;;
58          d)
59              DRY_RUN=1
60 diff --git a/deploy/deploy.py b/deploy/deploy.py
61 index 8064af9..56e5bd5 100755
62 --- a/deploy/deploy.py
63 +++ b/deploy/deploy.py
64 @@ -318,8 +318,8 @@ def parse_arguments():
65      parser.add_argument('-s', dest='storage_dir', action='store',
66                          default='%s/images' % CWD,
67                          help='Storage Directory [default: images]')
68 -    parser.add_argument('-b', dest='pxe_bridge', action='store',
69 -                        default='pxebr',
70 +    parser.add_argument('-b', dest='pxe_bridge', action='append',
71 +                        default=[],
72                          help='Linux Bridge for booting up the Fuel Master VM '
73                               '[default: pxebr]')
74      parser.add_argument('-p', dest='fuel_plugins_dir', action='store',
75 @@ -341,6 +341,9 @@ def parse_arguments():
76      args = parser.parse_args()
77      log(args)
78  
79 +    if not args.pxe_bridge:
80 +        args.pxe_bridge = ['pxebr']
81 +
82      check_file_exists(args.dha_file)
83  
84      check_dir_exists(os.path.dirname(args.deploy_log))
85 @@ -355,7 +358,8 @@ def parse_arguments():
86          check_file_exists(iso_abs_path)
87          log('Using image directory: %s' % args.storage_dir)
88          create_dir_if_not_exists(args.storage_dir)
89 -        check_bridge(args.pxe_bridge, args.dha_file)
90 +        for bridge in args.pxe_bridge:
91 +            check_bridge(bridge, args.dha_file)
92  
93  
94      kwargs = {'no_fuel': args.no_fuel, 'fuel_only': args.fuel_only,
95 diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py
96 index 5a86c97..b1a76e4 100644
97 --- a/deploy/environments/virtual_fuel.py
98 +++ b/deploy/environments/virtual_fuel.py
99 @@ -125,7 +125,8 @@ class VirtualFuel(ExecutionEnvironment):
100          disk_path = self.create_image(disk_path, disk_size)
101  
102          self.del_vm_nics()
103 -        self.add_vm_nic(self.pxe_bridge)
104 +        for bridge in self.pxe_bridge:
105 +            self.add_vm_nic(bridge)
106          self.update_vm_template_file()
107  
108          vm_definition_overwrite = self.dha.get_vm_definition('fuel')
109 -- 
110 2.5.5
111