Commit Graph

2824 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
0a1f3d0a44 core: split VM images handling to separate class
This will ease handling different types of VMM (which can require
different image types, location etc).
2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
d5cb05fdc6 Move dispvm+qmemman service files to relevant directories
Remove them from global services dir.
2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
a8bee8d978 Ignore error when 'xen.lowlevel.xs' doesn't exists
There are still few uses of direct xenstore access, most of them are
xen-specific (so doesn't need to be portable). For now simply don't
connect to xenstore when no 'xen.lowlevel.xs' module present. It will
break such xen-specific accesses - it must be somehow reworked - either
by adding appropriate conditionals, or moving such code somewhere else
(custom methods of libvirt driver?).
2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
bc58ca5edb Remove import xen.lowlevel.xc
There is still use of it: QubesHost.get_free_xen_memory and
QubesHost.measure_cpu_usage. Will migrate them to libvirt later (for now
some things will be broken - namely qubes-manager).
2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
6193b4fea3 Add support for VMM-specific settings. 2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
80c89cc91c Delay resolving system_path['qubes_base_dir']
So changes made by os/vmm-specific settings would be taken into account.
2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
f6835346d4 Move initialization code at the end of file
So all of it will be in one place.
2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
aad945e01b makefile: install only relevant stuff according to OS/VMM 2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
69d1ae645f Do not use qmemman when not present (installed) on particular VMM 2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
72e415a807 move qubes-notify-* to libexec 2014-11-19 12:50:25 +01:00
Marek Marczykowski-Górecki
ed13972e4e Remove xenstore-watch-qubes
Since we have Qubes DB, it needed anymore.
2014-11-19 12:50:24 +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
fb353ea615 core: fix regression in iptables rule generator
This commit:
eb11a2f Use QubesDB instead of Xenstore.
introduced regression in iptables rules generator (sed misuse...).
2014-11-19 12:50:24 +01:00
Marek Marczykowski-Górecki
7484ddfd2b startup-misc: populate local domain id
Apparently libvirt doesn't do it.
2014-11-19 12:50:24 +01:00
Marek Marczykowski
c8fb5cfd99 dispvm: minor fixes 2014-11-19 12:50:24 +01:00
Marek Marczykowski
ff2c925e18 dispvm: use qubesdb instead of xenstore 2014-11-19 12:50:24 +01:00
Marek Marczykowski
457737b6cc QubesVm: ignore errors during debug VM config file creation
Currently <vm-dir>/<vm-name>.conf file is used only for debugging
purposes - the real one is passed directly to libvirt, without storing
on disk for it.
In some cases (e.g. qvm-clone) QubesVM.create_config_file() can be
called before VM directory exists and in this case it would fail.
Because it isn't critical fail in any means (the config file will be
recreated on next occasion) just ignore this error.

Final version most likely will have this part of code removed
completely.
2014-11-19 12:48:28 +01:00
Marek Marczykowski
f159f3e168 Use QubesDB instead of Xenstore.
Mostly done. Things still using xenstore/not working at all:
 - DispVM
 - qubesutils.py (especially qvm-block and qvm-usb code)
 - external IP change notification for ProxyVM (should be done via RPC
   service)
