qubes: allow passing name of class to app.add_new_vm
This will allow more flexible API usage, especially when using mgmt API - we need to use VM type as string there. We don't lose any flexibility here - VM class names needs to be uniquely identified by a string (used in qubes.xml) anyway.
This commit is contained in:
parent
cae68f64ca
commit
e52d8fb051
@ -924,6 +924,8 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
if qid is None:
|
if qid is None:
|
||||||
qid = self.domains.get_new_unused_qid()
|
qid = self.domains.get_new_unused_qid()
|
||||||
|
|
||||||
|
if isinstance(cls, str):
|
||||||
|
cls = self.get_vm_class(cls)
|
||||||
# handle default template; specifically allow template=None (do not
|
# handle default template; specifically allow template=None (do not
|
||||||
# override it with default template)
|
# override it with default template)
|
||||||
if 'template' not in kwargs and hasattr(cls, 'template'):
|
if 'template' not in kwargs and hasattr(cls, 'template'):
|
||||||
|
Loading…
Reference in New Issue
Block a user