Merge lp:~corey.bryant/nova/2014.1.4 into lp:~ubuntu-server-dev/nova/icehouse

Proposed by Corey Bryant
Status: Merged
Merged at revision: 700
Proposed branch: lp:~corey.bryant/nova/2014.1.4
Merge into: lp:~ubuntu-server-dev/nova/icehouse
Diff against target: 728 lines (+132/-526)
9 files modified
debian/changelog (+56/-0)
debian/patches/block-device-mapping-config.patch (+0/-122)
debian/patches/cells-json-store.patch (+0/-76)
debian/patches/disable-websockify-tests.patch (+25/-0)
debian/patches/drop-oslo-utils-usage.patch (+41/-0)
debian/patches/fix-requirements.patch (+6/-6)
debian/patches/libvirt-Handle-unsupported-host-capabilities.patch (+0/-303)
debian/patches/series (+2/-3)
debian/patches/update-run-tests.patch (+2/-16)
To merge this branch: bzr merge lp:~corey.bryant/nova/2014.1.4
Reviewer Review Type Date Requested Status
James Page Needs Fixing
Review via email: mp+253242@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Page (james-page) wrote :
review: Needs Fixing
lp:~corey.bryant/nova/2014.1.4 updated
701. By Corey Bryant

d/p/update-run-tests.patch: Run tests with default concurrencey.

702. By Corey Bryant

