[libvirt] fix spice graphic format issue in function virDomainGraphicsDefFormat

Michal Prívozník mprivozn at redhat.com
Tue May 31 12:08:51 UTC 2011


On 31.05.2011 10:53, Chen Coolper wrote:
> hi,
> all sub item of spice graphics need to processed like spice channels,
> that is adding the following lines:
>  if (!children) {
>     virBufferAddLit(buf, ">\n");
>     children = 1;
> }
> 
> the following patch is generated base on git master.
> -----------------------------------------------------------------------------------------
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b30acc8..e42db06 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -8127,21 +8127,46 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
>                              
>  virDomainGraphicsSpiceChannelNameTypeToString(i),
>                              
>  virDomainGraphicsSpiceChannelModeTypeToString(mode));
>          }
> -        if (def->data.spice.image)
> +        if (def->data.spice.image) {
>              virBufferAsprintf(buf, "      <image compression='%s'/>\n",
>                              
>  virDomainGraphicsSpiceImageCompressionTypeToString(def->data.spice.image));
> -        if (def->data.spice.jpeg)
> +            if (!children) {
> +                virBufferAddLit(buf, ">\n");
> +                children = 1;
> +            }
> +        }
> +        if (def->data.spice.jpeg) {
>              virBufferAsprintf(buf, "      <jpeg compression='%s'/>\n",
>                              
>  virDomainGraphicsSpiceJpegCompressionTypeToString(def->data.spice.jpeg));
> -        if (def->data.spice.zlib)
> +            if (!children) {
> +                virBufferAddLit(buf, ">\n");
> +                children = 1;
> +            }
> +        }
> +        if (def->data.spice.zlib) {
>              virBufferAsprintf(buf, "      <zlib compression='%s'/>\n",
>                              
>  virDomainGraphicsSpiceZlibCompressionTypeToString(def->data.spice.zlib));
> -        if (def->data.spice.playback)
> +            if (!children) {
> +                virBufferAddLit(buf, ">\n");
> +                children = 1;
> +            }
> +        }
> +        if (def->data.spice.playback) {
>              virBufferAsprintf(buf, "      <playback compression='%s'/>\n",
>                              
>  virDomainGraphicsSpicePlaybackCompressionTypeToString(def->data.spice.playback));
> -        if (def->data.spice.streaming)
> +            if (!children) {
> +                virBufferAddLit(buf, ">\n");
> +                children = 1;
> +            }
> +        }
> +        if (def->data.spice.streaming) {
>              virBufferAsprintf(buf, "      <streaming mode='%s'/>\n",
>                              
>  virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
> +            if (!children) {
> +                virBufferAddLit(buf, ">\n");
> +                children = 1;
> +            }
> +        }
>      }
>  
>      if (children) {
> 
> 
> -- 
> Coolper Chen
> 
> 
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Or there is another approach:

https://www.redhat.com/archives/libvir-list/2011-May/msg01491.html

Michal




More information about the libvir-list mailing list