|
13 | 13 | *) |
14 | 14 |
|
15 | 15 | let network_conf = ref "/etc/xcp/network.conf" |
16 | | -let vif_script = ref "/usr/lib/xcp/scripts/vif" |
17 | | -let qemu_vif_script = ref "/usr/lib/xcp/scripts/qemu-vif-script" |
18 | | -let vbd_script = ref "/etc/xen/scripts/block" |
19 | | -let pci_flr_script = ref "/usr/lib/xcp/lib/pci-flr" |
20 | | -let vncterm = ref "/usr/lib/xcp/lib/vncterm" |
21 | | -let xenguest = ref "/usr/lib/xcp/lib/xenguest" |
22 | 16 | let qemu_dm_wrapper = ref "/usr/lib/xcp/lib/qemu-dm-wrapper" |
23 | 17 | let qemu_system_i386 = ref "/usr/lib/xen/bin/qemu-system-i386" |
24 | | -let tune2fs = ref "/sbin/tune2fs" |
25 | | -let mkfs = ref "/sbin/mkfs" |
26 | | -let mount = ref "/bin/mount" |
27 | | -let umount = ref "/bin/umount" |
28 | | -let ionice = ref "/usr/bin/ionice" |
29 | 18 | let chgrp = ref "/bin/chgrp" |
30 | | -let setup_vif_rules = ref "/usr/lib/xcp/lib/setup-vif-rules" |
31 | 19 | let hvmloader = ref "/usr/lib/xen-4.1/boot/hvmloader" |
32 | | -let pygrub = ref "/usr/lib/xen-4.1/bin/pygrub" |
33 | | -let eliloader = ref "/usr/bin/eliloader" |
34 | 20 |
|
35 | 21 | open Unix |
36 | 22 |
|
37 | | -let essentials = [ |
38 | | - X_OK, "vbd-script", vbd_script, "path to the vbd backend script"; |
39 | | - R_OK, "network-conf", network_conf, "path to the network backend switch"; |
40 | | - X_OK, "vif-script", vif_script, "path to the vif backend script"; |
41 | | - X_OK, "qemu-vif-script", qemu_vif_script, "path to the qemu vif script"; |
42 | | - X_OK, "vncterm", vncterm, "path to the vncterm binary"; |
43 | | - X_OK, "xenguest", xenguest, "path to the xenguest binary"; |
| 23 | +let hvm_guests = [ |
| 24 | + R_OK, "hvmloader", hvmloader, "path to the hvmloader binary for HVM guests"; |
44 | 25 | X_OK, "qemu-dm-wrapper", qemu_dm_wrapper, "path to the qemu-dm-wrapper script"; |
45 | 26 | X_OK, "qemu-system-i386", qemu_system_i386, "path to the qemu-system-i386 binary"; |
46 | | - X_OK, "tune2fs", tune2fs, "path to the tune2fs binary"; |
47 | | - X_OK, "mkfs", mkfs, "path to the mkfs binary"; |
48 | | - X_OK, "mount", mount, "path to the mount binary"; |
49 | | - X_OK, "umount", umount, "path to the umount binary"; |
50 | | - X_OK, "ionice", ionice, "path to the ionice binary"; |
| 27 | +] |
| 28 | + |
| 29 | +(* libvirt xc *) |
| 30 | +let network_configuration = [ |
| 31 | + R_OK, "network-conf", network_conf, "path to the network backend switch"; |
| 32 | +] |
| 33 | + |
| 34 | +let essentials = [ |
51 | 35 | X_OK, "chgrp", chgrp, "path to the chgrp binary"; |
52 | | - X_OK, "setup-vif-rules", setup_vif_rules, "path to the setup-vif-rules script"; |
53 | | - R_OK, "hvmloader", hvmloader, "path to the hvmloader binary for HVM guests"; |
54 | | - X_OK, "pygrub", pygrub, "path to the pygrub bootloader binary"; |
55 | | - X_OK, "eliloader", eliloader, "path to the eliloader bootloader binary"; |
56 | 36 | ] |
57 | 37 |
|
58 | 38 | let nonessentials = [ |
59 | | - X_OK, "pci-flr-script", pci_flr_script, "path to the PCI function-level reset script"; |
60 | 39 | ] |
61 | 40 |
|
62 | | -(* Sometimes we tell other services to execute programs (e.g. udev calling the vif script) |
63 | | - and they will have a different working directory *) |
64 | | -let canonicalise x = Filename.(if is_relative x then concat (Unix.getcwd ()) x else x) |
65 | | - |
66 | | -let config_spec = List.map (fun (_, a, b, c) -> a, Arg.String (fun x -> b := canonicalise x), c) (essentials @ nonessentials) |
| 41 | +let make_resources ~essentials ~nonessentials = |
| 42 | + let open Xcp_service in |
| 43 | + List.map (fun (perm, name, path, description) -> { |
| 44 | + essential = true; |
| 45 | + name; description; path; |
| 46 | + perms = [ perm ] |
| 47 | + }) essentials @ (List.map (fun (perm, name, path, description) -> { |
| 48 | + essential = false; |
| 49 | + name; description; path; |
| 50 | + perms = [ perm ] |
| 51 | + }) nonessentials) |
0 commit comments