Commit Graph

1166 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
3b1238f7cf vm: stub for new firewall API
- introduce 'firewall-changed' event
 - add reload_firewall_for_vm stub function

Should that function be private, called only from appropriate event
handlers?

QubesOS/qubes-issues#1815
2016-03-21 11:43:33 +01:00
Marek Marczykowski-Górecki
34fe4a2d71 tests: add function to provide real network to test case
Very few tests should use it, as it makes the test result somehow
dependent on outside world state. But still, some of them need it.
2016-03-21 11:43:33 +01:00
Marek Marczykowski-Górecki
c99a47d192 vm: fix handling firewall_conf path
It may be (and by default is) path relative to VM directory.
This code will be gone in the final version, after merging firewall
configuration into qubes.xml. But for now have something testable.
2016-03-21 11:43:33 +01:00
Marek Marczykowski-Górecki
c9cad71d03 vm/mix/net: create vm.connected_vms dynamically
It is much less error-prone way. Previous approach didn't worked because
VMs weren't added here at 'domain-init'/'domain-loaded' event. And even
after adding such handlers it wasn't working because of
QubesOS/qubes-issues#1816.

It may be a little slower, but since it isn't used so often
(starting/stopping VM and reloading firewall), shouldn't be a problem.
2016-03-21 11:43:33 +01:00
Marek Marczykowski-Górecki
3e3213e7c7 Redo "core: do not reset firewal when setting netvm=none"
Apparently it got lost in merge.

QubesOS/qubes-issues#862
2016-03-21 11:43:33 +01:00
Marek Marczykowski-Górecki
736773dbec vm: remove obsolete firewall handling code
There is no vm.write_iptables_xenstore_entry().

QubesOS/qubes-issues#1815
2016-03-21 11:43:33 +01:00
Marek Marczykowski-Górecki
a0fa8fcc8e ext/qubesmanager: fix events signature
There is event itself passed just after VM object.
2016-03-21 11:43:33 +01:00
Marek Marczykowski-Górecki
12f778b539 qubes/vm: do not recursively use repr in BaseVM.__repr__
This will easily end up in infinite recursion. For example
'sys-net'.template points at 'fedora-23', which itself has
'fedora-23'.netvm set to 'sys-net'.
2016-03-21 11:43:32 +01:00
Marek Marczykowski-Górecki
422f30b969 tests: port network tests to core3 API 2016-03-21 11:43:32 +01:00
Marek Marczykowski-Górecki
df5562d2c7 tests: fix rename test to report FAIL instead of ERROR when really failed 2016-03-21 11:43:32 +01:00
Wojtek Porczyk
394fa1e5d3 qubes/tests: tests for qubes.devices 2016-03-21 11:43:32 +01:00
Wojtek Porczyk
0f9ca47d90 qubes/ext/guid: Move gui-related code to extension 2016-03-21 11:43:32 +01:00
Wojtek Porczyk
75dd882b83 qubes: Unify event names
Events will be named <object>-[pre-]-<verb>, where verb is in infinitive
form.
2016-03-21 11:43:32 +01:00
Wojtek Porczyk
d09bd5ab6a qubes: Convert QubesVM and Extension discovery to pkg_resources
QubesOS/qubes-issues#1238
2016-03-21 11:43:32 +01:00
Wojtek Porczyk
93686eae06 qubes/vm: change services to features 2016-03-21 11:43:32 +01:00
Wojtek Porczyk
bf78e662f6 Import qubesdb from the new module
fixes QubesOS/qubes-issues#1252
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
5dca051b32 tests: enable storage tests 2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
8262f2ef4b storage: fix handling standalone VMs
Currently Standalone have template=None.
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
a73c694f54 storage: access *_img directly from vm.storage object
Not through vm.something_img proxy.
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
c0c0e0022e tests: convert storage tests to core3 API
QubesOS/qubes-issues#
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
14f31134c0 tests: move make_vm_name to QubesTestCase
This function is often useful also in unit tests, not only integration
tests.
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
5375dce90d Prefer human readable output in qvm-prefs and qubes-prefs tools 2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
68ed50c97d tests: enable dom0 update tests 2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
fb74126e56 tests: convert dom0 update test to core3 API 2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
0307ec22f2 tests: resolve template name when copying from host collection 2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
81dbe3628f tests: skip system tests if not in dom0 2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
50819c726c tests: set QUBES_XML_PATH env variable to force usage of qubes-test.xml
This way even separate processes (even those started not directly - like
qrexec service calls) will use correct qubes.xml file.

