On Tue, Aug 22, 2017 at 03:59:01PM +0200, Ján Tomko wrote:
On Mon, Aug 21, 2017 at 10:07:08AM +0200, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
> ---
> src/conf/domain_conf.c | 39 ++++++++++++++++++++++++++-------------
> 1 file changed, 26 insertions(+), 13 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index bb4be5d1cd..8fe79f70bf 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -11040,7 +11063,8 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
> goto error;
> }
> protocolParsed = true;
> - protocol = virXMLPropString(cur, "type");
> + if (virDomainChrSourceDefParseProtocol(def, cur) < 0)
> + goto error;
> }
> }
>
> @@ -11151,16 +11175,6 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr
def,
> }
> def->data.tcp.tlsFromConfig = !!tmp;
> }
> -
> - if (!protocol)
> - def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW;
This removes the explicit assignment of VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW
if no protocol node has been seen.
The most direct equivalent would be:
if (!protocolParsed)
but I would also be okay with (in the order of preference)
1. initializing it before we start parsing the node
This would require to check for the chardev type and I'm not a fan of
that.
2. adding a _DEFAULT enum value and changing it in PostParse
This is probably for a follow-up patch and the preferred way.
3. explicitly assigning VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW = 0
and letting calloc do the initialization
I'll go with this option since it's the easiest one :)
ACK with that fixed
Thanks, I'll push the series shortly.
Pavel