Commit Graph

107 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
cb87cfa824
app: add clone_vm function
This differ from main core-admin API, because Admin API do not expose
separate `create_on_disk()`/`clone_disk_files()` functions. When this is
a single operation, `add_new_vm()` cannot be repurposed to clone VM.
2017-04-29 01:18:36 +02:00
Marek Marczykowski-Górecki
2efe8405b7
app: fix QubesRemote.run_service
When no localcmd is given, it should only affect last argument(s) of
qrexec-client-vm call, not the whole command.
2017-04-29 01:18:36 +02:00
Marek Marczykowski-Górecki
b8a8394d2d
app: fix FD leak 2017-04-29 01:18:36 +02:00
Marek Marczykowski-Górecki
6e84422062
tools: minor fix for qvm-check 2017-04-29 01:18:36 +02:00
Marek Marczykowski-Górecki
b61844ae5d
tools: add qvm-create
The tool and tests.
2017-04-29 01:18:35 +02:00
Marek Marczykowski-Górecki
04593b273d
app: add get_label, get_vm_class and add_new_vm methods 2017-04-29 01:18:35 +02:00
Marek Marczykowski-Górecki
4113651f01
tools: fix default for SinglePropertyAction
For positional arguments default is sent to __call__ even when not
provided on command line. Exclude it in SinglePropertyAction, since
"default" value is really meant for 'properties' attribute, not
individual property.
2017-04-29 01:18:34 +02:00
Marek Marczykowski-Górecki
984ea09cef
tools: fix PropertyAction
self.default={} is mutable, so instead of modifying value derived from
that default, retrieve value, copy it and store again. Otherwise tests
(where the same parser is used multiple times) fails badly.
The same approach is used in argparse._AppendAction.
2017-04-29 01:18:34 +02:00
Marek Marczykowski-Górecki
377a82105d
Add qvm-start-gui autostart script
Start it using XDG Autostart feature, but exclude starting in
qubes-session - so even if package is installed in a VM, it wont be
started simultaneusly with GUI agent.
On the other hand, if some other DE session is running there (which will
be the case for GUI domain), gui-daemons will be started accordingly.

