[libvirt] [PATCH 4/5] conf: make sure that chardev reconnect is formatted only for connect mode
Michal Privoznik
mprivozn at redhat.com
Wed Aug 30 12:32:50 UTC 2017
On 08/30/2017 01:40 PM, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
> 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
More information about the libvir-list
mailing list