Merge lp:~racb/nova/868349 into lp:~ubuntu-server-dev/nova/diablo

Proposed by Robie Basak
Status: Merged
Merge reported by: James Page
Merged at revision: not available
Proposed branch: lp:~racb/nova/868349
Merge into: lp:~ubuntu-server-dev/nova/diablo
Diff against target: 250 lines (+49/-46)
2 files modified
debian/changelog (+7/-0)
debian/patches/backport-libvirt-console-pipe.patch (+42/-46)
To merge this branch: bzr merge lp:~racb/nova/868349
Reviewer Review Type Date Requested Status
James Page Approve
Review via email: mp+78284@code.launchpad.net

Description of the change

  * debian/patches/backport-libvirt-console-pipe.patch:
    - Patch updated to fix race on instance termination (LP: #868349)

To post a comment you must log in.
Revision history for this message
James Page (james-page) wrote :

LGTM - tested on local all-in-one deployment and resolves the original bug report.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-10-04 09:50:31 +0000
3+++ debian/changelog 2011-10-05 16:48:18 +0000
4@@ -1,3 +1,10 @@
5+nova (2011.3-0ubuntu6) oneiric; urgency=low
6+
7+ * debian/patches/backport-libvirt-console-pipe.patch:
8+ - Patch updated to fix race on instance termination (LP: #868349)
9+
10+ -- Robie Basak <robie.basak@ubuntu.com> Wed, 05 Oct 2011 17:37:49 +0100
11+
12 nova (2011.3-0ubuntu5) oneiric; urgency=low
13
14 * debian/nova-common.postinst:
15
16=== modified file 'debian/patches/backport-libvirt-console-pipe.patch'
17--- debian/patches/backport-libvirt-console-pipe.patch 2011-09-30 14:22:57 +0000
18+++ debian/patches/backport-libvirt-console-pipe.patch 2011-10-05 16:48:18 +0000
19@@ -1,10 +1,9 @@
20 Description: Move console.log to a ringbuffer
21 Author: Robie Basak <robie.basak@canonical.com>
22 Status: https://review.openstack.org/#change,706
23-diff -Naupr nova-2011.3.orig//Authors nova-2011.3//Authors
24---- nova-2011.3.orig//Authors 2011-09-22 08:02:23.000000000 -0400
25-+++ nova-2011.3//Authors 2011-09-30 10:14:45.375607481 -0400
26-@@ -95,6 +95,7 @@ Ricardo Carrillo Cruz <emaildericky@gmai
27+--- a/Authors
28++++ b/Authors
29+@@ -95,6 +95,7 @@
30 Rick Clark <rick@openstack.org>
31 Rick Harris <rconradharris@gmail.com>
32 Rob Kost <kost@isi.edu>
33@@ -12,10 +11,9 @@
34 Ryan Lane <rlane@wikimedia.org>
35 Ryan Lucio <rlucio@internap.com>
36 Ryu Ishimoto <ryu@midokura.jp>
37-diff -Naupr nova-2011.3.orig//nova/tests/test_libvirt.py nova-2011.3//nova/tests/test_libvirt.py
38---- nova-2011.3.orig//nova/tests/test_libvirt.py 2011-09-22 08:02:23.000000000 -0400
39-+++ nova-2011.3//nova/tests/test_libvirt.py 2011-09-30 10:14:45.379607485 -0400
40-@@ -565,7 +565,7 @@ class LibvirtConnTestCase(test.TestCase)
41+--- a/nova/tests/test_libvirt.py
42++++ b/nova/tests/test_libvirt.py
43+@@ -565,7 +565,7 @@
44 (lambda t: t.findall(parameter)[1].get('name'), 'DHCPSERVER'),
45 (lambda t: t.findall(parameter)[1].get('value'), '10.0.0.1'),
46 (lambda t: t.find('./devices/serial/source').get(
47@@ -24,7 +22,7 @@
48 (lambda t: t.find('./memory').text, '2097152')]
49 if rescue:
50 common_checks += [
51-@@ -1494,3 +1494,54 @@ class NWFilterTestCase(test.TestCase):
52+@@ -1501,3 +1501,54 @@
53 self.assertEqual(original_filter_count - len(fakefilter.filters), 2)
54
55 db.instance_destroy(admin_ctxt, instance_ref['id'])
56@@ -79,9 +77,8 @@
57 + os.unlink(self.ringbuffer_path)
58 + os.unlink(self.fifo_path)
59 + os.rmdir(self.directory_path)
60-diff -Naupr nova-2011.3.orig//nova/tests/test_utils.py nova-2011.3//nova/tests/test_utils.py
61---- nova-2011.3.orig//nova/tests/test_utils.py 2011-09-22 08:02:23.000000000 -0400
62-+++ nova-2011.3//nova/tests/test_utils.py 2011-09-30 10:14:45.379607485 -0400
63+--- a/nova/tests/test_utils.py
64++++ b/nova/tests/test_utils.py
65 @@ -15,9 +15,12 @@
66 # under the License.
67
68@@ -95,7 +92,7 @@
69 import nova
70 from nova import exception
71 from nova import test
72-@@ -439,3 +442,55 @@ class MonkeyPatchTestCase(test.TestCase)
73+@@ -439,3 +442,55 @@
74 in nova.tests.monkey_patch_example.CALLED_FUNCTION)
75 self.assertFalse(package_b + 'ExampleClassB.example_method_add'
76 in nova.tests.monkey_patch_example.CALLED_FUNCTION)
77@@ -151,10 +148,9 @@
78 + yield check_buffer, r, expected
79 + r.close()
80 + f.close()
81-diff -Naupr nova-2011.3.orig//nova/utils.py nova-2011.3//nova/utils.py
82---- nova-2011.3.orig//nova/utils.py 2011-09-22 08:02:23.000000000 -0400
83-+++ nova-2011.3//nova/utils.py 2011-09-30 10:20:37.823615836 -0400
84-@@ -26,10 +26,12 @@ import json
85+--- a/nova/utils.py
86++++ b/nova/utils.py
87+@@ -26,10 +26,12 @@
88 import lockfile
89 import netaddr
90 import os
91@@ -167,7 +163,7 @@
92 import struct
93 import sys
94 import time
95-@@ -49,6 +51,7 @@ from nova import log as logging
96+@@ -49,6 +51,7 @@
97 from nova import version
98
99
100@@ -175,7 +171,7 @@
101 LOG = logging.getLogger("nova.utils")
102 ISO_TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
103 PERFECT_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f"
104-@@ -910,3 +913,132 @@ def convert_to_list_dict(lst, label):
105+@@ -910,3 +913,132 @@
106 if not isinstance(lst, list):
107 lst = [lst]
108 return [{label: x} for x in lst]
109@@ -308,10 +304,22 @@
110 +
111 + def close(self):
112 + self.f.close()
113-diff -Naupr nova-2011.3.orig//nova/virt/libvirt/connection.py nova-2011.3//nova/virt/libvirt/connection.py
114---- nova-2011.3.orig//nova/virt/libvirt/connection.py 2011-09-22 08:02:23.000000000 -0400
115-+++ nova-2011.3//nova/virt/libvirt/connection.py 2011-09-30 10:14:45.387607449 -0400
116-@@ -37,6 +37,7 @@ Supports KVM, LXC, QEMU, UML, and XEN.
117+--- a/nova/virt/libvirt.xml.template
118++++ b/nova/virt/libvirt.xml.template
119+@@ -153,8 +153,8 @@
120+
121+ #end for
122+ <!-- The order is significant here. File must be defined first -->
123+- <serial type="file">
124+- <source path='${basepath}/console.log'/>
125++ <serial type="pipe">
126++ <source path='${basepath}/console.fifo'/>
127+ <target port='1'/>
128+ </serial>
129+
130+--- a/nova/virt/libvirt/connection.py
131++++ b/nova/virt/libvirt/connection.py
132+@@ -37,6 +37,7 @@
133
134 """
135
136@@ -319,7 +327,7 @@
137 import hashlib
138 import functools
139 import multiprocessing
140-@@ -44,7 +45,9 @@ import netaddr
141+@@ -44,7 +45,9 @@
142 import os
143 import random
144 import re
145@@ -329,7 +337,7 @@
146 import sys
147 import tempfile
148 import time
149-@@ -52,6 +55,7 @@ import uuid
150+@@ -52,6 +55,7 @@
151 from xml.dom import minidom
152 from xml.etree import ElementTree
153
154@@ -337,7 +345,7 @@
155 from eventlet import greenthread
156 from eventlet import tpool
157
158-@@ -141,6 +145,8 @@ flags.DEFINE_string('default_local_forma
159+@@ -141,6 +145,8 @@
160 flags.DEFINE_bool('libvirt_use_virtio_for_bridges',
161 False,
162 'Use virtio for bridge interfaces')
163@@ -346,7 +354,7 @@
164
165
166 def get_connection(read_only):
167-@@ -170,6 +176,55 @@ def _get_eph_disk(ephemeral):
168+@@ -170,6 +176,57 @@
169 return 'disk.eph' + str(ephemeral['num'])
170
171
172@@ -364,6 +372,7 @@
173 + def _reopen(self):
174 + if self.fd is not None:
175 + os.close(self.fd)
176++ self.fd = None
177 + self.fd = os.open(self.fifo_path, os.O_RDONLY | os.O_NONBLOCK)
178 +
179 + def _reader_thread_func(self):
180@@ -394,6 +403,7 @@
181 + pass
182 + if self.fd is not None:
183 + os.close(self.fd)
184++ self.fd = None
185 +
186 + def peek(self):
187 + return self.ringbuffer.peek()
188@@ -402,7 +412,7 @@
189 class LibvirtConnection(driver.ComputeDriver):
190
191 def __init__(self, read_only):
192-@@ -185,9 +240,15 @@ class LibvirtConnection(driver.ComputeDr
193+@@ -185,9 +242,15 @@
194 self.firewall_driver = fw_class(get_connection=self._get_connection)
195 self.vif_driver = utils.import_object(FLAGS.libvirt_vif_driver)
196
197@@ -419,7 +429,7 @@
198
199 def _get_connection(self):
200 if not self._wrapped_conn or not self._test_connection():
201-@@ -229,6 +290,15 @@ class LibvirtConnection(driver.ComputeDr
202+@@ -229,6 +292,15 @@
203 else:
204 return libvirt.openAuth(uri, auth, 0)
205
206@@ -435,7 +445,7 @@
207 def list_instances(self):
208 return [self._conn.lookupByID(x).name()
209 for x in self._conn.listDomainsID()]
210-@@ -333,6 +403,7 @@ class LibvirtConnection(driver.ComputeDr
211+@@ -333,6 +405,7 @@
212 def _cleanup(self, instance):
213 target = os.path.join(FLAGS.instances_path, instance['name'])
214 instance_name = instance['name']
215@@ -443,7 +453,7 @@
216 LOG.info(_('instance %(instance_name)s: deleting instance files'
217 ' %(target)s') % locals())
218 if FLAGS.libvirt_type == 'lxc':
219-@@ -652,24 +723,22 @@ class LibvirtConnection(driver.ComputeDr
220+@@ -652,24 +725,22 @@
221
222 @exception.wrap_exception()
223 def get_console_output(self, instance):
224@@ -473,7 +483,7 @@
225
226 @exception.wrap_exception()
227 def get_ajax_console(self, instance):
228-@@ -816,11 +885,25 @@ class LibvirtConnection(driver.ComputeDr
229+@@ -816,11 +887,25 @@
230 container_dir = '%s/rootfs' % basepath(suffix='')
231 utils.execute('mkdir', '-p', container_dir)
232
233@@ -504,17 +514,3 @@
234
235 if not disk_images:
236 disk_images = {'image_id': inst['image_ref'],
237-diff -Naupr nova-2011.3.orig//nova/virt/libvirt.xml.template nova-2011.3//nova/virt/libvirt.xml.template
238---- nova-2011.3.orig//nova/virt/libvirt.xml.template 2011-09-22 08:02:23.000000000 -0400
239-+++ nova-2011.3//nova/virt/libvirt.xml.template 2011-09-30 10:14:45.383607472 -0400
240-@@ -153,8 +153,8 @@
241-
242- #end for
243- <!-- The order is significant here. File must be defined first -->
244-- <serial type="file">
245-- <source path='${basepath}/console.log'/>
246-+ <serial type="pipe">
247-+ <source path='${basepath}/console.fifo'/>
248- <target port='1'/>
249- </serial>
250-

Subscribers

People subscribed via source and target branches