Line 0
Link Here
|
|
|
1 |
Originates here |
2 |
https://github.com/iocage/iocage/commit/753b2f35731423597d7f51f33427b6d619fcd0b5 |
3 |
https://github.com/iocage/iocage/pull/1106 |
4 |
and most likely can be removed on the next release of iocage. |
5 |
--- iocage_lib/ioc_start.py.orig 2019-09-26 07:23:24 UTC |
6 |
+++ iocage_lib/ioc_start.py |
7 |
@@ -145,7 +145,6 @@ class IOCStart(object): |
8 |
allow_quotas = self.conf["allow_quotas"] |
9 |
allow_socket_af = self.conf["allow_socket_af"] |
10 |
allow_vmm = self.conf["allow_vmm"] |
11 |
- devfs_ruleset = iocage_lib.ioc_common.generate_devfs_ruleset(self.conf) |
12 |
exec_prestart = self.conf["exec_prestart"] |
13 |
exec_poststart = self.conf["exec_poststart"] |
14 |
exec_clean = self.conf["exec_clean"] |
15 |
@@ -486,16 +485,8 @@ class IOCStart(object): |
16 |
_callback=self.callback, |
17 |
silent=self.silent) |
18 |
|
19 |
- if wants_dhcp and self.conf['type'] != 'pluginv2' \ |
20 |
- and self.conf['devfs_ruleset'] != '4': |
21 |
- iocage_lib.ioc_common.logit({ |
22 |
- "level": "WARNING", |
23 |
- "message": f" {self.uuid} is not using the devfs_ruleset" |
24 |
- f" of 4, not generating a ruleset for the jail," |
25 |
- " DHCP may not work." |
26 |
- }, |
27 |
- _callback=self.callback, |
28 |
- silent=self.silent) |
29 |
+ devfs_paths = None |
30 |
+ devfs_includes = None |
31 |
|
32 |
if self.conf['type'] == 'pluginv2' and os.path.isfile( |
33 |
os.path.join(self.path, f'{self.conf["plugin_name"]}.json') |
34 |
@@ -509,17 +500,51 @@ class IOCStart(object): |
35 |
plugin_name = self.conf['plugin_name'] |
36 |
plugin_devfs = devfs_json[ |
37 |
"devfs_ruleset"][f"plugin_{plugin_name}"] |
38 |
- plugin_devfs_paths = plugin_devfs['paths'] |
39 |
- |
40 |
- plugin_devfs_includes = None if 'includes' not in \ |
41 |
+ devfs_paths = plugin_devfs['paths'] |
42 |
+ devfs_includes = None if 'includes' not in \ |
43 |
plugin_devfs else plugin_devfs['includes'] |
44 |
|
45 |
- devfs_ruleset = \ |
46 |
- iocage_lib.ioc_common.generate_devfs_ruleset( |
47 |
- self.conf, |
48 |
- paths=plugin_devfs_paths, |
49 |
- includes=plugin_devfs_includes |
50 |
- ) |
51 |
+ # Generate dynamic devfs ruleset from configured one |
52 |
+ (manual_devfs_config, configured_devfs_ruleset, devfs_ruleset) \ |
53 |
+ = iocage_lib.ioc_common.generate_devfs_ruleset( |
54 |
+ self.conf, devfs_paths, devfs_includes) |
55 |
+ |
56 |
+ if int(devfs_ruleset) <= 0: |
57 |
+ iocage_lib.ioc_common.logit({ |
58 |
+ "level": "ERROR", |
59 |
+ "message": f"{self.uuid} devfs_ruleset" |
60 |
+ f" {configured_devfs_ruleset} does not exist!" |
61 |
+ " - Not starting jail" |
62 |
+ }, |
63 |
+ _callback=self.callback, |
64 |
+ silent=self.silent) |
65 |
+ return |
66 |
+ |
67 |
+ # Manually configured devfs_ruleset doesn't support all iocage features |
68 |
+ if manual_devfs_config: |
69 |
+ if devfs_paths is not None or devfs_includes is not None: |
70 |
+ iocage_lib.ioc_common.logit({ |
71 |
+ "level": "WARNING", |
72 |
+ "message": f" {self.uuid} is not using the devfs_ruleset" |
73 |
+ " of " |
74 |
+ f"{iocage_lib.ioc_common.IOCAGE_DEVFS_RULESET}" |
75 |
+ ", devices and includes from plugin not added" |
76 |
+ ", some features of the plugin may not work." |
77 |
+ }, |
78 |
+ _callback=self.callback, |
79 |
+ silent=self.silent) |
80 |
+ |
81 |
+ if wants_dhcp and self.conf['type'] != 'pluginv2': |
82 |
+ iocage_lib.ioc_common.logit({ |
83 |
+ "level": "WARNING", |
84 |
+ "message": f" {self.uuid} is not using the devfs_ruleset" |
85 |
+ " of " |
86 |
+ f"{iocage_lib.ioc_common.IOCAGE_DEVFS_RULESET}" |
87 |
+ ", not generating a ruleset for the jail," |
88 |
+ " DHCP may not work." |
89 |
+ }, |
90 |
+ _callback=self.callback, |
91 |
+ silent=self.silent) |
92 |
|
93 |
parameters = [ |
94 |
fdescfs, _allow_mlock, tmpfs, |
95 |
@@ -619,6 +644,9 @@ class IOCStart(object): |
96 |
iocage_lib.ioc_common.logit({ |
97 |
'level': 'INFO', |
98 |
'message': f' + Using devfs_ruleset: {devfs_ruleset}' |
99 |
+ + (' (cloned from devfs_ruleset ' |
100 |
+ f'{configured_devfs_ruleset})' if manual_devfs_config |
101 |
+ else ' (iocage generated default)') |
102 |
}, |
103 |
_callback=self.callback, |
104 |
silent=self.silent) |