summaryrefslogtreecommitdiff
path: root/app-emulation/openstack-guest-agents-unix/files/patches-1.39.0-20140621.patch
blob: c275982fa94bcc024fe538656b4f02cc715c5f33 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
commit fc8c9fe076e321ff98cc6717abbb21ee57808c52
Merge: eaaae09 1ecec49
Author: teran-mckinney <teran.mckinney@rackspace.com>
Date:   Wed Apr 30 15:33:43 2014 +0000

    Merge pull request #43 from gtmanfred/master
    
    sbindir changes to exec_prefix

commit eaaae09c27a33998374a8d63702c75b04ab3e5c2
Merge: 773e431 1505a5a
Author: teran-mckinney <teran.mckinney@rackspace.com>
Date:   Tue Apr 29 18:21:27 2014 +0000

    Merge pull request #45 from leader716/master
    
    Added addditional logic to deterine if the hardware address for and inte...

commit 1505a5a8e180910c3307bf04ccfc4eed09c0f40a
Author: John Ward <john.ward@rackspace.com>
Date:   Tue Apr 29 14:28:34 2014 +0000

    Added addditional logic to deterine if the hardware address for and interface is 0x0 if so go to the next interface.
    I put this into place to handle tun adapters that have a hardware address of 0x0 which was causing the agent to
    segfault when it encounterd this type of adapter.

commit 1ecec499d5bea73980a8aec992b394339acc83c7
Author: Daniel Wallace <danielwallace@gtmanfred.com>
Date:   Fri Apr 25 20:38:35 2014 -0500

    sbindir changes to exec_prefix
    
    Systemd requires a full path for the start of the command, and there
    isn't one that isn't a nice way to change this.

commit 773e431997a6612cbda9f11ec9d57f5685a29eea
Merge: 1ca2056 12c0294
Author: teran-mckinney <teran.mckinney@rackspace.com>
Date:   Fri Apr 25 18:41:56 2014 +0000

    Merge pull request #39 from Camisa/master
    
    nova-agent should replace the Slice or Image ID rather than append

commit 1ca2056a455f8075ed951f0a82b92820c0b33b54
Merge: 1b05c75 f9a365e
Author: teran-mckinney <teran.mckinney@rackspace.com>
Date:   Fri Apr 25 18:40:29 2014 +0000

    Merge pull request #42 from gtmanfred/master
    
    Do not add static routes that are the default route, if a default gateway already exists.
    
    Courtesy of gtmanfred. Thank you!

commit f9a365e7a9543d407ca9d75164688faa0ff53528
Author: Daniel Wallace <danielwallace@gtmanfred.com>
Date:   Fri Apr 25 10:54:29 2014 -0500

    remove extra and from debian network.py

commit 387d4e77695598a07be9e4593c5b236b81a1aeea
Author: Daniel Wallace <danielwallace@gtmanfred.com>
Date:   Fri Apr 25 09:31:15 2014 -0500

    Do not add static routes that are the default route

commit 1b05c75530c8b4cbf5347e84815e275ee0bbacd4
Author: teran-mckinney <teran.mckinney@rackspace.com>
Date:   Thu Feb 13 19:26:36 2014 +0000

    Fix nova-agent not starting on some systems
    
    data/host existing could cause a fault on xs_handle.mkdir(self.request_path) if request_path (data/host) already existed. Wrap it in a try/except clause to ignore the fault as if the directory already exists, there's no reason to throw an exception while trying to create it.
    
    Workaround without this patch is to xenstore-rm data/host from affected VMs, or to do it from dom0 with the full path.

commit 12c02941ef02dc6645e6d4700e8a028decbf0c19
Author: Christopher J. Camisa <cjc@operator.host>
Date:   Thu Jan 30 03:11:51 2014 -0600

    nova-agent should replace the Slice or Image ID rather than append

commit ce388bf600136736fdb790edef58a57aad8adfc1
Author: AbhishekKr <abhikumar163@gmail.com>
Date:   Tue Jan 21 17:22:23 2014 +0530

    shebang fixed for installer.sh and bintar script; gitignore updated

commit 91fe7d0262fe8ad685a287df291b504250b1184c
Author: AbhishekKr <abhikumar163@gmail.com>
Date:   Fri Jan 3 16:51:54 2014 +0530

    FreeBSD changed ports, so bintar creation script need to
diff --git a/.gitignore b/.gitignore
index ae1ae1b..6bdeda8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,4 @@ unix/scripts/generic/nova-agent
 unix/scripts/gentoo/nova-agent
 unix/scripts/freebsd/nova-agent
 .idea/*
+**/.venv
diff --git a/commands/arch/network.py b/commands/arch/network.py
index 1d698ca..2bc0aff 100644
--- a/commands/arch/network.py
+++ b/commands/arch/network.py
@@ -373,6 +373,11 @@ def _update_rc_conf_legacy(infile, interfaces):
             ifaces.append((ifname.replace(':', '_'), ' '.join(line)))
 
         for i, route in enumerate(interface['routes']):