Update patch description for update-run-tests.patch

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 2014-11-17 17:54:05 +0000
3+++ debian/changelog 2015-03-19 16:31:42 +0000
4@@ -1,3 +1,59 @@
5+nova (1:2014.1.4-0ubuntu1) trusty; urgency=medium
6+
7+ * Resynchronize with stable/icehouse (cac6472) (LP: #1432608):
8+ - [0ff6742] Websocket Proxy should verify Origin header
9+ - [c70e1fb] Fix kwargs['instance'] KeyError in @reverts_task_state decorator
10+ - [07ec12c] Revert "Eventlet green threads not released back to pool"
11+ - [e9cf07b] Compute: Catch binding failed exception while init host
12+ - [e275961] Make tests use sha256 as openssl default digest algorithm
13+ - [a657582] Eventlet green threads not released back to pool
14+ - [4b46a86] Fix image metadata returned for volumes
15+ - [58a6393] Check min_ram and min_disk when boot from volume
16+ - [c5411d2] Extends use of ServiceProxy to more methods in HostAPI in cells
17+ - [1e2abd6] Remove usage of self.__dict__ for message var replacement
18+ - [54f9225] only emit deprecation warnings once
19+ - [52103be] Fix disconnecting necessary iSCSI sessions issue
20+ - [cca94d0] Fix connecting unnecessary iSCSI sessions issue
21+ - [ac9f5c7] Fix wrong command for _rescan_multipath
22+ - [d7c8e93] Fix unsafe SSL connection on TrustedFilter
23+ - [9ecc468] Fix SecurityGroupExists error when booting instances
24+ - [33be7d7] Update "num_instance" during delete instance
25+ - [3de3f10] Fix nova evacuate issues for RBD
26+ - [fe289fb] Fix nova-compute start issue after evacuate
27+ - [f781656] Add _security_group_ensure_default() DBAPI method
28+ - [8812672] Run build_and_run_instance in a separate greenthread
29+ - [b6a080b] Fixes DOS issue in instance list ip filter
30+ - [5ab0421] Make the block device mapping retries configurable
31+ - [0695e14] Retry on closing of luks encrypted volume in case device is busy
32+ - [dffa810] Add @_retry_on_deadlock to _instance_update()
33+ - [f086ca3] Nova api service doesn't handle SIGHUP properly
34+ - [7cdb643] Fix XML UnicodeEncode serialization error
35+ - [98a6c1e] postgresql: use postgres db instead of template1
36+ - [155664f] share neutron admin auth tokens
37+ - [3e80433] VMware: validate that VM exists on backend prior to deletion
38+ - [d71445c] VMWare: Fix VM leak when deletion of VM during resizing
39+ - [56b62b7] Sync process utils from oslo
40+ - [ddd62ff] VMware: prevent race condition with VNC port allocation
41+ - [4174130] Fixes Hyper-V volume mapping issue on reboot
42+ - [bfeae68] Fix CellStateManagerFile init to failure
43+ - [5ec3cd3] Raise descriptive error for over volume quota
44+ - [f9fad7a] Fixes missing ec2 api address disassociate error on failure
45+ - [64ec1bf] Fix instance cross AZ check when attaching volumes
46+ - [698c821] Ignore errors when deleting non-existing vifs
47+ - [8141e7a] libvirt: Handle unsupported host capabilities
48+ - [df9ead9] libvirt: Make `fakelibvirt.libvirtError` match
49+ - [cac6472] Add _wrap_db_error() support to SessionTransaction.commit()
50+ * d/p/drop-oslo-utils-usage.patch: Added to override new oslo.utils dep.
51+ * d/p/disable-websockify-tests.patch: Added to disable websockify tests.
52+ * d/p/block-device-mapping-config.patch: Dropped. Fixed upstream in [5ab0421].
53+ * d/p/libvirt-Handle-unsupported-host-capabilities.patch: Dropped. Fixed
54+ upstream in [8141e7a] and [df9ead9].
55+ * d/p/cells-json-store.patch: Dropped. Fixed upstream in [bfeae68].
56+ * d/p/fix-requirements.patch: Rebased.
57+ * d/p/update-run-tests.patch: Run tests with default concurrencey.
58+
59+ -- Corey Bryant <corey.bryant@canonical.com> Mon, 16 Mar 2015 08:29:39 -0400
60+
61 nova (1:2014.1.3-0ubuntu2) trusty; urgency=medium
62
63 [ Corey Bryant ]
64
65=== removed file 'debian/patches/block-device-mapping-config.patch'
66--- debian/patches/block-device-mapping-config.patch 2014-11-10 16:31:07 +0000
67+++ debian/patches/block-device-mapping-config.patch 1970-01-01 00:00:00 +0000
68@@ -1,122 +0,0 @@
69-Description: Make the block device mapping retries configurable
70-Author: Akash Gangil <akashg1611@gmail.com>
71-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nova/+bug/1376927
72-Forwarded: https://review.openstack.org/#/c/129276/
73-diff --git a/nova/compute/manager.py b/nova/compute/manager.py
74-index 260a2b7..45e143c 100644
75---- a/nova/compute/manager.py
76-+++ b/nova/compute/manager.py
77-@@ -120,6 +120,10 @@ compute_opts = [
78- cfg.IntOpt('network_allocate_retries',
79- default=0,
80- help="Number of times to retry network allocation on failures"),
81-+ cfg.IntOpt('block_device_allocate_retries',
82-+ default=180,
83-+ help='Number of times to retry block device'
84-+ ' allocation on failures')
85- ]
86-
87- interval_opts = [
88-@@ -153,7 +157,11 @@ interval_opts = [
89- cfg.IntOpt('instance_delete_interval',
90- default=300,
91- help=('Interval in seconds for retrying failed instance file '
92-- 'deletes'))
93-+ 'deletes')),
94-+ cfg.IntOpt('block_device_allocate_retries_interval',
95-+ default=1,
96-+ help='Waiting time interval (seconds) between block'
97-+ ' device allocation retries on failures')
98- ]
99-
100- timeout_opts = [
101-@@ -1135,24 +1143,21 @@ class ComputeManager(manager.Manager):
102- instance)
103- return network_info
104-
105-- def _await_block_device_map_created(self, context, vol_id, max_tries=180,
106-- wait_between=1):
107-+ def _await_block_device_map_created(self, context, vol_id):
108- # TODO(yamahata): creating volume simultaneously
109- # reduces creation time?
110- # TODO(yamahata): eliminate dumb polling
111-- # TODO(harlowja): make the max_tries configurable or dynamic?
112- attempts = 0
113- start = time.time()
114-- while attempts < max_tries:
115-+ while attempts < CONF.block_device_allocate_retries:
116- volume = self.volume_api.get(context, vol_id)
117- volume_status = volume['status']
118- if volume_status not in ['creating', 'downloading']:
119- if volume_status != 'available':
120- LOG.warn(_("Volume id: %s finished being created but was"
121- " not set as 'available'"), vol_id)
122-- # NOTE(harlowja): return how many attempts were tried
123- return attempts + 1
124-- greenthread.sleep(wait_between)
125-+ greenthread.sleep(CONF.block_device_allocate_retries_interval)
126- attempts += 1
127- # NOTE(harlowja): Should only happen if we ran out of attempts
128- raise exception.VolumeNotCreated(volume_id=vol_id,
129-diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
130-index f1e334d..81765b4 100644
131---- a/nova/tests/compute/test_compute.py
132-+++ b/nova/tests/compute/test_compute.py
133-@@ -34,6 +34,8 @@ from oslo import messaging
134- import six
135- from testtools import matchers as testtools_matchers
136-
137-+from eventlet import greenthread
138-+
139- import nova
140- from nova import availability_zones
141- from nova import block_device
142-@@ -378,6 +380,8 @@ class ComputeVolumeTestCase(BaseTestCase):
143- lambda *a, **kw: None)
144- self.stubs.Set(self.compute.volume_api, 'check_attach',
145- lambda *a, **kw: None)
146-+ self.stubs.Set(greenthread, 'sleep',
147-+ lambda *a, **kw: None)
148-
149- def store_cinfo(context, *args, **kwargs):
150- self.cinfo = jsonutils.loads(args[-1].get('connection_info'))
151-@@ -438,7 +442,9 @@ class ComputeVolumeTestCase(BaseTestCase):
152- mock_get_by_id.assert_called_once_with(self.context, 'fake')
153- self.assertTrue(mock_attach.called)
154-
155-- def test_await_block_device_created_to_slow(self):
156-+ def test_await_block_device_created_too_slow(self):
157-+ self.flags(block_device_allocate_retries=2)
158-+ self.flags(block_device_allocate_retries_interval=0.1)
159-
160- def never_get(context, vol_id):
161- return {
162-@@ -449,13 +455,15 @@ class ComputeVolumeTestCase(BaseTestCase):
163- self.stubs.Set(self.compute.volume_api, 'get', never_get)
164- self.assertRaises(exception.VolumeNotCreated,
165- self.compute._await_block_device_map_created,
166-- self.context, '1', max_tries=2, wait_between=0.1)
167-+ self.context, '1')
168-
169- def test_await_block_device_created_slow(self):
170- c = self.compute
171-+ self.flags(block_device_allocate_retries=4)
172-+ self.flags(block_device_allocate_retries_interval=0.1)
173-
174- def slow_get(context, vol_id):
175-- while self.fetched_attempts < 2:
176-+ if self.fetched_attempts < 2:
177- self.fetched_attempts += 1
178- return {
179- 'status': 'creating',
180-@@ -467,9 +475,7 @@ class ComputeVolumeTestCase(BaseTestCase):
181- }
182-
183- self.stubs.Set(c.volume_api, 'get', slow_get)
184-- attempts = c._await_block_device_map_created(self.context, '1',
185-- max_tries=4,
186-- wait_between=0.1)
187-+ attempts = c._await_block_device_map_created(self.context, '1')
188- self.assertEqual(attempts, 3)
189-
190- def test_boot_volume_serial(self):
191
192=== removed file 'debian/patches/cells-json-store.patch'
193--- debian/patches/cells-json-store.patch 2014-09-30 09:25:52 +0000
194+++ debian/patches/cells-json-store.patch 1970-01-01 00:00:00 +0000
195@@ -1,76 +0,0 @@
196-Description: Fix nova cells failing with a json topology file bug
197-Author: Liam Young <liam.young@canonical.com>
198-Bug: https://bugs.launchpad.net/nova/+bug/1314677
199-Forwarded: https://review.openstack.org/#/c/124811/
200-diff --git a/nova/cells/state.py b/nova/cells/state.py
201-index b9112bd..1e12450 100644
202---- a/nova/cells/state.py
203-+++ b/nova/cells/state.py
204-@@ -152,10 +152,7 @@ class CellStateManager(base.Base):
205- cells_config = CONF.cells.cells_config
206-
207- if cells_config:
208-- config_path = CONF.find_file(cells_config)
209-- if not config_path:
210-- raise cfg.ConfigFilesNotFoundError(config_files=[cells_config])
211-- return CellStateManagerFile(cell_state_cls, config_path)
212-+ return CellStateManagerFile(cell_state_cls)
213-
214- return CellStateManagerDB(cell_state_cls)
215-
216-@@ -450,8 +447,11 @@ class CellStateManagerDB(CellStateManager):
217-
218-
219- class CellStateManagerFile(CellStateManager):
220-- def __init__(self, cell_state_cls, cells_config_path):
221-- self.cells_config_path = cells_config_path
222-+ def __init__(self, cell_state_cls=None):
223-+ cells_config = CONF.cells.cells_config
224-+ self.cells_config_path = CONF.find_file(cells_config)
225-+ if not self.cells_config_path:
226-+ raise cfg.ConfigFilesNotFoundError(config_files=[cells_config])
227- super(CellStateManagerFile, self).__init__(cell_state_cls)
228-
229- def _cell_data_sync(self, force=False):
230-diff --git a/nova/tests/cells/test_cells_state_manager.py b/nova/tests/cells/test_cells_state_manager.py
231-index 1c29927..4841e14 100644
232---- a/nova/tests/cells/test_cells_state_manager.py
233-+++ b/nova/tests/cells/test_cells_state_manager.py
234-@@ -16,12 +16,16 @@
235- Tests For CellStateManager
236- """
237-
238-+import mock
239-+import six
240-+
241- from oslo.config import cfg
242-
243- from nova.cells import state
244- from nova import db
245- from nova.db.sqlalchemy import models
246- from nova import exception
247-+from nova.openstack.common import fileutils
248- from nova import test
249-
250-
251-@@ -78,6 +82,19 @@ class TestCellsStateManager(test.TestCase):
252- state.CellStateManager)
253- self.assertEqual(['no_such_file_exists.conf'], e.config_files)
254-
255-+ @mock.patch.object(cfg.ConfigOpts, 'find_file')
256-+ @mock.patch.object(fileutils, 'read_cached_file')
257-+ def test_filemanager_returned(self, mock_read_cached_file, mock_find_file):
258-+ mock_find_file.return_value = "/etc/nova/cells.json"
259-+ mock_read_cached_file.return_value = (False, six.StringIO({}))
260-+ self.flags(cells_config='cells.json', group='cells')
261-+ self.assertIsInstance(state.CellStateManager(),
262-+ state.CellStateManagerFile)
263-+
264-+ def test_dbmanager_returned(self):
265-+ self.assertIsInstance(state.CellStateManager(),
266-+ state.CellStateManagerDB)
267-+
268- def test_capacity_no_reserve(self):
269- # utilize entire cell
270- cap = self._capacity(0.0)
271-
272
273=== added file 'debian/patches/disable-websockify-tests.patch'
274--- debian/patches/disable-websockify-tests.patch 1970-01-01 00:00:00 +0000
275+++ debian/patches/disable-websockify-tests.patch 2015-03-19 16:31:42 +0000
276@@ -0,0 +1,25 @@
277+--- a/nova/tests/console/test_websocketproxy.py
278++++ b/nova/tests/console/test_websocketproxy.py
279+@@ -16,8 +16,13 @@
280+
281+
282+ import mock
283++import testtools
284++
285++try:
286++ from nova.console import websocketproxy
287++except:
288++ websocketproxy = None
289+
290+-from nova.console import websocketproxy
291+ from nova import exception
292+ from nova import test
293+ from oslo.config import cfg
294+@@ -27,6 +32,7 @@
295+
296+ class NovaProxyRequestHandlerBaseTestCase(test.TestCase):
297+
298++ @testtools.skipIf(websocketproxy is None, "websockify not available")
299+ def setUp(self):
300+ super(NovaProxyRequestHandlerBaseTestCase, self).setUp()
301+
302
303=== added file 'debian/patches/drop-oslo-utils-usage.patch'
304--- debian/patches/drop-oslo-utils-usage.patch 1970-01-01 00:00:00 +0000
305+++ debian/patches/drop-oslo-utils-usage.patch 2015-03-19 16:31:42 +0000
306@@ -0,0 +1,41 @@
307+Description: Override python-oslo.utils dependency as it's not in trusty.
308+Author: Corey Bryant <corey.bryant@canonical.com>
309+Bug: https://bugs.launchpad.net/bugs/1432685
310+Forwarded: yes
311+
312+--- a/nova/compute/api.py
313++++ b/nova/compute/api.py
314+@@ -26,7 +26,6 @@
315+ import uuid
316+
317+ from oslo.config import cfg
318+-from oslo.utils import units
319+ import six
320+
321+ from nova import availability_zones
322+@@ -68,6 +67,7 @@
323+ from nova.openstack.common import log as logging
324+ from nova.openstack.common import strutils
325+ from nova.openstack.common import timeutils
326++from nova.openstack.common import units
327+ from nova.openstack.common import uuidutils
328+ import nova.policy
329+ from nova import quota
330+--- a/nova/tests/compute/test_compute.py
331++++ b/nova/tests/compute/test_compute.py
332+@@ -31,7 +31,6 @@
333+ import mox
334+ from oslo.config import cfg
335+ from oslo import messaging
336+-from oslo.utils import units
337+ import six
338+ from testtools import matchers as testtools_matchers
339+
340+@@ -69,6 +68,7 @@
341+ from nova.openstack.common import jsonutils
342+ from nova.openstack.common import log as logging
343+ from nova.openstack.common import timeutils
344++from nova.openstack.common import units
345+ from nova.openstack.common import uuidutils
346+ from nova import policy
347+ from nova import quota
348
349=== modified file 'debian/patches/fix-requirements.patch'
350--- debian/patches/fix-requirements.patch 2014-08-08 17:43:35 +0000
351+++ debian/patches/fix-requirements.patch 2015-03-19 16:31:42 +0000
352@@ -4,13 +4,13 @@
353 --- a/requirements.txt
354 +++ b/requirements.txt
355 @@ -25,9 +25,8 @@
356- python-neutronclient>=2.3.4,<3
357- python-glanceclient>=0.9.0
358- python-keystoneclient>=0.7.0
359+ python-neutronclient>=2.3.4,<2.3.11
360+ python-glanceclient>=0.9.0,!=0.14.0,<=0.14.2
361+ python-keystoneclient>=0.7.0,<=0.11.2
362 -six>=1.6.0
363 +six>=1.5.2
364- stevedore>=0.14
365+ stevedore>=0.14,<1.2
366 -websockify>=0.5.1,<0.6
367 wsgiref>=0.1.2
368- oslo.config>=1.2.0
369- oslo.rootwrap
370+ oslo.config>=1.2.0,<1.5
371+ oslo.rootwrap<1.4
372
373=== removed file 'debian/patches/libvirt-Handle-unsupported-host-capabilities.patch'
374--- debian/patches/libvirt-Handle-unsupported-host-capabilities.patch 2014-10-03 17:24:01 +0000
375+++ debian/patches/libvirt-Handle-unsupported-host-capabilities.patch 1970-01-01 00:00:00 +0000
376@@ -1,303 +0,0 @@
377-Description: Fix exception when starting LXC containers with libvirt-lxc.
378-Author: Chuck Short <zulcss@ubuntu.com>
379-Forwarded: Not Needed.
380---- a/nova/tests/virt/libvirt/fakelibvirt.py
381-+++ b/nova/tests/virt/libvirt/fakelibvirt.py
382-@@ -172,18 +172,76 @@
383-
384-
385- class libvirtError(Exception):
386-- def __init__(self, msg,
387-- error_code=VIR_ERR_INTERNAL_ERROR,
388-- error_domain=VIR_FROM_QEMU):
389-- self.error_code = error_code
390-- self.error_domain = error_domain
391-- Exception(self, msg)
392-+ """This class was copied and slightly modified from
393-+ `libvirt-python:libvirt-override.py`.
394-+
395-+ Since a test environment will use the real `libvirt-python` version of
396-+ `libvirtError` if it's installed and not this fake, we need to maintain
397-+ strict compatability with the original class, including `__init__` args
398-+ and instance-attributes.
399-+
400-+ To create a libvirtError instance you should:
401-+
402-+ # Create an unsupported error exception
403-+ exc = libvirtError('my message')
404-+ exc.err = (libvirt.VIR_ERR_NO_SUPPORT,)
405-+
406-+ self.err is a tuple of form:
407-+ (error_code, error_domain, error_message, error_level, str1, str2,
408-+ str3, int1, int2)
409-+
410-+ Alternatively, you can use the `make_libvirtError` convenience function to
411-+ allow you to specify these attributes in one shot.
412-+ """
413-+ def __init__(self, defmsg, conn=None, dom=None, net=None, pool=None,
414-+ vol=None):
415-+ Exception.__init__(self, defmsg)
416-+ self.err = None
417-
418- def get_error_code(self):
419-- return self.error_code
420-+ if self.err is None:
421-+ return None
422-+ return self.err[0]
423-
424- def get_error_domain(self):
425-- return self.error_domain
426-+ if self.err is None:
427-+ return None
428-+ return self.err[1]
429-+
430-+ def get_error_message(self):
431-+ if self.err is None:
432-+ return None
433-+ return self.err[2]
434-+
435-+ def get_error_level(self):
436-+ if self.err is None:
437-+ return None
438-+ return self.err[3]
439-+
440-+ def get_str1(self):
441-+ if self.err is None:
442-+ return None
443-+ return self.err[4]
444-+
445-+ def get_str2(self):
446-+ if self.err is None:
447-+ return None
448-+ return self.err[5]
449-+
450-+ def get_str3(self):
451-+ if self.err is None:
452-+ return None
453-+ return self.err[6]
454-+
455-+ def get_int1(self):
456-+ if self.err is None:
457-+ return None
458-+ return self.err[7]
459-+
460-+ def get_int2(self):
461-+ if self.err is None:
462-+ return None
463-+ return self.err[8]
464-
465-
466- class NWFilter(object):
467-@@ -219,8 +277,10 @@
468- try:
469- tree = etree.fromstring(xml)
470- except etree.ParseError:
471-- raise libvirtError("Invalid XML.",
472-- VIR_ERR_XML_DETAIL, VIR_FROM_DOMAIN)
473-+ raise make_libvirtError(
474-+ libvirtError, "Invalid XML.",
475-+ error_code=VIR_ERR_XML_DETAIL,
476-+ error_domain=VIR_FROM_DOMAIN)
477-
478- definition = {}
479-
480-@@ -369,7 +429,11 @@
481- 123456789L]
482-
483- def migrateToURI(self, desturi, flags, dname, bandwidth):
484-- raise libvirtError("Migration always fails for fake libvirt!")
485-+ raise make_libvirtError(
486-+ libvirtError,
487-+ "Migration always fails for fake libvirt!",
488-+ error_code=VIR_ERR_INTERNAL_ERROR,
489-+ error_domain=VIR_FROM_QEMU)
490-
491- def attachDevice(self, xml):
492- disk_info = _parse_disk_info(etree.fromstring(xml))
493-@@ -380,7 +444,11 @@
494- def attachDeviceFlags(self, xml, flags):
495- if (flags & VIR_DOMAIN_AFFECT_LIVE and
496- self._state != VIR_DOMAIN_RUNNING):
497-- raise libvirtError("AFFECT_LIVE only allowed for running domains!")
498-+ raise make_libvirtError(
499-+ libvirtError,
500-+ "AFFECT_LIVE only allowed for running domains!",
501-+ error_code=VIR_ERR_INTERNAL_ERROR,
502-+ error_domain=VIR_FROM_QEMU)
503- self.attachDevice(xml)
504-
505- def detachDevice(self, xml):
506-@@ -533,9 +601,11 @@
507- 'test:///default']
508-
509- if uri not in uri_whitelist:
510-- raise libvirtError("libvirt error: no connection driver "
511-- "available for No connection for URI %s" % uri,
512-- 5, 0)
513-+ raise make_libvirtError(
514-+ libvirtError,
515-+ "libvirt error: no connection driver "
516-+ "available for No connection for URI %s" % uri,
517-+ error_code=5, error_domain=0)
518-
519- self.readonly = readonly
520- self._uri = uri
521-@@ -594,16 +664,20 @@
522- def lookupByID(self, id):
523- if id in self._running_vms:
524- return self._running_vms[id]
525-- raise libvirtError('Domain not found: no domain with matching '
526-- 'id %d' % id,
527-- VIR_ERR_NO_DOMAIN, VIR_FROM_QEMU)
528-+ raise make_libvirtError(
529-+ libvirtError,
530-+ 'Domain not found: no domain with matching id %d' % id,
531-+ error_code=VIR_ERR_NO_DOMAIN,
532-+ error_domain=VIR_FROM_QEMU)
533-
534- def lookupByName(self, name):
535- if name in self._vms:
536- return self._vms[name]
537-- raise libvirtError('Domain not found: no domain with matching '
538-- 'name "%s"' % name,
539-- VIR_ERR_NO_DOMAIN, VIR_FROM_QEMU)
540-+ raise make_libvirtError(
541-+ libvirtError,
542-+ 'Domain not found: no domain with matching name "%s"' % name,
543-+ error_code=VIR_ERR_NO_DOMAIN,
544-+ error_domain=VIR_FROM_QEMU)
545-
546- def _emit_lifecycle(self, dom, event, detail):
547- if VIR_DOMAIN_EVENT_ID_LIFECYCLE not in self._event_callbacks:
548-@@ -904,14 +978,21 @@
549- 'user': 26728850000000L,
550- 'iowait': 6121490000000L}
551- else:
552-- raise libvirtError("invalid argument: Invalid cpu number")
553-+ raise make_libvirtError(
554-+ libvirtError,
555-+ "invalid argument: Invalid cpu number",
556-+ error_code=VIR_ERR_INTERNAL_ERROR,
557-+ error_domain=VIR_FROM_QEMU)
558-
559- def nwfilterLookupByName(self, name):
560- try:
561- return self._nwfilters[name]
562- except KeyError:
563-- raise libvirtError("no nwfilter with matching name %s" % name,
564-- VIR_ERR_NO_NWFILTER, VIR_FROM_NWFILTER)
565-+ raise make_libvirtError(
566-+ libvirtError,
567-+ "no nwfilter with matching name %s" % name,
568-+ error_code=VIR_ERR_NO_NWFILTER,
569-+ error_domain=VIR_FROM_NWFILTER)
570-
571- def nwfilterDefineXML(self, xml):
572- nwfilter = NWFilter(self, xml)
573-@@ -964,6 +1045,24 @@
574- pass
575-
576-
577-+def make_libvirtError(error_class, msg, error_code=None,
578-+ error_domain=None, error_message=None,
579-+ error_level=None, str1=None, str2=None, str3=None,
580-+ int1=None, int2=None):
581-+ """Convenience function for creating `libvirtError` exceptions which
582-+ allow you to specify arguments in constructor without having to manipulate
583-+ the `err` tuple directly.
584-+
585-+ We need to pass in `error_class` to this function because it may be
586-+ `libvirt.libvirtError` or `fakelibvirt.libvirtError` depending on whether
587-+ `libvirt-python` is installed.
588-+ """
589-+ exc = error_class(msg)
590-+ exc.err = (error_code, error_domain, error_message, error_level,
591-+ str1, str2, str3, int1, int2)
592-+ return exc
593-+
594-+
595- virDomain = Domain
596-
597-
598---- a/nova/virt/libvirt/driver.py
599-+++ b/nova/virt/libvirt/driver.py
600-@@ -77,6 +77,7 @@
601- from nova.openstack.common import excutils
602- from nova.openstack.common import fileutils
603- from nova.openstack.common.gettextutils import _
604-+from nova.openstack.common.gettextutils import _LW
605- from nova.openstack.common import importutils
606- from nova.openstack.common import jsonutils
607- from nova.openstack.common import log as logging
608-@@ -2888,9 +2889,14 @@
609- # this -1 checking should be removed later.
610- if features and features != -1:
611- self._caps.host.cpu.parse_str(features)
612-- except libvirt.VIR_ERR_NO_SUPPORT:
613-- # Note(yjiang5): ignore if libvirt has no support
614-- pass
615-+ except libvirt.libvirtError as ex:
616-+ error_code = ex.get_error_code()
617-+ if error_code == libvirt.VIR_ERR_NO_SUPPORT:
618-+ LOG.warn(_LW("URI %(uri)s does not support full set"
619-+ " of host capabilities: " "%(error)s"),
620-+ {'uri': self.uri(), 'error': ex})
621-+ else:
622-+ raise
623- return self._caps
624-
625- def get_host_uuid(self):
626---- a/nova/tests/virt/libvirt/test_libvirt.py
627-+++ b/nova/tests/virt/libvirt/test_libvirt.py
628-@@ -83,7 +83,7 @@
629- try:
630- import libvirt
631- except ImportError:
632-- import nova.tests.virt.libvirt.fakelibvirt as libvirt
633-+ libvirt = fakelibvirt
634- libvirt_driver.libvirt = libvirt
635-
636-
637-@@ -887,6 +887,42 @@
638- caps = conn.get_host_capabilities()
639- self.assertIn('aes', [x.name for x in caps.host.cpu.features])
640-
641-+ def test_baseline_cpu_not_supported(self):
642-+ conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
643-+
644-+ # `mock` has trouble stubbing attributes that don't exist yet, so
645-+ # fallback to plain-Python attribute setting/deleting
646-+ cap_str = 'VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES'
647-+ if not hasattr(libvirt_driver.libvirt, cap_str):
648-+ setattr(libvirt_driver.libvirt, cap_str, True)
649-+ self.addCleanup(delattr, libvirt_driver.libvirt, cap_str)
650-+
651-+ # Handle just the NO_SUPPORT error
652-+ not_supported_exc = fakelibvirt.make_libvirtError(
653-+ libvirt.libvirtError,
654-+ 'this function is not supported by the connection driver:'
655-+ ' virConnectBaselineCPU',
656-+ error_code=libvirt.VIR_ERR_NO_SUPPORT)
657-+
658-+ with mock.patch.object(conn._conn, 'baselineCPU',
659-+ side_effect=not_supported_exc):
660-+ caps = conn.get_host_capabilities()
661-+ self.assertEqual(vconfig.LibvirtConfigCaps, type(caps))
662-+ self.assertNotIn('aes', [x.name for x in caps.host.cpu.features])
663-+
664-+ # Clear cached result so we can test again...
665-+ conn._caps = None
666-+
667-+ # Other errors should not be caught
668-+ other_exc = fakelibvirt.make_libvirtError(
669-+ libvirt.libvirtError,
670-+ 'other exc',
671-+ error_code=libvirt.VIR_ERR_NO_DOMAIN)
672-+
673-+ with mock.patch.object(conn._conn, 'baselineCPU',
674-+ side_effect=other_exc):
675-+ self.assertRaises(libvirt.libvirtError, conn.get_host_capabilities)
676-+
677- def test_lxc_get_host_capabilities_failed(self):
678- conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
679-
680
681=== modified file 'debian/patches/series'
682--- debian/patches/series 2014-11-10 16:31:07 +0000
683+++ debian/patches/series 2015-03-19 16:31:42 +0000
684@@ -1,8 +1,7 @@
685 # Ubuntu specific patches below here. Note these can be dropped eventually.
686-block-device-mapping-config.patch
687+drop-oslo-utils-usage.patch
688+disable-websockify-tests.patch
689 fix-requirements.patch
690 skip_ipv6_test.patch
691 arm-console-patch.patch
692 update-run-tests.patch
693-libvirt-Handle-unsupported-host-capabilities.patch
694-cells-json-store.patch
695
696=== modified file 'debian/patches/update-run-tests.patch'
697--- debian/patches/update-run-tests.patch 2014-03-05 14:00:22 +0000
698+++ debian/patches/update-run-tests.patch 2015-03-19 16:31:42 +0000
699@@ -1,20 +1,9 @@
700-Description: Update run_tests.sh to show results and default the concurrency to 1.
701+Description: Update run_tests.sh to show results.
702 Author: Chuck Short <zulcss@ubuntu.com>
703 Forwarded: Not needed.
704-diff --git a/run_tests.sh b/run_tests.sh
705-index 1fecc4c..84537cb 100755
706 --- a/run_tests.sh
707 +++ b/run_tests.sh
708-@@ -86,7 +86,7 @@ no_pep8=0
709- coverage=0
710- debug=0
711- update=0
712--concurrency=0
713-+concurrency=4
714-
715- LANG=en_US.UTF-8
716- LANGUAGE=en_US:en
717-@@ -137,14 +137,7 @@ function run_tests {
718+@@ -137,14 +137,7 @@
719 ${wrapper} python setup.py egg_info
720 fi
721 echo "Running \`${wrapper} $TESTRTESTS\`"
722@@ -30,6 +19,3 @@
723 RESULT=$?
724 set -e
725
726---
727-1.9.0
728-

Subscribers

People subscribed via source and target branches