Commit Graph

186 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
489efce9cb
Merge remote-tracking branch 'origin/pr/99'
* origin/pr/99:
  devices: add missing docstring for _get_device_classes
  devices: make iteration device classes compatible with Python2
  tools/qvm-device: make PEP8 happy
  tests/devices: add test for handling listing device classes
  tests/devices: make PEP8 happy
  devices: handle listing of available device classes
  devices: make PEP8 happy
2019-08-08 14:13:38 +02:00
Frédéric Pierret (fepitre)
174f155d31
tools/qvm-device: make PEP8 happy 2019-08-06 15:15:12 +02:00
Marek Marczykowski-Górecki
e700af9eb2
tools/qvm-volume: add 'import' action
Add support for importing volume data with qvm-volume tool.
This could be also used to clear volume by issuing:

    qvm-volume import --no-resize some-vm:private /dev/null

QubesOS/qubes-issues#5192
2019-07-29 22:20:06 +02:00
Marek Marczykowski-Górecki
fdc632c959
tools: reset private volume when importing template over existing one
Reinstalling template is a recommended way to get it back to a clean
state after potential compromise. In that case it is essential to
discard any persistent storage of old template, as it could be used by
the attacker to re-compromise it after reinstall.
Do this similar as root volume is overridden - via volume import
function.

Fixes QubesOS/qubes-issues#5192
2019-07-29 22:20:06 +02:00
Malte Leip
32538fa5ec
qvm-prefs: add --hide-default option 2019-05-29 20:32:13 +02:00
Conor Schaefer
40eeddbfc8
Adds docs for clone ignore_errors, feeds linter
Addresses review comments, specifically:

  * updates qvm-clone tests to handle ignore_errors option
  * adds manpage reference to new --ignore-errors option
  * trims line length in qvm-clone changes

All tests should now be passing, including the new qvm-clone
functionality.
2019-04-16 10:44:47 -07:00
Conor Schaefer
55a22e7955
Adds support for --ignore-errors to qvm-clone CLI
The underlying API already supported the `ignore_errors` param in
Python, now we just expose that option to the `qvm-clone` CLI.
2019-04-15 17:33:41 -07:00
Marek Marczykowski-Górecki
d7430d42ce
Make pylint happy
no-else-raise warning
2019-03-07 03:17:29 +01:00
Marek Marczykowski-Górecki
fb910a71cf
tools/qvm-start: validate output of losetup command
QubesOS/qubes-issues#4860
2019-03-07 02:53:52 +01:00
Marek Marczykowski-Górecki
a2629b1239
tools/qvm-start: use vm.run_with_args to call losetup in the VM
This will fix handling filenames with spaces and shell special
characters.

Reported by @v6ak

Fixes QubesOS/qubes-issues#4860
2019-03-07 02:53:45 +01:00
Marek Marczykowski-Górecki
1145f70334
tools/qvm-backup: allow to disable compression
Specify compression explicitly in the backup profile, not only when
requested with --compress or --compress-filter.
This will allow to disable compression with --no-compress option, as the
default if no compression is specified in the profile is to use gzip.

Fixes QubesOS/qubes-issues#4803
2019-02-24 05:32:46 +01:00
Marek Marczykowski-Górecki
b1a191446a
tools/qvm-run: do not color the output unless --pass-io is used
Since no output from VM is passed (and even if it would, it's redirected
to /dev/null), there is no need to switch output color.
This fixes the case when qvm-run is started in background - the color
change would affect further shell output.