+            if route['network'] == '0.0.0.0' and \
+                    route['netmask'] == '0.0.0.0' and \
+                    route['gateway'] == gateway4:
+                continue
+
             line = "-net %(network)s netmask %(netmask)s gw %(gateway)s" % \
                     route
 
@@ -499,7 +504,10 @@ def _get_file_data_netctl(ifname, interface):
             print >>outfile, 'Gateway6=%s' % gateway6
 
     routes = ['%(network)s/%(netmask)s via %(gateway)s' % route
-              for route in interface['routes']]
+              for route in interface['routes'] if not
+              route['network'] == '0.0.0.0' and not
+              route['netmask'] == '0.0.0.0' and not
+              route['gateway'] == gateway4]
 
     if routes:
         print >>outfile, 'Routes=(\'%s\')' % '\' \''.join(routes)
@@ -552,7 +560,10 @@ def _get_file_data_netcfg(ifname, interface):
             print >>outfile, 'GATEWAY6="%s"' % gateway6
 
     routes = ['"%(network)s/%(netmask)s via %(gateway)s"' % route 
-              for route in interface['routes']]
+              for route in interface['routes'] if not
+              route['network'] == '0.0.0.0' and not
+              route['netmask'] == '0.0.0.0' and not
+              route['gateway'] == gateway4]
 
     if routes:
         print >>outfile, 'ROUTES=(%s)' % ' '.join(routes)
diff --git a/commands/debian/network.py b/commands/debian/network.py
index d91d602..3b82d97 100644
--- a/commands/debian/network.py
+++ b/commands/debian/network.py
@@ -234,6 +234,11 @@ def _get_file_data(interfaces):
             ifname_suffix_num += 1
 
         for route in interface['routes']:
+            if route['network'] == '0.0.0.0' \
+                    and route['netmask'] == '0.0.0.0'\
+                    and 'gateway4' in interface \
+                    and route['gateway'] == interface['gateway4']:
+                continue
             file_data += "    post-up route add -net %(network)s " \
                          "netmask %(netmask)s gw %(gateway)s || true\n" % route
             file_data += "    pre-down route del -net %(network)s " \
diff --git a/commands/freebsd/network.py b/commands/freebsd/network.py
index 2d5d7f1..87e5e9e 100644
--- a/commands/freebsd/network.py
+++ b/commands/freebsd/network.py
@@ -211,6 +211,10 @@ def _create_rcconf_file(infile, interfaces, hostname):
             ifname_suffix_num += 1
 
         for route in interface['routes']:
+            if route['network'] == '0.0.0.0' and \
+                    route['netmask'] == '0.0.0.0' and \
+                    route['gateway'] == gateway4:
+                continue
             if ':' in route['network']:
                 # ipv6
                 fmt = '-net %(network)s/%(netmask)s %(gateway)s'
diff --git a/commands/gentoo/network.py b/commands/gentoo/network.py
index f3ceff5..f3e5251 100644
--- a/commands/gentoo/network.py
+++ b/commands/gentoo/network.py
@@ -199,7 +199,11 @@ def _confd_net_file(interfaces):
         lines.extend([ "  {0}/{1} via {2}".format(route['network'],
                         commands.network.NETMASK_TO_PREFIXLEN[route['netmask']],
                         route['gateway']
-                    ) for route in interface['routes'] ])
+                    ) for route in interface['routes'] if not 
+                    route['network'] == '0.0.0.0' and not
+                    route['netmask'] == '0.0.0.0' and
+                    'gateway4' in interface and not
+                    route['gateway'] == interface['gateway4']])
         if 'gateway4' in interface and interface['gateway4']:
             lines.append("  default via {0}".format(interface['gateway4']))
         if 'gateway6' in interface and interface['gateway6']:
@@ -247,7 +251,11 @@ def _confd_net_file_legacy(interfaces):
         lines.append("routes_{0}=(".format(name))
         lines.extend([ "  \"{0} netmask {1} gw {2}\"".format(
                         route['network'], route['netmask'], route['gateway']
-                    ) for route in interface['routes'] ])
+                    ) for route in interface['routes'] if not 
+                    route['network'] == '0.0.0.0' and not
+                    route['netmask'] == '0.0.0.0' and
+                    'gateway4' in interface and not
+                    route['gateway'] == interface['gateway4'] ])
         if 'gateway4' in interface and interface['gateway4']:
             lines.append("  \"default via {0}\"".format(interface['gateway4']))
         if 'gateway6' in interface and interface['gateway6']:
diff --git a/commands/redhat/network.py b/commands/redhat/network.py
index a85ed6b..e853fbd 100644
--- a/commands/redhat/network.py
+++ b/commands/redhat/network.py
@@ -202,6 +202,11 @@ def _get_file_data(ifname_prefix, interface):
 
     route_data = ''
     for i, route in enumerate(interface['routes']):
