From 4208897146974c6c10b62e5bf520744d1a807683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 25 Jul 2017 05:32:45 +0200 Subject: [PATCH] storage/file: create -cow.img only when needed Do not create it at volume creation time. It it needed only when VM is running, so create it just before startup only. QubesOS/qubes-issues#2256 --- qubes/storage/file.py | 3 --- qubes/tests/storage_file.py | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/qubes/storage/file.py b/qubes/storage/file.py index 928e111d..ae56d920 100644 --- a/qubes/storage/file.py +++ b/qubes/storage/file.py @@ -164,9 +164,6 @@ class FileVolume(qubes.storage.Volume): 'Volume size must be > 0' if not self.snap_on_start: create_sparse_file(self.path, self.size) - # path_cow not needed only in volatile volume - if self.save_on_stop or self.snap_on_start: - create_sparse_file(self.path_cow, self.size) def remove(self): if not self.snap_on_start: diff --git a/qubes/tests/storage_file.py b/qubes/tests/storage_file.py index 4987c7a9..fea11d85 100644 --- a/qubes/tests/storage_file.py +++ b/qubes/tests/storage_file.py @@ -406,8 +406,7 @@ class TC_03_FilePool(qubes.tests.QubesTestCase): expected_private_path) expected_rootcow_path = os.path.join(expected_vmdir, 'root-cow.img') - self.assertEqualAndExists(vm.volumes['root'].path_cow, - expected_rootcow_path) + self.assertEqual(vm.volumes['root'].path_cow, expected_rootcow_path) def assertEqualAndExists(self, result_path, expected_path): """ Check if the ``result_path``, matches ``expected_path`` and exists.