Fixes QubesOS/qubes-issues#4808
2019-02-11 19:23:35 +01:00
Marek Marczykowski-Górecki
a65ef425e1
tools/qvm-run: make -q affect 'command failed with code' message
Fixes QubesOS/qubes-issues#4616
2018-12-16 05:51:41 +01:00
Marek Marczykowski-Górecki
9061169f90
Merge branch 'devel-20181206' 2018-12-09 18:08:25 +01:00
Marek Marczykowski-Górecki
0bb35193b4
doc: fix rst syntax in documentation, including docstrings 2018-12-08 23:53:55 +01:00
GammaSQ
ce2fb96a4b
diff doesn't set template 2018-12-08 12:29:48 +01:00
Marek Marczykowski-Górecki
415f5faae9
tools/qvm-run: factor out actual process running into separate function
Pylint complains that main() is too long and that's indeed true. Factor
out single process call (together with all the prepartion) into separate
function and keep only common code in main().
2018-12-08 00:44:18 +01:00
Marek Marczykowski-Górecki
5fe6ffc04c
tools/qvm-create: reject --root-{move,copy}-from with template-based qubes
Fixes QubesOS/qubes-issues#4424
2018-12-08 00:44:18 +01:00
Marek Marczykowski-Górecki
f03937c51e
tools: remove extra debug 2018-12-08 00:44:18 +01:00
Marek Marczykowski-Górecki
bee55a3bce
tools/qvm-device: allow detaching all devices
QubesOS/qubes-issues#4530
2018-12-08 00:44:18 +01:00
Marek Marczykowski-Górecki
954ffc4bf2
tools/qvm-run: add error message if command in VM failed
Print some error even without --pass-io, otherwise the only way to learn
the failure is checking $?, as no other visual sign is there.

Fixes QubesOS/qubes-issues#4533
2018-12-08 00:44:18 +01:00
Marek Marczykowski-Górecki
4b00ef7ec7
tools/qvm-run: fix error reporting on qvm-run -n on halted qube
Fixes QubesOS/qubes-issues#4476
2018-12-08 00:44:18 +01:00
Marek Marczykowski-Górecki
d34b1bfc4f
tools/qvm-run: factor out print_no_color function
Will be useful for other messages that should not be in red.
2018-12-08 00:44:18 +01:00
Marek Marczykowski-Górecki
32cbc59ba9
tools/qvm-run: handle Ctrl+C nicely
Do not exit with ugly python backtrace, simply interrupt the command
(propagate SIGINT) and exit.

QubesOS/qubes-issues#4532
2018-12-08 00:44:17 +01:00
Marek Marczykowski-Górecki
9acce13a35
tools: fix qvm-run --pass-io --localcmd=... vmname command
qubes.VMShell service, used by qvm-run, expects the command on the first
input line. Previously, when --localcmd was used, the command wasn't
written anywhere and the local command was connected directly to
qubes.VMShell service. And the first line of its output was interpreted
as a command.

Fix this by starting the local command separately, after sending the
command to qubes.VMShell service.

While at it, unify handling shell command and service calls in the process.
vm.run_service(..., localcmd= ) isn't that useful in general case,
because for qubes.VMShell the caller first need to send the command
before starting local process. Since the qvm-run tool needs to implement
manual starting localcmd anyway, don't use localcmd= run_service's
argument at all to unify calling methods.

There is slight behavior change: previously localcmd was started only
after establishing service connection (for example only if qrexec policy
allows), now it is started in all the cases.

Fixes QubesOS/qubes-issues#4040
2018-12-08 00:44:02 +01:00
GammaSQ
e55b530865
added --standalone and --disp shortcuts 2018-12-03 09:21:01 +01:00
Marek Marczykowski-Górecki
861e4fb04f
tools: clarify qvm-service --help 2018-10-29 05:27:05 +01:00
Marek Marczykowski-Górecki
5078d75aa3
tools/qvm-create: fix handling invalid label 2018-10-18 03:24:24 +02:00
Marek Marczykowski-Górecki
759fafea63
tools/qvm-create: properly create template-based StandaloneVM
By definition StandaloneVM is not linked to the template. Creating one
from a template is a clone operation. It's already possible using
qvm-clone tool, but it's logical to do that using qvm-create tool too.
This was the case in R3.2 too.

While adding this special case, skip cloning private volume, to preserve
behaviour of TemplateBaseVMs which do not inherit private volume either.

Fixes QubesOS/qubes-issues#3793
2018-10-18 03:24:15 +02:00
Patrik Hagara
4cd513757b
qvm-ls: add filtering by domain power state 2018-10-10 20:06:35 +02:00
Marek Marczykowski-Górecki
045bad13e7
tools/qvm-create: resize root volume if needed before imporing data
If file to be imported is larger than the default root volume, resize
the volume first. It might be also a good idea to shrink it when needed,
but currently the backend refuse it.

Fixes QubesOS/qubes-issues#3422
2018-09-05 04:29:36 +02:00
Patrik Hagara
cd4424235b
qvm-ls: add filtering by tags 2018-08-26 22:08:32 +02:00
Marta Marczykowska-Górecka
ad2a6e3408
Better information on error in qvm-remove
If qvm-remove fails because the VM is in use, it will display
information about where it is used.