+        if route['network'] == '0.0.0.0' and \
+                route['netmask'] == '0.0.0.0' and \
+                'gateway4' in interface and \
+                route['gateway'] == interface['gateway4']:
+            continue
         route_data += "ADDRESS%d=%s\n" % (i, route['network'])
         route_data += "NETMASK%d=%s\n" % (i, route['netmask'])
         route_data += "GATEWAY%d=%s\n" % (i, route['gateway'])
diff --git a/commands/suse/network.py b/commands/suse/network.py
index 2947974..baad7b2 100644
--- a/commands/suse/network.py
+++ b/commands/suse/network.py
@@ -191,6 +191,10 @@ def _get_file_data(ifname, interface):
 
     route_data = ''
     for route in interface['routes']:
+        if route['network'] == '0.0.0.0' and \
+                route['netmask'] == '0.0.0.0' and \
+                route['gateway'] == gateway4:
+            continue
         network = route['network']
         netmask = route['netmask']
         gateway = route['gateway']
diff --git a/lib/agentlib.c b/lib/agentlib.c
index ccba6e3..cced430 100644
--- a/lib/agentlib.c
+++ b/lib/agentlib.c
@@ -73,7 +73,10 @@ static PyObject *_agentlib_get_interfaces(PyObject *self, PyObject *args)
             goto next;
 
 #if defined(__linux__)
-        if (ifa->ifa_addr->sa_family != PF_PACKET)
+        if (ifa->ifa_addr == NULL)
+	    goto next;
+
+	if (ifa->ifa_addr->sa_family != PF_PACKET)
             goto next;
 
         struct sockaddr_ll *sll = (struct sockaddr_ll *)ifa->ifa_addr;
diff --git a/plugins/xscomm.py b/plugins/xscomm.py
index e3faa2e..9b8a33b 100644
--- a/plugins/xscomm.py
+++ b/plugins/xscomm.py
@@ -41,7 +41,11 @@ class XSComm(object):
                 XENSTORE_RESPONSE_PATH)
 
         self.xs_handle = pyxenstore.Handle()
-        self.xs_handle.mkdir(self.request_path)
+        try:
+            self.xs_handle.mkdir(self.request_path)
+        except:
+            pass
+
         self.requests = []
 
     def _check_handle(self):
diff --git a/scripts/gentoo/nova-agent.in b/scripts/gentoo/nova-agent.in
index a043394..7f2687e 100755
--- a/scripts/gentoo/nova-agent.in
+++ b/scripts/gentoo/nova-agent.in
@@ -59,7 +59,7 @@ start() {
         /usr/bin/xenstore write data/host/system-init '{"name":"resetnetwork","value":""}'
         /usr/bin/xenstore watch -n 1 data/guest/system-init >/dev/null
         [ "$(/usr/bin/xenstore read data/guest/system-init | wc -l)" -gt "0" ] || eend 1
-        echo "UUID=\"$(/usr/bin/xenstore read name)\"" >> /etc/conf.d/nova-agent
+        echo "UUID=\"$(/usr/bin/xenstore read name)\"" > /etc/conf.d/nova-agent
     fi
 
     eend $RET
diff --git a/scripts/installer.sh.in b/scripts/installer.sh.in
index 8ef793d..3fbf352 100755
--- a/scripts/installer.sh.in
+++ b/scripts/installer.sh.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 #
diff --git a/scripts/systemd/nova-agent.service.in b/scripts/systemd/nova-agent.service.in
index 9d8a4a7..b73ebbe 100644
--- a/scripts/systemd/nova-agent.service.in
+++ b/scripts/systemd/nova-agent.service.in
@@ -4,7 +4,7 @@ Description=nova-agent service
 [Service]
 Environment=LD_LIBRARY_PATH=@prefix@/share/@PACKAGE@/@PACKAGE_VERSION@/lib
 EnvironmentFile=-/etc/nova-agent.env
-ExecStart=@sbindir@/nova-agent -n -l info @prefix@/share/@PACKAGE@/nova-agent.py
+ExecStart=@prefix@/sbin/nova-agent -n -l info @prefix@/share/@PACKAGE@/nova-agent.py
 
 
 [Install]
diff --git a/tools/nova-agent-builder.sh b/tools/nova-agent-builder.sh
index 1823639..fcaa7c7 100755
--- a/tools/nova-agent-builder.sh
+++ b/tools/nova-agent-builder.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 ##### NOVA AGENT BUILDER
 ##### how_to:$ sh nova-agent-builder.sh help
 ##### W.I.P. works fine for most of cases,
@@ -202,7 +202,7 @@ install_pre_requisite_freebsd(){
     export INSTALL_D=""
     uname -a
 
-    pkg_add -r git autogen automake wget bash
+    pkg_add -r git autogen automake wget bash libtool
     pkg_add -r py27-unittest2 py27-cryptkit py27-pycrypto py27-mox
 
     # re-install xen-tool :: required for pyxenstore install