Commit Graph

191 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
57e293eb54
Merge branch 'core3-qmemman-fix' 2017-06-22 23:16:35 +02:00
Marek Marczykowski-Górecki
588ff04f0d
qmemman: fix units on meminfo parsing
meminfo (written by VM) is expected report KiB, but qmemman internally
use bytes. Convert units.
And also move obscure unit conversion in is_meminfo_suspicious to more
logical place in sanitize_and_parse_meminfo.
2017-06-21 06:34:00 +02:00
Wojtek Porczyk
96a66ac6bd
qubes/api: refactor creating multiple qubesd sockets
Now there is a single function to do this, shared with tests.
2017-06-21 00:17:37 +02:00
Wojtek Porczyk
71a4390fdb
qubes/tools/qubesd: properly unlink UNIX sockets at shutdown 2017-06-20 13:00:20 +02:00
Wojtek Porczyk
858e547525
qubes: reorganise API protocols
Now instantiating API servers is handled by common function. This is,
among other reasons, for creating ad-hoc sockets for tests.
2017-06-20 13:00:20 +02:00
Marek Marczykowski-Górecki
93ccb8bbda
Merge remote-tracking branch 'qubesos/pr/111'
* qubesos/pr/111:
  vm: drop 'internal' property
  qmemman: make sure to release lock
  qmemman: fix meminfo parsing for python 3
  devices: drop 'data' and 'frontend_domain' fields, rename 'devclass' to 'bus'
2017-06-12 23:22:55 +02:00
Marek Marczykowski-Górecki
206b7c02d5
qmemman: make sure to release lock
Even when handling updated meminfo or domain list something goes wrong,
make sure to release the lock - otherwise the whole qmemman will be
blocked.
2017-06-12 10:06:43 +02:00
Marek Marczykowski-Górecki
28737d16ce
Migrate qubes.NotifyTools, qubes.FeaturesRequest, qubes.NotifyUpdates
Make them call into qubesd. Create separate socket for "misc" calls - VM
accessible, but not part of Admin API.
2017-06-06 03:33:30 +02:00
Marek Marczykowski-Górecki
43fd1d76e8
tools/qubesd-query: add option to report failure with exit code 2017-06-06 03:33:30 +02:00
Marek Marczykowski-Górecki
305fb5b6d0
Move qvm-template-postprocess tool to core-admin-client
Since implementing admin.vm.volume.Import, this migrated to Admin API.
2017-05-26 15:08:17 +02:00
Marek Marczykowski-Górecki
74689dd998
qubesd: reduce verbosity
Remove debug prints, log full traceback (of handled exception) only when
debug mode enabled (--debug, introduce in this commit too).
--debug option also enables sending tracebacks to the API clients.

QubesOS/qubes-issues#853
2017-05-23 04:47:50 +02:00
Marek Marczykowski-Górecki
0ef010cc70
qmemman: fix list/filter handling on python3
Filter in python3 returns a generator, can be iterated only once.
This is about list of existing domains - store it as a list, otherwise
domains will "disappear" after being discovered.
2017-05-18 09:44:48 +02:00
Marek Marczykowski-Górecki
4d6d6c913a
qubesd: make sure NOTIFY_SOCKET variable is not propagated
qubesd do start other daemons - make sure they will not try to signal
systemd about it. In some cases such daemons (qubesdb-daemon) behave
differently based on this variable.
2017-05-17 11:17:22 +02:00
Marek Marczykowski-Górecki
cd489f46e1
Rename MgmtAPI to AdminAPI - part 1: classes
QubesOS/qubes-issues#853
2017-05-12 19:28:07 +02:00
Marek Marczykowski-Górecki
83eef56f9d
Remove tools that are moved to -client repository
QubesOS/qubes-issues#853
2017-05-12 18:43:35 +02:00
Marek Marczykowski-Górecki
0dfcaa63c9
Handle libvirt events in qubesd
This is required to get shutdown notification, when it wasn't initiated
by qubesd (for example 'poweroff' command inside of VM).
Libvirt event loop implementation must be registered before making
connection to libvirt, so move it to the beginning of main().
For now, only 'domain-shutdown' event is emited.
2017-05-12 17:04:19 +02:00
Marek Marczykowski-Górecki
68c3d7309a
tools: remove qubes_monitor_layout_notify tool - moved to mgmt-client 2017-05-12 14:25:30 +02:00
Marek Marczykowski-Górecki
278243d7dc
tools/qubesd: fix sending exception response
QubesOS/qubes-issues#2622
2017-05-12 14:25:29 +02:00
Marek Marczykowski-Górecki
2aa0de3d5b
tools: remove qvm-ls tool and related integration in qubes.property
qvm-ls tool (as all other tools) will be accessing properties through
API, so no need (nor sense) for this tool-specific attributes in
qubes.property. The only somehow used was ls_width, and in fact it made
the output unnecessary wide.