Fixes QubesOS/qubes-issues#1730
2016-03-03 01:18:17 +01:00
Wojtek Porczyk
c80e89d47e qubes: support QUBES_XML_PATH environment variable
This is reworked
    core: load default qubes.xml location from QUBES_XML_PATH env variable

QubesOS/qubes-issues#1730
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
e3c94f3949 core: fix handling numeric label value set
Not sure if it should be supported this way, but surely it shouldn't
throw AttributeError.
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
79a6da1163 tests: split off invalid values tests for better reporting
Most of them fails for now...
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
c45c91c5f0 tests: improve verbosity of assertNotRaises even further
Include traceback in error message.
2016-03-03 01:18:17 +01:00
Marek Marczykowski-Górecki
5a409ad417 tests: few more (disabled for now) tests for hvm related properties 2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
1b69f5c213 tests: make test cleanup more defensive - qubes.xml load failure
If qubes.xml doesn't even load, remove it anyway and clean up the VMs
the hard way.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
9633573408 core: adjust units comment for host.memory_total, and fix related places
QubesOS/qubes-issues#1737
2016-03-03 01:18:16 +01:00
Wojtek Porczyk
88a63cbe3a qubes/vm/qubesvm: do not clone VM-specific properties
This is reworked
    core: do not clone VM-unique identifiers in clone_properties
by Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
2cbbe0bdb6 core: abandon 'kernels' in VM directory
Since we have PV Grub now (which is much more convenient), it is useless
now.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
9428c70d31 core: fix vm.create_on_disk
QubesOS/qubes-issues#
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
62759fb1f6 core: move maxmem default initialization to property itself
Also fix (for now?) units - memory_total is int bytes while maxmem in
megabytes.

QubesOS/qubes-issues#1737
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
2f3762ee68 core: minor fixes in handling properties
Conflicts:
	qubes/vm/qubesvm.py
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
12941d67bf tests: do not unnecessary mangle test name passed as runner parameter
Otherwise `qubes.tests.run -l` output would not be useful as input for
test list.
2016-03-03 01:18:16 +01:00
Marek Marczykowski-Górecki
05d006b873 tests: minor fixes in int.tools tests 2016-03-03 01:18:16 +01:00
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
Wojtek Porczyk
689dd64b0d qubes: misc pylint fixes 2015-12-29 22:04:00 +01:00
Wojtek Porczyk
bf4dbe07d5 qubes/tests/vm/qubesvm: add basic tests for QubesVM
And already one fix to instantiation.
2015-12-29 20:35:04 +01:00
Wojtek Porczyk
66475e5ca7 qubes/tests/run: Fix running foregin TestCases
This is needed, because when tests fail to load, unittest module
generates artificial „LoadTestsFailure” class -- not based on our
QubesTestCase, so it does not have .log attribute.
2015-12-29 20:08:47 +01:00
Wojtek Porczyk
13b1a7201a qubes/tests: fix tearing down QubesTestCase 2015-12-29 16:49:17 +01:00
Wojtek Porczyk
8d55bf9016 qubes/tools/qvm_run: do not colour autostart log messages 2015-12-29 14:47:37 +01:00
Wojtek Porczyk
69e0b94c74 Fix for UUID management
This fixes up 75c3f355db "qubes/vm/qubesvm: fix domain's UUID management".

Previously 'domain-init' was never really fired.

