Commit Graph

102 Commits

Author SHA1 Message Date
Rusty Bird
2d8bade8b2
qvm-backup-restore: really pass options 2018-02-23 02:09:04 +00:00
Marek Marczykowski-Górecki
060171f19f
tests: dom0 backup restore, both v3 and v4
QubesOS/qubes-issues#3467
2018-02-14 04:28:23 +01:00
Marek Marczykowski-Górecki
3d4f626515
Merge remote-tracking branch 'qubesos/pr/51'
* qubesos/pr/51:
  qvm-run: wait for X11 in --dispvm --gui case
  vm/DispVM: use 'qrexec_timeout' also for call connection timeout
2018-01-15 03:23:54 +01:00
Marek Marczykowski-Górecki
4a28c560d9
Merge remote-tracking branch 'qubesos/pr/50'
* qubesos/pr/50:
  Add property_get_default method
2018-01-15 03:23:00 +01:00
Rusty Bird
c83deccdd3
qvm-run: wait for X11 in --dispvm --gui case
'qvm-run --dispvm' cannot easily make a separate qubes.WaitForSession
call. Instead, if --gui is active, pass the new WaitForSession argument
to qubes.VMShell, which will do the equivalent.

The unit tests have been copied (in slightly adapted form) from commit
a620f02e2a

Fixes QubesOS/qubes-issues#3012
Closes QubesOS/qubes-core-admin-client#49
2018-01-14 18:36:46 +00:00
Marek Marczykowski-Górecki
c98b33bcd6
vm/DispVM: use 'qrexec_timeout' also for call connection timeout
When calling a service in DispVM, the connection is established only
after session is ready (if required for given service). qrexec-client by
default use 5s here, which is too low depending on hardware. Use
'qrexec_timeout' property here for DispVM case.

Fixes QubesOS/qubes-issues#3012
2018-01-14 18:36:24 +00:00
Marek Marczykowski-Górecki
ce0d230866
Add property_get_default method
It is useful to get property default value, without changing it to
default. For example to list it in GUI tools

Fixes QubesOS/qubes-issues#3197
2018-01-12 23:40:05 +01:00
Marek Marczykowski-Górecki
04f8d85819
base: make WrapperObjectsCollection behave like a dict
In core-admin matching collections are real dicts, so clone this API
behaviour here too. Specific changes:
 - iteration yields keys, not values
 - implement values and items methods

Additionally fix keys method, it was broken on python2 (list have no
copy method).
2018-01-12 05:29:40 +01:00
Marek Marczykowski-Górecki
080b563ae2
tools/qvm-ls: add --raw-list option for compatibility with R3.2
There was an option to list just VM names, useful for scripting.
Preserve that for compatibility.
2018-01-12 05:29:39 +01:00
Marek Marczykowski-Górecki
0533703ddf
tools/qvm-ls: allow list only selected VMs
Restore possibility to list only some VMs, by naming them on command
line.
2018-01-12 05:29:39 +01:00
Marek Marczykowski-Górecki
51a89a9e77
Merge remote-tracking branch 'qubesos/pr/44'
* qubesos/pr/44:
  Fix style else-return
  tests: update qvm-template-process and qvm-remove tests
  Add --force to manpage.
  Avoid cloning installed_by_rpm
  Print vm list before prompt
  Use --force instead of --yes
  Toggle installed_by_rpm in template tool
  Fix error message grammar
  Add --yes option and confirm prompt.
