Commit Graph

2205 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
740a56781e
qmemman: Load default log-level value if not present in the config
Don't crash if the config wasn't updated.

Fixes QubesOS/qubes-issues#6427
2021-03-03 18:30:37 +01:00
Marek Marczykowski-Górecki
3b1e57dc73
Enable pylint for qubes.tools.qmemmand
Adjust the code to make pylint pass. It's just one part of qmemman, the
smalest one.
2021-03-03 18:30:37 +01:00
Rusty Bird
d4b1794c15
storage: avoid concurrent umask()
umask() modifies the whole process, which could lead to odd permission
problems in concurrent code. Use explicit fchmod() calls instead.

Preserve the legacy storage/file behavior of creating files 0o664 in
FileVolume.create() and 0o644 (from the normal qubesd umask) otherwise.
2021-02-15 15:14:03 +00:00
Rusty Bird
5d2fe7643c
storage/file: delete -cow.img.old on volume remove() 2021-02-15 14:10:47 +00:00
Rusty Bird
c7d74f2a63
storage/file: add is_outdated() that always returns False
Fixes QubesOS/qubes-issues#6398
2021-02-15 14:10:46 +00:00
Rusty Bird
87b9ed2a5f
storage/reflink: consistently use _io suffix 2021-02-15 14:10:45 +00:00
Rusty Bird
c56f06166b
storage/reflink: tweak FICLONE definition
Get rid of an otherwise unused module-level variable (HOST_MACHINE), and
show the relevant file (reflink.py) in the error message:

Traceback (most recent call last):
  File "/usr/bin/qubesd", line 2, in <module>
    from qubes.tools.qubesd import main
  File "/usr/lib/python3.8/site-packages/qubes/__init__.py", line 801, in <module>
    from qubes.app import Qubes
  File "/usr/lib/python3.8/site-packages/qubes/app.py", line 64, in <module>
    import qubes.storage.reflink
  File "/usr/lib/python3.8/site-packages/qubes/storage/reflink.py", line 46, in <module>
    FICLONE = {
KeyError: 'armv7l'
qubesd.service: Main process exited, code=exited, status=1/FAILURE
2021-02-15 14:10:44 +00:00
Rusty Bird
d1800f4960
vm/qubesvm: omit stray 'import qubes.storage.file' 2021-02-15 14:10:43 +00:00
Rusty Bird
7a43ee6ae2
utils: assume Fedora 18+ in dom0 2021-02-15 14:10:42 +00:00
Rusty Bird
7860c3b365
utils: "parallel" -> "concurrent" 2021-02-15 14:10:41 +00:00
Rusty Bird
e0fcbd3498
Drop obsolete core2 dvmdata/ and servicevms/ directories 2021-02-15 14:10:39 +00:00
Marek Marczykowski-Górecki
a1931057b6
Merge remote-tracking branch 'origin/pr/381'
* origin/pr/381:
  api/admin: add 'wait' parameter to admin.vm.Shutdown
2021-02-15 08:54:55 +01:00
donoban
d5e77066e9
Removed unused method get_loglevel_from_verbosity() 2021-02-13 00:47:44 +01:00
donoban
c9a0f4ea66
Parse logLevel from /etc/qmemman.conf 2021-02-13 00:38:52 +01:00
donoban
9571765b4c
Remove '/var/log/qmemman.log' backward compatiblity 2021-02-11 23:57:00 +01:00
Marek Marczykowski-Górecki
e1991d5c33
Merge remote-tracking branch 'origin/pr/389'
* origin/pr/389:
  app: save qubes.xml with utils.replace_file()
  app: use suppress() in simple cases
  firewall: save firewall.xml with utils.replace_file()
  utils: take tweaked helper functions from storage/reflink
  storage/reflink: quote logged filenames
2021-02-11 13:48:12 +01:00
Marek Marczykowski-Górecki
6abaa7b619
Merge remote-tracking branch 'origin/pr/390'
* origin/pr/390:
  Fix pylint invalid-overridden-method warning
  Fix asyncio.Lock usage for Python 3.9+
  Fix formatting glitches after conversion to await
2021-02-11 13:15:45 +01:00
Rusty Bird
0ca5e87129
Fix pylint invalid-overridden-method warning
"Method 'start' was expected to be 'async', found it instead as
'non-async'"

QubesOS/qubes-issues#2738
2021-02-11 11:17:43 +00:00
Rusty Bird
a7fe59449a
Fix asyncio.Lock usage for Python 3.9+
'with (yield from alock):' is incompatible with Python 3.9+.

Change it to 'async with alock:', and then change the affected functions
to 'async def'.

This makes the test suite pass again in a Fedora 33 VM.

QubesOS/qubes-issues#2738
2021-02-11 11:17:41 +00:00
Rusty Bird
7a91af9b2c
Fix formatting glitches after conversion to await
QubesOS/qubes-issues#2738
2021-02-11 11:17:40 +00:00
Marek Marczykowski-Górecki
0605a1197a
Merge remote-tracking branch 'origin/pr/386'
* origin/pr/386:
  log: don't write to qubes.log or vm-*.log, only stderr
  log: remove unused DBusHandler
  log: avoid qubesd restart on logrotate
  log: remove orphaned LOGFILE variable
2021-02-11 11:32:07 +01:00
Marek Marczykowski-Górecki
df7cd63bd1
Merge remote-tracking branch 'origin/pr/384'
* origin/pr/384:
  storage/file: fix is_dirty() false positive
  storage/file: refactor is_dirty()
2021-02-11 11:26:53 +01:00
Rusty Bird
05eb051193
storage/file: fix is_dirty() false positive
is_dirty() returned a false positive if the volume was merely the source
of a currently running volume. For example, if fedora-33:root was the
source volume for myappvm:root and myappvm was running - then is_dirty()
returned True for fedora-33:root, because fedora-33/root-cow.img
contains some allocated blocks (one 256 KiB chunk containing only the
header) in this scenario, even though fedora-33 is shut down.

Fixes QubesOS/qubes-issues#6371
2021-02-11 09:34:48 +00:00
Shawn Anastasio
801a8f7154
storage/reflink: Add IOCTL definitions for ppc64le
Update the hardcoded x86_64-only IOCTL constants to match the correct
values for the host architecture.
2021-02-10 15:42:20 -06:00
Rusty Bird
12d117b20a
app: save qubes.xml with utils.replace_file()
That takes care of the missing fsync() calls.

Fixes QubesOS/qubes-issues#3376
2021-02-10 12:58:02 +00:00
Rusty Bird
9b6d082673
app: use suppress() in simple cases 2021-02-10 12:58:01 +00:00
Rusty Bird
7159f206a5
firewall: save firewall.xml with utils.replace_file()
Don't rewrite the file in-place.

Also change the error message from 'save error' to 'firewall save
error'.
2021-02-10 12:58:00 +00:00
Rusty Bird
c988a2218b
utils: take tweaked helper functions from storage/reflink
replace_file(), rename_file(), and remove_file() now have optional
'logger' and 'log_level' (defaulting to DEBUG) arguments.

replace_file() now has a required 'permissions' and an optional
'close_on_success' (defaulting to True) argument. Also, it doesn't
create any directories; and in case of an exception, the tempfile is
removed even when closing it raises another exception.

remove_file() now returns a value: True if the file was removed, or
False if it already didn't exist.

(fsync_path() is unchanged.)

!!! After cherry-picking for release4.0, consider a fixup !!!
!!! adding 'import qubes.utils' to storage/reflink there  !!!
2021-02-10 12:47:09 +00:00
Rusty Bird
6c8fb4180b
storage/reflink: quote logged filenames 2021-02-10 12:47:07 +00:00
Rusty Bird
7c5988f696
log: don't write to qubes.log or vm-*.log, only stderr 2021-02-05 18:39:17 +00:00
Rusty Bird
761d752363
log: remove unused DBusHandler 2021-02-05 18:39:16 +00:00
Rusty Bird
bb6e73c43e
log: avoid qubesd restart on logrotate
Fixes QubesOS/qubes-issues#5004
2021-02-04 18:21:55 +00:00
Rusty Bird
c2c8db066e
log: remove orphaned LOGFILE variable 2021-02-04 13:10:19 +00:00
Rusty Bird
796e6f5096
storage/file: refactor is_dirty() 2021-01-29 18:13:29 +00:00
Marek Marczykowski-Górecki
6d11388807
api/admin: add 'wait' parameter to admin.vm.Shutdown
Add support for blocking shutdown call. This adds a symmetry to
admin.vm.Start call which is blocking.
Since the admin.vm.Shutdown has established semantic already, add a
'wait' parameter. It can be combined with 'force' as 'force+wait' (or
the other way around).
2021-01-13 02:06:16 +01:00
Marek Marczykowski-Górecki
2bc3393fce
tests: skip pvgrub tests on Fedora
Fedora compresses the kernel with zstd now, which isn't suppported in
grub (as of 2.04). Since we don't care about PV that much anymore,
simply skip the test there.
2020-12-31 06:12:02 +01:00
Demi Marie Obenour
27c70bff05
make pylint happy 2020-11-27 20:29:15 -05:00
Demi Marie Obenour
8b8c17f8b8
Avoid permission problems 2020-11-27 20:05:18 -05:00
Demi Marie Obenour
88cb57ca7a
Fix tests for DispVMs 2020-11-27 19:32:53 -05:00
Demi Marie Obenour
13cd47ecb4
Try to get the tests to work
They fail because the root volume is not actually updated.
2020-11-27 17:16:20 -05:00
Demi Marie Obenour
76cd08af00
Fix test suite
It failed to consider that the tests run outside of dom0.
2020-11-27 14:29:35 -05:00
Demi Marie Obenour
f4d93fd68e
Test that a DispVM’s template can be changed
Previously this raised a QubesValueError.
2020-11-27 14:29:34 -05:00
Demi Marie Obenour
9b3a598eff
DispVM has no “default_volume_config” property
Use “volume_config” (an instance property) instead
2020-11-27 14:29:34 -05:00
Demi Marie Obenour
d46657a244
Changing AppVM template breaks running DispVMs
So prevent changing a VM’s template if there are running DispVMs based
on it.
2020-11-27 14:29:30 -05:00
Demi Marie Obenour
e11f94b496
Implement changing the template of a DispVM 2020-11-27 14:28:02 -05:00
Marek Marczykowski-Górecki
39ef189a93
Merge remote-tracking branch 'origin/pr/354'
* origin/pr/354: (35 commits)
  tests/lvm: re-introduce POOL_CONF
  tests/lvm & callback: remove explicit class references
  storage/callback: remove the "word of caution"
  storage/callback: comment fixes
  storage/callback: add the config ID as callback argument
  storage/callback: some callbacks added & removed
  tests/lvm & callback: Refactoring
  Revert "storage/callback: do not run sync code async"
  tests/callback: ensure missing conf causes errors
  storage/callback: do not run sync code async
  tests/callback: added callback-specific tests
  storage/callback: async Volume.export() & added Volume.export_end()
  storage/lvm: make the "hack" work with CallbackPool instances
  storage/callback: add the backend_class property
  tests/callback: add them to the rpm build
  storage/callback: various fixes
  tests/callback: add rudimentary tests for the callback driver
  tests/lvm: make the tests re-usable for other drivers
  storage/callback: fix issues detected by pylint
  storage/callback: volume callbacks now also rceive the source volume as argument (if there's any)
  ...
2020-11-27 00:26:18 +01:00
Marek Marczykowski-Górecki
7ab1703a06
Merge remote-tracking branch 'origin/pr/375'
* origin/pr/375:
  Fix line lengths
  Return better error messages from file pool
  Fix bugs found by Rusty Bird
  Fix export locking
  Re-add dirty check in case qubesd is restarted
  File volumes are started NAND exported
  file pool: snapshotting dirty volume not supported
  Always snapshot in the FILE pool
2020-11-27 00:19:51 +01:00
Marek Marczykowski-Górecki
b3bb65d3b0
Merge branch 'tests20201030'
* tests20201030:
  tests: fix test_550_ipv6_spoof_ip
  tests: wait for full VM startup before testing network and few other
  tests: fix logging network info on failed test
  tests: use dup-ed stdin in wait_on_fail
  tests: add PVH grub2 tests
  tests: adjust for applications list stored in features dict
  tests: remove test_030_clone
  tests: make sure dnsmasq is stopped before starting it again
  tests: fail the test early if VM fails to start
2020-11-26 22:44:39 +01:00
Demi Marie Obenour
542fee173d
Fix line lengths 2020-11-26 13:40:07 -05:00
Demi Marie Obenour
09785449ed
Return better error messages from file pool
A `qubes.storage.StoragePoolException` will be returned as a useful
error from `qvm-backup`.
2020-11-26 11:17:33 -05:00