fixes QubesOS/qubes-issues#1557
2015-12-29 03:50:35 +01:00
Wojtek Porczyk
ce0b927a98 qubes/tests/int/tools/qvm_run: add tests for qvm-run
Missing is test for --gui/--no-gui.

part of QubesOS/qubes-issues#1226
2015-12-29 03:50: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
Wojtek Porczyk
7b30361fa6 qubes/tools: add qubes-prefs
fixes QubesOS/qubes-issues#1209
2015-12-24 00:48:17 +01:00
Wojtek Porczyk
87f74a5ba8 qubes/storage: Fix template instantiation
rootcow image was somehow dropped
2015-12-24 00:14:28 +01:00
Wojtek Porczyk
ec50a411fe qubes/tests/int/tools/qubes_create: fix wrong assert 2015-12-23 14:34:54 +01:00
Wojtek Porczyk
5c57b4cda7 qubes/tests: fix regression in test setup
Regression was caused by 648fe213 "core3: test fixing"
2015-12-23 14:34:54 +01:00
Wojtek Porczyk
e4a0cfc8c8 qubes: fix instantiating with no or empty qubes.xml
There is always dom0 (domid=0) added, but it has None as self.xml.
2015-12-23 14:34:54 +01:00
Wojtek Porczyk
b54305bff1 qubes: fix qubes-create regression
Previous commit, which changed the handling of qubes.xml again, broke
bootstrapping.
2015-12-23 14:34:54 +01:00
Wojtek Porczyk
58608864c1 qubes: fix saving qubes.xml 2015-12-23 14:34:54 +01:00
Wojtek Porczyk
d693964ab9 qubes: fix deleting domain 2015-12-23 14:34:53 +01:00
Wojtek Porczyk
0dc0fd306f core3: test fixing
part of QubesOS/qubes-issues#1248
2015-12-23 14:34:53 +01:00
Wojtek Porczyk
dc3fcc3141 qubes/tests: port again the backported test runner
part of QubesOS/qubes-issues#1248
2015-10-17 00:20:44 +02:00
Wojtek Porczyk
2e42a408e5 core3: Add documentation to qubes.exc
part of QubesOS/qubes-issues#1279
2015-10-17 00:20:44 +02:00
Wojtek Porczyk
96efb4568a core3: add different exceptions
From now on there are different exceptions which can be raise on
different occasions.

fixes QubesOS/qubes-issues#1279
2015-10-17 00:17:12 +02:00
Wojtek Porczyk
ea44c0acf3 qubes: pylint fixes
Fix bunch of errors and warnings.
2015-10-05 23:49:39 +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
015b01fe46 qubes/tools: unify looking up the domain
This is common operation that is repeatable.
2015-10-05 17:34:13 +02:00
Wojtek Porczyk
55e4ddcd3d qubes/tools: custom QubesArgumentParser
Common functions that revolve around running the tool (like
`dont_run_as_root`) will be methods of this class.
2015-10-05 14:03:11 +02:00
Wojtek Porczyk
c9cbf8ffe2 core3: fix mounting modules.img 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
15c59f938c qubes/storage/xen: fix RO snapshot 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
3724d6fca1 qubes/vm/qubesvm: fix core2 compatibility 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
8628a984fc qubes/vm: fix memory constraint while generating libvirt XML 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
c538d536c8 core3: move qmemman
This is part of fixing qvm-start.

qmemman was moved with minimal touching, mainly module names.

Moved function parsing human-readable sizes from core2. This function is
wrong, because it treats k/M/G as 1024-based, but leave it for now.
2015-10-05 12:46:14 +02:00
Wojtek Porczyk
fcdb579bab core3: qubesmanager notifying extension
core/notify.py was excavated and tray notifying remnants were moved to
qubes.log. They are unused as yet.

Also extension events are fixed.
2015-10-05 12:46:14 +02:00
Wojtek Porczyk
75c3f355db qubes/vm/qubesvm: fix domain's UUID management
Now we generate UUID on domain's instantiation. This is needed, because
we sometimes don't update XML (like in qvm-start).

