Commit Graph

228 Commits

Author SHA1 Message Date
Wojtek Porczyk
e720e1634b qubes/tools: rewrite qvm-shutdown
fixes QubesOS/qubes-issues#1228
2016-04-20 13:52:58 +02:00
Marek Marczykowski-Górecki
8c6fe7ed90
Merge remote-tracking branch 'origin/master' into core3-devel-mm 2016-04-11 13:03:12 +02:00
o
01bc257265 cleanup whitespace mess 2016-04-04 15:57:42 +02:00
o
b04d1ce005 new qvm-top utility
Display cpu and mem similar to qvm-ls but ordered by cpu time. Also a
one line summary switch which includes the top n cpu consuming vms and
total memory consumption. Intended usage is to e.g. embed in a window
manager widget.
2016-04-04 15:51:09 +02:00
o
958c292607 fix qvm-ls display of cpu_time
qhost.measure_cpu_usage expects the qvm_collection as parameter. Also
the number of vcpus of dom0 seems to be 0, leading to a div by 0. A more
complete fix would probably involve e.g. a new num_cores property which
would contain number of vcpu for vhosts and number of actual cores for
dom0.

For now this is a partial solution.
2016-04-04 15:30:22 +02:00
Danny Fullerton
efb5c1fd25 Fix --rename-conflicting option.
The code was fully implemented - and tested - but didn't worked from the cli.
2016-03-28 13:45:23 -04:00
Marek Marczykowski-Górecki
830444fefb
Merge remote-tracking branch 'qubesos/pr/20'
* qubesos/pr/20:
  qvm-backup/qvm-backup-restore: Allow reading pass phrase from file or stdin
2016-03-13 03:39:14 +01:00
Marek Marczykowski-Górecki
bc1c3c2cc0
Merge remote-tracking branch 'qubesos/pr/19'
* qubesos/pr/19:
  qvm-create: Don't allow the user to manually create dispNN names
2016-03-13 03:38:48 +01:00
Marek Marczykowski-Górecki
57f259700c
Merge remote-tracking branch 'qubesos/pr/18'
* qubesos/pr/18:
  filename sanitization
2016-03-13 03:38:16 +01:00
Jon Griffiths
63407b689e qvm-backup/qvm-backup-restore: Allow reading pass phrase from file or stdin
Passing -p/--passphrase-file uses the first line of the file passed,
or stdin if '-' is given. This works with piped input too.
2016-03-09 01:41:20 +13:00
Marek Marczykowski-Górecki
fae73e6373
qvm-sync-clock: clarify message on NTP call failed and --force used 2016-03-03 23:47:50 +01:00
Jon Griffiths
4dd87f2683 qvm-create: Don't allow the user to manually create dispNN names 2016-03-03 13:46:20 +13:00
Wojtek Porczyk
9eafa57539 Merge remote-tracking branch 'marmarek/master' into core3-devel
The following list is bollocks. There were many, many more.

Conflicts:
    core-modules/003QubesTemplateVm.py
    core-modules/005QubesNetVm.py
    core/qubes.py
    core/storage/__init__.py
    core/storage/xen.py
    doc/qvm-tools/qvm-pci.rst
    doc/qvm-tools/qvm-prefs.rst
    qubes/tools/qmemmand.py
    qvm-tools/qvm-create
    qvm-tools/qvm-prefs
    qvm-tools/qvm-start
    tests/__init__.py
    vm-config/xen-vm-template-hvm.xml

This commit took 2 days (26-27.01.2016) and put our friendship to test.
    --Wojtek and Marek
2016-03-03 01:13:51 +01:00
Zrubi
4ae52b037b filename sanitization 2016-02-25 15:05:06 +01:00
Marek Marczykowski-Górecki
3ece17a8cf
qvm-sync-clock: sync dom0 clock only when NTP sync succeeded, even with --force
Otherwise dom0 clock (initially almost ok) may be adjusted to totally
invalid timestamp of ClockVM (for example just after resume from S3
sleep).
2016-02-22 20:56:38 +01:00
Marek Marczykowski-Górecki
3f19157d2f
Merge remote-tracking branch 'qubesos/pr/16'
* qubesos/pr/16:
  new --force option for qvm-sync-clock to be able to bypass time sync errors
