]> xenbits.xen.org Git - xenclient/toolstack.git/commitdiff
augment the cpus_affinity config when adding a id:v1,v2,... to cpus-affinity config.
authorVincent Hanquez <vincent.hanquez@eu.citrix.com>
Tue, 8 Sep 2009 14:50:14 +0000 (15:50 +0100)
committerVincent Hanquez <vincent.hanquez@eu.citrix.com>
Tue, 8 Sep 2009 14:50:14 +0000 (15:50 +0100)
xenvm/vmconfig.ml

index e68cd0076f79bab927a2e03edbcc01fc11445d3e..f818808107534a2860aaef5233516318164ce684 100644 (file)
@@ -519,6 +519,15 @@ let list_add cfg field value =
                | k :: []      -> k, ""
                | _            -> failwith "bad format for platform. expecting k=v"
                in
+       let config_cpus_affinity_of_string s =
+               match String.split ~limit:2 ':' s with
+               | k :: v :: [] ->
+                       let id = int_of_string k in
+                       let args = String.split ',' v in
+                       let vcpus = List.map int_of_string args in
+                       (id, vcpus)
+               | _            -> failwith "bad format for cpu affinity. expecting id:list"
+               in
        match field with
        | "disk"        -> { cfg with disks = cfg.disks @ [ config_disk_of_string value ] }
        | "nic" | "vif" -> { cfg with nics = cfg.nics @ [ config_nic_of_string value ] }
@@ -528,6 +537,7 @@ let list_add cfg field value =
        | "platform"    -> { cfg with platform = cfg.platform @ [ config_platform_of_string value ] }
        | "extra-local-watch" -> { cfg with extra_local_watches = cfg.extra_local_watches @ [ value ] }
        | "extra-vm-watch"    -> { cfg with extra_vm_watches = cfg.extra_vm_watches @ [ value ] }
+       | "cpus-affinity"     -> { cfg with cpus_affinity = cfg.cpus_affinity @ [ config_cpus_affinity_of_string value ] }
        | _             -> raise (Unknown_field field)
 
 let list_del cfg field index =
@@ -639,7 +649,7 @@ let of_file uuid error_report file =
        ] in
        let kv k v =
                match k with
-               | "disk" | "vif" | "nic" | "pci" | "cpuid"
+               | "disk" | "vif" | "nic" | "pci" | "cpuid" | "cpus-affinity"
                | "extra-hvm" | "extra-local-watch" | "extra-vm-watch" ->
                        cfg := list_add !cfg k v
                | _      ->