summaryrefslogtreecommitdiff
path: root/nova/tests/unit/virt/libvirt/test_imagebackend.py
diff options
context:
space:
mode:
authorLee Yarwood <lyarwood@redhat.com>2022-01-27 12:19:22 +0000
committermelanie witt <melwittt@gmail.com>2022-08-16 08:08:21 +0000
commit48a6a9cab2e60244343e4981b346c8fc8cf90fa3 (patch)
tree6fb8a6879599facb3b80a2adb042f2ea95dea66e /nova/tests/unit/virt/libvirt/test_imagebackend.py
parente2cf3ae9ab54f7aea1354de112f7a58ece135e9e (diff)
downloadnova-48a6a9cab2e60244343e4981b346c8fc8cf90fa3.tar.gz
libvirt: Consolidate create_cow_image and create_image
This commonizes the code in create_cow_image and create_image so that creating a qcow2 image will use the same code path as any other disk format. This is done ahead of adding encryption support to the qemu-img create command to avoid duplication. Change-Id: I111cfc8a5eae27b15c6312957255fcf973038ddf
Diffstat (limited to 'nova/tests/unit/virt/libvirt/test_imagebackend.py')
-rw-r--r--nova/tests/unit/virt/libvirt/test_imagebackend.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/nova/tests/unit/virt/libvirt/test_imagebackend.py b/nova/tests/unit/virt/libvirt/test_imagebackend.py
index 34f022700c..0dc1009c92 100644
--- a/nova/tests/unit/virt/libvirt/test_imagebackend.py
+++ b/nova/tests/unit/virt/libvirt/test_imagebackend.py
@@ -525,7 +525,7 @@ class Qcow2TestCase(_ImageTestCase, test.NoDBTestCase):
mock_exists.assert_has_calls(exist_calls)
@mock.patch.object(imagebackend.utils, 'synchronized')
- @mock.patch('nova.virt.libvirt.utils.create_cow_image')
+ @mock.patch('nova.virt.libvirt.utils.create_image')
@mock.patch.object(os.path, 'exists', side_effect=[])
@mock.patch.object(imagebackend.Image, 'verify_base_size')
@mock.patch('nova.privsep.path.utime')
@@ -546,14 +546,14 @@ class Qcow2TestCase(_ImageTestCase, test.NoDBTestCase):
mock_verify.assert_called_once_with(self.TEMPLATE_PATH, self.SIZE)
mock_create.assert_called_once_with(
- self.TEMPLATE_PATH, self.PATH, self.SIZE)
+ self.PATH, 'qcow2', self.SIZE, backing_file=self.TEMPLATE_PATH)
fn.assert_called_once_with(target=self.TEMPLATE_PATH)
mock_exist.assert_has_calls(exist_calls)
self.assertTrue(mock_sync.called)
mock_utime.assert_called()
@mock.patch.object(imagebackend.utils, 'synchronized')
- @mock.patch('nova.virt.libvirt.utils.create_cow_image')
+ @mock.patch('nova.virt.libvirt.utils.create_image')
@mock.patch.object(imagebackend.disk, 'extend')
@mock.patch.object(os.path, 'exists', side_effect=[])
@mock.patch.object(imagebackend.Qcow2, 'get_disk_size')
@@ -578,7 +578,7 @@ class Qcow2TestCase(_ImageTestCase, test.NoDBTestCase):
self.assertFalse(mock_extend.called)
@mock.patch.object(imagebackend.utils, 'synchronized')
- @mock.patch('nova.virt.libvirt.utils.create_cow_image')
+ @mock.patch('nova.virt.libvirt.utils.create_image')
@mock.patch('nova.virt.libvirt.utils.get_disk_backing_file')
@mock.patch.object(imagebackend.disk, 'extend')
@mock.patch.object(os.path, 'exists', side_effect=[])
@@ -617,7 +617,7 @@ class Qcow2TestCase(_ImageTestCase, test.NoDBTestCase):
mock_utime.assert_called()
@mock.patch.object(imagebackend.utils, 'synchronized')
- @mock.patch('nova.virt.libvirt.utils.create_cow_image')
+ @mock.patch('nova.virt.libvirt.utils.create_image')
@mock.patch('nova.virt.libvirt.utils.get_disk_backing_file')
@mock.patch.object(imagebackend.disk, 'extend')
@mock.patch.object(os.path, 'exists', side_effect=[])