fixes QubesOS/qubes-issues#1236
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
ce60915fb0 qvm-ls: fix listing domains and labels 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
17ac6cb225 core3: boolean properties can be set explicitely 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
b4d51b016b core3: some properties can be set only once
Some properties should not be changed by user at will (like UUID). The
solution is to make them write-once, so they will be set when loading
from XML and frozen for the lifespan of the object holding the property.
When desperately needed, users may edit XML by hand.

fixes QubesOS/qubes-issues#1235
2015-10-05 12:46:14 +02:00
Wojtek Porczyk
a017d78174 Dumb down dir_path property
From now, dir_path cannot be set and is calculated from domain's class
and name.

fixes QubesOS/qubes-issues#1234
2015-10-05 12:46:14 +02:00
Wojtek Porczyk
12329e7b35 qubes/vm/qubesvm: fix log initialisation 2015-10-05 12:46:14 +02:00
Wojtek Porczyk
9da5ae8169 qvm-create: fix --template option 2015-10-05 12:46:13 +02:00
Wojtek Porczyk
d3425142bc qubes/tools: hide --xml option
It requires user to know, what he is doing
2015-10-05 12:46:13 +02:00
Wojtek Porczyk
b0af95fa2b qvm-prefs: support resetting values 2015-10-05 12:46:13 +02:00
Wojtek Porczyk
af1a6a49bd qvm-ls: fix printing label 2015-10-05 12:46:13 +02:00
Wojtek Porczyk
e7cba0214f qubes/tools: qvm-prefs 2015-10-05 12:46:13 +02:00
Wojtek Porczyk
0fbee4dc10 core3: more fixes 2015-10-05 12:46:13 +02:00
Wojtek Porczyk
80d664441d core3: fixes from Marek
This is adapted from commit 90a50dca406e3d40c88ea338566e0460589df7a3.
2015-10-05 12:46:13 +02:00
Wojtek Porczyk
e9b998400d qubes/vm/qubesvm: fix __init__ wrt .storage attr 2015-09-28 18:20:28 +02:00
Wojtek Porczyk
6241859dc8 qubes: Fix PropertyHolder.property_get_default
And test cases, some of them stubs.
2015-09-28 18:20:28 +02:00
Wojtek Porczyk
067f033af6 qubes/tools/qvm-create: Add internal --no-root option
And documentation fixes.
2015-09-28 18:20:28 +02:00
Wojtek Porczyk
136b3b36b8 qubes/tools/qubes-create: add --property option 2015-09-28 18:20:28 +02:00
Wojtek Porczyk
84eb082ed2 qubes/vm/qubesvm: fix label setting/loading 2015-09-28 18:20:28 +02:00
Wojtek Porczyk
f536935632 qubes/tools: add --verbose and --quiet to tools 2015-09-28 18:20:28 +02:00
Wojtek Porczyk
ea9a984fa7 qubes/vm: Fix instantiating QubesVM
vm.app attribute needs to be accessible before setting properties
2015-09-28 18:20:28 +02:00
Wojtek Porczyk
cb62545007 qubes: fix qid generation 2015-09-28 18:20:07 +02:00
Wojtek Porczyk
12092c3aa5 core3: port TemplateVM 2015-09-28 18:15:24 +02:00
Wojtek Porczyk
ff7d89700a qubes/tools: port qvm-create 2015-06-30 17:18:24 +02:00
Wojtek Porczyk
669a976d4e qubes/tools: add common action for setting properties 2015-06-29 17:40:43 +02:00
Wojtek Porczyk
b11b8cdbde qubes/tools: add common --force-root option 2015-06-29 17:39:29 +02:00
Wojtek Porczyk
6dc5f328f3 qubes/tools: ArgumentParser prepopulated with common options 2015-06-29 17:39:29 +02:00
Wojtek Porczyk
7832f23d5d qubes: minor fix 2015-06-29 17:39:29 +02:00
Wojtek Porczyk
7886695c63 qubes/vm/qubesvm: fix qid setter to accept str
Mainly for loading from XML.
2015-06-29 17:39:29 +02:00
Wojtek Porczyk
d4147c52bd qubes: Fix property-set events signature 2015-06-29 17:39:29 +02:00
Wojtek Porczyk
7f16e0a73b qubes: disable events by default not to interfere with loading from XML 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
f2d9d628c4 qubes/vm/qubesvm: Fix loading/instantiating 2015-06-29 17:39:28 +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
8e690c6858 qubes: fix saving Label 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
d5f2e6ab74 qubes: rework qubes.xml handling
Now it more closely aligns with old core2 semantics. New semantics will
have to wait for qubesd.
2015-06-29 17:39:28 +02:00
Wojtek Porczyk
7c8cc14bec core3: fix import 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
9a5703d5ea pylint fix 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
142521317c qubes: Documentation for qubes.tools
And first documentation for qubes.tools.qvm_ls.
2015-06-29 17:39:28 +02:00
Wojtek Porczyk
6a4820c381 qubes/tools: qvm-ls 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
e83d21c671 qubes: more documentation and doc fixes 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
5d9b92a039 qubes: pylint fixes (minor programming errors) 2015-06-29 17:39:28 +02:00
Wojtek Porczyk
186b277418 qubes/vm: fix logging 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
45977fc873 qubes: fix VM instantiation and loading 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
8c437f4053 qubes: unify PropertyHolder API
get_props_list() -> property_list()
_init_property() -> _property_init()
2015-06-29 17:39:27 +02:00
Wojtek Porczyk
6798790e1f qubes: pylint fixes (fix signatures) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
8d3edbf133 qubes/vm: fix kernels_dir 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
a686e810b9 qubes/tests: enhance test runner report 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
adb144acfe qubes: pylint fixes (small mistakes and wrong names) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
4a85c823c3 qubes: pylint fixes (qualify imported variables) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
bf29d5e5b5 qubes: pylint fixes (disable unfounded messages) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
ac1739df6b qubes: pylint fixes (fix imports) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
ee06e7d7a2 qubes: documentation and licence fixes 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
cdc3df66c8 qubes: pylint fixes (mostly whitespace) 2015-06-29 17:39:27 +02:00
Wojtek Porczyk
d937d39c9e qubes: fix Qubes instantiation 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
8e16dd2b28 qubes/storage: fix storage instantiation 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
8805db5e5f core3 move: AdminVM class 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
8afba4c5e9 core3 move: storage/* 2015-06-29 17:39:26 +02:00
Jason Mehring
0dbcdb8c0d qubes: pep8 fixes
-------------------------------------------------------------------------------
ISSUES:
-------------------------------------------------------------------------------

- Some auto-corrected code (when line is too long) may still be over-indented.
  It can be manually chaged and it will be left alone, or is it acceptable as
  I am not sure how strict your rule is for under-indented lines for which
  context.  If you want this only indented 4 spaces, I can work on it some more.
  [Also @ ~line:385 in new file]

  For example, __init__.py:382
  OLD:
    def __contains__(self, key):
        return any((key == vm or key == vm.qid or key == vm.name) for vm in self)

  NEW:
    def __contains__(self, key):
        return any((key == vm or key == vm.qid or key == vm.name)
                   for vm in self)

- will not detect if there are more than 2 spaces between function methods

-------------------------------------------------------------------------------
FIXED:
-------------------------------------------------------------------------------
- Now uses the most horizontial space and does not use excessive lines when
  splitting a line

- __init__:489
  - '#' comments being indented for some lines and not others; would like no indent
  - Only happens if line preceeding comment ends in a ':'

E128 - Fix visual indentation
E128 - Fix a badly indented line [Now allows under-indented lines]

E309 - Add missing blank line (after class declaration) [No longer adds it]

E303 - Remove extra blank lines [Now allows 2 blank lines between function defs]
       [TODO: Create definition to enforce this]

Conflicts:
	qubes/__init__.py
2015-06-29 17:39:26 +02:00
Jason Mehring
6504da9524 qubes: changed a test for None from == None to is None
Conflicts:
	qubes/__init__.py
2015-06-29 17:39:26 +02:00
Jason Mehring
be3e888bbe Fixed typos 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
a13a41fbaf qubes/tests: fix testrunner dependency on being run in specific directory 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
e5d2b49fd6 qubes/tests: fix colourful testrunner 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
7e12d0485d add core3 to Makefiles and spec 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
04c221e924 qubes/vm/qubesvm: fix env manipulation on qrexec-daemon start 2015-06-29 17:39:26 +02:00
Wojtek Porczyk
eda2f7cf73 qubes/tests: mark one test as expected failure
This is temporary, to be fixed in the future.
2015-06-29 17:39:26 +02:00
Wojtek Porczyk
af154b53fe qubes: change names of XML generating methods
Methods returning lxml.etree.Elements are called xml_ or lvxml_, meant for
qubes.xml or libvirt respectively.

Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:26 +02:00
Wojtek Porczyk
92eca8edb9 qubes: Fix comments accross the code
Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
2e1696cb16 qubes: Fix XML validation test 2015-06-29 17:39:25 +02:00
Wojciech Zygmunt Porczyk
42d8e67556 doc: Add autogenerated qubes.xml documentation 2015-06-29 17:39:25 +02:00
Wojciech Zygmunt Porczyk
118edb6ac4 First RelaxNG schema of qubes.xml
Schema is most likely incomplete.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
091ffa5444 qubes: Add parser for property docstring
From now, docstrings in properties cannot contain sphinx-specific features,
because there is no sphinx in dom0.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
0a94762508 doc: Tutorial for qubes.events and fix 2015-06-29 17:39:25 +02:00
Wojtek Porczyk
99edcb56c1 qubes: fix event framework
Two important fixes are in this commit: handlers from decorators are added when
class is defined (and not when class is instantiated); also multiple events can
be specified in the decorator.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
7971342811 qubes: Make get_props_list a classmethod
Same for get_property_def.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
c0e3281d04 qubes: fix changing domain name
Changing name of running VM is wrong.

Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
1deb3221c7 qubes: fix netvm semantics WRT default values
Automatic acquiring default*_netvm, default_template and {clock,update}vm is no
more. This will be moved to firstboot. Advanced users (those, who elect not to
autoconfig their initial VMs) will have to deal with that.

Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
c2a35c02b4 qubes: Cache QubesHost requests, fix xen-specific members
Acknowledgement:
This commit is a result of core3 review by Marek.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
2a62780ea2 qubes: add property-del events 2015-06-29 17:39:25 +02:00
Wojtek Porczyk
6ec86ec9f7 qubes: property may be unset by assinging DEFAULT
Introducing qubes.property.DEFAULT special value, which may be assigned to any
property. Result is the same as del'ing a property.
2015-06-29 17:39:25 +02:00
Wojtek Porczyk
713ced8cd2 qubes/tests: add event asserts for qubes module 2015-06-29 17:39:25 +02:00
Wojtek Porczyk
74c3126b80 qubes/tests: add some tests for qubes.property 2015-06-29 17:39:25 +02:00
Wojtek Porczyk
eabc571102 qubes/tests: colourful test runner 2015-06-29 17:39:24 +02:00
Wojtek Porczyk
52c1be49ec qubes/vm: remove unneccessary import 2015-06-29 17:39:24 +02:00
Wojtek Porczyk
de9eb60f61 Developer's documentation for qubes.tests 2015-06-29 17:39:24 +02:00
Wojtek Porczyk
8ace0fa634 qubes/tests: skipping tests outside dom0
New variable and decorator enable skipping tests outside dom0, that is, without
connection to libvirtd.
2015-06-29 17:39:24 +02:00
Wojtek Porczyk
613b03d277 qubes/tests: Common TestEmitter class
qubes.tests.TestEmitter is intended to check whether specific event fired on
given emitter.
2015-06-29 17:39:24 +02:00
Wojtek Porczyk
a82bf7cc54 qubes/tests: Move unit tests inside qubes/, add runner 2015-06-29 17:39:24 +02:00
Wojtek Porczyk
9fa3d60d0b qubes/events: fix event handling order
Events are divided into "pre" and "post" events. "Pre" events fire handlers in
MRO, "post" fire them in reverse.
2015-06-29 17:39:24 +02:00
Wojtek Porczyk
41fef46db2 core3 move: QubesVM
This is a big commit and probably incomplete. Tests will follow.
2015-06-29 17:39:24 +02:00
Wojtek Porczyk
6b7860995b qubes/events.py: Fire events from parent classes too 2015-06-29 17:39:24 +02:00
Wojtek Porczyk
f9658ae338 qubes/vm: remove old event methods that were overlooked 2015-06-29 17:39:24 +02:00
Wojtek Porczyk
f149c7b59b qubes/vm: fixed __repr__ for BaseVM
Previously it could fail with AttributeError when any of the properties was unset.
2015-06-29 17:39:24 +02:00
Wojtek Porczyk
ef4f00dac0 qubes/vm: DeviceManager class for herding devices
collections.defaultdict was not enough, because it cannot pass any arguments to
factory. We need to pass domain object and device class to fire events on attach
and detach.
2015-06-29 17:39:24 +02:00
Wojtek Porczyk
1a032ecf2a core3: basic global events and their documentation 2015-06-29 17:39:24 +02:00
Wojtek Porczyk
855a434879 core3: event framework adjusted for global Qubes object
From now, global events are emitted by qubes.Qubes object and handlers are registered there.
2015-06-29 17:39:24 +02:00
Wojtek Porczyk
b623a71d87 core3 move: QubesVmCollection
This got split to qubes.Qubes and qubes.VMCollection.
From now on, VMCollection is a stupid bag. Some parts went elsewhere.
2015-06-29 17:39:23 +02:00
Wojtek Porczyk
6146c8e466 QubesVmLabel: XML parsing 2015-06-29 17:39:23 +02:00
Wojtek Porczyk
6c68bd062e qubes.dochelpers: Version check for manual pages 2015-06-29 17:39:23 +02:00
Wojtek Porczyk
96bff66546 qubes.dochelpers: Helpers for Sphinx documentation
Currently it is possible to refer to Qubes' tickets via 🎫`#no`
2015-06-29 17:39:23 +02:00
Wojtek Porczyk
87ae0112eb qubes/vm: New XML format loading 2015-06-29 17:39:23 +02:00
Wojtek Porczyk
f3673dd34c core3 move: class QubesVmLabel 2015-06-29 17:39:23 +02:00
Wojtek Porczyk
778571fe8d core3 move: class QubesHost 2015-06-29 17:39:23 +02:00
Wojtek Porczyk
c3dd13c0ab qubes/log: logging routines 2015-06-29 17:39:23 +02:00
Wojtek Porczyk
320cb096f6 qubes: drop dry_run 2015-06-29 17:39:22 +02:00
Wojtek Porczyk
57d35fbc4c qubes: fix qubes.QubesVMMConnection
fix logical error in resetting offline_mode
and drop redundant _common_getter()
2015-06-29 17:39:22 +02:00
Wojtek Porczyk
cec3db993d core3 move: class QubesVMMConnection 2015-06-29 17:39:22 +02:00
Wojtek Porczyk
e1a6fb2859 core3 move: class QubesException 2015-06-29 17:39:22 +02:00
Wojtek Porczyk
65595e3b39 apidoc stub 2015-06-29 17:39:22 +02:00
Wojtek Porczyk
7f27d987cc import framework for core3 2015-06-29 17:39:22 +02:00