Commit Graph

3894 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
0a21300872 qubes/storage: unify _remove_if_exists argument type
In some places full volume object was called, in others - just file
path. Since this function is also used in some volume init/teardown, use
path everywhere.
2016-06-02 13:07:35 +02:00
Marek Marczykowski-Górecki
574834ac68 qubes/core2migration: rework load order
To successfully load all the data, proceed in order:
- set app.default_kernel
- load all templates
- set app.default_template
- load other VMs
- update network dependencies between VMs
- set other global properties
2016-06-02 12:44:31 +02:00
Marek Marczykowski-Górecki
554a99610f qubes/core2migration: use app.load_initial_values
Reduce code duplication.
2016-06-02 12:43:25 +02:00
Marek Marczykowski-Górecki
692f75353e qubes/app: split initialising empty Qubes object from saving it
It may be useful to create fresh Qubes() object but not save it yet
before setting other things. One such case is migration from core2.
2016-06-02 12:42:37 +02:00
Marek Marczykowski-Górecki
2909d252d6 backup: get_fisk_usage is now in storage.file 2016-06-02 12:41:59 +02:00
Marek Marczykowski-Górecki
ff78b26f66 qubes: implement offline mode
Apparently the most important (the only?) property required in offline
mode is "is_running". So let's patch it to return False and make sure
any other libvirt usage would result in failure.

Or maybe better simply returh False in vm.is_running, when libvirt
connection fails? But then it would not be possible to use offline mode
and have (some, probably unrelated) libvirtd running at the same time.

Fixes QubesOS/qubes-issues#2008
2016-06-02 12:41:26 +02:00
Marek Marczykowski-Górecki
b119b2c36b storage/file: simplify search for origin volume of snapshot/read-only
Check directly vm.template, throwing AttributeError when not found.
There may be some value in converting it to more descriptive error, but
since that's mostly for internal users (not user facing actions) don't
bother for now.

QubesOS/qubes-issues#1842
2016-06-02 12:38:07 +02:00
Marek Marczykowski-Górecki
07b72ef3fd tests: fix after moving VMCollection to qubes.app 2016-06-02 12:37:30 +02:00
Marek Marczykowski-Górecki
c965024287 qubes/vm: Implement Disposable VM
Implement DispVM as a VM based on AppVM.

QubesOS/qubes-issues#866
2016-06-02 12:37:19 +02:00
Marek Marczykowski-Górecki
54c70766a4 qubes/storage: allow snapshots of snapshots
It may make sense to create 'snapshot' volume out of already 'snapshot',
not only 'origin'. In pracice it will exactly the same as 'snapshot
connected directly to 'origin'.

QubesOS/qubes-issues#866
2016-06-02 12:37:00 +02:00
Marek Marczykowski-Górecki
48176d51f1 qubes/storage: minor error message fix 2016-06-02 12:29:39 +02:00
Marek Marczykowski-Górecki
d80f34888d qubes/storage: fix getting origin pool
volume_config parameter is about target volume, not origin.

QubesOS/qubes-issues#1842
2016-06-02 12:29:30 +02:00
Marek Marczykowski-Górecki
b24ab45d00 qubes/vm: fix network attach/detach 2016-06-02 12:28:53 +02:00
Marek Marczykowski-Górecki
3b407eb79e qubes/app: do not enable domain events when loading XML
Event should be enabled only after all the domains are loaded (and
domain-load event if fired).

QubesOS/qubes-issues#1816
2016-06-02 12:28:14 +02:00
Marek Marczykowski-Górecki
daf55710b8
travis: initial version
QubesOS/qubes-issues#1926
2016-06-02 11:29:38 +02:00
Marek Marczykowski-Górecki
a534b1dd2c
qvm-usb: remove scary warning about PV USB stability
USBIP (used for PV USB here) is considered stable by Linux maintainers,
so follow their judgement.

Fixes QubesOS/qubes-issues#531
2016-06-02 02:52:59 +02:00
Marek Marczykowski-Górecki
e87da9ec9d
tests: adjust dom0_update tests for dnf in VM
There is no support for 'copy_local' repository option, so setup test
repository over http.

Related to QubesOS/qubes-issues#1574
2016-06-02 02:51:18 +02:00
Marek Marczykowski-Górecki
767d1f0074
qvm-usb: implement usb_detach_all
QubesOS/qubes-issues#531
2016-06-02 02:49:22 +02:00
Marek Marczykowski-Górecki
d5e06bfb83
qvm-usb: issue detach call to backend domain
Make sure that even compromised frontend will be cut of (possibly
sensitive - like a webcam) device. On the other hand, if backend domain
is already compromised, it may already compromise frontend domain too,
so none of them would be better to call detach to.

QubesOS/qubes-issues#531
2016-06-02 02:45:26 +02:00
Marek Marczykowski-Górecki
52fb410deb
qvm-usb: always pass VM as object reference not a name
Make the API consistent.

QubesOS/qubes-issues#531
2016-06-02 02:44:38 +02:00
Bahtiar `kalkin-` Gadimov
17790c32bb
Fix DomainPool missing a continue 2016-06-01 17:28:55 +02:00
Bahtiar `kalkin-` Gadimov
90928dc4a0
qubes-pool skip DomainPools without volumes 2016-05-30 13:31:58 +02:00
Bahtiar `kalkin-` Gadimov
c8363cfc95
qvm-pool simplify options parsing 2016-05-30 13:31:57 +02:00
Bahtiar `kalkin-` Gadimov
27305dd85d
qvm-pool actions remove access to app 2016-05-30 13:31:56 +02:00
Bahtiar `kalkin-` Gadimov
ed1a6977c0
Qubes.add_pool() add name parameter 2016-05-30 13:31:55 +02:00
Bahtiar `kalkin-` Gadimov
d703f2f44b
Add qvm-pool and manpage for it
- Use full import paths in qvm-pool
- Add, Remove, Info and List options set `Namespace.command`. This fixes a crash
  when `-o dir_path=/mnt/foo` is specified after `-a foo xen`.
