core3: more fixes

This commit is contained in:
Wojtek Porczyk 2015-09-21 22:48:19 +02:00
parent 80d664441d
commit 0fbee4dc10
3 changed files with 6 additions and 5 deletions

View File

@ -640,7 +640,7 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
if self._setter is not None:
value = self._setter(instance, self, value)
if self._type is not None: # XXX what about QubesVM and other types?
if self._type not in (None, type(value)):
value = self._type(value)
if has_oldvalue:
@ -1333,7 +1333,7 @@ class Qubes(PropertyHolder):
# then search for name
for l in self.labels.values():
if l.name == label:
return label
return l
# last call, if label is a number represented as str, search in indices
try:

View File

@ -158,7 +158,7 @@ class QubesVM(qubes.vm.BaseVM):
ls_width=31,
doc='User-specified name of the domain.')
uuid = qubes.property('uuid', type=uuid.UUID, default=None,
uuid = qubes.property('uuid', type=uuid.UUID,
ls_width=36,
doc='UUID from libvirt.')
@ -316,7 +316,7 @@ class QubesVM(qubes.vm.BaseVM):
# XXX _update_libvirt_domain?
try:
if self.uuid is not None:
if hasattr(self, 'uuid'):
self._libvirt_domain = self.app.vmm.libvirt_conn.lookupByUUID(
self.uuid.bytes)
else:

View File

@ -19,7 +19,8 @@ class TemplateVM(qubes.vm.qubesvm.QubesVM):
super(TemplateVM, self).__init__(*args, **kwargs)
# Some additional checks for template based VM
assert self.root_img is not None, "Missing root_img for standalone VM!"
# TODO find better way
# assert self.root_img is not None, "Missing root_img for standalone VM!"
def clone_disk_files(self, src):