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
Tento commit je obsažen v:
Marek Marczykowski-Górecki 2017-07-25 05:32:45 +02:00
rodič c5667791e8
revize 4208897146
V databázi nebyl nalezen žádný známý klíč pro tento podpis
ID GPG klíče: 063938BA42CFA724
2 změnil soubory, kde provedl 1 přidání a 5 odebrání

Zobrazit soubor

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

Zobrazit soubor

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