diff mbox

[2/2] ui/spice-core: report version in 'info spice'

Message ID 1312923215-11824-2-git-send-email-alevy@redhat.com
State New
Headers show

Commit Message

Alon Levy Aug. 9, 2011, 8:53 p.m. UTC
Signed-off-by: Alon Levy <alevy@redhat.com>
---
 ui/spice-core.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Gerd Hoffmann Aug. 10, 2011, 6:54 a.m. UTC | #1
On 08/09/11 22:53, Alon Levy wrote:
> Signed-off-by: Alon Levy<alevy@redhat.com>
> ---
>   ui/spice-core.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index 3d77c01..342ed6c 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -372,6 +372,10 @@ void do_info_spice_print(Monitor *mon, const QObject *data)
>           monitor_printf(mon, "     address: %s:%d [tls]\n", host, port);
>       }
>       monitor_printf(mon, "        auth: %s\n", qdict_get_str(server, "auth"));
> +    monitor_printf(mon, "     version: %d.%d.%d\n",
> +                   (SPICE_SERVER_VERSION&  0xff0000)>>  16,
> +                   (SPICE_SERVER_VERSION&  0xff00)>>  8,
> +                    SPICE_SERVER_VERSION&  0xff);

No.  You should should stick this info into the dict in do_info_spice, 
then just get it from the dict for printing like it is done for auth. 
This way you'll have the information in the qmp monitor too.

I think it would also be nice to somehow hint this is the spice version 
qemu was compiled against.  The shared library which is actually used 
might be newer.

cheers,
   Gerd
Alon Levy Aug. 10, 2011, 7:43 a.m. UTC | #2
On Wed, Aug 10, 2011 at 08:54:36AM +0200, Gerd Hoffmann wrote:
> On 08/09/11 22:53, Alon Levy wrote:
> >Signed-off-by: Alon Levy<alevy@redhat.com>
> >---
> >  ui/spice-core.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> >
> >diff --git a/ui/spice-core.c b/ui/spice-core.c
> >index 3d77c01..342ed6c 100644
> >--- a/ui/spice-core.c
> >+++ b/ui/spice-core.c
> >@@ -372,6 +372,10 @@ void do_info_spice_print(Monitor *mon, const QObject *data)
> >          monitor_printf(mon, "     address: %s:%d [tls]\n", host, port);
> >      }
> >      monitor_printf(mon, "        auth: %s\n", qdict_get_str(server, "auth"));
> >+    monitor_printf(mon, "     version: %d.%d.%d\n",
> >+                   (SPICE_SERVER_VERSION&  0xff0000)>>  16,
> >+                   (SPICE_SERVER_VERSION&  0xff00)>>  8,
> >+                    SPICE_SERVER_VERSION&  0xff);
> 
> No.  You should should stick this info into the dict in
> do_info_spice, then just get it from the dict for printing like it
> is done for auth. This way you'll have the information in the qmp
> monitor too.
> 
> I think it would also be nice to somehow hint this is the spice
sent a second patch (fixing the above), but didn't do any hinting. I'll send a third.

> version qemu was compiled against.  The shared library which is
> actually used might be newer.

I thought of this problem but decided it's better to at least have the compiled
version (getting the linked against version is not hard, but I'd rather
not force to do it at this moment - I guess via dlopen. Which is linux specific - 
will need yet another wrapper for that api to compile on windows).

> 
> cheers,
>   Gerd
>
Gerd Hoffmann Aug. 10, 2011, 8:10 a.m. UTC | #3
Hi,

>> I think it would also be nice to somehow hint this is the spice
> sent a second patch (fixing the above), but didn't do any hinting. I'll send a third.

Saw v2.  I would just stick a "version" string into the dict instead of 
the three values for major, minor and micro.

>> version qemu was compiled against.  The shared library which is
>> actually used might be newer.
>
> I thought of this problem but decided it's better to at least have the compiled
> version (getting the linked against version is not hard, but I'd rather
> not force to do it at this moment - I guess via dlopen. Which is linux specific -
> will need yet another wrapper for that api to compile on windows).

The compiled version is perfectly fine, I think it is more useful to 
have that one as it decides which features qemu is able to use.

If we want report the runtime version too (any reason to do this?) I'd 
just add a spice_server_get_version() function to the library.

cheers,
   Gerd
Alon Levy Aug. 10, 2011, 8:32 a.m. UTC | #4
On Wed, Aug 10, 2011 at 10:10:59AM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> >>I think it would also be nice to somehow hint this is the spice
> >sent a second patch (fixing the above), but didn't do any hinting. I'll send a third.
> 
> Saw v2.  I would just stick a "version" string into the dict instead
> of the three values for major, minor and micro.
> 

Argh. Sent v3 with the three ints. Do you prefer a single version?

> >>version qemu was compiled against.  The shared library which is
> >>actually used might be newer.
> >
> >I thought of this problem but decided it's better to at least have the compiled
> >version (getting the linked against version is not hard, but I'd rather
> >not force to do it at this moment - I guess via dlopen. Which is linux specific -
> >will need yet another wrapper for that api to compile on windows).
> 
> The compiled version is perfectly fine, I think it is more useful to
> have that one as it decides which features qemu is able to use.
> 

Just completeness :) I'm not going to do it right now anyway.

> If we want report the runtime version too (any reason to do this?)
> I'd just add a spice_server_get_version() function to the library.
> 
> cheers,
>   Gerd
>
Gerd Hoffmann Aug. 10, 2011, 3:10 p.m. UTC | #5
Hi,

> Argh. Sent v3 with the three ints. Do you prefer a single version?

Yea, would be great.

thanks,
   Gerd
diff mbox

Patch

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 3d77c01..342ed6c 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -372,6 +372,10 @@  void do_info_spice_print(Monitor *mon, const QObject *data)
         monitor_printf(mon, "     address: %s:%d [tls]\n", host, port);
     }
     monitor_printf(mon, "        auth: %s\n", qdict_get_str(server, "auth"));
+    monitor_printf(mon, "     version: %d.%d.%d\n",
+                   (SPICE_SERVER_VERSION & 0xff0000) >> 16,
+                   (SPICE_SERVER_VERSION & 0xff00) >> 8,
+                    SPICE_SERVER_VERSION & 0xff);
 
     channels = qdict_get_qlist(server, "channels");
     if (qlist_empty(channels)) {