Commit Graph

3511 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
163ab25d4b tests: enable qubes.tests.int.basic
It is fully converted to core3 API (or tests marked as 'skip' if not),
so can be reenabled.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
9b1b82c592 tests: move properties tests to QubesVM unit tests
Since qvm-prefs is now a generic tool without any property-specific
stuff, we can tests properties getters/setters in QubesVM class unit
tests.
Now most of properties are tested. Some of those tests still fails
because missing/incomplete underlying implementation.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
81bc615bce tests: convert tests/int/basic to core3 API
Not all tests converted - some of them will be removed in the next
commit. Also it doesn't mean that all tested functionality already
works...
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
2daba9e0eb core: migrate handy GUI functions and backup mixin from core2
That's all from tests/__init__.py, so remove that file.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
bc82643580 tests: redo "84af738 tests: support VMs cleaned up in tearDownClass..."
Usage: VMs with name created by self.make_vm_name(name,
class_teardown=True) will be cleaned up in tearDownClass. It
should be used only in setUpClass.

Fixes QubesOS/qubes-issues#1691
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
0a45164be7 tests: few more FD leak fixes
QubesOS/qubes-issues#1697
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
47e346efbf tests: initialize Qubes() object in SystemTestsMixin, add handy helpers
Most of the tests needs existing template, so add helper to copy it from
"host" collection. Add also helpers to reload qubes.xml - in case of
modification of it from some other process.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
2966456387 tests: improve assertNotRaises reporting
Include whole exception value, not only its type.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
f52a0f2d41 storage: get rid of 'servicevms' subdir
Keep all the non-template VMs in 'appvms'. Having it split makes no
sense since any VM can be "converted" to NetVM by simply changing its
provides_network attribute and probably assigning some PCI device.

On the other hand, it may be useful to set this manually, for example by
management stack - based on VM function, not type. But don't care about
it for now.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
c1bab3d094 storage: reset_volatile_storage doesn't need source_template parameter
It shouldn't touch anything not already known to the VM object.
2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
5f48b76b27 storage: fix vm.create_on_disk for non-template based VMs 2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
539a46ca9a core/log: do not attach multiple handlers to the same logger
logging.getLogger when given the same name twice, will return the same
object. Do not attach handler there every time, it will really open new
file, leading to multiplicated log entries and depleting file
descriptors.

QubesOS/qubes-issues#1697
2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
64260f5844 core: handle default template
Fixes QubesOS/qubes-issues#1559
2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
15192ede42 core: allow not having clockvm/updatevm 2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
f7f1038f57 core: add a stopgap detection for simultaneous qubes.xml access
For now simply throw an exception. Proper solution require some locking

QubesOS/qubes-issues#1729
2016-03-03 01:18:15 +01:00
Wojtek Porczyk
c531b0eac2 qubes: fix None serialisation for VMProperty
Note that None != default (no attribute in XML at all).

This is reworked
  27eddcb WIP core: fix deserializing None for VMProperty
by Marek.
2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
843cf68c1a core: return QubesVMNotFoundError when setting non-existent VM to VMProperty
Not sure about this one. Maybe it should be rather
QubesPropertyValueError?
2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
380ad74494 core: fix property.__eq__ 2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
ee1e836523 core: fix clone_properties(proplist=something) 2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
929923164e Move libvirt_conn.close to object destructor
Process exit is too late for long-running processes. Especially tests,
which create a lot of such objects which leads to depleting all
the file descriptors.

