[libvirt] fix spice graphic format issue in function virDomainGraphicsDefFormat

Chen Coolper coolper22 at gmail.com
Tue May 31 08:53:37 UTC 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110531/f34b79d8/attachment-0001.htm>


More information about the libvir-list mailing list