fixes QubesOS/qubes-issues#3193
2018-07-20 00:21:47 +02:00
Marek Marczykowski-Górecki
87122e54c9
Merge branch 'windows-tools'
* windows-tools:
  doc: add info what properties are inherited from template
  Add 'gui-emulated' feature
  qvm-start-gui: fix handlign rpc-clipboard feature
2018-07-16 22:06:44 +02:00
Marek Marczykowski-Górecki
4d61407f5d
Add 'gui-emulated' feature
Add an explicit method for forcing emulated VGA output. Previously it
was possible only by removing `gui` feature (setting it to false had a
different effect), or enabling debug mode.
Using lack of a feature as a third state was a bad idea.

QubesOS/qubes-issues#3585
2018-07-16 04:25:56 +02:00
Marek Marczykowski-Górecki
16064f6fb4
Fixes for pylint 2.0
Ignore most of them - we still support python 2.7 here.
Fix no-else-return.
2018-07-16 02:25:25 +02:00
Marek Marczykowski-Górecki
72a2fd646d
tools/qvm-start-gui: do not crash on qubesd restart
Do not crash if qubesd restart exactly the moment event handler was
called.
Event listener properly handle qubesd restarts (reconnects), but exists
if any handler raise an exception. Avoid this by logging such exceptions
but not propagating them.
2018-07-14 03:31:03 +02:00
Marek Marczykowski-Górecki
95ce30a9e3
qvm-start-gui: fix handlign rpc-clipboard feature
Pass -Q option to both stubdoman's gui daemon and actual VM's gui
daemon.

QubesOS/qubes-issues#3585
2018-07-11 23:39:37 +02:00
Marek Marczykowski-Górecki
d995e2b213
Merge remote-tracking branch 'qubesos/pr/68'
* qubesos/pr/68:
  Add test of qvm_prefs for specal case "None"
  Change "None" in qvm_prefs
  Change "None" to Property None

Fixes QubesOS/qubes-issues#3942
2018-06-27 03:02:34 +02:00
Marek Marczykowski-Górecki
b359f9ca5e
tools: don't fail qvm-template-postprocess on shutdown race condition
It may happen that shutdown timeout expires at exact time that template
has stopped.
2018-06-27 02:24:03 +02:00
jimtahu
4156fa38a5
Change "None" in qvm_prefs
The string "none" is now changed to '' in qvm_prefs, and
only for certain properties (eg netvm).
2018-06-13 23:38:16 -05:00
Peter Gerber
b2a70f3794
tools/qvm-firewall: improve manpage and --help output 2018-05-03 01:03:35 +02:00
Peter Gerber
00fbfdd77a
tools/qvm-firewall: add dst4 and dst6 as synonyms for dsthost 2018-05-03 00:49:43 +02:00
Peter Gerber
ed9b42d5b4
tools/qvm-firewall: Show EXPIRE column in list output 2018-04-30 21:30:52 +02:00
Marek Marczykowski-Górecki
ab79bd2a44
tools/qvm-firewall: make 'list' a default action 2018-04-30 04:16:23 +02:00
Marek Marczykowski-Górecki
7f79075088
tools/qvm-firewall: add 'expire' rule support 2018-04-30 04:13:45 +02:00
Peter Gerber
e69b4fb1bd
tools/qvm-firewall: Describe available rules in --help output 2018-04-29 15:47:59 +02:00
Marek Marczykowski-Górecki
c75c0176dc
tools/qvm-template-postprocess: fix reinstall action
Do not remove template directory after reinstalling it in dom0.

Fixes QubesOS/qubes-issues#3169
2018-04-21 15:07:21 +02:00
Marek Marczykowski-Górecki
fbd5ca4150
tools/qvm-ls: add --kernel option for compatibility with R3.2
There was such option on Qubes 3.2, so add it here too. This is
especially useful for kernel package - preun script use it to verify if
given kernel isn't needed anymore.
2018-04-21 02:51:31 +02:00
Marek Marczykowski-Górecki
90df051f4f
tools/qvm-pool: add --set to modify pool properties
Fixes QubesOS/qubes-issues#3256
2018-04-13 00:26:25 +02:00