Re: [PATCH 4/5] conf: make sure that chardev reconnect is formatted only for connect mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/30/2017 01:40 PM, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index f7574d77b6..7f443e5b4d 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -23257,8 +23257,9 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
>              virBufferAsprintf(&attrBuf, " tlsFromConfig='%d'",
>                                def->data.tcp.tlsFromConfig);
>  
> -        virDomainChrSourceReconnectDefFormat(&childBuf,
> -                                             &def->data.tcp.reconnect);
> +        if (!def->data.tcp.listen)
> +            virDomainChrSourceReconnectDefFormat(&childBuf,
> +                                                 &def->data.tcp.reconnect);
>  
>          if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0)
>              goto error;
> @@ -23276,8 +23277,9 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
>              virDomainSourceDefFormatSeclabel(&childBuf, def->nseclabels,
>                                               def->seclabels, flags);
>  
> -            virDomainChrSourceReconnectDefFormat(&childBuf,
> -                                                 &def->data.nix.reconnect);
> +            if (!def->data.nix.listen)
> +                virDomainChrSourceReconnectDefFormat(&childBuf,
> +                                                     &def->data.nix.reconnect);
>  
>              if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0)
>                  goto error;
> 

This looks like a workaround. Because def->data.tcp.listen shouldn't be
set if reconnect is enabled and vice versa. And
virDomainChrSourceReconnectDefFormat() shortcuts out. Or you want the
following:

    <channel type='tcp'>
      <source mode='bind' host='localhost' service='5678'>
        <reconnect enabled='no'/>
      </source>
      <target type='virtio' name='test2'/>
    </channel>

to be turned into:

    <channel type='tcp'>
      <source mode='bind' host='localhost' service='5678'/>
      <target type='virtio' name='test2'/>
    </channel>

Michal

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux