Commit Graph

6150 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
46cc4ca910
tests: collect detailed diagnostics on failure
Help debugging test failures by collecting detailed information on
failure. It will be logger to the standard logger, which will end up
either on stderr or in journalctl.
2020-08-08 20:36:42 +02:00
Marek Marczykowski-Górecki
8b076dfe5f
tests: workaround a race in qrexec test
qrexec-client-vm may return earlier than it's child process (it exits
right away, without waiting for its child). Add a small wait before
reading exit code from a file.
2020-08-08 19:22:26 +02:00
Marek Marczykowski-Górecki
6d50546bd0
Merge branch 'paranoid-restore'
* paranoid-restore:
  tests: paranoid backup restore
  Add policy for paranoid mode backup restore
  Add an extension preventing starting a VM while it's being restored
  Add support for 'tag-created-vm-with' feature
2020-08-07 02:02:32 +02:00
Marek Marczykowski-Górecki
1abf949faf
tests: fix audio recording test
To calculate frequency it needs to use samples per second (44100), not
samples pre recording lenght. This caused shorter recordings to not fit
into the margin.
2020-08-07 01:55:10 +02:00
Marta Marczykowska-Górecka
ebb1cf6e78
Added icon property to AdminVM
To provide greater visual distinctiveness to AdminVMs, now they will
have their own icons.

requires https://github.com/QubesOS/qubes-artwork/pull/20
fixes QubesOS/qubes-issues#3853
2020-08-06 21:40:07 +02:00
Marek Marczykowski-Górecki
2a1e5a2af9
Merge remote-tracking branch 'origin/pr/363'
* origin/pr/363:
  vm/adminvm: adjust exception raised by AdminVM.start()
2020-08-06 05:42:07 +02:00
Marek Marczykowski-Górecki
512ff8e8b8
Merge remote-tracking branch 'origin/pr/362'
* origin/pr/362:
  Fixed property-reset event not firing for default_dispvm global property
2020-08-06 05:41:30 +02:00
Marek Marczykowski-Górecki
117724a772
tests: paranoid backup restore
QubesOS/qubes-issues#5310
2020-08-06 04:23:04 +02:00
Marek Marczykowski-Górecki
e73320533f
Add policy for paranoid mode backup restore
Policy allows a VM with 'backup-restore-mgmt' tag to create VMs, and
then manage VMs with 'backup-restore-in-progress' tag (which is added by
AdminExtension, based on 'tag-created-vm-with' feature).

VM with 'backup-restore-mgmt' tag can also call qubes.RestoreById
service to a VM with 'backup-restore-storage' tag. This service allows
to retrieve backup archive.

QubesOS/qubes-issues#5310
2020-08-06 04:23:03 +02:00
Marek Marczykowski-Górecki
3815e0b5cf
tests: make qvm-sync-clock test more reliable
Compare the time with the "current" time retrieved from ClockVM just
before comparing, not with the test start time. This should work even if
the test machine is quite slow (test taking more than 30s).
2020-08-06 03:27:40 +02:00
3hhh
9e26bfd432
tests/lvm & callback: remove explicit class references 2020-08-05 16:56:02 +02:00
Marek Marczykowski-Górecki
0eb458109c
vm/adminvm: adjust exception raised by AdminVM.start()
Behave like any other running domain - raise
qubes.exc.QubesVMNotHaltedError instead of generic
qubes.exc.QubesVMError.
2020-08-05 04:38:59 +02:00
Marta Marczykowska-Górecka
f35a7a78b3
Fixed property-reset event not firing for default_dispvm global property
fixes QubesOS/qubes-issues#5977
2020-08-03 22:12:02 +02:00
Marek Marczykowski-Górecki
2cdba05c99
Add an extension preventing starting a VM while it's being restored
Do not allow starting a VM while the restoring management VM has still
control over it. Specifically, that restoring VM will not be able to
start just restored VM.

QubesOS/qubes-issues#5310
2020-08-03 04:38:11 +02:00
Marek Marczykowski-Górecki
6f87f310db
Add support for 'tag-created-vm-with' feature
When a VM with 'tag-created-vm-with' feature set creates a VM (using
Admin API), that VM will get all the tags listed in the feature.
Multiple tags can be separated with spaces.

This will be useful to tag VMs created during paranoid mode backup
restore.

QubesOS/qubes-issues#5310
2020-08-03 04:38:11 +02:00
3hhh
b95339ea27
storage/callback: remove the "word of caution"
As discussed in the PR, sync code will not be interrupted when run from
async code as long as Qubes OS doesn't run dedicated threads for async
& sync code. So there's simply no issue to be expected and thus no special
caution required.
2020-08-01 10:04:27 +02:00
3hhh
b9b86976f3
storage/callback: comment fixes 2020-07-29 19:45:35 +02:00
3hhh
2487d86c72
storage/callback: add the config ID as callback argument 2020-07-29 17:30:47 +02:00
3hhh
536e12d80c
storage/callback: some callbacks added & removed
Added:
post_volume_create & post_volume_import as requested by Marek

Removed:
post_ctor as this wasn't really useful anyway, but required a lot of
sync code. Without it, some refactoring & potential async improvements
became possible.
2020-07-29 17:06:23 +02:00
3hhh
fd3a56e0cb
tests/lvm & callback: Refactoring
Mostly to avoid re-writing storage_lvm globals in storage_callback
tests.
2020-07-28 18:44:16 +02:00
3hhh
3db5e9f8bf
Revert "storage/callback: do not run sync code async"
This reverts commit 287a4a0429.

As Marek correctly pointed out, sync functions cannot be run async against one another even if run inside an async function
(the python interpreter will remain active until the next yield and that's at the end of the sync func / inside the async function).
--> So there's no need for a lock.

I still cannot protect against assumptions made by sync code authors about blocking the Qubes OS main loop. Those will be broken.

Moreover the code of this commit was botched anyway.
2020-07-28 18:42:02 +02:00
Paweł Marczewski
4acf69e8ec
Add power state to get_system_info
For qrexec policy, to implement 'autostart'
(see QubesOS/qubes-issues#5952).
2020-07-23 13:32:16 +02:00
3hhh
fdceb064fe
tests/callback: ensure missing conf causes errors 2020-07-19 09:06:23 +02:00
3hhh
287a4a0429
storage/callback: do not run sync code async 2020-07-18 12:47:22 +02:00
3hhh
a53781b114
tests/callback: added callback-specific tests
This involved some further generalisation of the lvm tests.
2020-07-17 14:38:06 +02:00
3hhh
56c8d9d039
storage/callback: async Volume.export() & added Volume.export_end()
Fixes QubesOS/qubes-issues#5935
2020-07-16 17:02:19 +02:00
3hhh
42d62bb47e
storage/lvm: make the "hack" work with CallbackPool instances
CallbackPool instances are no ThinPool instances, but behave
identically, if their backend driver is a ThinPool instance.
2020-07-16 14:31:04 +02:00
3hhh
409ea88a66
storage/callback: add the backend_class property
This should be useful for devs to inspect the Callback* classes.
2020-07-16 14:31:04 +02:00
3hhh
527fa1ec20
tests/callback: add them to the rpm build 2020-07-16 14:31:03 +02:00
3hhh
e5838dbd97
storage/callback: various fixes
- Removed all own class attributes to avoid name clashes with delegated
class attributes.
- Implemented the previously missing Pool.usage_details property.
- Shadowed all class attributes as instance properties. This is required
as the parent classes enforce the class attributes upon the
CallbackPool & CallbackVolume classes, but they need to be delegated to
the class of the _cb_impl object. We also cannot implement them as class
attributes in CallbackVolume & CallbackPool as they need to work for
arbitrary backend drivers and two backend drivers must not interfere with
each other. Possible alternative: One could dynamically create classes.
2020-07-16 14:31:03 +02:00
3hhh
d9f1bced22
tests/callback: add rudimentary tests for the callback driver 2020-07-16 14:31:03 +02:00
3hhh
fe27b2a1eb
tests/lvm: make the tests re-usable for other drivers
in particular for the callback driver tests
2020-07-16 14:31:03 +02:00
3hhh
43fca80a5b
storage/callback: fix issues detected by pylint 2020-07-16 14:31:03 +02:00
3hhh
529e4bfbbf
storage/callback: volume callbacks now also rceive the source volume
as argument (if there's any)

This is useful for disposable VMs to identify from which template they
originate.
2020-07-16 14:31:03 +02:00
3hhh
57e7a02912
storage/callback: add a post_volume_start callback 2020-07-16 14:31:03 +02:00
3hhh
bf8ece8a0c
storage/callback: more succinct callback names
[pre|post]_[operation] should be more clear than
on_[operation]
2020-07-16 14:31:03 +02:00
3hhh
9de54ab242
storage/callback: make CallbackVolume a Volume
Unfortunately this appears to be necessary due to
various Qubes OS `assert` checks and to get `__str__()` et al
from the super class. It also means that we have to implement
all methods of the super class (in the future as well).
2020-07-16 14:31:03 +02:00
3hhh
178d4dd997
storage/callback: enforce CallbackPool as the pool attribute of delegated volumes
This fixes a bug preventing the use of the callback pool driver
with disposable VMs.
2020-07-16 14:31:03 +02:00
3hhh
caddc1c499
storage/callback: pylint: disable line-too-long 2020-07-16 14:31:03 +02:00
3hhh
889c9238fe
storage/callback: asyncio implementation 2020-07-16 14:31:03 +02:00
3hhh
170e5f5d7a
storage/callback: fix the rpm build 2020-07-16 14:31:03 +02:00
3hhh
eee800366d
storage/tests: expect the callback pool driver 2020-07-16 14:31:03 +02:00
3hhh
dab41ddcf7
storage/callback: comments 2020-07-16 14:31:03 +02:00
3hhh
a00b2d563a
storage/callback: use Qubes exceptions 2020-07-16 14:31:03 +02:00
3hhh
49dd8250c5
storage/callback: added sphinx attribute comments 2020-07-16 14:31:03 +02:00
3hhh
bbb596e3ee
storage/callback: initialize logger in __init__ 2020-07-16 14:31:02 +02:00
3hhh
5530265b27
storage/callback: make pylint happy 2020-07-16 14:31:02 +02:00
3hhh
efa0d7c257
storage/callback: more readable bash invocation 2020-07-16 14:31:02 +02:00
3hhh
746697ad2c
storage: added the callback pool driver 2020-07-16 14:31:02 +02:00
Marek Marczykowski-Górecki
784878f1f7
Merge remote-tracking branch 'origin/pr/359'
* origin/pr/359:
  Add tests for vm.volume.Clear.
  Use self.dest.storage.import* wrappers instead.
  Add admin.vm.volume.Clear call (QubesOS/qubes-issues#5946)
2020-07-16 03:44:46 +02:00