2016-02-22 20:44:30 +01:00
Jon Griffiths
9bd651faaa qvm-prefs: --get option was misspelled --gry 2016-02-18 16:01:08 +13:00
Zrubi
2fcd3c6832 new --force option for qvm-sync-clock to be able to bypass time sync errors 2016-02-10 14:55:11 +01:00
Marek Marczykowski-Górecki
0e273276d3
qvm-run: warn if --localcmd used without --pass-io 2016-02-08 05:01:50 +01:00
Marek Marczykowski-Górecki
6378e2bd20
qvm-run: allow --localcmd with --pass-io, even when --all is given
With --localcmd, stdin/out are connected to that local process (instead
of a terminal), so it doesn't conflict with --all.

QubesOS/qubes-issues#1728
2016-02-08 04:50:05 +01:00
Marek Marczykowski-Górecki
d2640b517f
backup: Allow to specify custom temporary directory
Using tmpfs-backed directory may speed up the backup process.

QubesOS/qubes-issues#1652
2016-01-20 03:35:35 +01:00
Wojtek Porczyk
f1a0b1af39 qubes/tools: add qvm-run, qvm-{,un}pause
Also change convention of calling main(): now command returns its
numeric value instead of bool.

Also fixed QSB#13

fixes QubesOS/qubes-issues#1226
2015-12-29 03:43:08 +01:00
Marek Marczykowski-Górecki
b8e40895b3
Add qvm-start --skip-if-running option
QubesOS/qubes-issues#1528
2015-12-26 11:31:56 +01:00
Marek Marczykowski-Górecki
1b5daea771
qvm-grow-root: add --allow-start option
In some (most) cases VM needs to be started to complete resize
operation. This may be unexpected, so make it clear and do not start the
VM when the user did not explicitly allow that.

Fixes QubesOS/qubes-issues#1268
2015-12-26 04:10:20 +01:00
Marek Marczykowski-Górecki
adb282ef8e
Implement qvm-shutdown --wait-time option
Flexible VM shutdown timeout option.

Fixes QubesOS/qubes-issues#1320
2015-12-26 02:14:28 +01:00
Bahtiar `kalkin-` Gadimov
8d3616689e PEP8 qvm-tools/qvm-clone 2015-12-07 11:03:51 +01:00
Bahtiar `kalkin-` Gadimov
65f00d8393 Remove unnecessary imports from qvm-clone 2015-12-07 10:59:44 +01:00
Bahtiar `kalkin-` Gadimov
bb754b68c3 Add pool support to qvm-clone 2015-12-07 10:50:01 +01:00
Marek Marczykowski-Górecki
cda6ae8751
qvm-pci: one more fix - save changes 2015-11-28 23:03:08 +01:00
Marek Marczykowski-Górecki
67ca619ee5
qvm-pci: fix PCI device id (BDF) regexp
Actually BDF is in hex...

Fixes QubesOS/qubes-issues#1461
2015-11-27 22:56:55 +01:00
Marek Marczykowski-Górecki
8725bdefb0
backup: add qvm-backup --compress-filter option
Custom compression program was supported for a long time. But there was
no option to use it...

Fixes QubesOS/qubes-issues#1459
2015-11-27 20:00:34 +01:00
Marek Marczykowski-Górecki
1e48beaf6f
backup: add qvm-backup-restore --rename-conflicting option
QubesOS/qubes-issues#869
2015-11-27 20:00:34 +01:00
Marek Marczykowski-Górecki
c6df81ccff
Merge remote-tracking branch 'qubesos/pr/6' 2015-11-25 01:34:36 +01:00
Marek Marczykowski-Górecki
c337494ba6
Add qvm-pci --add-class option for adding all devices of given class
This should reduce code duplication in most of initial setup like places
- currently firstboot and live image setup.
2015-11-25 01:34:15 +01:00
Bahtiar `kalkin-` Gadimov
348030bf9c Add --storage-pool option to qvm-create 2015-11-17 19:37:20 +01:00
Marek Marczykowski-Górecki
540fe3f552
core: set vm.uses_default_kernel=False when setting vm.kernel
Forgetting this leads to misterious errors (VM started with different
kernel than it was just set), so simplify the API.

