libvirtd_qemu.aug 5.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(* /etc/libvirt/qemu.conf *)

module Libvirtd_qemu =
   autoload xfm

   let eol   = del /[ \t]*\n/ "\n"
   let value_sep   = del /[ \t]*=[ \t]*/  " = "
   let indent = del /[ \t]*/ ""

   let array_sep  = del /,[ \t\n]*/ ", "
   let array_start = del /\[[ \t\n]*/ "[ "
   let array_end = del /\]/ "]"

   let str_val = del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\""
   let bool_val = store /0|1/
16
   let int_val = store /[0-9]+/
17 18 19 20 21
   let str_array_element = [ seq "el" . str_val ] . del /[ \t\n]*/ ""
   let str_array_val = counter "el" . array_start . ( str_array_element . ( array_sep . str_array_element ) * ) ? . array_end

   let str_entry       (kw:string) = [ key kw . value_sep . str_val ]
   let bool_entry      (kw:string) = [ key kw . value_sep . bool_val ]
22
   let int_entry       (kw:string) = [ key kw . value_sep . int_val ]
23 24
   let str_array_entry (kw:string) = [ key kw . value_sep . str_array_val ]

25 26 27
   let unlimited_val =  del /\"/ "\"" . store /unlimited/ . del /\"/ "\""
   let limits_entry (kw:string) = [ key kw . value_sep . unlimited_val ] |  [ key kw . value_sep . int_val ]

28 29

   (* Config entry grouped by function - same order as example config *)
30 31
   let default_tls_entry = str_entry "default_tls_x509_cert_dir"
                 | bool_entry "default_tls_x509_verify"
32
                 | str_entry "default_tls_x509_secret_uuid"
33

34
   let vnc_entry = str_entry "vnc_listen"
35
                 | bool_entry "vnc_auto_unix_socket"
36 37 38
                 | bool_entry "vnc_tls"
                 | str_entry "vnc_tls_x509_cert_dir"
                 | bool_entry "vnc_tls_x509_verify"
39
                 | str_entry "vnc_password"
40 41
                 | bool_entry "vnc_sasl"
                 | str_entry "vnc_sasl_dir"
42 43 44
                 | bool_entry "vnc_allow_host_audio"

   let spice_entry = str_entry "spice_listen"
45 46
                 | bool_entry "spice_tls"
                 | str_entry  "spice_tls_x509_cert_dir"
47
                 | bool_entry "spice_auto_unix_socket"
D
Daniel P. Berrange 已提交
48
                 | str_entry "spice_password"
49 50
                 | bool_entry "spice_sasl"
                 | str_entry "spice_sasl_dir"
51

52 53 54
   let chardev_entry = bool_entry "chardev_tls"
                 | str_entry "chardev_tls_x509_cert_dir"
                 | bool_entry "chardev_tls_x509_verify"
55
                 | str_entry "chardev_tls_x509_secret_uuid"
56

57 58
   let nogfx_entry = bool_entry "nographics_allow_host_audio"

59 60
   let remote_display_entry = int_entry "remote_display_port_min"
                 | int_entry "remote_display_port_max"
61 62
                 | int_entry "remote_websocket_port_min"
                 | int_entry "remote_websocket_port_max"
63

64
   let security_entry = str_entry "security_driver"
65 66
                 | bool_entry "security_default_confined"
                 | bool_entry "security_require_confined"
67 68
                 | str_entry "user"
                 | str_entry "group"
69
                 | bool_entry "dynamic_ownership"
70 71
                 | str_array_entry "cgroup_controllers"
                 | str_array_entry "cgroup_device_acl"
72
                 | int_entry "seccomp_sandbox"
73 74

   let save_entry =  str_entry "save_image_format"
75
                 | str_entry "dump_image_format"
76
                 | str_entry "snapshot_image_format"
H
Hu Tao 已提交
77
                 | str_entry "auto_dump_path"
78 79
                 | bool_entry "auto_dump_bypass_cache"
                 | bool_entry "auto_start_bypass_cache"
80 81

   let process_entry = str_entry "hugetlbfs_mount"
82
                 | bool_entry "clear_emulator_capabilities"
83
                 | str_entry "bridge_helper"
84
                 | bool_entry "set_process_name"
85
                 | int_entry "max_processes"
86
                 | int_entry "max_files"
87
                 | limits_entry "max_core"
88
                 | bool_entry "dump_guest_core"
89
                 | str_entry "stdio_handler"
90 91 92 93

   let device_entry = bool_entry "mac_filter"
                 | bool_entry "relaxed_acs_check"
                 | bool_entry "allow_disk_format_probing"
94
                 | str_entry "lock_manager"
95 96

   let rpc_entry = int_entry "max_queued"
97 98
                 | int_entry "keepalive_interval"
                 | int_entry "keepalive_count"
99

100
   let network_entry = str_entry "migration_address"
101 102
                 | int_entry "migration_port_min"
                 | int_entry "migration_port_max"
103
                 | str_entry "migration_host"
104

105 106
   let log_entry = bool_entry "log_timestamp"

107 108
   let nvram_entry = str_array_entry "nvram"

109 110
   let gluster_debug_level_entry = int_entry "gluster_debug_level"

M
Martin Kletzander 已提交
111
   (* Each entry in the config is one of the following ... *)
112 113
   let entry = default_tls_entry
             | vnc_entry
114
             | spice_entry
115
             | chardev_entry
116
             | nogfx_entry
117
             | remote_display_entry
118 119 120 121 122
             | security_entry
             | save_entry
             | process_entry
             | device_entry
             | rpc_entry
123
             | network_entry
124
             | log_entry
125
             | nvram_entry
126
             | gluster_debug_level_entry
127

128 129 130 131 132 133 134 135 136 137 138
   let comment = [ label "#comment" . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
   let empty = [ label "#empty" . eol ]

   let record = indent . entry . eol

   let lns = ( record | comment | empty ) *

   let filter = incl "/etc/libvirt/qemu.conf"
              . Util.stdexcl

   let xfm = transform lns filter