Wojtek Porczyk пре 9 година
родитељ
комит
0fbee4dc10
3 измењених фајлова са 6 додато и 5 уклоњено
  1. 2 2
      qubes/__init__.py
  2. 2 2
      qubes/vm/qubesvm.py
  3. 2 1
      qubes/vm/templatevm.py

+ 2 - 2
qubes/__init__.py

@@ -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:

+ 2 - 2
qubes/vm/qubesvm.py

@@ -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:

+ 2 - 1
qubes/vm/templatevm.py

@@ -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):