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:
Marek Marczykowski-Górecki 2017-02-21 00:50:26 +01:00
parent cae68f64ca
commit e52d8fb051
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -924,6 +924,8 @@ class Qubes(qubes.PropertyHolder):
if qid is None:
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
# override it with default template)
if 'template' not in kwargs and hasattr(cls, 'template'):