Simplify libvirt snapshot code path

The "cold" snapshot code path was unnecessarily complex. We were
traversing 3 layers of abstraction to reach 3 lines of code. I've
completely eliminated snapshot.py by moving all "cold" snapshot
functions into imagebackend.py and adjusting the libvirt driver
accordingly. This is the first pass of several I intend to make
against imagebackend.py, as it is far too difficult to read given
how basic the basic level of functionality it is intended to
provide.

Change-Id: Idfacffb7210ae61193ee4f2360d4b38f330a177c
This commit is contained in:
Rafi Khardalian
2013-02-08 00:31:46 +00:00
committed by Gerrit Code Review
parent c635d048ec
commit dfbcef34a8
3 changed files with 6 additions and 2 deletions

View File

@@ -144,3 +144,7 @@ def fetch_image(context, target, image_id, user_id, project_id):
def get_instance_path(instance):
# TODO(mikal): we should really just call the real one here
return os.path.join(CONF.instances_path, instance['name'])
def pick_disk_driver_name(is_block_dev=False):
return "qemu"

View File

@@ -273,7 +273,7 @@ class LibvirtConnTestCase(test.TestCase):
'nova.virt.libvirt.driver.libvirt_utils',
fake_libvirt_utils))
self.useFixture(fixtures.MonkeyPatch(
'nova.virt.libvirt.snapshots.libvirt_utils',
'nova.virt.libvirt.imagebackend.libvirt_utils',
fake_libvirt_utils))
def fake_extend(image, size):

View File

@@ -84,7 +84,7 @@ class _FakeDriverBackendTestCase(object):
'nova.virt.libvirt.driver.libvirt_utils',
fake_libvirt_utils))
self.useFixture(fixtures.MonkeyPatch(
'nova.virt.libvirt.snapshots.libvirt_utils',
'nova.virt.libvirt.imagebackend.libvirt_utils',
fake_libvirt_utils))
self.useFixture(fixtures.MonkeyPatch(
'nova.virt.libvirt.firewall.libvirt',