]> xenbits.xensource.com Git - xenclient/toolstack.git/commitdiff
error out if config require hvm or directio but they haven't been found on the system
authorVincent Hanquez <vincent.hanquez@eu.citrix.com>
Fri, 26 Jun 2009 10:09:14 +0000 (11:09 +0100)
committerVincent Hanquez <vincent.hanquez@eu.citrix.com>
Fri, 26 Jun 2009 10:09:14 +0000 (11:09 +0100)
xenvm/xenvm.ml

index d0ce6886169f6812f45a49f35990e006bdc6e415..a0e5ac38cafaa511b695f44fca09e6f4c5e238a5 100644 (file)
@@ -695,6 +695,22 @@ let main state =
                close_monitor_socket socket name
        )
 
+let verify_config cfg =
+       let verify_hvm = cfg.hvm in
+       let verify_directio = cfg.hvm && cfg.pcis <> [] in
+       if verify_hvm || verify_directio then (
+               let physinfo = Xc.with_intf (fun xc -> Xc.physinfo xc) in
+               let verify =
+                       (if verify_hvm then [ ("hvm", List.mem Xc.CAP_HVM physinfo.Xc.capabilities) ] else []) @
+                       (if verify_directio then [ ("directio", List.mem Xc.CAP_DirectIO physinfo.Xc.capabilities) ] else [])
+                       in
+               let missings = List.map fst (List.filter (fun (_, found) -> found) verify) in
+               if missings <> [] then (
+                       error "config requires %s" (String.concat ", " missings);
+                       exit 1
+               )
+       )
+
 let () =
        let anon = ref [] in
        let config = ref "" in
@@ -730,6 +746,9 @@ let () =
                in
 
        let cfg = Config.of_file error_report !config in
+
+       verify_config cfg;
+
        if cfg.daemonize then
                Unixext.daemonize ();