]> xenbits.xensource.com Git - xenclient/toolstack.git/commitdiff
add display config option that permit to have vnc or others type of display.
authorVincent Hanquez <vincent.hanquez@eu.citrix.com>
Tue, 11 Aug 2009 16:09:47 +0000 (17:09 +0100)
committerVincent Hanquez <vincent.hanquez@eu.citrix.com>
Tue, 11 Aug 2009 16:09:47 +0000 (17:09 +0100)
remove old vnc and vnckeymap config options, since they are superseded by
the display config option. no display imply the same vnc port with en-us keymap
that before this commit

xenvm/vmact.ml
xenvm/vmconfig.ml

index c3e9461822ead963ac3748dc07fd28bd3d1d5e91..99cf255a0f72b3c4b249ac189e87d54c0523f912 100644 (file)
@@ -186,10 +186,11 @@ let dm_info_of_cfg cfg =
        let nics = get_nics cfg in
        let nics = List.map (fun nic -> nic.nic_mac_gen, nic.nic_bridge_gen, nic.nic_model) nics in
        let disp =
-               match cfg.vnc with
-               | (-1) -> Device.Dm.NONE
-               | 0    -> Device.Dm.VNC (true, "", 0, cfg.vnc_keymap)
-               | _    -> Device.Dm.VNC (false, "", cfg.vnc, cfg.vnc_keymap)
+               match cfg.display with
+               | DisplayNone    -> Device.Dm.NONE
+               | DisplaySDL _   -> Device.Dm.NONE
+               | DisplayIntel _ -> Device.Dm.NONE
+               | DisplayVNC (unused, port, keymap) -> Device.Dm.VNC (unused, "", port, keymap)
                in
        {
                Device.Dm.hvm = cfg.hvm;
index c6969f9edb38514b2c345e7f76cda60b5ba22f65..e4bf8602df15274a0d170caf709472d10d81ea67 100644 (file)
@@ -46,6 +46,21 @@ let snapshot_mode_of_string s =
        | "coalesce"  -> Snapshot_coalesce
        | _           -> failwith "unknown snapshot mode"
 
+type display =
+       | DisplayNone
+       | DisplaySDL of string option
+       | DisplayVNC of bool * int * string
+       | DisplayIntel of string option
+
+let string_of_display disp =
+       match disp with
+       | DisplayNone       -> "none"
+       | DisplaySDL x      -> String.concat ":" ([ "sdl" ] @ (match x with None -> [] | Some s -> [ s ]))
+       | DisplayIntel x    -> String.concat ":" ([ "intel" ] @ (match x with None -> [] | Some s -> [ s ]))
+       | DisplayVNC (u, port, k) ->
+               let args = (if u then [ "use-port-unused" ] else []) @ [ "port=" ^ (string_of_int port) ] @ [ "keymap=" ^ k ] in
+               String.concat ":" ([ "vnc" ] @ [ String.concat "," args ])
+
 type config_pci = {
        pci_bind: bool;
        pci_domain: int;
@@ -114,8 +129,7 @@ type config = {
        pcis: (int * config_pci) list;
        (* others *)
        boot: string;
-       vnc: int;
-       vnc_keymap: string;
+       display: display;
        cpuid: Domain.cpuid_config;
        datadir: string;
        notify: notify_ty;
@@ -294,6 +308,31 @@ let config_notify_of_string s =
        | _ ->
                failwith "bah"
 
+let config_display_of_string s =
+       match String.split ~limit:2 ':' s with
+       | "vnc" :: options ->
+               let options = try List.hd options with _ -> "" in
+               let keymap = ref "en-us" in
+               let port = ref 0 in
+               let unused = ref false in
+               let opts = String.split ',' options in
+               List.iter (fun opt ->
+                       match String.split '=' ~limit:2 opt with
+                       | "use-port-unused" :: [] -> unused := true
+                       | "keymap" :: s :: []     -> keymap := s
+                       | "port" :: s :: []       -> port := int_of_string s
+                       | _                       -> ()
+               ) opts;
+               DisplayVNC (!unused, !port, !keymap)
+       | "sdl" :: options   ->
+               DisplaySDL (try Some (List.hd options) with _ -> None)
+       | "intel" :: options ->
+               DisplayIntel (try Some (List.hd options) with _ -> None)
+       | "none" :: _        ->
+               DisplayNone
+       | _ ->
+               failwith "unknown display format"
+
 exception Unknown_boolean of string
 
 let string_of_string_option opt = match opt with None -> "" | Some v -> v
@@ -328,11 +367,10 @@ let get cfg field =
        | "acpi-pt"   -> string_of_bool cfg.acpi_pt
        | "diskinfo-pt" -> string_of_bool cfg.diskinfo_pt
        | "boot"      -> cfg.boot
-       | "vnc"       -> string_of_int cfg.vnc
-       | "vnc-keymap" -> cfg.vnc_keymap
        | "timer-mode" -> string_of_int_option cfg.timer_mode
        | "time-offset" -> string_of_string_option cfg.timeoffset
        | "hpet"      -> string_of_int_option cfg.hpet
+       | "display"   -> string_of_display cfg.display
        | "vpt-align" -> string_of_int_option cfg.vpt_align
        | "power-management" -> string_of_int cfg.power_management
        | "oem-features" -> string_of_int cfg.oem_features
@@ -364,11 +402,10 @@ let set cfg field value =
        | "acpi-pt"   -> { cfg with acpi_pt = bool_of_string value }
        | "diskinfo-pt"      -> { cfg with diskinfo_pt = bool_of_string value }
        | "boot"             -> { cfg with boot = value }
-       | "vnc"              -> { cfg with vnc = int_of_string value }
-       | "vnc-keymap"       -> { cfg with vnc_keymap = value }
        | "timer-mode"       -> { cfg with timer_mode = int_option_of_string value }
        | "time-offset"      -> { cfg with timeoffset = string_option_of_string value }
        | "hpet"             -> { cfg with hpet = int_option_of_string value }
+       | "display"          -> { cfg with display = config_display_of_string value }
        | "vpt-align"        -> { cfg with vpt_align = int_option_of_string value }
        | "power-management" -> { cfg with power_management = int_of_string value }
        | "oem-features"     -> { cfg with oem_features = int_of_string value }
@@ -441,13 +478,12 @@ let empty =
                viridian = false;
                videoram = None;
                boot = "cd";
-               vnc = 0;
-               vnc_keymap = "en-us";
                power_management = 0;
                oem_features = 0;
                timer_mode = None;
                timeoffset = None;
                hpet = None;
+               display = DisplayVNC (false, 0, "en-us");
                vpt_align = None;
                global_pci_msitranslate = 0;
                global_pci_power_mgmt = 0;