Commit Graph

637 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
37e4e4c6ca
tests: update yaml syntax in qvm-backup tests
yaml.safe_dump() finally produces canonical yaml output, not a
one-liner.
2019-04-16 23:10:38 +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
anadahz
2f1be16635
Remove policy option from man page
Firewall policy is now hardcoded to 'drop'.

QubesOS/qubes-issues#2869
2019-03-09 11:53:44 +00:00
Marek Marczykowski-Górecki
080935a6fd
doc: typo fix 2019-03-07 04:46:53 +01:00
Marek Marczykowski-Górecki
310a4f2090
version 4.0.25 2019-03-07 03:58:08 +01: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
05f0d4ca0f
Make vm.run_with_args working on python2
This part of the qubesadmin module still needs to be compatible with
python2.
2019-03-07 03:05:09 +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
a35cb46342
tests: vm.run, vm.run_with_args
QubesOS/qubes-issues#4850
2019-02-28 05:34:42 +01:00
Marek Marczykowski-Górecki
0092c0ac99
vm: add run_with_args method to call a single command with specific arguments
The method will ensure the parameters are properly handled as actual
separate arguments, regardless of shell special characters in them.
For now implement this with shlex.quote, later dedicated qrexec service
could be used.

QubesOS/qubes-issues#4850
2019-02-28 04:37:59 +01:00
Marek Marczykowski-Górecki
88ab55b940
events: simplify handling qubesd reconnect
Retry connection on any OSError, instead of only few selected error
types. For example PermissionError may happen too (when socket is
created, but before it gets appropriate mode), which wasn't listed.
2019-02-24 05:32:51 +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
5e4831ede4
backup: Do not try to attach devices during backup verification
The "restored" VM object will be discarded anyway, and it doesn't have
real 'attach' method.

Fixes QubesOS/qubes-issues#4830
2019-02-24 02:26:05 +01:00
Marek Marczykowski-Górecki
2ad9b57961
utils: include management_dispvm property when checking where VM is used
Fixes QubesOS/qubes-issues#4812
2019-02-24 02:26:05 +01:00
Marek Marczykowski-Górecki
bde60c154a
Bump Python version requirement for qvm-* to 3.5
Some of qvm-* tools do use asyncio and its API have changed between 3.4
and 3.5.
2019-02-12 02:17:38 +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
89ee4931fb
backup: do not fail restore if scrypt anticipate more time needed
For various reasons, decryption may be slower than initial encryption
(different hardware, different system load etc). Do not fail the restore
operation if scrypt anticipate it will take considerably more time or
memory, than while creating the backup (where the scrypt parameters were
originally set).

Thanks to @jharveyb for the report and suggested solution.
Fixes QubesOS/qubes-issues#4683
2019-01-09 19:09:44 +01:00
Marek Marczykowski-Górecki
61cc6b008e rpm: add R: python3-yaml, as needed by qvm-backup tool
Fixes QubesOS/qubes-issues#4666
2018-12-28 11:53:57 +01:00
Marek Marczykowski-Górecki
78b07aeda7 rpm: unify fedora and centos packaging
Use %{python3_pkgversion} instead of hardcoding python34
2018-12-28 11:53:13 +01:00
Marek Marczykowski-Górecki
9ed922a2f0
Merge remote-tracking branch 'origin/pr/87'
* origin/pr/87:
  fixed typo
2018-12-18 16:48:53 +01:00
Marek Marczykowski-Górecki
e6a7580831
doc: update meminfo-writer service note
It's not listed by qvm-service tool anymore.
2018-12-18 16:43:00 +01:00
GammaSQ
0d9fcb92ae
fixed typo
Signed-off-by: GammaSQ <doesnt.work@gmx.at>
2018-12-18 14:13:59 +01:00
Marek Marczykowski-Górecki
b40939b13c
version 4.0.24 2018-12-18 04:58:21 +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
351502635f
version 4.0.23 2018-12-09 18:33:27 +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
Marek Marczykowski-Górecki
57a98b97cb
doc: improve qvm-device man page
Move options after action.
Make note about `qvm-block`, `qvm-usb`, `qvm-pci` more visible.

Suggested by @GammaSQ
QubesOS/qubes-issues#4530
2018-12-08 23:29:25 +01:00
Marek Marczykowski-Górecki
558c5d4a7c
Merge remote-tracking branch 'origin/pr/84'
* origin/pr/84:
  Fixed typo in documentation
  Documentation is important! Added shortcuts to manpages
  added tests for shortcuts
  diff doesn't set template
  added --standalone and --disp shortcuts
2018-12-08 15:10:42 +01:00
GammaSQ
4ae683054f
Fixed typo in documentation 2018-12-08 14:37:59 +01:00
GammaSQ
b49f2b0768
Documentation is important! Added shortcuts to manpages 2018-12-08 13:42:17 +01:00
GammaSQ
b848625428
added tests for shortcuts 2018-12-08 12:38:26 +01:00
GammaSQ
ce2fb96a4b
diff doesn't set template 2018-12-08 12:29:48 +01:00
Marek Marczykowski-Górecki
4a727f1dfa
Merge remote-tracking branch 'origin/pr/85'
* origin/pr/85:
  isinstance instead of type
  reverted to comparing .index
  forgot braces
  forgot braces
  get_label now accepts integer and has correct return-type
2018-12-08 12:28:36 +01:00
GammaSQ
2c836c5adc
isinstance instead of type 2018-12-08 12:00:15 +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
e827e47926
Clone VM's volume into the same pool, unless overridden specifically
When cloning VM, create it in the same pool as the source one.
Previously it always used default pool, which means for example renaming
a VM in non-default pool moved it back to the default one.

Fixes QubesOS/qubes-issues#4145
Fixes QubesOS/qubes-issues#4523
2018-12-08 00:44:18 +01:00
Marek Marczykowski-Górecki
1c82441781
doc: add 'permissive' PCI device option and 'mic' device class
QubesOS/qubes-issues#4530
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
Marek Marczykowski-Górecki
e6202d496d
tests/tools: improve qvm-run tests
Fix most FD/process leaks, make qvm-run --passio tests working (as much
as possible).
2018-12-07 23:55:03 +01:00
Marek Marczykowski-Górecki
1d877742ae
tests/tools: extend vm.run_service() mockup
Handle stdout/stderr arguments and provide file-like objects when
requested.
2018-12-07 04:25:00 +01:00