The tool itself is already moved to core-mgmt-client repository.

QubesOS/qubes-issues#853
2017-05-12 14:25:27 +02:00
Marek Marczykowski-Górecki
7e4bc4249d
tools/qubesd-query: handle events-based methods
Pass the data as it arrives, instead of buffering it all.

QubesOS/qubes-issues#2622
2017-05-12 14:25:26 +02:00
Marek Marczykowski-Górecki
40a86efd66
mgmt: add support for events-sending methods
Standard methods return only one value, after operation is completed,
but events-related methods may return multiple values during the method
execution time. Provide a callback for such cases.
Also, according to specification, avoid sending both event and non-event
values.

QubesOS/qubes-issues#2622
2017-05-12 14:25:26 +02:00
Marek Marczykowski-Górecki
bd9f1d2e7c
mgmt: add support for cancellable operations
Allow method handler to decide if operation could be cancelled. If yes,
when connection to the qubesd is terminated (and
protocol.connection_lost get called) the operation is cancelled using
standard asyncio method - in which case asyncio.CancelledError is thrown
inside method handler. This needs to be explicitly enabled, because
cancellable methods are much harder to write, to maintain consistent
system state.
Caveat: protocol.connection_lost is called only when trying to send some
data to it (and it's already terminated). Which makes this whole
mechanism useful only for events. Otherwise, when sending some data (and
possibly detecting that connection is broken), the operation is already
completed.

QubesOS/qubes-issues#2622
2017-05-12 14:25:26 +02:00
Marek Marczykowski-Górecki
6383d87be9
qmemmand: fix systemd notification 2017-05-12 14:25:25 +02:00
Marek Marczykowski-Górecki
50b812190b
Merge remote-tracking branch 'kalkin/device-assignments' into core3-devel
* kalkin/device-assignments: (21 commits)
  PCI extension cache PCIDevice objects
  Make pylint ♥
  Fix pylint warning no-else-return
  Fix pylint warning len-as-conditional
  device-list-attached event returns a dev/options tupples list
  DeviceAssignment options are now a dict
  Remove WrongAssignment exception
  Rename qubes.devices.BlockDevice to qubes.storage.BlockDevice
  Update relaxng devices option element
  Fix tests broken by the new assignment api
  Fix qubes.tests.devices
  Fix pci device integration tests
  qvm-device add support for assignments
  Update ext/pci to new api
  BaseVM add DeviceAssignment xml serialization
  Migrate DeviceCollection to new API
  Add PersistentCollection helper to qubes.devices
  Add DeviceAssignment
  qvm-device validates device parameters
  qvm-device fix handling of non block devices
  ...
2017-04-21 17:09:33 +02:00
Marek Marczykowski-Górecki
fa72679b47
Make pylint happy
New pylint throw some more warnings.
2017-04-21 16:57:35 +02:00
Bahtiar `kalkin-` Gadimov
79407a8717
Make pylint ♥ 2017-04-15 23:50:11 +02:00
Bahtiar `kalkin-` Gadimov
5bc7a8f9e3
Fix pylint warning no-else-return 2017-04-15 23:49:41 +02:00
Bahtiar `kalkin-` Gadimov
eb217e0d27
Fix pylint warning len-as-conditional 2017-04-15 23:49:41 +02:00
Bahtiar `kalkin-` Gadimov
0f78d257d4
qvm-device add support for assignments
- Add header field ASSIGNED
- Persistent assignments are displayed with an asterisk
- Add '-p' to attach command

Fix qvm-device

Signed-off-by: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
2017-04-15 18:05:30 +02:00
Bahtiar `kalkin-` Gadimov
e52898972d
qvm-device validates device parameters 2017-04-15 18:05:25 +02:00
Bahtiar `kalkin-` Gadimov
6caaa6f66d
qvm-device fix handling of non block devices 2017-04-15 18:05:24 +02:00
Marek Marczykowski-Górecki
83526a28d3
qubesd: add second socket for in-dom0 internal calls
This socket (and commands) are not exposed to untrusted input, so no
need to extensive sanitization. Also, there is no need to provide a
stable API here, as those methods are used internally only.

QubesOS/qubes-issues#853
2017-04-07 17:07:28 +02:00
Wojtek Porczyk
1b9479837a Merge remote-tracking branch 'marmarek/core3-mgmt-methods1' into core3-devel
Conflicts:
	qubes/mgmt.py
2017-04-01 18:33:54 +02:00
Wojtek Porczyk
8e3621c4e5 Move libviraio to core-libvirt, may be upstreamed
QubesOS/qubes-issues#2622
2017-03-22 15:30:55 +01:00
Marek Marczykowski-Górecki
2c115bb648
mgmt: allow functions to return None if no data is to be returned
Don't force `return ''` everywhere.

QubesOS/qubes-issues#2622
2017-03-17 12:49:28 +01:00
Marek Marczykowski-Górecki
f7eabf8eb0
tools/qubesd: do not close connection before sending response
eof_received callback should return True, if connection should not be
automatically closed just after returning from it.
2017-03-16 20:04:01 +01:00
Wojtek Porczyk
4a247b1b1b Merge remote-tracking branch 'origin/pull/90/head' into core3-devel 2017-03-02 13:19:57 +01:00
Wojtek Porczyk
c2a0d34ade pylint: do not interpret asyncio.ensure_future compat hack 2017-03-01 18:30:49 +01:00
Wojtek Porczyk
865ab10a0c qubesd+mgmt: convert mgmt functions to coroutines
QubesOS/qubes-issues#2622
2017-03-01 17:31:37 +01:00
Marek Marczykowski-Górecki
2169075807
qubesd: fix response message header
Type is not 16 bit big-endian. Encode it as 8bit code and \x00 as
delimiter explicitly.

QubesOS/qubes-issues#853
2017-02-27 21:43:14 +01:00
Marek Marczykowski-Górecki
f4616fc366
qubesd: make qubesd socket qubes-group owned
QubesOS/qubes-issues#853
2017-02-27 21:42:06 +01:00
Marek Marczykowski-Górecki
33416f2549
qmemman: update for py3k
This just make the code compatible with py3k, but nothing more.
Converting to asyncio is probably the next step.
2017-02-27 02:37:49 +01:00
Wojtek Porczyk
be53db4db9 qubes/events: they accept only keyword arguments
Positional arguments are hereby deprecated, with immediate effect.

QubesOS/qubes-issues#2622
2017-02-21 14:46:42 +01:00
Wojtek Porczyk
48f10a79c9 qubes/tools/qubesd: add response header
QubesOS/qubes-issues#2622
2017-02-21 14:46:42 +01:00
Wojtek Porczyk
25d81b8ab6 Merge remote-tracking branch 'origin/pull/88/head' into core3-devel 2017-02-15 12:17:41 +01:00
Marek Marczykowski-Górecki
e50b17a6b3
tools/qvm-features: make pylint happy
reduce number of return statements.
2017-02-15 00:01:33 +01:00
Marek Marczykowski-Górecki
0c43329188
tools/qvm-features: fix handling empty list of features 2017-02-15 00:01:33 +01:00
Marek Marczykowski-Górecki
98edc9779c
tools/qvm-features: fix domain argument handling
It's args.domains[0], not args.vm.
2017-02-15 00:01:33 +01:00
Wojtek Porczyk
e8a5bc9b36 qubesd: improve exception handling
QubesOS/qubes-issues#2622
2017-02-10 23:25:45 +01:00
Wojtek Porczyk
249d8c08e2 qubes/tools/qubesd-query: low-level interrogation tool 2017-02-10 23:25:45 +01:00