- Remove `_List`
- Remove 'added pool' and 'removed pool' messages. Unix tools are quiet
- qvm-pool call app.save()
- Rename create_parser in get_parser
- Rename local_parser variables to just parser
- qvm-pool uses print_table
2016-05-30 13:31:54 +02:00
Bahtiar `kalkin-` Gadimov
9ef9575d4e
Fix typo in "No driver FOO for pool BAR" message 2016-05-30 13:31:54 +02:00
Bahtiar `kalkin-` Gadimov
357e8125eb
Add qubes.tools.PoolsAction 2016-05-30 13:31:53 +02:00
Bahtiar `kalkin-` Gadimov
0319df25e5
Add print_table function to qubes.tools
- print_table uses the `column` tool with the ASCII Unit Separator to print a
pretty table
2016-05-30 13:31:51 +02:00
Marek Marczykowski-Górecki
d67636308f
qvm-usb: modify for USBIP-over-qrexec implementation
QubesOS/qubes-issues#531
2016-05-26 01:38:08 +02:00
Marek Marczykowski-Górecki
3afc7b7d50
core: start qrexec-daemon as normal user, even when VM is started by root
qrexec-daemon will start new processes for called services, which
include starting new DispVM, starting other required VMs (like backend
GPG VM). Having those processes as root leads to many permissions
problems, like the one linked below. So when VM is started by root, make
sure that qrexec-daemon will be running as normal user (the first user
in group 'qubes' - there should be only one).

QubesOS/qubes-issues#1768
2016-05-26 01:34:53 +02:00
Bahtiar `kalkin-` Gadimov
35974a5dbf
DomainPool check the untrusted data from qubes-db 2016-05-25 17:39:34 +02:00
Wojtek Porczyk
0484be518c Merge remote-tracking branch 'woju/pull/12/head' into core3-devel
Conflicts:
    doc/manpages/qvm-kill.rst
2016-05-25 11:01:19 +02:00
Bahtiar `kalkin-` Gadimov
3f5a92772a
A QubesVM always has an empty DomainPool
- A DomainPool is initialized by QubesVM after Storage initialization on a
  `domain-load` event
2016-05-22 22:09:56 +02:00
Bahtiar `kalkin-` Gadimov
ddf040ae64
Do not serialize the domain pool config 2016-05-22 22:09:55 +02:00
Bahtiar `kalkin-` Gadimov
baaac858bc
Add DomainPool
- All domain pool volumes are removable volumes
- DomainVolume uses device name as vid
2016-05-22 22:09:54 +02:00
Bahtiar `kalkin-` Gadimov
e30f894df9
Add Volume.removable field 2016-05-22 21:42:27 +02:00
Bahtiar `kalkin-` Gadimov
df83188fb5
Update qvm-remove manpage 2016-05-21 01:35:33 +02:00
Bahtiar `kalkin-` Gadimov
116ba64e51
Storage.remove() catch IO/OSError and log it 2016-05-21 01:35:32 +02:00
Bahtiar `kalkin-` Gadimov
c5810758c5
FilePool fix origin volume removale 2016-05-21 01:35:31 +02:00
Bahtiar `kalkin-` Gadimov
8959e5a77e
Implement qvm-remove
- Remove old qvm-remove
- Remove a log line from Storage, because it prints confusing lines, like:
    Removing volume kernel: /var/lib/qubes/vm-kernels/4.1.13-6/modules.img
2016-05-21 01:35:30 +02:00
Bahtiar `kalkin-` Gadimov
3009bd862e
Fix manpage generation 2016-05-21 01:25:15 +02:00
Bahtiar `kalkin-` Gadimov
91f72dc56c
Rework argument checking when generating manpages
Add the ability to handle commands having subcommands, like `qvm-block`

Split the ArgumentCheckVisitor in an OptionsCheckVisitor &
SubCommandCheckVisitor. The OptionsCheckVisitor checks options given
in a section named 'Options' (case insensitive), while the
SubCommandCheckVisitor dispatches on a section named 'Commands' (case
insensitive).

This also fixes finding the undocumented command arguments. The previous
solution with depart_document did not work. NodeVisitor does not dispatch to
depart_document() even if it's mentioned in the documentation.
2016-05-21 01:25:14 +02:00
Bahtiar `kalkin-` Gadimov
e580131465
Add AliasedSubParsersAction 2016-05-21 01:25:13 +02:00
Bahtiar `kalkin-` Gadimov
99598fe4b2
Update qvm-kill manpage 2016-05-21 01:24:18 +02:00
Bahtiar `kalkin-` Gadimov
910276e898
Rename want_vm_* in vmname_nargs 2016-05-21 01:24:17 +02:00
Bahtiar `kalkin-` Gadimov
d4c74d210f
Implement vmname parsing 2016-05-21 01:24:16 +02:00
Bahtiar `kalkin-` Gadimov
3549a9d4ec
Add VmNameGroup 2016-05-21 01:24:14 +02:00
Bahtiar `kalkin-` Gadimov
7fe827d858
Add VmNameAction 2016-05-21 01:24:13 +02:00
Bahtiar `kalkin-` Gadimov
c22d9e88c9
Add QubesAction 2016-05-21 01:24:12 +02:00