[01/12] domain: separate out function for post parse console compat

Message ID d693824800358bff21915423a7de920930c5aead.1452224621.git.crobinso@redhat.com
State Accepted
Commit 11de45bb71cbd90bbdc9d6ad26aefcc1ee7f5f16
Headers show

Commit Message

Cole Robinson Jan. 8, 2016, 3:49 a.m.
This should be a no-op
---
 src/conf/domain_conf.c | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

-- 
2.5.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Cole Robinson Jan. 8, 2016, 6:33 p.m. | #1
On 01/08/2016 02:00 AM, Peter Krempa wrote:
> On Thu, Jan 07, 2016 at 22:49:55 -0500, Cole Robinson wrote:

>> This should be a no-op

>> ---

>>  src/conf/domain_conf.c | 38 ++++++++++++++++++++++++--------------

>>  1 file changed, 24 insertions(+), 14 deletions(-)

>>

>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c

>> index 9d47846..ab22322 100644

>> --- a/src/conf/domain_conf.c

>> +++ b/src/conf/domain_conf.c

>> @@ -3664,24 +3664,11 @@ virDomainDefPostParseMemory(virDomainDefPtr def,

>>      return 0;

>>  }

>>  

>> -

> 

> This file uses two newlines to separate functions ..

> 

>>  static int

>> -virDomainDefPostParseInternal(virDomainDefPtr def,

>> -                              virCapsPtr caps ATTRIBUTE_UNUSED,

>> -                              unsigned int parseFlags)

>> +virDomainDefAddConsoleCompat(virDomainDefPtr def)

>>  {

>>      size_t i;

>>  

>> -    /* verify init path for container based domains */

>> -    if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) {

>> -        virReportError(VIR_ERR_XML_ERROR, "%s",

>> -                       _("init binary must be specified"));

>> -        return -1;

>> -    }

>> -

>> -    if (virDomainDefPostParseMemory(def, parseFlags) < 0)

>> -        return -1;

>> -

>>      /*

>>       * Some really crazy backcompat stuff for consoles

>>       *

>> @@ -3774,6 +3761,29 @@ virDomainDefPostParseInternal(virDomainDefPtr def,

>>          def->consoles[0]->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;

>>      }

>>  

>> +    return 0;

>> +}

> 

> ... here too ...

> 

>> +

>> +static int

>> +virDomainDefPostParseInternal(virDomainDefPtr def,

>> +                              virCapsPtr caps ATTRIBUTE_UNUSED,

>> +                              unsigned int parseFlags)

>> +{

>> +    size_t i;

>> +

>> +    /* verify init path for container based domains */

>> +    if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) {

>> +        virReportError(VIR_ERR_XML_ERROR, "%s",

>> +                       _("init binary must be specified"));

>> +        return -1;

>> +    }

>> +

>> +    if (virDomainDefPostParseMemory(def, parseFlags) < 0)

>> +        return -1;

>> +

>> +    if (virDomainDefAddConsoleCompat(def) < 0)

>> +        return -1;

>> +

>>      if (virDomainDefRejectDuplicateControllers(def) < 0)

>>          return -1;

> 

> ACK with whitespace fixed.

> 


I pushed patches 1, 2, 5, 6, 7, and 10, with the whitespace bits fixed. Thanks
for the review. I'll follow up on the other bits later

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9d47846..ab22322 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3664,24 +3664,11 @@  virDomainDefPostParseMemory(virDomainDefPtr def,
     return 0;
 }
 
-
 static int
-virDomainDefPostParseInternal(virDomainDefPtr def,
-                              virCapsPtr caps ATTRIBUTE_UNUSED,
-                              unsigned int parseFlags)
+virDomainDefAddConsoleCompat(virDomainDefPtr def)
 {
     size_t i;
 
-    /* verify init path for container based domains */
-    if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) {
-        virReportError(VIR_ERR_XML_ERROR, "%s",
-                       _("init binary must be specified"));
-        return -1;
-    }
-
-    if (virDomainDefPostParseMemory(def, parseFlags) < 0)
-        return -1;
-
     /*
      * Some really crazy backcompat stuff for consoles
      *
@@ -3774,6 +3761,29 @@  virDomainDefPostParseInternal(virDomainDefPtr def,
         def->consoles[0]->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
     }
 
+    return 0;
+}
+
+static int
+virDomainDefPostParseInternal(virDomainDefPtr def,
+                              virCapsPtr caps ATTRIBUTE_UNUSED,
+                              unsigned int parseFlags)
+{
+    size_t i;
+
+    /* verify init path for container based domains */
+    if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("init binary must be specified"));
+        return -1;
+    }
+
+    if (virDomainDefPostParseMemory(def, parseFlags) < 0)
+        return -1;
+
+    if (virDomainDefAddConsoleCompat(def) < 0)
+        return -1;
+
     if (virDomainDefRejectDuplicateControllers(def) < 0)
         return -1;