QubesOS/qubes-issues#1697
2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
ab469e4473 vm: fix calling monitor layout notifier 2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
4095f3c5eb vm: disable uses_custom_config for now 2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
db20581340 storage: few more merge fixes 2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
926596cba7 Initialize vm.storage after loading all the properties
It needs at least vm.name to be set.
2016-03-03 01:18:15 +01:00
Marek Marczykowski-Górecki
3af71ab65d storage: fix handling netvm and adminvm
@woju what was consensus on 'servicevms' dir? Since "being network
provider" is no longer separate type and can be changed during VM
lifetime, maybe we should abandon that idea? Or maybe just set it as VM
property (some storage pool config argument) - that way mgmt stack could
put all the sys-* VMs into separate directory, regardless of the type.
2016-03-03 01:18:06 +01:00
Marek Marczykowski-Górecki
d3f9c0b169 storage: fix loading default storage pool
qubes.config.defaults holds ['pool_drivers'] strings, not classes.
2016-03-03 01:14:54 +01:00
Wojtek Porczyk
c47e29ed50 Fix most errors from pylint 2016-03-03 01:14:54 +01: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
Wojtek Porczyk
2d6ad3b60c qubes/vm/qubesvm: remove prefixes from qubesdb keys 2016-03-03 00:46:05 +01:00
Wojtek Porczyk
e8bedcd7ba qubes/vm: fix starting netvm 2016-03-03 00:46:05 +01:00
Wojtek Porczyk
6bc30b2e0b qubes/tools/qvm_ls: fix getting columns from mixin 2016-03-03 00:46:05 +01:00
Wojtek Porczyk
21d6d51cbb qubes/tools/qvm_ls: remove fmt= argument
Unneeded, added complexity.
2016-03-03 00:46:05 +01:00
Wojtek Porczyk
01319e391f qubes: port netvm
From now, there are no separate NetVM and ProxyVM class, but property
"provides_network".
2016-03-03 00:46:05 +01:00
Wojtek Porczyk
638c31ce68 qubes/tests/vm/qubesvm: some more tests 2016-01-21 13:31:43 +01:00
Wojtek Porczyk
06cc064c8c qubes/tests: split init to init1 and init2
This is to keep the correct order of the tests. The exact dependency
graph is somewhat complicated and contains several cycles.
2016-01-21 13:31:43 +01:00
Marek Marczykowski-Górecki
31a3796ed3
dispvm: do not remove innocent files when cleaning up DispVM
Fixes QubesOS/qubes-issues#1662
2016-01-20 02:51:57 +01:00
Marek Marczykowski-Górecki
689df4afd3
dispvm: cleanup DispVM even if was already destroyed
dispvm.force_shutdown() throw an exception if the VM is already dead.

Fixes QubesOS/qubes-issues#1660
2016-01-20 02:50:47 +01:00
Marek Marczykowski-Górecki
176755d9e2
tests: DispVM cleanup
QubesOS/qubes-issues#1660
2016-01-20 02:48:46 +01:00
Marek Marczykowski-Górecki
873706428e
dispvm: fix firewall propagation when the calling VM has no rules set
Fixes QubesOS/qubes-issues#1608
2016-01-18 02:19:19 +01:00
Marek Marczykowski-Górecki
ce75ba411f
tests: "empty" firewall propagation
Check if "empty" firewall is also properly propagated.

QubesOS/qubes-issues#1608
2016-01-18 02:09:17 +01:00
Marek Marczykowski-Górecki
04415e13fe
version 3.1.11 2016-01-15 17:35:25 +01:00
Marek Marczykowski-Górecki
5d36923170
qmemman: fix race condition on starting new VM
Force refreshing domain list after starting new VM, even if the
triggering watch wasn't about domain list change. Otherwise (with
outdated domain list) memory allocated to a new VM, but not yet used may
be redistributed (leaving to little to the Xen itself).

Fixes QubesOS/qubes-issues#1389
2016-01-14 04:37:02 +01:00
Marek Marczykowski-Górecki
411e8b5323
qmemman: refresh domain list holding global_lock
Retrieve a domain list only after obtaining global lock. Otherwise an
outdated list may be used, when a domain was introduced in the meantime
(starting a new domain is done with global lock held), leading to #1389.

QubesOS/qubes-issues#1389
2016-01-14 04:34:53 +01:00
Marek Marczykowski-Górecki
caa75cbc18
tests: regression test for #1389
QubesOS/qubes-issues#1389
2016-01-14 04:28:17 +01:00
Marek Marczykowski-Górecki
3eccc3a633
qmemman: use try/finally to really release the lock
Currently not needed in practice, but a preparation for the next
commit(s).

QubesOS/qubes-issues#1389
2016-01-14 03:32:18 +01:00
Marek Marczykowski-Górecki
6a99b0b2ba
qmemman: add some useful logging for #1389
QubesOS/qubes-issues#1389
2016-01-14 03:15:38 +01:00
Marek Marczykowski-Górecki
f4d46c7855
tests: add a test for proper saving of DispVM firewall rules
Test if DispVM firewall rules are:
 - inherited from a calling VM
 - saved properly (so will be effective after firewall reload)
 - saved only for that DispVM (#1608)

QubesOS/qubes-issues#1608
2016-01-14 01:14:41 +01:00
Marek Marczykowski-Górecki
46a338d087
version 3.1.10 2016-01-12 12:05:19 +01:00
Marek Marczykowski-Górecki
8b9049d8c6
core/hvm: create root-cow.img if it's missing
It should be created at VM creation time (or template changes commit).
But for example for HVM templates created before implementing
QubesOS/qubes-issues#1573, there would be no such image. So create it
when needed, just before VM startup

Fixes QubesOS/qubes-issues#1602
2016-01-11 21:53:33 +01:00
Marek Marczykowski-Górecki
78b63eb21a
qmemman: fix crash when VM fails to start
In this case, qmemman would not manage to get any memory state for such
VM, so memory_current would be 'None'. But later it would perform
arithmetics on it, which would result in qmemman crash (TypeError
exception).

Fixes QubesOS/qubes-issues#1601
2016-01-11 21:50:57 +01:00