Fixes QubesOS/qubes-issues#1400
2015-11-10 17:07:57 +01:00
Marek Marczykowski-Górecki
18edf4946c
dispvm: get rid of obsolete symlinks to dvm.conf
Separate config file is no longer created for DispVM - the configuration
is passed directly to libvirt.

Fixes QubesOS/qubes-issues#1314
2015-10-10 05:22:44 +02:00
Wojtek Porczyk
15713cbf46 qubes/tools: rewrite qvm-kill
Also new function, `error_runtime` for common parser.

fixes QubesOS/qubes-issues#1222
2015-10-05 18:06:02 +02:00
Wojtek Porczyk
c4da931a1d qvm-tools: remove unneeded stubs
Those stubs are now automagically created by setuptools
2015-10-05 12:46:14 +02:00
Wojtek Porczyk
6f4951d08a install python package with setuptools 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
b0be1ad584 qubes/tools: qvm-start rewritten from original 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
e7cba0214f qubes/tools: qvm-prefs 2015-10-05 12:46:13 +02:00
Marek Marczykowski-Górecki
28cc933c4c
qvm-prefs: fix validation of 'timezone' property
This should be done in QubesVm class (property setter). But since we're
going to rewrite both qvm-prefs and QubesVm, settle on smaller change
for now.

QubesOS/qubes-issues#1184
2015-10-05 05:56:16 +02:00
Marek Marczykowski-Górecki
d2617917be
qvm-prefs: refuse negative 'qrexec_timeout' value
This should be done in QubesVm class (property setter). But since we're
going to rewrite both qvm-prefs and QubesVm, settle on smaller change
for now.

Fixes QubesOS/qubes-issues#1273
2015-10-05 05:54:21 +02:00
Marek Marczykowski-Górecki
0e37ac617a
qvm-prefs: unify 'seamless_gui_mode' with other true/false properties 2015-10-05 05:53:48 +02:00
Marek Marczykowski-Górecki
7be7cf2c5e
qvm-prefs: fix setting dispvm_netvm to none
Fixes QubesOS/qubes-issues#1272
2015-10-05 05:53:04 +02:00
Marek Marczykowski-Górecki
16b8fa011b
qvm-prefs: fix display format of 'label' property
Fixes QubesOS/qubes-issues#1274
2015-10-05 05:52:35 +02:00
Patrick Schleizer
f4a38f0540 suggest to use 'yum remove' rather than 'rpm -e' for VM removal so avoid yum's warning of noticing rpm changes outside of yum 2015-08-10 18:02:18 +02:00
Marek Marczykowski-Górecki
46b94b6682
Make qubes-set-updates set also default state for new VMs
This makes possible to also check if the "updates check enabled" state
is consistent across VMs.

Fixes qubesos/qubes-issues#892
2015-08-05 01:04:43 +02:00
Marek Marczykowski-Górecki
fbfaa98b80
Implement offline mode in qubes-set-updates tool 2015-08-03 22:29:31 +02:00
Marek Marczykowski-Górecki
a425873e73
core: add offline mode to qvm-pci
Called on LiveUSB system before libvirtd starts.
2015-08-01 22:02:16 +02:00
Marek Marczykowski-Górecki
52d7de006b
do not print scary message when qvm-create --force-root is used 2015-08-01 21:58:43 +02:00
Marek Marczykowski-Górecki
90393c33f2
core: add offline mode to qvm-create, qvm-prefs
This is required to create VMs in process of building Live system, where
libvirt isn't running.

