LZ4 compression option for SPICE
RFC PATCH 1/1 LZ4 compression option for SPICE
Hello
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it. However, SPICE_IMAGE_COMPRESS_LZ4 did not exist before the commit that added this compression algorithm, so it should be guarded with conditional compilation. How do you think this should be done? Wait for the next stable version of spice-server and check for SPICE_SERVER_VERSION? Or add a specific flag?
Thank you
--- ui/spice-core.c | 1 + 1 file changed, 1 insertion(+)
ui/spice-core.c +1 -0
@@ -359,6 +359,7 @@ static const char *compression_names[] = { [ SPICE_IMAGE_COMPRESS_QUIC ] = "quic", [ SPICE_IMAGE_COMPRESS_GLZ ] = "glz", [ SPICE_IMAGE_COMPRESS_LZ ] = "lz", + [ SPICE_IMAGE_COMPRESS_LZ4 ] = "lz4", };#define parse_compression (_name) \ parse_name(_name, "image compression", \
--
1.9.3
Quoted 8 lines · Javier Celaya
Hello
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it. However,
SPICE_IMAGE_COMPRESS_LZ4did not exist before the commit that added this compression algorithm, so it should be guarded with conditional compilation. How do you think this should be done? Wait for the next stable version of spice-server and check forSPICE_SERVER_VERSION? Or add a specific flag?
Given that SPICE_IMAGE_COMPRESS_LZ4 is a enum not define (so you can't just #ifdef SPICE_IMAGE_COMPRESS_LZ4) using SPICE_SERVER_VERSION looks best to me.
cheers,
Gerd
Il 08/01/2015 11:50, Javier Celaya ha scritto:
Quoted 27 lines
Hello
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it. However,
SPICE_IMAGE_COMPRESS_LZ4did not exist before the commit that added this compression algorithm, so it should be guarded with conditional compilation. How do you think this should be done? Wait for the next stable version of spice-server and check forSPICE_SERVER_VERSION? Or add a specific flag?Thank you
--- ui/spice-core.c | 1 + 1 file changed, 1 insertion(+)ui/spice-core.c +1
-1@@ -359,6 +359,7 @@ static const char *compression_names[] = { [ SPICE_IMAGE_COMPRESS_QUIC ] = "quic", [ SPICE_IMAGE_COMPRESS_GLZ ] = "glz", [ SPICE_IMAGE_COMPRESS_LZ ] = "lz", + [ SPICE_IMAGE_COMPRESS_LZ4 ] = "lz4", };#define parse_compression (_name) \ parse_name(_name, "image compression", \ --
Quoted 1 line
1.9.3
I did a small search now and seems that also other small change to qemu-options.hx file should be done, search this line:
@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off]
Quoted 8 lines
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel
Sure, for the help text of the image-compression option, thanks.
Quoted 45 lines · El Jueves, 8 de enero de 2015 12:48:57 Fabio Fantoni escribió:
Il 08/01/2015 11:50, Javier Celaya ha scritto:
Quoted 31 lines
Hello
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it. However,
SPICE_IMAGE_COMPRESS_LZ4did not exist before the commit that added this compression algorithm, so it should be guarded with conditional compilation. How do you think this should be done? Wait for the next stable version of spice-server and check forSPICE_SERVER_VERSION? Or add a specific flag?Thank you
---ui/spice-core.c | 1 + 1 file changed, 1 insertion(+)ui/spice-core.c +1
-0@@ -359,6 +359,7 @@ static const char *compression_names[] = { [ SPICE_IMAGE_COMPRESS_QUIC ] = "quic", [ SPICE_IMAGE_COMPRESS_GLZ ] = "glz", [ SPICE_IMAGE_COMPRESS_LZ ] = "lz", + [ SPICE_IMAGE_COMPRESS_LZ4 ] = "lz4",};
#defineparse_compression(_name)\Quoted 4 lines
parse_name(_name, "image compression", \--
1.9.3I did a small search now and seems that also other small change to qemu-options.hx file should be done, search this line:
@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off]Quoted 4 lines
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel
Hey,
Quoted 8 lines · Javier Celaya
Hello
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it. However,
SPICE_IMAGE_COMPRESS_LZ4did not exist before the commit that added this compression algorithm, so it should be guarded with conditional compilation. How do you think this should be done? Wait for the next stable version of spice-server and check forSPICE_SERVER_VERSION? Or add a specific flag?
Version check seems good, we probably can raise spice-server version in git preemptively so that you can have a working version check now.
Given that lz4 support is optional, spice_server_set_image_compression should probably error out if we try to set lz4 but it's not supported.
Christophe
Hello, this is the patch with the version check. Christophe, can you check that the version is the correct one?
Quoted 7 lines · El Martes, 20 de enero de 2015 17:08:07 Christophe Fergeau escribió:
Hey,
Version check seems good, we probably can raise spice-server version in git preemptively so that you can have a working version check now.
Given that lz4 support is optional,
spice_server_set_image_compressionshould probably error out if we try to set lz4 but it's not supported.
Ack
Quoted 3 lines
Christophe
From896a3ea776ee95653a7cb8a0c90111a89b57c73fMon Sep 17 00:00:00 2001
From: Javier Celaya <[email protected]>
Date: Wed, 7 Jan 2015 11:53:24 +0100
Subject: [PATCH] Add lz4 compression option for SPICE.
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
--- ui/spice-core.c | 3 +++ 1 file changed, 3 insertions(+)
ui/spice-core.c +3 -0
@@ -359,6 +359,9 @@ static const char *compression_names[] = { [ SPICE_IMAGE_COMPRESS_QUIC ] = "quic", [ SPICE_IMAGE_COMPRESS_GLZ ] = "glz", [SPICE_IMAGE_COMPRESS_LZ ] ="lz" , +#if SPICE_SERVER_VERSION >= 0x000c07 + [ SPICE_IMAGE_COMPRESS_LZ4 ] = "lz4", +#endif };#define parse_compression (_name) \ parse_name(_name, "image compression", \
Signature · 1 line
1.9.3
Quoted 16 lines · Javier Celaya
Hello, this is the patch with the version check. Christophe, can you check that the version is the correct one?
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
--- ui/spice-core.c | 3 +++ 1 file changed, 3 insertions(+)ui/spice-core.c +0
-0
ui/spice-core.c static const char *compression_names[] = { · line 363
Quoted 5 lines
ui/spice-core.c +2
-0@@ -359,6 +359,9 @@ static const char *compression_names[] = { [ SPICE_IMAGE_COMPRESS_QUIC ] = "quic", [ SPICE_IMAGE_COMPRESS_GLZ ] = "glz", [SPICE_IMAGE_COMPRESS_LZ ] ="lz" , +#if SPICE_SERVER_VERSION >= 0x000c07 + [ SPICE_IMAGE_COMPRESS_LZ4 ] = "lz4",
How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Sorry, I forgot to patch the command-line help. Hope it helps.
Quoted 23 lines · El Viernes, 23 de enero de 2015 09:25:38 Eric Blake escribió:
Quoted 22 lines · Javier Celaya
Hello, this is the patch with the version check. Christophe, can you check that the version is the correct one?
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
---ui/spice-core.c | 3 +++ 1 file changed, 3 insertions(+)ui/spice-core.c +0
-0@@ -359,6 +359,9 @@ static const char *compression_names[] = { [ SPICE_IMAGE_COMPRESS_QUIC ] = "quic", [ SPICE_IMAGE_COMPRESS_GLZ ] = "glz", [ SPICE_IMAGE_COMPRESS_LZ ] = "lz",
Quoted 7 lines
ui/spice-core.c static const char *compression_names[] = { · line 365
Quoted 2 lines
ui/spice-core.c +2
-0+#if SPICE_SERVER_VERSION >=0x000c07 + [ SPICE_IMAGE_COMPRESS_LZ4 ] = "lz4",How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
From26864da931603791c70c570b9b46f21657ebcaecMon Sep 17 00:00:00 2001
From: Javier Celaya <[email protected]>
Date: Wed, 7 Jan 2015 11:53:24 +0100
Subject: [PATCH] Add lz4 compression option for SPICE.
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
--- qemu-options.hx | 4 ++-- ui/spice-core.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)
qemu-options.hx +2 -2
@@ -953,7 +953,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice, " [,tls-channel=[main|display|cursor|inputs|record|playback]]\n" " [,plaintext-channel=[main|display|cursor|inputs|record|playback]]\n" " [,sasl][,password=<secret>][,disable-ticketing]\n" - " [,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]\n" + " [,image-compression=[auto_glz|auto_lz|quic|glz|lz|lz4|off]]\n" " [,jpeg-wan-compression=[auto|never|always]]\n" " [,zlib-glz-wan-compression=[auto|never|always]]\n" " [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"
@@ -1028,7 +1028,7 @@ channels. The special name "default" can be used to set the default mode. For channels which are not explicitly forced into one mode the spice client is allowed to pick tls/plaintext as he pleases. -@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off] +@item image-compression=[auto_glz|auto_lz|quic|glz|lz|lz4|off] Configure image compression (lossless). Default is auto_glz.
ui/spice-core.c +3 -0
@@ -359,6 +359,9 @@ static const char *compression_names[] = { [ SPICE_IMAGE_COMPRESS_QUIC ] = "quic", [ SPICE_IMAGE_COMPRESS_GLZ ] = "glz", [SPICE_IMAGE_COMPRESS_LZ ] ="lz" , +#if SPICE_SERVER_VERSION >= 0x000c07 + [ SPICE_IMAGE_COMPRESS_LZ4 ] = "lz4", +#endif };#define parse_compression (_name) \ parse_name(_name, "image compression", \
Signature · 1 line
1.9.3
Quoted 11 lines · Javier Celaya
Sorry, I forgot to patch the command-line help. Hope it helps.
Quoted 8 lines
Quoted 3 lines
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
No, patching the command line --help does NOT help libvirt. It needs to be discoverable via QMP to be introspectible, as scraping --help output is not machine-friendly. (That said, you DO want to expose it in --help output; I'm just complaining that --help output alone is not enough).
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 9 lines · Eric Blake
Quoted 8 lines · Javier Celaya
Sorry, I forgot to patch the command-line help. Hope it helps.
Quoted 5 lines
Quoted 3 lines
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
No, patching the command line --help does NOT help libvirt. It needs to be discoverable via QMP to be introspectible, as scraping --help output is not machine-friendly. (That said, you DO want to expose it in --help output; I'm just complaining that --help output alone is not enough).
We should really, really, really provide access to (the relevant subset of) the QAPI schema over QMP! Until we get that, useful progress is delayed by problems like this one, and we keep growing special-purpose solutions to problems like this one.
Quoted 1 line
From what I've seen in QEMU and libvirt's code, I would say that discovering
whether the spice server supports LZ4 is not a matter of adding a new QMP command. That would not scale very well with new command line options. I would suggest something more general. For instance, having the command query- command-line-options return also the allowed values for string parameters. That would output "lz4" for parameter "image-compression" in option "spice", among the other compression methods. Another possibility would be a new QMP command that returns the capabilities of the spice server, as defined in the spice protocol. They include the SPICE_DISPLAY_CAP_LZ4_COMPRESSION capability, if the spice server supports LZ4. In any case, I think it is out of the scope of this patch.
Quoted 20 lines · El Martes, 27 de enero de 2015 09:26:11 Markus Armbruster escribió:
Quoted 6 lines · Eric Blake
Quoted 5 lines · Javier Celaya
Sorry, I forgot to patch the command-line help. Hope it helps.
Quoted 3 lines
Quoted 2 lines
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
No, patching the command line --help does NOT help libvirt. It needs to be discoverable via QMP to be introspectible, as scraping --help output is not machine-friendly. (That said, you DO want to expose it in --help output; I'm just complaining that --help output alone is not enough).
We should really, really, really provide access to (the relevant subset of) the QAPI schema over QMP! Until we get that, useful progress is delayed by problems like this one, and we keep growing special-purpose solutions to problems like this one.
Please don't top-quote.
Quoted 23 lines · Javier Celaya
Quoted 16 lines · El Martes, 27 de enero de 2015 09:26:11 Markus Armbruster escribió:
Quoted 6 lines · Eric Blake
Quoted 5 lines · Javier Celaya
Sorry, I forgot to patch the command-line help. Hope it helps.
Quoted 3 lines
Quoted 2 lines
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
No, patching the command line --help does NOT help libvirt. It needs to be discoverable via QMP to be introspectible, as scraping --help output is not machine-friendly. (That said, you DO want to expose it in --help output; I'm just complaining that --help output alone is not enough).
Quoted 6 lines
We should really, really, really provide access to (the relevant subset of) the QAPI schema over QMP! Until we get that, useful progress is delayed by problems like this one, and we keep growing special-purpose solutions to problems like this one.
From what I've seen in QEMU and libvirt's code, I would say that discovering
Quoted 10 lines
whether the spice server supports LZ4 is not a matter of adding a new QMP command. That would not scale very well with new command line options. I would suggest something more general. For instance, having the command query- command-line-options return also the allowed values for string parameters. That would output "lz4" for parameter "image-compression" in option "spice", among the other compression methods. Another possibility would be a new QMP command that returns the capabilities of the spice server, as defined in the spice protocol. They include the
SPICE_DISPLAY_CAP_LZ4_COMPRESSIONcapability, if the spice server supports LZ4. In any case, I think it is out of the scope of this patch.
We already have a language to describe interfaces: QAPI schema. It already covers QMP. I propose to reuse it for QMP introspection instead of inventing yet another language.
Unfortunately, it doesn't cover the command line. Recasting the command line in QAPI sounds sensible to me, but it's non-trivial, and so far nobody has volunteered to try. So we'll likely need a stop-gap, like extending query-command-line-options. I don't like growing more external interface languages, but I don't have better ideas.
Il 27/01/2015 09:26, Markus Armbruster ha scritto:
Quoted 14 lines
Quoted 5 lines · Eric Blake
Quoted 4 lines · Javier Celaya
Sorry, I forgot to patch the command-line help. Hope it helps.
Quoted 2 lines
Quoted 2 lines
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
No, patching the command line --help does NOT help libvirt. It needs to be discoverable via QMP to be introspectible, as scraping --help output is not machine-friendly. (That said, you DO want to expose it in --help output; I'm just complaining that --help output alone is not enough).
Quoted 11 lines
We should really, really, really provide access to (the relevant subset of) the QAPI schema over QMP! Until we get that, useful progress is delayed by problems like this one, and we keep growing special-purpose solutions to problems like this one.
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel
Hi, any news about spice lz4 support still missed in qemu upstream?
Thanks for any reply.
Quoted 27 lines · Fabio Fantoni
Il 27/01/2015 09:26, Markus Armbruster ha scritto:
Quoted 14 lines
Quoted 5 lines · Eric Blake
Quoted 4 lines · Javier Celaya
Sorry, I forgot to patch the command-line help. Hope it helps.
Quoted 2 lines
Quoted 2 lines
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
No, patching the command line --help does NOT help libvirt. It needs to be discoverable via QMP to be introspectible, as scraping --help output is not machine-friendly. (That said, you DO want to expose it in --help output; I'm just complaining that --help output alone is not enough).
Quoted 11 lines
We should really, really, really provide access to (the relevant subset of) the QAPI schema over QMP! Until we get that, useful progress is delayed by problems like this one, and we keep growing special-purpose solutions to problems like this one.
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel
Quoted 3 lines
Hi, any news about spice lz4 support still missed in qemu upstream?
Thanks for any reply.
I'm committed to delivering QMP introspection in the next development cycle. That'll answer "does this version support X in QMP" questions, which may in turn be a usable indicator for "does it support X' on the command line", at least for some X.
If the SPICE LZ4 feature is such an X, the patch can then go in without further work.
Il 27/01/2015 09:26, Markus Armbruster ha scritto:
Quoted 14 lines
Quoted 5 lines · Eric Blake
Quoted 4 lines · Javier Celaya
Sorry, I forgot to patch the command-line help. Hope it helps.
Quoted 2 lines
Quoted 2 lines
Recently, SPICE included the lz4 compression algorithm. This patch adds a command line option to select it.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
How is libvirt going to introspect whether the command line supports this option? Is there some QMP command that lists the set of valid compression formats understood by a given qemu binary?
No, patching the command line --help does NOT help libvirt. It needs to be discoverable via QMP to be introspectible, as scraping --help output is not machine-friendly. (That said, you DO want to expose it in --help output; I'm just complaining that --help output alone is not enough).
Quoted 9 lines
We should really, really, really provide access to (the relevant subset of) the QAPI schema over QMP! Until we get that, useful progress is delayed by problems like this one, and we keep growing special-purpose solutions to problems like this one.
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel
Hi, spice 0.12.6 with lz4 support has been released, is there any possibility to add it also in qemu upstream to make possible selecting it "Out of the box" please?