Commit Graph

203 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
6dac228648 backup: backup any template marked to do so, even if installed by rpm 2015-03-31 05:54:41 +02:00
Marek Marczykowski-Górecki
01e208d5ec utils/QubesWatch: provide domain UUID to domain_callback 2015-03-30 00:08:00 +02:00
Marek Marczykowski-Górecki
30fadfa994 core/block: handle any QubesDB exception 2015-03-29 23:47:39 +02:00
Marek Marczykowski-Górecki
075f35b873 core: do not assume that libvirt domain is always defined
Define it only when really needed:
 - during VM creation - to generate UUID
 - just before VM startup

As a consequence we must handle possible exception when accessing
vm.libvirt_domain. It would be a good idea to make this field private in
the future. It isn't possible for now because block_* are external for
QubesVm class.

This hopefully fixes race condition when Qubes Manager tries to access
libvirt_domain (using some QubesVm.*) at the same time as other tool is
removing the domain. Additionally if Qubes Manage would loose that race, it could
define the domain again leaving some unused libvirt domain (blocking
that domain name for future use).
2015-03-29 23:38:36 +02:00
Marek Marczykowski-Górecki
f8ad78d174 core: use absolute imports in qubesutils 2015-03-29 17:33:02 +02:00
Marek Marczykowski-Górecki
bb958fd1c8 core: improve handling dead domains when talking to QubesDB daemon
Provide vm.refresh(), which will force to reconnect do QubesDB daemon,
and also get new libvirt object (including new ID, if any). Use this
method whenever QubesDB call returns DisconnectedError exception. Also
raise that exception when someone is trying to talk to not running
QubesDB - instead of returning None.
2015-03-29 17:22:15 +02:00
Marek Marczykowski-Górecki
c878beb25d utils/block: catch an exception when talking to disconnected qubesdb
This can happen for example when domain disappeared in the meantime.
2015-03-26 22:10:49 +01:00
Marek Marczykowski-Górecki
4dfb629dd8 Update libvirt config syntax for new version of driver domain patches
Finally accepted patches uses different syntax: <backenddomain name=.../> tag
instead of <source domain=.../>.
2015-03-21 21:12:48 +01:00
Marek Marczykowski-Górecki
ae6ca5c0a3 core: prevent taking database lock twice 2015-02-22 01:25:51 +01:00
Marek Marczykowski-Górecki
b858488719 Merge remote-tracking branch 'woju/master' 2015-02-21 03:09:29 +01:00
Marek Marczykowski-Górecki
e65842322a core: hold the lock after QubesVmCollection.save()
The statement that unlock_db() is always called directly after save() is
no longer true - tests holds the lock all the time, doing multiple saves
in the middle.
2015-02-21 00:25:50 +01:00
Wojtek Porczyk
2b14bc88d0 core/modules: debug important VM changes 2015-02-19 21:32:43 +01:00
Wojtek Porczyk
241cf2e089 core/qubes.py: ensure that all default_*vm are present in collection
References to invalid qids are None'd. Failure to do so may cause KeyErrors even
on fixing ntpd service during instantiation of QubesVmCollection.
2015-02-19 21:32:43 +01:00
Marek Marczykowski-Górecki
bdae560770 backup: fix deadlock on error while receiving backup from a VM
When qfile-dom0-unpacker detects an error, it sends error report to
stdout and terminate (so stdout is closed). That close should be
transferred to the VM process (as EOF on its stdin), which will signal
it to stop sending the data and handle error report.
Also qrexec-client holds the connection until both stdin and
stdout are closed.
So when that EOF is missing, tar2qfile will not detect error report and
still tries to send the data and qrexec-client will hold the
connection while receiving process is long dead.