2018-01-06 14:54:32 +01:00
Marek Marczykowski-Górecki
75a433f07a
tests: update qvm-template-process and qvm-remove tests 2018-01-06 03:40:51 +01:00
Marek Marczykowski-Górecki
0e033645ad
backup: restore Qubes 3.x VMs as HVMs
Make use of better security of Qubes 4.x by using HVM by default. If
some VMs are incompatible with it (like MirageOS based), user can always
switch it to PV manually later.
2018-01-04 23:39:31 +01:00
Marek Marczykowski-Górecki
917df5a8c5
tools/qvm-ls: fix handling columns with underscore
Mangling column type was inconsistent, resulting in
KeyError('VIRT_MODE').
2017-12-29 03:24:22 +01:00
Marek Marczykowski-Górecki
8ebcb438dd
tests: update tests for fixed verify_only handling 2017-12-10 22:39:19 +01:00
Marek Marczykowski-Górecki
01114e828b
tests: fix tests after dropping unnecessary admin.label.List call 2017-12-05 22:56:37 +01:00
Marek Marczykowski-Górecki
5b7ea16808
tests: make filter-esc tests working also on travis
There stderr is not a tty, so filtering isn't turned on by default. Mock
os.isatty() to fake it.
2017-12-05 22:56:37 +01:00
Marek Marczykowski-Górecki
afc9e645fa
tests: Update tests after fix for filtering stderr 2017-12-05 22:20:53 +01:00
Marek Marczykowski-Górecki
7bcab46f96
tools/qvm-shutdown: fix handling shutdown timeout for multiple VMs
When some VM timeout on shutdown, the tool will try to kill all of them,
but at this point some of them may be already powered off (not all
hanged during shutdown, but only some). Handle this
situation instead of crashing. And add appropriate test.
2017-10-28 22:40:24 +02:00
Marek Marczykowski-Górecki
8981e71b88
tools: fix handling qvm-run --no-autostart
Fixes QubesOS/qubes-issues#3083
2017-10-19 14:55:33 +02:00
Marek Marczykowski-Górecki
f89d67c3e3
backup: improve migrating templates from Qubes 3.x
In Qubes 3.x any PV template had qrexec-agent and gui-agent installed.
Adjust features appropriately while restoring them.
2017-10-19 14:54:30 +02:00
Marek Marczykowski-Górecki
a6ff459a1d
tests: multi-part volume in backup tests
Create on of VM's disk volumes big enough to split it into multiple
parts. To do that, add a test of uncompressed backup.

QubesOS/qubes-issues#3167
2017-10-16 04:11:04 +02:00
Marek Marczykowski-Górecki
7a6e8d04b8
backup: improve restoring HVMs from Qubes 3.2
Set kernel to '' - boot from VM's own bootloader.
Keep it on MiniOS-based stubdomain - otherwise Windows would not boot.
2017-10-16 04:11:04 +02:00
Marek Marczykowski-Górecki
d1eab2d4f5
backup: update DispVM template property: template_for_dispvms
It was renamed from 'dispvm_allowed'.

QubesOS/qubes-issues#3047
2017-10-16 04:11:03 +02:00
Marek Marczykowski-Górecki
001b42f7d8
backup: fix name of meminfo-writer feature
It's 'service.meminfo-writer'.
2017-10-16 04:11:02 +02:00
Marek Marczykowski-Górecki
0187588531
tools: adjust qvm-start message and logic, update tests
QubesOS/qubes-issues#3130
2017-10-08 18:17:03 +02:00
Marek Marczykowski-Górecki
559cc9b0d6
tools/qvm-start: fix starting a VM with cdrom image
1. Output of `losetup` command contains `\n` - strip it.
2. Provide read-only option - if device info hasn't propagated to qubesd
yet, it will not be set automatically.

Fixes QubesOS/qubes-issues#3146
2017-10-04 15:18:28 +02:00
Marek Marczykowski-Górecki
8476afc306
tools: finish 'qvm-volume revert' implementation, add tests
It wasn't aware of snapshot identifier, fix that. Also update to use
VM:VOLUME syntax, not POOL:VID.
2017-10-02 21:12:17 +02:00
Marek Marczykowski-Górecki
edcaed537a
Always use QubesVM objects, instead of AppVM/TemplateVM etc
Very few calls at client side really needs VM class name. So, even in
non-blind mode use just QubesVM class, to avoid strange cases depending
on blind mode being enabled or not. Then, have VM class name in 'klass'
property. If known at object creation time, cache it, otherwise query
qubesd at first access.
2017-10-02 21:12:16 +02:00
Marek Marczykowski-Górecki
b28ddb6621
Implement "blind mode" to avoid listing objects
This allows to perform actions on objects (VM, storage etc), without
listing them. This is useful when calling VM have minimal permissions
and only selected actions are allowed.

This means that app.domains['some-name'] will not raise KeyError, even
when domain do not exists. But performing actual action (like
vm.start()) will fail in that case.
2017-09-20 20:18:59 +02:00
Marek Marczykowski-Górecki
5e2638ab5e
tools: restore qvm-start --cdrom and similar options
Booting a VM from cdrom require attaching the device before VM startup,
which is possible only in persistent mode. But for qvm-start --cdrom
adding a cdrom only temporarily, use new update_persistence() function
to convert the assignment to temporary one.

Fixes QubesOS/qubes-issues#3055
2017-09-05 08:33:47 +02:00
Marek Marczykowski-Górecki
1481dc4fb8
devices: client stub for DeviceCollection.update_persistent
QubesOS/qubes-issues#3055
2017-09-05 03:59:01 +02:00
Marek Marczykowski-Górecki
0fa374264f
tools: add qvm-create --help-classes
List available VM classes

