libxl: Refactor logic in domain post parse callback

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 commit is contained in:
Peter Krempa 2015-03-16 15:33:45 +01:00
parent b15f588385
commit 19e85d8454

View File

@ -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()))