Additionally there is no udev in the build environment, so needs to
manually create /dev/loop*p* based on sysfs info.
2015-08-01 21:58:38 +02:00
Marek Marczykowski-Górecki
4a01c53787
qvm-tools: update qvm-trim-template for R3 block attach api 2015-07-22 05:46:12 +02:00
Marek Marczykowski-Górecki
b47c74c3a4 qvm-tools: fix usage info for qvm-template-commit 2015-07-08 05:58:29 +02:00
Marek Marczykowski-Górecki
6c167911f1 qvm-sync-clock: hide stdout in non-verbose mode 2015-07-08 01:59:49 +02:00
Marek Marczykowski-Górecki
5f9a30d335 qvm-sync-clock: use qubes.SetDateTime service instead of direct "date" call
This way it gives more control over time synchronization to the VM. For
example Whonix VMs can decide to not use this mechanism. Also VM can
choose how that time will be set (chronyc call?). And finally it will be
possible to implement the same for other OS-es (Windows).

Additionally because of calling date as "localcmd" each time, instead of
once at the beginning, time synchronization is more accurrate now. If
some VM stall the time set call, other VMs time will no longer be
affected (but still synchronization will be delayed).
2015-07-08 01:56:38 +02:00
Wojtek Porczyk
ff7d89700a qubes/tools: port qvm-create 2015-06-30 17:18:24 +02:00
Wojtek Porczyk
fd0107f11a new tool: qubes-create
At present it just creates default qubes.xml (empty barring labels and AdminVM).
In the future it can be evolved into backend for firstboot.
2015-06-29 17:39:28 +02:00
Wojtek Porczyk
6a4820c381 qubes/tools: qvm-ls 2015-06-29 17:39:28 +02:00
Jason Mehring
be3e888bbe Fixed typos 2015-06-29 17:39:26 +02:00
Marek Marczykowski-Górecki
f7c86f861c Prevent GUI usage in qvm-sync-clock 2015-06-23 00:15:21 +02:00
Zrubi
2c1889acbb YML output fix
(cherry picked from commit 53260bd66ba3f0b2cc62b9488d67cdcdb6cec1e8)
2015-06-12 10:25:02 +02:00
Zrubi
d43848d163 YML output fix
(cherry picked from commit 60cf12b4fdea0d119c1b8ca0c84f77bd4877f843)
2015-06-02 11:18:18 +02:00
Marek Marczykowski-Górecki
9cbf9a8a59 Add support for 'pci_strictreset' option
This allows to assign PCI device to the VM, even if it doesn't support
proper reset. The default behaviour (when the value is True) is to not
allow such attachment (VM will not start if such device is assigned).

Require libvirt patch for this option.
2015-05-28 00:11:17 +02:00
Marek Marczykowski-Górecki
acbdb3a261 qvm-tools: do not show scary message on --force-root
When this option is used, the user probably already got that message.
Also some internal scripts are using this (for example template
pre-uninstall script).

Conflicts:
	qvm-tools/qvm-remove
2015-05-23 04:43:51 +02:00
Marek Marczykowski-Górecki
8aaef404de qvm-prefs: add an option to get a single VM property
Could be useful for scripts
2015-05-15 03:22:06 +02:00
Zrubi
770cf5cce0 Wiki -> YML output format change + basic TPM detection
(cherry picked from commit 28097bfdf1e3220a9de295cb7621d611d4f0620b)
2015-05-10 03:29:20 +02:00
Marek Marczykowski-Górecki
1d69f2c24a qvm-tools: fix qvm-firewall -r 2015-04-28 15:00:50 +02:00
Marek Marczykowski-Górecki
c421dc2a95 Prevent concurrent qvm-sync-clock calls
In some cases qvm-sync-clock can take a long time (for example in case
of network problems, or when some do not responds). This can lead to
multiple qvm-sync-clock hanging for the same reason (blocking vchan
resources). To prevent that create a lock file and simply abort when one
instance is already running.
2015-04-28 15:00:50 +02:00
Marek Marczykowski-Górecki
08c8c919a5 minor indentation fix 2015-04-10 19:05:42 +02:00
Marek Marczykowski-Górecki
7516737fae core: Add "dispvm_netvm" property - NetVM for DispVMs started from a VM
This allows to specify tight network isolation for a VM, and finally
close one remaining way for leaking traffic around TorVM. Now when VM is
connected to for example TorVM, its DispVMs will be also connected
there.
The new property can be set to:
 - default (uses_default_dispvm_netvm=True) - use the same NetVM/ProxyVM as the
 calling VM itself - including none it that's the case
 - None - DispVMs will be network-isolated
 - some NetVM/ProxyVM - will be used, even if calling VM is network-isolated