QubesOS/qubes-issues#3017
2017-08-30 16:54:24 +02:00
Marek Marczykowski-Górecki
0464a3ebfc
tools: implement qvm-create --root-move-from/--root-copy-from 2017-08-30 16:54:23 +02:00
Marek Marczykowski-Górecki
5b7947b51a
Improve QubesDaemonNoResponseError error message
Include hint to look into dom0 logs

QubesOS/qubes-issues#3016
2017-08-12 15:15:52 +02:00
Marek Marczykowski-Górecki
188bc2799b
tests: add DispVM tests
Especially for one service call wrapper

QubesOS/qubes-issues#3016
2017-08-12 15:15:19 +02:00
Marek Marczykowski-Górecki
596eb3d96c
tools/qvm-run: ignore --filter-esc/--no-filter-esc unless --pass-io is given
If no VM output is printed on terminal, those options doesn't make sense
anyway.

Fixes QubesOS/qubes-issues#3013
2017-08-12 14:19:41 +02:00
Marek Marczykowski-Górecki
7d25f1bf2b
app: add VMCollection.values()
Let it behave more like a dict()
2017-08-09 04:04:26 +02:00
Marek Marczykowski-Górecki
37ae76823b
tools: add qvm-run --dispvm option
Add option to uniformly start new DispVM from either VM or Dom0. This
use DispVMWrapper, which translate it to either qrexec call to $dispvm,
or (in dom0) to appropriate Admin API call to create fresh DispVM
first.
This require abandoning registering --all and --exclude by
QubesArgumentParser, because we need to add --dispvm mutually exclusive
with those two. But actually handling those two options is still done by
QubesArgumentParser.

This also updates man page and tests.

Fixes QubesOS/qubes-issues#2974
2017-08-06 20:44:55 +02:00
Marek Marczykowski-Górecki
c4460751a9
tools/qvm-start-gui: do not start stubdomain GUI for VMs with gui-agent 2017-07-30 18:54:08 +02:00
Marek Marczykowski-Górecki
f48321dd98
Merge branch 'devel-6'
* devel-6:
  qvm-ls: fix total VM size reporting
  doc: update manpage of qvm-service
  tools: qvm-service tool
  tests: too much copy&paste
  features: serialize True as '1'
  tools/qvm-start-gui: add --force-stubdomain options
  tools/qvm-shutdown: fix help message
  tools/qvm-shutdown: drop --force option, it isn't supported anymore
2017-07-29 05:28:57 +02:00
Marek Marczykowski-Górecki
18153652f3
tools: qvm-service tool
This really use features, but keep compatibility with Qubes 3.x

Fixes QubesOS/qubes-issues#1227
2017-07-28 14:24:04 +02:00
Marek Marczykowski-Górecki
1000d7902d
tests: too much copy&paste 2017-07-28 13:56:39 +02:00
Marek Marczykowski-Górecki
0fae70be53
features: serialize True as '1'
Do the same as core-admin code.
2017-07-28 13:56:05 +02:00
Marek Marczykowski-Górecki
2d5d9d6d7d
tools: add qvm-backup tool
New qvm-backup tool can either use pre-existing backup profile
(--profile), or - when running in dom0 - can create new one based on
used options (--save-profile).

This commit add a tool itself, update its man page, and add tests for
it.

Fixes QubesOS/qubes-issues#2931
2017-07-21 03:58:18 +02:00
Marek Marczykowski-Górecki
d8af76ed60
backup: move BackupRestore class and helpers to 'restore' submodule
This breaks cyclic imports and also allow cleaner separation between
backup make and restore code.

No functional change.
2017-07-21 03:54:04 +02:00
Marek Marczykowski-Górecki
8d884a52e6
tests: disable slow tests unless ENABLE_SLOW_TESTS=1 is set 2017-07-21 03:54:04 +02:00
Marek Marczykowski-Górecki
c50fc21e44
tests: qvm-backup-restore tool tests
Very simple one, but also fix reporting errors detected by tests.
2017-07-21 03:54:04 +02:00
Marek Marczykowski-Górecki
3c9fb8dbac
tools/qvm-volume: fix default action handling 2017-07-21 03:10:02 +02:00
Marek Marczykowski-Górecki
ae0729fb53
storage: drop 'internal' volume property
Since external block devices use Devices API now, it isn't useful
anymore.

QubesOS/qubes-issues#2256
2017-07-21 03:10:01 +02:00