QubesOS/qubes-issues#833
2017-04-29 01:18:34 +02:00
Marek Marczykowski-Górecki
47cea5d146
Add 'daemon' python module dependency
It is required by qvm-start-gui tool.
2017-04-29 01:18:34 +02:00
Marek Marczykowski-Górecki
8eed508864
tools: add qvm-start-gui --notify-monitor-layout option
This is mostly what 'qubes-monitor-layout-notify' tool did in Qubes 3.2.
2017-04-29 01:18:33 +02:00
Marek Marczykowski-Górecki
bf053769bf
tools: qvm-remove
The tool and test.
2017-04-29 01:18:33 +02:00
Marek Marczykowski-Górecki
6cbfd74631
app: add VM removal support 2017-04-29 01:18:32 +02:00
Marek Marczykowski-Górecki
77a96b8b21
tools: qvm-features
The tool and tests.
2017-04-29 01:18:32 +02:00
Marek Marczykowski-Górecki
ed93b40e72
tools: qvm-check
The tool and tests.
2017-04-29 01:18:31 +02:00
Marek Marczykowski-Górecki
275a53e545
Make pylint happy 2017-04-29 01:18:31 +02:00
Marek Marczykowski-Górecki
b6d06d856d
tools: qvm-start
The tool and tests for it.
2017-04-29 01:18:31 +02:00
Marek Marczykowski-Górecki
8f7b902034
tools: qvm-run
The tool and tests for it.
2017-04-29 01:18:30 +02:00
Marek Marczykowski-Górecki
e7118b53ce
tests: basic tests for qvm-start-gui tool 2017-04-29 01:18:29 +02:00
Marek Marczykowski-Górecki
e76af930a7
tests: very naive mockup of app.run_service
Currently it doesn't check passed arguments, does not allow specify
expected stdout/stderr or even return code.
It's only enough to not crash tests on NotImplementedError.
2017-04-29 01:18:29 +02:00
Marek Marczykowski-Górecki
3559ec0c54
tools: add monitor layout support to qvm-start-gui
Again, mostly moved from qubes/exc/gui.py in core-admin.
2017-04-29 01:18:29 +02:00
Marek Marczykowski-Górecki
ef683485e2
events: add qubesd reconnection support
If connection is interrupted (for example qubesd restart), attempt to
reconnect.
2017-04-29 01:18:29 +02:00
Marek Marczykowski-Górecki
6dd7c69b3f
vm: add run* methods
The base method is run_service, but also implement convenient wrappers.
2017-04-29 01:18:28 +02:00
Marek Marczykowski-Górecki
21c65d7ea8
tools: improve --all switch
Don't check VM 'qid' (which require mgmt call), but VM class instead
2017-04-29 01:18:28 +02:00
Marek Marczykowski-Górecki
7a4f36f015
tests: add/fix VM state tests 2017-04-29 01:18:28 +02:00
Marek Marczykowski-Górecki
914c2d7e5e
vm: add/fix lifecycle-related methods 2017-04-29 01:18:27 +02:00
Marek Marczykowski-Górecki
e066656903
features: client-side API 2017-04-29 01:18:27 +02:00
Marek Marczykowski-Górecki
8989c1c010
tests: fix label test file location 2017-04-29 01:18:26 +02:00
Marek Marczykowski-Górecki
e40875ee5f
tests: events
Since qubesmgmt.events require python3, those tests can use python3
features. But it should be still importable on python2 (so, no 'yield
from', not type hits etc).
2017-04-29 01:18:26 +02:00
Marek Marczykowski-Górecki
5ed3d8d262
tools: add qvm-start-gui tool
This is mostly moved from qubes.ext.gui module.
2017-04-29 01:18:26 +02:00
Marek Marczykowski-Górecki
e66b96edd1
Add logging to Qubes() and QubesVM() objects 2017-04-29 01:18:25 +02:00
Marek Marczykowski-Górecki
7bafd631d4
Exclude tools and events from python2 tests and packaging
Those two parts require python3.
To avoid duplicating the exclude list, run tests and pylint on a copy
installed via setuptools.
2017-04-29 01:18:25 +02:00
Marek Marczykowski-Górecki
d0e8c0515e
label: add index and icon 2017-04-29 01:18:25 +02:00
Marek Marczykowski-Górecki
785706af2f
events: initial implementation
This module use asyncio, so require Python 3. And actually >= 3.5.2
because of asyncio.StreamReader.readuntil().

Modules are designed the way it's still possible to use non-events API
on Python 2.
2017-04-29 01:18:24 +02:00
Marek Marczykowski-Górecki
d8b0ff349d
refactor 'QUBESD_SOCKET' into separate module
This will avoid cyclic imports in upcoming events implementation
2017-04-29 01:18:24 +02:00
Marek Marczykowski-Górecki
36d8ee9b32
Add qvm-pool and qvm-volume tool 2017-04-07 18:48:05 +02:00
Marek Marczykowski-Górecki
1fd09f4e58
Add StoragePoolException 2017-03-13 04:41:55 +01:00
Marek Marczykowski-Górecki
f42b8d0721
tools: recognize size units regardless of case 2017-03-13 04:41:55 +01:00
Marek Marczykowski-Górecki
9a26eec1ac
Make names always 'str'
Regardless of python version, always have names as 'str' type.
2017-03-13 04:41:54 +01:00
Marek Marczykowski-Górecki
e7d89bcc0d
Add app.pools collection and related functions
Collection to access storage pools and methods to create/remove pools.
2017-03-13 04:41:54 +01:00
Marek Marczykowski-Górecki
64d2f13212
Make generic named objects collection instead of separate for each type
There will be more:
 - labels
 - storage pools
 - storage volumes
2017-03-13 04:41:54 +01:00
Marek Marczykowski-Górecki
0e775209fd
storage: pass volume id as a payload in mgmt.pool.volume.* methods
Volume id may contain characters normally not allowed in qrexec argument
(like '/'). Also, don't encode two values inside one qrexec argument, as
it makes writing a policy much harder.
2017-03-13 04:37:31 +01:00
Marek Marczykowski-Górecki
a493352e5d
tests: add qvm-ls
Very few tests for qvm-ls, but include two very broad (multiple VMs,
various columns etc).
2017-03-13 04:37:31 +01:00
Marek Marczykowski-Górecki
ad570ec027
tools: make print_table compatible with python2 and python3 tests
StringIO expect 'str' object, but on python2 it's different from
'unicode' (returned by decode() method). Convert it explicitly back to
str.
2017-03-13 04:37:31 +01:00
Marek Marczykowski-Górecki
e2481b19a2
tools/qvm-ls: various fixes
1. Fix displaying non-str values - convert them to string.
2. Always sort VMs.
3. Add app argument to main - required for tests.
2017-03-13 04:37:31 +01:00
Marek Marczykowski-Górecki
9262363569
Make QubesVM objects comparable and str()-able
Required for sorting and displaying easily.
2017-03-13 04:37:30 +01:00
Marek Marczykowski-Górecki
310d9da381
tests: add convenient TestVM and TestVMCollection classes
Very simple mockups for other tests.
2017-03-13 04:37:30 +01:00
Marek Marczykowski-Górecki
f323fdec53
Initial labels support
It's just first part - reading info about them. The missing part:
creating and removing.
2017-03-13 04:37:30 +01:00
Marek Marczykowski-Górecki
ede625d1dd
tests: catch and check stderr from invalid argument type tests
Verify if tool failed with expected message, but also make tests output
more readable.
2017-03-13 04:37:30 +01:00
Marek Marczykowski-Górecki
c1ae5f8bf5
Adjust property value decoding
Now property.Get contains also explicit value type.
2017-03-13 04:37:30 +01:00