Closes qubesos/qubes-issues#862
2015-04-04 21:47:31 +02:00
Marek Marczykowski-Górecki
999698bd68 core: rename create_xenstore_entries, get rid of xid parameter
It have nothing to do with xenstore, so change the name to not mislead.
Also get rid of unused "xid" parameter - we should use XID as little as
possible, because it is not a simple task to keep it current.
2015-03-28 22:36:28 +01:00
Marek Marczykowski-Górecki
6b05d5b392 Add qvm-trim-template tool
Based on work done by Matt McCutchen <matt@mattmccutchen.net>, details
here:
https://groups.google.com/d/msgid/qubes-users/1417939737.2033.24.camel%40localhost
2015-01-30 01:39:59 +01:00
Marek Marczykowski-Górecki
25c425920c qvm-tools: fix error reporting in qvm-kill 2015-01-30 01:38:56 +01:00
Marek Marczykowski-Górecki
73301a67c8 core: fix vm.run(..., passio=False) handling
Long time ago passio=True was used to replace current process with
qrexec-client directly (qvm-run --pass-io was the called), but this
behaviour is not used anymore (qvm-run was the only user). And this
option was left untouched, with misleading name - one would assume that
using passio=False should disallow any I/O, but this isn't the case.

Especially qvm-sync-clock is calling clockvm.run('...', wait=True),
default value for passio=False. This causes to output data from
untrusted VM, without sanitising terminal sequences, which can be fatal.

This patch changes passio semantic to actually do what it means - when
set to True - VM process will be able to interact with
stdin/stdout/stderr. But when set to False, all those FDs will be
connected to /dev/null.

Conflicts:
	core-modules/000QubesVm.py
2015-01-30 01:38:52 +01:00
Marek Marczykowski-Górecki
d4ab70ae9d core: update qvm-block code for HAL API
Use QubesDB to get list of devices, call libvirt methods to
attach/detach devices.
2014-12-12 03:59:01 +01:00
Zrubi
b4e0833cb7 qubes-hcl-report v2.2
- Network devices section added to HCL Info output
2014-12-05 19:33:17 +01:00
Zrubi
55fce5dd36 qubes-hcl-report v2.1
- script redesign,
- fixed VT-d, VT-x detection,
- Support File generation is optional,
- the results are kept in dom0 by default,
- version and usage info added.