To prevent that deadlock from happening, close FD in python code, so
qfile-dom0-unpacker will be the last owner of write end of the pipe.
When it closes its stdout, qrexec-client will receive EOF at its stdin.
2015-02-18 21:41:22 +01:00
Marek Marczykowski-Górecki
adfc4e0ac9 core: disks handling cleanup, fix them for TemplateHVM
Move rootcow_img to storage class, remove clean_volatile_img. And most
importantly - set source_template in QubesHVm.create_on_disk.
2015-02-09 06:02:20 +01:00
Marek Marczykowski-Górecki
869675c15c core: convert memory/cpu stats to libvirt API 2015-02-09 03:28:01 +01:00
Marek Marczykowski-Górecki
48fd2669cb raise correct exception 2015-02-07 01:14:22 +01:00
Marek Marczykowski-Górecki
1da8ab5823 core: Add missing import 2015-01-08 03:55:02 +01:00
Marek Marczykowski-Górecki
adff88101a Rework QubesWatch implementation for libvirt events 2014-12-26 02:56:38 +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
Marek Marczykowski-Górecki
592a4901c9 core: import monitorlayoutnotify instead of calling it as external script
Otherwise deadlock could happen - the script will try to get read lock
on qubes.xml, while the calling tool can already hold the lock. If that
was write lock (which is in case of qfile-daemon-dvm), the deadlock
occurs.
2014-11-21 21:45:03 +01:00
Wojciech Zygmunt Porczyk
6b0a5f9738 storage/xen.py: always initialise args['otherdevs'] 2014-11-19 12:50:32 +01:00
Marek Marczykowski-Górecki
9205c5c054 core: fix imports 2014-11-19 12:50:32 +01:00
Rafał Wojdyła
7e8978d278 wni: changed qrexec agent path environment variable name 2014-11-19 12:50:32 +01:00
Rafał Wojdyła
f91d6e93f6 wni: set random password on user creation 2014-11-19 12:50:31 +01:00
Rafał Wojdyła
ccd04c7c8f wni: properly get user profiles directory 2014-11-19 12:50:31 +01:00
Rafał Wojdyła
81fb2b696b wni: vm users can't change their password 2014-11-19 12:50:31 +01:00
Rafał Wojdyła
b4d827d5e8 wni: remove user profiles on domain removal 2014-11-19 12:50:31 +01:00
Rafał Wojdyła
b6a379e94a Fixed PyQt4 import in guihelpers 2014-11-19 12:50:31 +01:00
Marek Marczykowski-Górecki
fef2672935 settings-wni: get installation directory from windows registry 2014-11-19 12:50:31 +01:00
Marek Marczykowski-Górecki
803e128b8e wni: Add qrexec-client path to WNI settings 2014-11-19 12:50:30 +01:00
Marek Marczykowski-Górecki
071a01d29e guihelpers: Import PyQt only when needed 2014-11-19 12:50:30 +01:00
Marek Marczykowski-Górecki
06189b4a5b wni: set path to qrexec-daemon 2014-11-19 12:50:30 +01:00
Marek Marczykowski-Górecki
63eccac025 wni: use win32net module for creating new user
This require UAC disabled (or already started as administrator), but
works much more reliable ("net user" sometimes fails _silently_).
2014-11-19 12:50:30 +01:00
Marek Marczykowski-Górecki
e5c2448af4 copy & paste error (VM rename fix) 2014-11-19 12:50:30 +01:00
Marek Marczykowski-Górecki
4300d778a5 qvm-toos: import dbus only when needed
Void import errors when 'dbus' module not really needed.
2014-11-19 12:50:29 +01:00
Marek Marczykowski-Górecki
d88da1e66b wni: add missing parameter 2014-11-19 12:50:29 +01:00
Marek Marczykowski-Górecki
f6729b4968 wni: use generated password 2014-11-19 12:50:29 +01:00
Marek Marczykowski-Górecki
5dbad01796 Fill some more WNI settings
Especially use new "wni" libvirt driver.
2014-11-19 12:50:29 +01:00
Marek Marczykowski-Górecki
ea68c6a766 xen: fix template vm storage code 2014-11-19 12:50:28 +01:00
Marek Marczykowski-Górecki
11047bf427 Use platform specific locking method
None of found existing portable locking module does support RW locks.
Use lowlevel system locking support - both Windows and Linux support
such feature.

Drop locking code in write_firewall_conf() b/c is is called with
QubesVmCollection lock held anyway.
2014-11-19 12:50:28 +01:00
Marek Marczykowski-Górecki
a5a2c0b97c Revert "release qubes.xml lock on object destroy"
This reverts commit 39e056b74acca3854c5707d8f2cbcd199b8cac75.
This change rely on reverted python-locking use.
2014-11-19 12:50:28 +01:00
Marek Marczykowski-Górecki
5fb1991ad5 QubesWniVmStorage: prefix system user with "qubes-vm-". 2014-11-19 12:50:28 +01:00
Marek Marczykowski-Górecki
f927f12e39 QubesWniVmStorage: pass all positional parameters to base class 2014-11-19 12:50:28 +01:00
Marek Marczykowski-Górecki
392b70a4d8 Create missing private.img when needed
Not only for HVM, but any VM type which support private.img.
2014-11-19 12:50:28 +01:00
Marek Marczykowski-Górecki
21c908b9b2 Move storage-related VM rename code to storage class 2014-11-19 12:50:28 +01:00
Marek Marczykowski-Górecki
ada5ebd784 Use "None" in *_img attr for "not applicable"
Some VM types do not have particular disk image. Instead of enumerating
cases in storage class, signal unused image from VM class by setting
appropriate attr to None.
2014-11-19 12:50:27 +01:00
Marek Marczykowski-Górecki
e2bea656b4 Add vm-configs for WNI 2014-11-19 12:50:27 +01:00
Marek Marczykowski-Górecki
ec37a4e681 Rename vm-configs directory to be more generic 2014-11-19 12:50:27 +01:00
Marek Marczykowski-Górecki
35ecfc82ef wni: QubesWniVmStorage and update settings file 2014-11-19 12:50:27 +01:00