With the current control flow the post parse callback returned success
right away for fully virtualized VMs. To allow adding additional checks
into the post parse callback tweak the conditions so that the function
doesn't return early except for error cases.
To clarify the original piece of code borrow the wording from the commit
message for the patch that introduced the code.
---
This patch is new in the series.
src/libxl/libxl_domain.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 407a9bd..611ccf4 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -546,10 +546,9 @@ libxlDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
- if (STREQ(def->os.type, "hvm"))
- return 0;
-
- if (def->nconsoles == 0) {
+ /* Xen PV domains always have a PV console, so add one to the domain config
+ * via post-parse callback if not explicitly specified in the XML. */
+ if (STRNEQ(def->os.type, "hvm") && def->nconsoles == 0) {
virDomainChrDefPtr chrdef;
if (!(chrdef = virDomainChrDefNew()))
--
2.2.2