[virt-tools-list] [PATCH virt-viewer] monitor-mapping: Do not allow to skip a display

Jonathon Jongsma jjongsma at redhat.com
Wed Jun 3 14:29:54 UTC 2015


ACK


On Wed, 2015-06-03 at 14:43 +0200, Pavel Grunt wrote:
> Skipping a display does not have an effect because displays will be
> reconfigured and shifted on the guest side anyway.
> 
> these monitor mappings are not valid:
>  'monitor-mapping=1:2;3:1' - display #2 is not specified
>  'monitor-mapping=4:2;2:1' - displays #1, #3 are not specified
>  'monitor-mapping=3:3'     - displays #1, #2 are not specified
> ---
>  man/remote-viewer.pod | 4 ++++
>  man/virt-viewer.pod   | 4 ++++
>  src/virt-viewer-app.c | 9 +++++++++
>  3 files changed, 17 insertions(+)
> 
> diff --git a/man/remote-viewer.pod b/man/remote-viewer.pod
> index 00b474c..eb85532 100644
> --- a/man/remote-viewer.pod
> +++ b/man/remote-viewer.pod
> @@ -332,6 +332,10 @@ guest with a UUID of e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2, use:
>      [e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2]
>      monitor-mapping=1:2;2:3
>  
> +The monitor-mapping must contain ids of all displays from 1 to the last
> +desired display id, e.g. "monitor-mapping=3:3" is invalid because mappings
> +for displays 1 and 2 are not specified.
> +
>  =head1 EXAMPLES
>  
>  To connect to SPICE server on host "makai" with port 5900
> diff --git a/man/virt-viewer.pod b/man/virt-viewer.pod
> index aaf9eff..ca1c9e8 100644
> --- a/man/virt-viewer.pod
> +++ b/man/virt-viewer.pod
> @@ -151,6 +151,10 @@ guest with a UUID of e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2, use:
>      [e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2]
>      monitor-mapping=1:2;2:3
>  
> +The monitor-mapping must contain ids of all displays from 1 to the last
> +desired display id, e.g. "monitor-mapping=3:3" is invalid because mappings
> +for displays 1 and 2 are not specified.
> +
>  =head1 EXAMPLES
>  
>  To connect to the guest called 'demo' running under Xen
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index b22a876..8a08b6b 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -370,6 +370,7 @@ virt_viewer_app_parse_monitor_mappings(gchar **mappings, gsize nmappings)
>      GHashTable *displaymap = g_hash_table_new(g_direct_hash, g_direct_equal);
>      GHashTable *monitormap = g_hash_table_new(g_direct_hash, g_direct_equal);
>      int i = 0;
> +    int max_display_id = 0;
>      gchar **tokens = NULL;
>  
>      for (i = 0; i < nmappings; i++) {
> @@ -414,6 +415,14 @@ virt_viewer_app_parse_monitor_mappings(gchar **mappings, gsize nmappings)
>              g_debug("Fullscreen config: mapping guest display %i to monitor %i", display, monitor);
>              g_hash_table_insert(displaymap, GINT_TO_POINTER(display), GINT_TO_POINTER(monitor));
>              g_hash_table_insert(monitormap, GINT_TO_POINTER(monitor), GINT_TO_POINTER(display));
> +            max_display_id = MAX(display, max_display_id);
> +        }
> +    }
> +
> +    for (i = 0; i < max_display_id; i++) {
> +        if (!g_hash_table_lookup_extended(displaymap, GINT_TO_POINTER(i), NULL, NULL)) {
> +            g_warning("Invalid monitor-mapping configuration: display #%d was not specified", i+1);
> +            goto configerror;
>          }
>      }
>  





More information about the virt-tools-list mailing list