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:
parent
476b681749
commit
a719e0d93d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user