diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-04-05 16:19:46 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-04-05 16:19:46 +0000 |
| commit | 7f4a7b3916bc91d0919252257929c68ba384d303 (patch) | |
| tree | 36afa27b9f7bf9f8deedacd999a979b1b4bc9935 | |
| parent | 7ae65242bd525ce08b1168100ba16a220f73fddd (diff) | |
| parent | bc173ec44e6c3a42af22976122b46fd25546559b (diff) | |
| download | nova-7f4a7b3916bc91d0919252257929c68ba384d303.tar.gz nova-7f4a7b3916bc91d0919252257929c68ba384d303.tar.xz nova-7f4a7b3916bc91d0919252257929c68ba384d303.zip | |
Merge "Fixed bug 962840, added a test case."
| -rw-r--r-- | nova/tests/test_libvirt.py | 18 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index d7f7d7e79..87b3073ed 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -2509,3 +2509,21 @@ class LibvirtConnectionTestCase(test.TestCase): ref = self.libvirtconnection.finish_revert_migration(ins_ref, None) self.assertTrue(isinstance(ref, eventlet.event.Event)) + + +class LibvirtNonblockingTestCase(test.TestCase): + """Test libvirt_nonblocking option""" + + def setUp(self): + super(LibvirtNonblockingTestCase, self).setUp() + self.flags(libvirt_nonblocking=True, libvirt_uri="test:///default") + + def tearDown(self): + super(LibvirtNonblockingTestCase, self).tearDown() + + @test.skip_if(missing_libvirt(), "Test requires libvirt") + def test_connection_to_primitive(self): + """Test bug 962840""" + import nova.virt.libvirt.connection + connection = nova.virt.libvirt.connection.get_connection('') + utils.to_primitive(connection._conn, convert_instances=True) diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 3c4bbb016..363aaf742 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -158,6 +158,24 @@ flags.DECLARE('live_migration_retry_count', 'nova.compute.manager') flags.DECLARE('vncserver_proxyclient_address', 'nova.vnc') +def patch_tpool_proxy(): + """eventlet.tpool.Proxy doesn't work with old-style class in __str__() + or __repr__() calls. See bug #962840 for details. + We perform a monkey patch to replace those two instance methods. + """ + def str_method(self): + return str(self._obj) + + def repr_method(self): + return repr(self._obj) + + tpool.Proxy.__str__ = str_method + tpool.Proxy.__repr__ = repr_method + + +patch_tpool_proxy() + + def get_connection(read_only): # These are loaded late so that there's no need to install these # libraries when not using libvirt. |
