Skip to content

Commit 8a93ad3

Browse files
committed
Merge remote-tracking branch 'origin/pr/637'
* origin/pr/637: Few fixes from @marmarek's comments qubes.rng: reorder according to how we construct xml Introduce LocalVM to extract BaseVM being smaller class
2 parents 69235b9 + 755e7cf commit 8a93ad3

File tree

15 files changed

+177
-137
lines changed

15 files changed

+177
-137
lines changed

doc/qubes-features.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ request in ``features-request`` event handler. If no extension handles given
7272
feature request, it will be ignored. The extension should carefuly validate
7373
requested features (ignoring those not recognized - may be for another
7474
extension) and only then set appropriate value on VM object
75-
(:py:attr:`qubes.vm.BaseVM.features`). It is recommended to make the
75+
(:py:attr:`qubes.vm.LocalVM.features`). It is recommended to make the
7676
verification code as bulletproof as possible (for example allow only specific
7777
simple values, instead of complex structures), because feature requests come
7878
from untrusted sources. The features actually set on the VM in some cases may

doc/qubes-vm/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ two, the :py:class:`qubes.vm.qubesvm.QubesVM` cares about Qubes-specific
1919
actions, that are more or less directly related to security model. It is
2020
intended to be easily auditable by non-expert programmers (ie. we don't use
2121
Python's magic there). The second class is its parent,
22-
:py:class:`qubes.vm.BaseVM`, which is concerned about technicalities like XML
22+
:py:class:`qubes.vm.LocalVM`, which is concerned about technicalities like XML
2323
serialising/deserialising. It is of less concern to threat model auditors, but
2424
still relevant to overall security of the Qubes OS. It is written for
2525
programmers by programmers.
2626

2727
The second object is the XML node that refers to the domain. It can be accessed
28-
as :py:attr:`Qubes.vm.BaseVM.xml` attribute of the domain object. The third one
28+
as :py:attr:`Qubes.vm.LocalVM.xml` attribute of the domain object. The third one
2929
is :py:attr:`Qubes.vm.qubesvm.QubesVM.libvirt_domain` object for directly
3030
interacting with libvirt. Those objects are intended to be used from core and/or
3131
plugins, but not directly by user or from qvm-tools. They are however public, so
@@ -48,7 +48,7 @@ Package contents
4848
Main public classes
4949
^^^^^^^^^^^^^^^^^^^
5050

51-
.. autoclass:: qubes.vm.BaseVM
51+
.. autoclass:: qubes.vm.LocalVM
5252
:members:
5353
:show-inheritance:
5454

qubes/app.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,17 +503,19 @@ def vms(self):
503503
def add(self, value, _enable_events=True):
504504
"""Add VM to collection
505505
506-
:param qubes.vm.BaseVM value: VM to add
506+
:param qubes.vm.LocalVM value: VM to add
507507
:param _enable_events:
508508
:raises TypeError: when value is of wrong type
509509
:raises ValueError: when there is already VM which has equal ``qid``
510510
"""
511511

512512
# this violates duck typing, but is needed
513513
# for VMProperty to function correctly
514-
if not isinstance(value, qubes.vm.BaseVM):
514+
if not isinstance(value, qubes.vm.LocalVM):
515515
raise TypeError(
516-
"{} holds only BaseVM instances".format(self.__class__.__name__)
516+
"{} holds only LocalVM instances".format(
517+
self.__class__.__name__
518+
)
517519
)
518520

519521
if value.qid in self:
@@ -543,7 +545,7 @@ def __getitem__(self, key):
543545
return vm
544546
raise KeyError(key)
545547

546-
if isinstance(key, qubes.vm.BaseVM):
548+
if isinstance(key, qubes.vm.LocalVM):
547549
key = key.uuid
548550

549551
if isinstance(key, uuid.UUID):

qubes/ext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def decorator(func):
9494
elif "vm" in kwargs:
9595
func.ha_vm = kwargs["vm"]
9696
else:
97-
func.ha_vm = qubes.vm.BaseVM
97+
func.ha_vm = qubes.vm.LocalVM
9898

9999
return func
100100

qubes/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _recursive_check(
161161
raise NotImplementedError("app does not have features yet")
162162

163163
assert isinstance(
164-
self.subject, _vm.BaseVM
164+
self.subject, _vm.LocalVM
165165
), "recursive checks do not work for {}".format(
166166
type(self.subject).__name__
167167
)

qubes/tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def cleanup_gc(self):
536536
obj,
537537
(
538538
qubes.Qubes,
539-
qubes.vm.BaseVM,
539+
qubes.vm.LocalVM,
540540
libvirt.virConnect,
541541
libvirt.virDomain,
542542
),

qubes/tests/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def test_010_property_require(self):
402402
pass
403403

404404

405-
class TestVM(qubes.vm.BaseVM):
405+
class TestVM(qubes.vm.LocalVM):
406406
qid = qubes.property("qid", type=int)
407407
name = qubes.property("name")
408408
uuid = uuid.uuid5(uuid.NAMESPACE_DNS, "testvm")

qubes/tests/integ/backupcompatibility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def assertRestored(self, name, **kwargs):
494494
)
495495
else:
496496
actual_value = getattr(vm, prop)
497-
if isinstance(actual_value, qubes.vm.BaseVM):
497+
if isinstance(actual_value, qubes.vm.LocalVM):
498498
self.assertEqual(
499499
value,
500500
actual_value.name,

qubes/tests/storage_callback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def tearDown(self):
240240
self.app.close()
241241
del self.app
242242
for attr in dir(self):
243-
if isinstance(getattr(self, attr), qubes.vm.BaseVM):
243+
if isinstance(getattr(self, attr), qubes.vm.LocalVM):
244244
delattr(self, attr)
245245

246246
if os.path.exists(self.test_log):

qubes/tests/storage_lvm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def tearDown(self):
176176
self.app.close()
177177
del self.app
178178
for attr in dir(self):
179-
if isinstance(getattr(self, attr), qubes.vm.BaseVM):
179+
if isinstance(getattr(self, attr), qubes.vm.LocalVM):
180180
delattr(self, attr)
181181

182182
def test_000_default_thin_pool(self):
@@ -1488,7 +1488,7 @@ def tearDown(self):
14881488
self.app.close()
14891489
del self.app
14901490
for attr in dir(self):
1491-
if isinstance(getattr(self, attr), qubes.vm.BaseVM):
1491+
if isinstance(getattr(self, attr), qubes.vm.LocalVM):
14921492
delattr(self, attr)
14931493

14941494
def test_000_search_thin_pool(self):

0 commit comments

Comments
 (0)