From 41e8d793231b12bcddfce49d7820afd53335cb02 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Mon, 11 Jan 2010 12:03:12 +0000 Subject: [PATCH] add optional cdrom-pt option to xenvm if cdrom-pt is specified, it will pass the argument to qemu as -cdrom-pt "path", otherwise no extra argument are added. the qemu-dm-wrapper need to be tweaked (remove the cdrom-pt option) when the upper layer know about the option. --- xenvm/vmact.ml | 10 +++++++++- xenvm/vmconfig.ml | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xenvm/vmact.ml b/xenvm/vmact.ml index 6b193a7..9e27d13 100644 --- a/xenvm/vmact.ml +++ b/xenvm/vmact.ml @@ -209,6 +209,14 @@ let get_pcis cfg = let dm_info_of_cfg cfg = let nics = get_nics cfg in let nics = List.map (fun nic -> nic.nic_mac, nic.nic_bridge, if nic.nic_model="" then None else Some nic.nic_model) nics in + + let extrahvm = + (match cfg.cdrom_pt with + | None -> [] + | Some path -> [ ("-cdrom-pt", Some path) ] + ) @ cfg.extrahvm + in + let disp = match cfg.display with | DisplayNone -> Device.Dm.NONE @@ -232,7 +240,7 @@ let dm_info_of_cfg cfg = Device.Dm.oem_features = cfg.oem_features; Device.Dm.inject_sci = cfg.inject_sci; Device.Dm.videoram = (match cfg.videoram with None -> 8 | Some i -> i); - Device.Dm.extras = cfg.extrahvm; + Device.Dm.extras = extrahvm; } let rm_snapshots disks = diff --git a/xenvm/vmconfig.ml b/xenvm/vmconfig.ml index 62e0b26..12652a1 100644 --- a/xenvm/vmconfig.ml +++ b/xenvm/vmconfig.ml @@ -158,6 +158,7 @@ type config = { sound: string option; inject_sci: int; qemu_pv: bool; + cdrom_pt: string option; cpus_affinity: (int * (int list)) list; } @@ -497,6 +498,7 @@ let get cfg field = | "sound" -> string_of_string_option cfg.sound | "notify" -> string_of_notify cfg.notify | "qemu-pv" -> string_of_bool cfg.qemu_pv + | "cdrom-pt" -> string_of_string_option cfg.cdrom_pt | _ -> raise (Unknown_field field) let set cfg field value = @@ -534,6 +536,7 @@ let set cfg field value = | "sound" -> { cfg with sound = string_option_of_string value } | "notify" -> { cfg with notify = config_notify_of_string value } | "qemu-pv" -> { cfg with qemu_pv = bool_of_string value } + | "cdrom-pt" -> { cfg with cdrom_pt = string_option_of_string value } | _ -> raise (Unknown_field field) let list_add cfg field value = @@ -621,6 +624,7 @@ let empty = inject_sci = 0; sound = None; qemu_pv = true; + cdrom_pt = None; (* list_{get/del/add} *) disks = []; -- 2.39.5