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
Marek Marczykowski-Górecki
ade0030efe
Implement vm.get_power_state()
2017-03-13 04:37:29 +01:00
Marek Marczykowski-Górecki
795909bc05
tools/qvm-prefs: re-add --help-properties action
...
Specific VM object is required to get list of properties and help on
them, so convert HelpPropertiesAction into normal action (like --get or
--set).
2017-03-13 04:37:29 +01:00
Marek Marczykowski-Górecki
2472be9d61
Implement property_help() method
2017-03-13 04:37:29 +01:00
Marek Marczykowski-Górecki
f027aa5385
Improve handling rejected access to properties
...
When qubesd reject access to property (do not return anything), it may
mean various things - invalid property, permission denied, or even
invalid VM. Handle all of those with exception inheriting from
AttributeError.
2017-03-13 04:37:29 +01:00
Marek Marczykowski-Górecki
5615510da5
Add specific exception for qubesd communication error
2017-03-13 04:37:28 +01:00
Marek Marczykowski-Górecki
9d5e974c5b
Simplify reading data from local socket
2017-03-13 04:37:28 +01:00
Marek Marczykowski-Górecki
f6e48cb3ff
Rename methods for global properties
...
Finally we've settled for `mgmt.property.`, instead of
`mgmt.global.property.` prefix.
QubesOS/qubes-issues#853
2017-03-13 04:37:28 +01:00
Marek Marczykowski-Górecki
435a465d70
tools/qvm-ls: kill fixed column width
...
Calculate column width dynamically, besed on actual contents.
2017-03-13 04:37:28 +01:00
Marek Marczykowski-Górecki
fea3d3391f
tools/qvm-ls: adjust VM classes
...
QubesOS/qubes-issues#853
2017-03-11 09:40:08 +01:00
Marek Marczykowski-Górecki
554081498d
tools/qvm-ls: assume "unknown" colums being VM properties
...
Listing VM properties require specific object, so instead of collecting
all properties from all VMs (which may be denied by policy), simply
try to access properties (and display '-' when it fails).
QubesOS/qubes-issues#853
2017-03-11 09:39:09 +01:00
Marek Marczykowski-Górecki
77250ab529
tools/qvm-ls: copy mostly-unmodified version from core-admin
2017-03-09 02:52:37 +01:00
Marek Marczykowski-Górecki
f9241c854a
pylint: disable duplicate-code
...
It's triggered by various qvm-* tools. While it could be improved, in
most cases it isn't worth it.
2017-03-09 02:46:13 +01:00
Marek Marczykowski-Górecki
6dd6d9e254
tests: add tests for simple tools
...
QubesOS/qubes-issues#853
2017-03-09 02:46:13 +01:00
Marek Marczykowski-Górecki
21d60eff4c
Add vm.shutdown(force) parameter
...
But not it's implementation (currently not specified in API).
QubesOS/qubes-issues#853
2017-03-09 02:39:54 +01:00
Marek Marczykowski-Górecki
795a06e400
tools: pause/unpause/shutdown - don't stop on first failed VM
...
But still report a failure with exit code if any of them failed.
QubesOS/qubes-issues#853
2017-03-09 02:39:54 +01:00
Marek Marczykowski-Górecki
7baa7e4862
Import full exceptions hierarchy
...
QubesOS/qubes-issues#853
2017-03-09 02:39:54 +01:00
Marek Marczykowski-Górecki
484743faf0
tests: add qubes-prefs tests
...
Based on qvm-prefs.
2017-03-09 02:39:53 +01:00
Marek Marczykowski-Górecki
e0af402c16
tools/qvm-kill: don't use deprecated force_shutdown method
...
QubesOS/qubes-issues#853
2017-03-09 02:39:53 +01:00
Marek Marczykowski-Górecki
69396040fd
Fix global properties handling
...
API name isn't 'mgmt.global.*' - discussed options are
'mgmt.global.property.*' or 'mgmt.property.*'. Lets settle on the
former.
QubesOS/qubes-issues#853
2017-03-09 02:39:53 +01:00
Marek Marczykowski-Górecki
4ffd44da49
tools/qvm-prefs: handle invalid properties by catching AttributeError
...
This may avoid unneded qubesd call (listing properties).
2017-03-09 02:39:53 +01:00
Marek Marczykowski-Górecki
e4c2294ce0
tools/qvm-prefs: adjust for qubesmgmt module
...
list_properties() returns strings, not property objects.
2017-03-09 02:39:52 +01:00
Marek Marczykowski-Górecki
bf03f6630f
Handle python standard exceptions in qubesd response
...
This may be useful for things like AttributeError, ValueError etc.
Use error name directly as exception name without much validation, as it
comes from dom0.
2017-03-09 02:39:52 +01:00
Marek Marczykowski-Górecki
6b8bbd9c51
tests: adjust StdoutBuffer for python2/python3 compatibility
...
io.StringIO expects unicode writes, while string literal on python2 are
bytes. Act accordingly.
2017-03-09 02:39:52 +01:00
Marek Marczykowski-Górecki
a575bc3422
tools: allow supplying app object to main function
...
This is mostly for tests, which use dummy app instance.
2017-03-09 02:39:52 +01:00
Marek Marczykowski-Górecki
61731a9490
tools: kill --force-root and --qubesxml arguments
...
Those are no longer useful, as all actions are delegated to qubesd. Keep
--force-root argument (but ignore it and hide from help) for backward
compatibility with various scripts.
Fixes QubesOS/qubes-issues#2684
2017-03-09 02:39:51 +01:00
Marek Marczykowski-Górecki
32bd75da77
Update license headers
...
Update GPL->LGPL for tools moved from core-admin repository.
While at it, change mailing address to www link, as suggested by FSF.
Cc: @woju
Cc: @rootkovska
2017-03-09 02:39:51 +01:00
Marek Marczykowski-Górecki
fe74b05049
tests: migrate basic tools tests
2017-03-09 02:39:51 +01:00
Marek Marczykowski-Górecki
6b8d58885b
tools: reduce code duplication
...
Have one implementation for all property-related tools.
2017-03-09 02:39:51 +01:00
Marek Marczykowski-Górecki
bb770b4744
tools: include a few simple tools
...
QubesOS/qubes-issues#853
2017-03-09 02:39:50 +01:00
Marek Marczykowski-Górecki
a813d50267
tools: adjust for qubesmgmt module
...
For now comment out HelpPropertiesAction, as we don't have VM classes
here and accessing properties help require VM instances.
This needs some better idea...
2017-03-08 15:55:52 +01:00
Marek Marczykowski-Górecki
2e2ce8454b
tools: copy unmodified file from core-admin
2017-03-08 15:55:51 +01:00
Marek Marczykowski-Górecki
45dcc6b1dd
travis: integrate test coverage reports via codecov
2017-03-02 02:05:36 +01:00
Marek Marczykowski-Górecki
7d7f1724ff
make pylint happy
...
Add mock dbus module
2017-03-02 02:05:35 +01:00
Marek Marczykowski-Górecki
e826ebff53
utils: copy tools-related utility functions
2017-03-02 02:05:35 +01:00