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
这个提交包含在:
Marek Marczykowski-Górecki 2017-07-25 05:32:45 +02:00
父节点 c5667791e8
当前提交 4208897146
找不到此签名对应的密钥
GPG 密钥 ID: 063938BA42CFA724
共有 2 个文件被更改,包括 1 次插入5 次删除

查看文件

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

查看文件

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