(cherry picked from commit f5845b2df1db19da37f02ace24f29a82660c39ff)
2014-12-05 17:06:17 +01:00
Marek Marczykowski-Górecki
467477409d makefile/windows: install qvm-tools with .py extension
So system will automatically run them with python interpreter (wherever
it is installed). This require to have ".py" in PATHEXT variable.
2014-11-19 12:50:26 +01:00
Marek Marczykowski-Górecki
eaac99bf64 qvm-tools: check if running as root only on systems with os.geteuid 2014-11-19 12:50:26 +01:00
Marek Marczykowski-Górecki
0009805041 rpm+makefile: move build/install code to Makefile files
This makes build "scripts" not tied to Fedora-specific files. Especially
ease porting to other platforms.
2014-11-19 12:50:24 +01:00
Marek Marczykowski
5a28074c2b qvm-template-commit: add --offline-mode option
Allow force offline mode (disable check if VM isn't running) - useful
for running from anaconda (inside of chroot).
2014-11-19 12:48:27 +01:00
Marek Marczykowski
b8c62c0279 Wrap all VMM connection related object into QubesVMMConnection class
This makes easier to import right objects in submodules (only one
object). This also implement lazy connection - at first access, not at
module import, which speeds up tools, which doesn't need runtime
information (like qvm-prefs or qvm-service). In the future this will
ease migration from xenstore to QubesDB.

Also implement "offline mode" - operate on qubes.xml without connecting
to VMM - raise exception at such try.
This is needed to run tools during installation, where only minimal
set of services are started, especially no libvirt.
2014-11-19 12:48:26 +01:00
Marek Marczykowski-Górecki
19d064ca66 qvm-tools/qvm-run: do not echo empty line, remove unneeded imports 2014-11-10 02:25:27 +01:00
Marek Marczykowski-Górecki
ac155705d1 qvm-tools/qvm-run: remove --shutdown option
There is separate tool for this operation (qvm-shutdown). qvm-run
options related to shutdown (--wait, --force) can be confusing to the
user.
2014-11-10 02:24:43 +01:00
Marek Marczykowski-Górecki
96d5b47cce qvm-tools/qvm-backup: add --debug option 2014-09-26 14:42:25 +02:00
Marek Marczykowski-Górecki
68460fb272 qvm-tools/qvm-shutdown: handle domains with xl daemon killed (#903)
When system is going down, systemd kills all the users processes,
including 'xl' daemons waiting for domain shutdown. This results in
zombie domains not cleaned up. The proper fix would be somehow extract
those processes from user session scope (most likely by starting them as
a service).

But because it applies only to system shutdown (qvm-shutdown
call there), it is simpler to add appropriate handling code to
qvm-shutdown.

In R3 the problem will vanish, because of use libvirtd deamon, so no
user processes required to track domains state.
2014-09-26 02:18:42 +02:00
Marek Marczykowski-Górecki
fc7d686b2e qvm-tools/qvm-shutdown: do not kill already dead VM
When VM stop just when the timeout expires, qvm-shutdown should not try
to kill it - this would result in QubesException("VM already stopped!").
2014-09-25 05:47:35 +02:00
Marek Marczykowski-Górecki
a40e946a3f backups: add qvm-backup-restore --debug option 2014-09-17 23:12:27 +02:00
Marek Marczykowski-Górecki
b506a0cc15 backups: make the restore more defensive
Continue restore even if some fails failed to extract
2014-09-17 23:12:27 +02:00
Marek Marczykowski-Górecki
228ae07543 backups: improve errors handling
Report nice error message (not a traceback), interrupt the process on
non-recoverable error (when extraction process is already dead).
2014-09-17 14:43:41 +02:00
Marek Marczykowski-Górecki
f0bbb28398 backups: implement verify-only option (#863) 2014-09-17 14:43:27 +02:00
Marek Marczykowski-Górecki
591826daa2 qvm-tools: fix error message for setting vcpus using qvm-prefs
Simple typo, but results in exception.
2014-09-16 01:21:21 +02:00
Marek Marczykowski-Górecki
4913fc4fbc qvm-tools: improve messages for qvm-create --root-{move,copy}
There was no separate message, so it looked like registering appmenus
takes a long time.
2014-09-16 01:20:06 +02:00
Marek Marczykowski-Górecki
6dbaede3d0 qvm-tools/qubes-prefs: report empty setting as empty string instead of "none" (#894) 2014-09-04 23:58:32 +02:00
Hakisho Nukama
be8d807624 removed duplicated comment tag 2014-09-04 23:31:38 +02:00
Marek Marczykowski-Górecki
e5a6f58851 dispvm: by default use default dispvm-prerun script
Assume "--default-script" when no second argument given.
2014-07-02 02:31:22 +02:00
Marek Marczykowski-Górecki
c9ff9c2258 Revert "dispvm: use < 3.12 kernel if possible (#868)"
This reverts commit 7ce6601853.
3.12+ kernel fixed, so no longer needed.
2014-06-27 17:31:32 +02:00
Marek Marczykowski-Górecki
7ce6601853 dispvm: use < 3.12 kernel if possible (#868)
3.12+ is known to have broken balloon driver after save+restore.
2014-06-27 03:24:41 +02:00