Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: openstack/nova
base: master
...
head fork: vishvananda/nova
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 06, 2012
@vishvananda vishvananda Stop libvirt test from deleting instances dir
 * fixes bug 974293

Change-Id: Id41ab20193a70246ad2e3e1cc18edf47059d312d
6ba0bc3
Showing with 12 additions and 21 deletions.
  1. +12 −21 nova/tests/test_libvirt.py
View
33 nova/tests/test_libvirt.py
@@ -2275,25 +2275,12 @@ class LibvirtConnectionTestCase(test.TestCase):
"""Test for nova.virt.libvirt.connection.LibvirtConnection."""
def setUp(self):
super(LibvirtConnectionTestCase, self).setUp()
-
self.libvirtconnection = connection.LibvirtConnection(read_only=True)
- self.temp_path = os.path.join(flags.FLAGS.instances_path,
- 'instance-00000001/', '')
- try:
- os.makedirs(self.temp_path)
- except Exception:
- print 'testcase init error'
- pass
def tearDown(self):
super(LibvirtConnectionTestCase, self).tearDown()
- try:
- shutil.rmtree(flags.FLAGS.instances_path)
- except Exception:
- pass
-
def _create_instance(self, params=None):
"""Create a test instance"""
if not params:
@@ -2501,14 +2488,18 @@ def fake_create_new_domain(xml):
self.stubs.Set(self.libvirtconnection, '_create_new_domain',
fake_create_new_domain)
- ins_ref = self._create_instance()
- libvirt_xml_path = os.path.join(flags.FLAGS.instances_path,
- ins_ref['name'], 'libvirt.xml')
- f = open(libvirt_xml_path, 'w')
- f.close()
-
- ref = self.libvirtconnection.finish_revert_migration(ins_ref, None)
- self.assertTrue(isinstance(ref, eventlet.event.Event))
+ with utils.tempdir() as tmpdir:
+ self.flags(instances_path=tmpdir)
+ ins_ref = self._create_instance()
+ os.mkdir(os.path.join(tmpdir, ins_ref['name']))
+ libvirt_xml_path = os.path.join(tmpdir,
+ ins_ref['name'],
+ 'libvirt.xml')
+ f = open(libvirt_xml_path, 'w')
+ f.close()
+
+ ref = self.libvirtconnection.finish_revert_migration(ins_ref, None)
+ self.assertTrue(isinstance(ref, eventlet.event.Event))
class LibvirtNonblockingTestCase(test.TestCase):

No commit comments for this range

Something went wrong with that request. Please try again.