Make AppVM/DispVM root volume rw to avoid CoW-on-CoW

This commit is contained in:
Rusty Bird 2018-02-12 21:20:04 +00:00
parent 9b5256f002
commit 7a75e1090d
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF
4 changed files with 11 additions and 7 deletions

View File

@ -9,14 +9,18 @@ possible to register additional 3rd-party drivers.
Domain's storage volumes: Domain's storage volumes:
- `root` - this is where operating system is installed. The volume is - `root` - this is where operating system is installed. The volume is
available read-write to :py:class:`~qubes.vm.templatevm.TemplateVM` and available read-write to all domain classes. It could be made read-only for
:py:class:`~qubes.vm.standalonevm.StandaloneVM`, and read-only to others :py:class:`~qubes.vm.appvm.AppVM` and :py:class:`~qubes.vm.dispvm.DispVM` to
(:py:class:`~qubes.vm.appvm.AppVM` and :py:class:`~qubes.vm.dispvm.DispVM`). implement an untrusted storage domain in the future, but doing so will cause
such VMs to set up a device-mapper based copy-on-write layer that redirects
writes to the `volatile` volume. Whose storage driver may already do CoW,
leading to an inefficient CoW-on-CoW setup. For this reason, `root` is
currently read-write in all cases.
- `private` - this is where domain's data live. The volume is available - `private` - this is where domain's data live. The volume is available
read-write to all domain classes (including :py:class:`~qubes.vm.dispvm.DispVM`, read-write to all domain classes (including :py:class:`~qubes.vm.dispvm.DispVM`,
but data written there is discarded on domain shutdown). but data written there is discarded on domain shutdown).
- `volatile` - this is used for any data that do not to persist. This include - `volatile` - this is used for any data that do not to persist. This include
swap, copy-on-write layer for `root` volume etc. swap, copy-on-write layer for a future read-only `root` volume etc.
- `kernel` - domain boot files - operating system kernel, initial ramdisk, - `kernel` - domain boot files - operating system kernel, initial ramdisk,
kernel modules etc. This volume is provided read-only and should be provided by kernel modules etc. This volume is provided read-only and should be provided by
a storage pool respecting :py:attr:`qubes.vm.qubesvm.QubesVM.kernel` property. a storage pool respecting :py:attr:`qubes.vm.qubesvm.QubesVM.kernel` property.

View File

@ -274,7 +274,7 @@ class TC_01_FileVolumes(qubes.tests.QubesTestCase):
expected = template_dir + '/root.img:' + \ expected = template_dir + '/root.img:' + \
template_dir + '/root-cow.img:' + \ template_dir + '/root-cow.img:' + \
vm_dir + '/root-cow.img' vm_dir + '/root-cow.img'
self.assertVolumePath(vm, 'root', expected, rw=False) self.assertVolumePath(vm, 'root', expected, rw=True)
expected = vm_dir + '/private.img:' + \ expected = vm_dir + '/private.img:' + \
vm_dir + '/private-cow.img' vm_dir + '/private-cow.img'
self.assertVolumePath(vm, 'private', expected, rw=True) self.assertVolumePath(vm, 'private', expected, rw=True)

View File

@ -45,7 +45,7 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
'name': 'root', 'name': 'root',
'snap_on_start': True, 'snap_on_start': True,
'save_on_stop': False, 'save_on_stop': False,
'rw': False, 'rw': True,
'source': None, 'source': None,
}, },
'private': { 'private': {

View File

@ -47,7 +47,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
'name': 'root', 'name': 'root',
'snap_on_start': True, 'snap_on_start': True,
'save_on_stop': False, 'save_on_stop': False,
'rw': False, 'rw': True,
'source': None, 'source': None,
}, },
'private': { 'private': {