qubes/vm/qubesvm: allow looking up by UUID

Also, allow lookup using VM from other app.

QubesOS/qubes-issues#866
This commit is contained in:
Wojtek Porczyk 2016-06-02 17:18:33 +02:00
parent 476b681749
commit a719e0d93d

View File

@ -414,8 +414,12 @@ class VMCollection(object):
raise KeyError(key)
if isinstance(key, qubes.vm.BaseVM):
if key in self:
return key
key = key.uuid
if isinstance(key, uuid.UUID):
for vm in self:
if vm.uuid == key:
return vm
raise KeyError(key)
raise KeyError(key)