From e52d8fb0518c6905268b284fd3bfe03f02d7f038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 21 Feb 2017 00:50:26 +0100 Subject: [PATCH] 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. --- qubes/app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qubes/app.py b/qubes/app.py index 7b92da5a..ae9380f5 100644 --- a/qubes/app.py +++ b/qubes/app.py @@ -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'):