2014-11-19 12:48:28 +01:00
Marek Marczykowski
31424603fa rpm: move R: xen-runtime inside vmm-xen deps block
Do not depend on xen package unconditionally.
2014-11-19 12:48:28 +01:00
Marek Marczykowski
6c345aaccf hvm: enable missing features
Apparently libvirt driver have own defaults for machine features - all
disabled (instead of using libxl defaults). So enable such features
explicitly.
2014-11-19 12:48:28 +01:00
Marek Marczykowski
5644656859 hvm: add UUID to libvirt config
Add missing entry. Also fix indentation of first few lines.
2014-11-19 12:48:28 +01:00
Marek Marczykowski
3f6947b87e dispvm: fix domain ID handling
Do not use obsoleted get_xid() function.
2014-11-19 12:48:27 +01:00
Marek Marczykowski
9393b5f931 Fix domain rename
libvirt_domain object needs to be recreated, so force it. Also fix
config path setting (missing extension) - create_config_file
uses it as custom config indicator (if such detected, VM settings -
especially name, would not be updated).
2014-11-19 12:48:27 +01:00
Marek Marczykowski
062c3afcf5 Remove unused 'source_template' parameter from some QubesVm internal functions 2014-11-19 12:48:27 +01:00
Marek Marczykowski
fc7d200452 add vim swapfiles to gitignore 2014-11-19 12:48:27 +01:00
Marek Marczykowski
c95dc298a1 rpm: set sgid for data directories
Make sure that contents belong to qubes group, even when created by root
user.
2014-11-19 12:48:27 +01:00
Marek Marczykowski
25ee58217d Set umask before possibly creating new files - make them group-writable 2014-11-19 12:48:27 +01:00
Marek Marczykowski
b3af858502 Indentation fix - check for custom config file 2014-11-19 12:48:27 +01:00
Marek Marczykowski
5db1957086 rpm: improve deps on libvirt
Use metapackage to install all required libvirt modules.
2014-11-19 12:48:27 +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
8e9c59e7f8 Minor changes to make VMM connection really lazy
1. Fake dom0 object doesn't need proper maxmem nor vcpus - set
statically to 0 instead of getting from physical host.
2. QubesHVM doesn't preserve maxmem setting, so set it to self.memory
earlier (to suppress default total_memory/2 calculation).
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
9f90106db4 rpm: Add libvirt to dependencies 2014-11-19 12:48:26 +01:00
Marek Marczykowski
0f6b878664 rpm: update build dependencies 2014-11-19 12:48:26 +01:00
Marek Marczykowski
201cd509e1 QubesDom0NetVm: provide get_mem*
As libvirt doesn't keep dom0 domain object, so add special cases to get
memory information.
2014-11-19 12:48:26 +01:00
Marek Marczykowski
550d8cac68 Create permanent libvirt domain objects
Do not recreate them at each startup. This will save some time and also
solve some problems from invalidated libvirt handles after domain
shutdown (e.g. causes qubes-manager crashes).
This requires storing uuid in qubes.xml.
2014-11-19 12:48:26 +01:00
Marek Marczykowski
1fda0502ab Check for invalid XID 2014-11-19 12:48:26 +01:00
Marek Marczykowski
895ca0633d Fix current memory reporting 2014-11-19 12:48:26 +01:00
Marek Marczykowski
4f090cdb5e pass VM name to guid via cmdline 2014-11-19 12:48:26 +01:00
Marek Marczykowski
3b5c89d9ce makefile: change build order
Move docs to the end of list - build errors in core code can be spotted
earlier.
2014-11-19 12:48:26 +01:00
Marek Marczykowski
107ebad9d5 Migration to libvirt - DispVM
Move DispVM creation to qfile-daemon-dvm/QubesDisposableVm from
qubes-restore. As actual restore is handled by libvirt, we don't get
much from separate qubes-restore process.
This code still needs some improvements, especially on performance.
2014-11-19 12:48:26 +01:00
Marek Marczykowski
f44dc40858 Migration to libvirt - HVM 2014-11-19 12:47:00 +01:00
Marek Marczykowski
f3a7d5f6e6 Remove debug_console QubesVm.start() argument
It isn't working for a long time, so remove it to not confuse reader.
2014-11-19 12:47:00 +01:00
Marek Marczykowski
a880483092 Migration to libvirt - core part
Still not all code migrated, added appropriate TODO/FIXME comments.
2014-11-19 12:47:00 +01:00
Marek Marczykowski
4a4fb5e243 qmemman: change process model from forking to single process + sd_notify
Forking daemon after initializing hypervisor connection can cause
problems (and actually does in case of libvirt).
To notify systemd when daemon is ready use notify socket (previously it
was termination of parent process).
2014-11-19 12:47:00 +01:00
Marek Marczykowski
b242680cc1 spec: fix typi in %post 2014-11-19 12:46:59 +01:00
Marek Marczykowski-Górecki
7fbbcd58bf dispvm: print diagnostics to stderr 2014-11-10 11:42:47 +01:00
Marek Marczykowski-Górecki
49ca49017e tests: DispVM tests 2014-11-10 11:42:30 +01:00
Marek Marczykowski-Górecki
256e35a62c tests: annotate qrexec EOF tests with expected failure
EOF transmission actually doesn't work in some cases in R2. It is rather
hard to change without introducing big changes (which we don't want to
do in R2). It should be fixed in R3.

BTW The said changes are in my qrexec-sockets branch in core-agent-linux
and linux-utils (then application should use shutdown(2) instead of
close). Alternatively qrexec-agent can use PAM directly (instead of
calling "su"). This is also implemented (pam branch in
core-agent-linux), but IMO it isn't the way to go (reimplementing "su"
in qrexec-agent code).
2014-11-10 02:28:18 +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