From: Vincent Hanquez Date: Fri, 26 Jun 2009 10:09:14 +0000 (+0100) Subject: error out if config require hvm or directio but they haven't been found on the system X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=21ea4f612dfb5202f9487eb71e79cc72fc645c27;p=xenclient%2Ftoolstack.git error out if config require hvm or directio but they haven't been found on the system --- diff --git a/xenvm/xenvm.ml b/xenvm/xenvm.ml index d0ce688..a0e5ac3 100644 --- a/xenvm/xenvm.ml +++ b/xenvm/xenvm.ml @@ -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 ();