Commit Graph

35 Commits

Author SHA1 Message Date
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
3564250298
devices: drop 'data' and 'frontend_domain' fields, rename 'devclass' to 'bus'
Drop DeviceInfo.data - device extension should provide a subclass with
proper individual fields.
Drop DeviceAssignment.frontend_domain - this information is redundant -
frontend domain is defined by where DeviceAssignment is attached.
Rename DeviceCollection.devclass to bus - devclass if confusing here,
because this term is also used for DeviceInfo subclass.
2017-06-12 10:06:42 +02:00
Marek Marczykowski-Górecki
257c8c0821
devices : make DeviceInfo sortable 2017-06-05 23:33:58 +02:00
Marek Marczykowski-Górecki
d0b8933374
devices: add assignment.device property
Make it easy to retrieve DeviceInfo object out of DeviceAssignment
object. The only missing piece of information for that is device class,
so add it. Make it optional, as it can be filled on demand when passing
the object through DeviceCollection (either by listing devices, or
attaching/detaching).

This is mostly to ease handling options in libvirt template - to get
them, you need to use `assignments()`, istead of `persistent()` or
`attached()`, but there were no _simple_ way of getting actual device
object.

This also makes DeviceCollection._device method not needed anymore.
2017-05-22 03:21:07 +02:00
Marek Marczykowski-Górecki
661752bbc1
devices: list persistent devices also when not currently attached
When device extension do not return some "persistent" device as
currently attached, still return it, as it will be attached at next
domain startup. User can distinguish such devices by having
frontend_domain=None (or other VM).
Also, return a set from DeviceCollection.assignments().
2017-05-16 09:05:22 +02:00
Marek Marczykowski-Górecki
2c0d79af4a
devices: pass attach options to device handling extension
Otherwise options would be ignored...
2017-05-16 09:05:22 +02:00
Marek Marczykowski-Górecki
8533ec9773
devices: add clone method
Copy DeviceAssignment object
2017-05-16 09:05:00 +02:00
Marek Marczykowski-Górecki
7ef020d5fe
devices: fix 'NotImplemented' usage
'__eq__' function should return 'NotImplemented' _value_, not
'NotImplementedError' exception.
2017-05-12 17:04:20 +02:00
Marek Marczykowski-Górecki
4f0d72f99a
devices: adjust API documentation
Device ident may contain only characters allowed in qrexec argument.
This will allow using it directly in qrexec argument in Attach/Detach
methods.
This also means PCI extension will need to be updated (it uses ':' in
ident).

QubesOS/qubes-issues#853
2017-05-12 17:04:20 +02:00
Marek Marczykowski-Górecki
6926725e02
Fixes for devices API
See comments in #98
2017-05-12 14:25:31 +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
9da28c9c15
device-list-attached event returns a dev/options tupples list 2017-04-15 23:49:40 +02:00
Bahtiar `kalkin-` Gadimov
1c9636c5af
DeviceAssignment options are now a dict 2017-04-15 23:49:40 +02:00
Bahtiar `kalkin-` Gadimov
5a8cc9bdd3
Remove WrongAssignment exception
Signed-off-by: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
2017-04-15 23:49:39 +02:00
Bahtiar `kalkin-` Gadimov
e446e7a2f4
Rename qubes.devices.BlockDevice to qubes.storage.BlockDevice
Signed-off-by: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
2017-04-15 23:49:36 +02:00
Bahtiar `kalkin-` Gadimov
990cfd8ab9
Migrate DeviceCollection to new API
- Use PersistentCollection as _set()
- attach/detach expect DeviceAssignment as parater
- attached(persistent=True) is now persistent()
- attached() returns all attached devices
- assigned() returns all attached device assignments

`#	modified:   templates/libvirt/xen.xml

Signed-off-by: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
2017-04-15 18:05:28 +02:00
Bahtiar `kalkin-` Gadimov
23c68c5458
Add PersistentCollection helper to qubes.devices 2017-04-15 18:05:27 +02:00
Bahtiar `kalkin-` Gadimov
211e018268
Add DeviceAssignment 2017-04-15 18:05:26 +02: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
d74567d65f qubes: port core to python3
fixes QubesOS/qubes-issues#2074
2017-01-20 16:42:51 +01:00
Marek Marczykowski-Górecki
aa67a4512e
qubes/ext/pci: move PCI devices handling to an extension
Implement required event handlers according to documentation in
qubes.devices.

A modification of qubes.devices.DeviceInfo is needed to allow dynamic,
read-only properties.

QubesOS/qubes-issues#2257
2016-09-03 20:41:03 +02:00
Marek Marczykowski-Górecki
e1de82ea53
qubes/devices: use more detailed exceptions than just KeyError
Especially inherit from QubesException, so tools will treat this as
properly handled error.

QubesOS/qubes-issues#2257
2016-09-03 20:41:03 +02:00
Marek Marczykowski-Górecki
e5d6c4e078
qubes/devices: allow non-persistent attach
QubesOS/qubes-issues#2257
2016-09-03 20:41:02 +02:00
Marek Marczykowski-Górecki
d7a3c0d319
qubes: new devices API
Allow device plugin to list attached and available devices. Enforce
at API level every device being exposed by some domain.

This commit only changes devices API, but not update existing users
(pci) yet.

QubesOS/qubes-issues#2257
2016-09-03 20:40:39 +02:00
Bahtiar `kalkin-` Gadimov
d3f8fc96e4 Fix pci device attachment to QubesVM 2016-07-21 12:22:53 +02:00
Wojtek Porczyk
ba20254888 Rewrite PCI attaching/detaching from xl to libvirt
The only remaining part is querying vm-side BDF. That can't be done
in libvirt.
2016-06-16 13:29:15 +02:00
Wojtek Porczyk
6ade5736d7 pylint fixes 2016-06-10 21:27:29 +02:00
Wojtek Porczyk
63c09a090c qubes: Combat import cycles
This commit eliminates import statements happening in the middle of the
file (between two classes definition). The cycles are still there. The
only magic module is qubes itself.
2016-05-05 14:33:09 +02:00
Bahtiar `kalkin-` Gadimov
2f99efa4b8 Add BlockDevice 2016-04-25 07:16:36 +02:00
Marek Marczykowski-Górecki
06c315c94b qubes: fix/update event names
Fix few typos, then rename:
 - recreate-appmenus -> domain-restore: there may be more to do than
 only appmenus
2016-04-07 12:59:39 +02:00
Wojtek Porczyk
c375334c54 qubes/devices: calculate event names using +
This make static analysis of the events easier.
2016-03-23 09:08:13 +01:00
Wojtek Porczyk
349e218638 qubes/devices: devices class framework
This fixes loading PCI devices.
2016-03-23 09:08:13 +01:00
Wojtek Porczyk
5eaf03c4a2 HVM part 1 2016-03-21 11:44:46 +01:00