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
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-25 05:32:45 +02:00
parent c5667791e8
commit 4208897146
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 1 additions and 5 deletions

View File

@ -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:

View File

@ -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.