1 |
idella4 13/12/07 06:49:41 |
2 |
|
3 |
Modified: xencommons.confd xenqemudev.initd xenstored.initd |
4 |
xenstored.confd xenconsoled.initd |
5 |
Log: |
6 |
corrections to previous patch by dlan, tested by him |
7 |
|
8 |
(Portage version: 2.2.0/cvs/Linux x86_64, signed Manifest commit with key 0xB8072B0D) |
9 |
|
10 |
Revision Changes Path |
11 |
1.2 app-emulation/xen-tools/files/xencommons.confd |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xencommons.confd?rev=1.2&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xencommons.confd?rev=1.2&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xencommons.confd?r1=1.1&r2=1.2 |
16 |
|
17 |
Index: xencommons.confd |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xencommons.confd,v |
20 |
retrieving revision 1.1 |
21 |
retrieving revision 1.2 |
22 |
diff -u -r1.1 -r1.2 |
23 |
--- xencommons.confd 6 Dec 2013 23:34:11 -0000 1.1 |
24 |
+++ xencommons.confd 7 Dec 2013 06:49:41 -0000 1.2 |
25 |
@@ -1,7 +1,4 @@ |
26 |
-# /etc/conf.d/xenqemudev |
27 |
+# /etc/conf.d/xencommons |
28 |
|
29 |
-# To enable QEMU file backend, set to 'yes' |
30 |
-XENQEMUDEV_FILE_BACKEND_ENABLE="" |
31 |
- |
32 |
-# Common options for xenqemudev |
33 |
-XENQEMUDEV_OPTS="" |
34 |
+# Load xen's kernel modules, and this will override defaults |
35 |
+XEN_KERNEL_MODULES="" |
36 |
|
37 |
|
38 |
|
39 |
1.2 app-emulation/xen-tools/files/xenqemudev.initd |
40 |
|
41 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd?rev=1.2&view=markup |
42 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd?rev=1.2&content-type=text/plain |
43 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd?r1=1.1&r2=1.2 |
44 |
|
45 |
Index: xenqemudev.initd |
46 |
=================================================================== |
47 |
RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd,v |
48 |
retrieving revision 1.1 |
49 |
retrieving revision 1.2 |
50 |
diff -u -r1.1 -r1.2 |
51 |
--- xenqemudev.initd 6 Dec 2013 23:34:11 -0000 1.1 |
52 |
+++ xenqemudev.initd 7 Dec 2013 06:49:41 -0000 1.2 |
53 |
@@ -1,117 +1,81 @@ |
54 |
#!/sbin/runscript |
55 |
# Copyright 1999-2013 Gentoo Foundation |
56 |
# Distributed under the terms of the GNU General Public License v2 |
57 |
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd,v 1.1 2013/12/06 23:34:11 idella4 Exp $ |
58 |
- |
59 |
-extra_commands="status" |
60 |
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd,v 1.2 2013/12/07 06:49:41 idella4 Exp $ |
61 |
|
62 |
depend() { |
63 |
- need xend |
64 |
- after dhcp |
65 |
+ need xencommons xenstored xenconsoled |
66 |
} |
67 |
|
68 |
-get_domname() { |
69 |
- local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1) |
70 |
- |
71 |
- if [ -z ${name_from_file} ] ; then |
72 |
- basename "${1}" |
73 |
- else |
74 |
- echo ${name_from_file} |
75 |
- fi |
76 |
+is_privileged_domain() { |
77 |
+ grep -qsE '^control_d$' /proc/xen/capabilities |
78 |
+ return $? |
79 |
} |
80 |
|
81 |
-is_running() { |
82 |
- /usr/sbin/xm list "${1}" >/dev/null 2>&1 |
83 |
-} |
84 |
+xen_setvars() { |
85 |
+ . /etc/xen/scripts/hotplugpath.sh |
86 |
|
87 |
-using_screen() { |
88 |
- [ "${SCREEN}" = "yes" -o "${SCREEN}" = "YES" ] |
89 |
+ XENQEMUDEV_PIDFILE=/run/xenqemudev.pid |
90 |
+ XEN_QEMU="${LIBEXEC}/qemu-system-i386" |
91 |
} |
92 |
|
93 |
-set_screen_cmd() { |
94 |
- screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X" |
95 |
+xen_qemu_start() { |
96 |
+ if [ -z "${XENQEMUDEV_FILE_BACKEND_ENABLE}" ]; then |
97 |
+ ewarn " QEMU disk backend not enabled" |
98 |
+ ewarn " enable XENQEMUDEV_FILE_BACKEND_ENABLE in /etc/conf.d/xenqemudev" |
99 |
+ return 1 |
100 |
+ fi |
101 |
+ |
102 |
+ xen_setvars |
103 |
+ |
104 |
+ if [ ! -c /dev/xen/gntdev ]; then |
105 |
+ einfo " Xen gntdev driver not loaded" |
106 |
+ return 1 |
107 |
+ fi |
108 |
+ |
109 |
+ if [ -e "${XEN_QEMU}" ]; then |
110 |
+ einfo " Starting QEMU as disk backend for dom0" |
111 |
+ |
112 |
+ XENQEMUDEV_DEFAULT_OPTS="-xen-domid 0 -xen-attach -name dom0 \ |
113 |
+ -nographic -M xenpv -daemonize \ |
114 |
+ -monitor /dev/null -serial /dev/null -parallel /dev/null" |
115 |
+ |
116 |
+ XENQEMUDEV_OPTS=${XENQEMUDEV_OPTS:-${XENQEMUDEV_DEFAULT_OPTS}} |
117 |
+ |
118 |
+ start-stop-daemon --start --exec ${XEN_QEMU} \ |
119 |
+ --pidfile ${XENQEMUDEV_PIDFILE} \ |
120 |
+ -- -pidfile ${XENQEMUDEV_PIDFILE} \ |
121 |
+ ${XENQEMUDEV_OPTS} |
122 |
+ return $? |
123 |
+ fi |
124 |
} |
125 |
|
126 |
start() { |
127 |
- set_screen_cmd |
128 |
+ ebegin "Starting xenqemudev daemon" |
129 |
|
130 |
- einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}" |
131 |
- if using_screen ; then |
132 |
- ebegin "Creating screen session to hold domain consoles" |
133 |
- ( screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 && sleep 3 \ |
134 |
- && ${screen_cmd} zombie dr \ |
135 |
- && logrotate -f /etc/xen/xen-consoles.logrotate \ |
136 |
- && ${screen_cmd} logfile /var/log/xen-consoles/%t.log \ |
137 |
- && ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \ |
138 |
- && ${screen_cmd} log on \ |
139 |
- && ${screen_cmd} deflog on ) >/dev/null |
140 |
- if [ $? -ne 0 ] ; then |
141 |
- eend 1 |
142 |
- return 1 |
143 |
- else |
144 |
- eend |
145 |
- fi |
146 |
- fi |
147 |
- # Create all domains with config files in AUTODIR. |
148 |
- for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do |
149 |
- name=$(get_domname ${dom}) |
150 |
- if ! is_running ${name} ; then |
151 |
- ebegin " Starting domain ${name}" |
152 |
- if using_screen ; then |
153 |
- ${screen_cmd} screen -t ${name} xm create ${dom} -c |
154 |
- else |
155 |
- xm create --quiet ${dom} |
156 |
- fi |
157 |
- eend $? |
158 |
- else |
159 |
- einfo " Not starting domain ${name} - already running" |
160 |
- fi |
161 |
- done |
162 |
-} |
163 |
- |
164 |
-stop() { |
165 |
- set_screen_cmd |
166 |
- |
167 |
- einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}" |
168 |
- # Stop all domains with config files in AUTODIR. |
169 |
- DOMAINS="$(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort -r)" |
170 |
- |
171 |
- if [[ "$PARALLEL_SHUTDOWN" == "yes" ]] ; then |
172 |
- for dom in $DOMAINS ; do |
173 |
- name=$(get_domname ${dom}) |
174 |
- if is_running ${name} ; then |
175 |
- ebegin " Asking domain ${name} to shutdown in the background..." |
176 |
- xm shutdown --wait ${name} >/dev/null & |
177 |
- else |
178 |
- einfo " Not stopping domain ${name} - not running" |
179 |
- fi |
180 |
- done |
181 |
- einfo " Waiting for shutdown of domains that are still running" |
182 |
- wait |
183 |
- eend $? |
184 |
- else |
185 |
- for dom in $DOMAINS ; do |
186 |
- name=$(get_domname ${dom}) |
187 |
- if is_running ${name} ; then |
188 |
- ebegin " Waiting for domain ${name} to shutdown" |
189 |
- xm shutdown --wait ${name} >/dev/null |
190 |
- eend $? |
191 |
- else |
192 |
- einfo " Not stopping domain ${name} - not running" |
193 |
- fi |
194 |
- done |
195 |
+ # not running in Xen dom0 or domU |
196 |
+ if [ ! -d /proc/xen ]; then |
197 |
+ eend 1 "Not running in Xen mode" |
198 |
+ return 1 |
199 |
fi |
200 |
- if using_screen ; then |
201 |
- if ${screen_cmd} sleep 0 >/dev/null 2>&1 ; then |
202 |
- ebegin "Closing screen session ${SCREEN_NAME}" |
203 |
- ${screen_cmd} quit |
204 |
- eend $? |
205 |
- else |
206 |
- eend 0 |
207 |
- fi |
208 |
+ |
209 |
+ if ! is_privileged_domain; then |
210 |
+ eend 1 "Not running on a privileged domain. xenqemudev not started" |
211 |
+ return 1 |
212 |
fi |
213 |
+ |
214 |
+ xen_qemu_start |
215 |
+ |
216 |
+ eend $? "Failed to start xenqemudev" |
217 |
} |
218 |
|
219 |
-status() { |
220 |
- /usr/sbin/xm list |
221 |
-} |
222 |
\ No newline at end of file |
223 |
+stop () { |
224 |
+ ebegin "Stopping xenqemudev" |
225 |
+ |
226 |
+ xen_setvars |
227 |
+ |
228 |
+ start-stop-daemon --stop --exec ${XEN_QEMU} \ |
229 |
+ --pidfile ${XENQEMUDEV_PIDFILE} |
230 |
+ |
231 |
+ eend $? "Stopping xenqemudev, as it cannot be restarted." |
232 |
+} |
233 |
|
234 |
|
235 |
|
236 |
1.12 app-emulation/xen-tools/files/xenstored.initd |
237 |
|
238 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd?rev=1.12&view=markup |
239 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd?rev=1.12&content-type=text/plain |
240 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd?r1=1.11&r2=1.12 |
241 |
|
242 |
Index: xenstored.initd |
243 |
=================================================================== |
244 |
RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd,v |
245 |
retrieving revision 1.11 |
246 |
retrieving revision 1.12 |
247 |
diff -u -r1.11 -r1.12 |
248 |
--- xenstored.initd 6 Dec 2013 23:34:11 -0000 1.11 |
249 |
+++ xenstored.initd 7 Dec 2013 06:49:41 -0000 1.12 |
250 |
@@ -1,7 +1,6 @@ |
251 |
#!/sbin/runscript |
252 |
# Copyright 1999-2013 Gentoo Foundation |
253 |
# Distributed under the terms of the GNU General Public License v2 |
254 |
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd,v 1.11 2013/12/06 23:34:11 idella4 Exp $ |
255 |
|
256 |
depend() { |
257 |
before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp |
258 |
@@ -9,7 +8,7 @@ |
259 |
} |
260 |
|
261 |
start() { |
262 |
- ! [ -x /run/xen ] && mkdir -p /run/xen |
263 |
+ [ -x /run/xen ] || mkdir -p /run/xen |
264 |
ebegin "Starting xenstored daemon" |
265 |
start-stop-daemon --start --exec /usr/sbin/xenstored \ |
266 |
--pidfile /run/xenstored.pid \ |
267 |
@@ -31,3 +30,4 @@ |
268 |
--pidfile /run/xenstored.pid |
269 |
eend $? |
270 |
} |
271 |
+ |
272 |
|
273 |
|
274 |
|
275 |
1.3 app-emulation/xen-tools/files/xenstored.confd |
276 |
|
277 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.confd?rev=1.3&view=markup |
278 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.confd?rev=1.3&content-type=text/plain |
279 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.confd?r1=1.2&r2=1.3 |
280 |
|
281 |
Index: xenstored.confd |
282 |
=================================================================== |
283 |
RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenstored.confd,v |
284 |
retrieving revision 1.2 |
285 |
retrieving revision 1.3 |
286 |
diff -u -r1.2 -r1.3 |
287 |
--- xenstored.confd 4 Aug 2013 12:22:18 -0000 1.2 |
288 |
+++ xenstored.confd 7 Dec 2013 06:49:41 -0000 1.3 |
289 |
@@ -1,52 +1,2 @@ |
290 |
-#!/sbin/runscript |
291 |
-# Copyright 1999-2013 Gentoo Foundation |
292 |
-# Distributed under the terms of the GNU General Public License v2 |
293 |
- |
294 |
-is_privileged_domain() { |
295 |
- # [ -e /proc/xen/capabilities ] |
296 |
- ! [ -z /proc/xen/capabilities ] && return 0 |
297 |
- return 1 |
298 |
-} |
299 |
- |
300 |
-depend() { |
301 |
- before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp |
302 |
-} |
303 |
- |
304 |
-start() { |
305 |
- [ -x /run/xen ] || mkdir -p /run/xen |
306 |
- ebegin "Starting xenstored daemon" |
307 |
- |
308 |
- if [ -e /proc/xen/privcmd ] && is_privileged_domain |
309 |
- then |
310 |
- eend 1 "Not running on a privileged domain. xenstored not started" |
311 |
- return 1 |
312 |
- fi |
313 |
- |
314 |
- start-stop-daemon --start --exec /usr/sbin/xenstored \ |
315 |
- --pidfile /var/run/xenstored.pid \ |
316 |
- -- --pid-file=/var/run/xenstored.pid \ |
317 |
- $XENSTORED_OPTS || return 1 |
318 |
- |
319 |
- einfo "Waiting (upto 10 seconds) for xenstore to come up" |
320 |
- |
321 |
- for i in {0..20}; do |
322 |
- sleep .5 |
323 |
- ! xenstore-exists / 2> /dev/null || break |
324 |
- done |
325 |
- |
326 |
- if ! xenstore-exists / 2> /dev/null; then |
327 |
- eend 1 "xenstore not up within 10 seconds" |
328 |
- else |
329 |
- einfo "Setting domain0 name record" |
330 |
- xenstore-write "/local/domain/0/name" "Domain-0" |
331 |
- eend $? |
332 |
- fi |
333 |
-} |
334 |
- |
335 |
-stop() { |
336 |
- ebegin "Stopping xenstored daemon" |
337 |
- start-stop-daemon --stop --exec /usr/sbin/xenstored \ |
338 |
- --pidfile /var/run/xenstored.pid |
339 |
- eend $? |
340 |
-} |
341 |
- |
342 |
+# /etc/conf.d/xenstored |
343 |
+XENSTORED_OPTS="" |
344 |
|
345 |
|
346 |
|
347 |
1.4 app-emulation/xen-tools/files/xenconsoled.initd |
348 |
|
349 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd?rev=1.4&view=markup |
350 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd?rev=1.4&content-type=text/plain |
351 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd?r1=1.3&r2=1.4 |
352 |
|
353 |
Index: xenconsoled.initd |
354 |
=================================================================== |
355 |
RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd,v |
356 |
retrieving revision 1.3 |
357 |
retrieving revision 1.4 |
358 |
diff -u -r1.3 -r1.4 |
359 |
--- xenconsoled.initd 6 Dec 2013 23:34:11 -0000 1.3 |
360 |
+++ xenconsoled.initd 7 Dec 2013 06:49:41 -0000 1.4 |
361 |
@@ -1,7 +1,7 @@ |
362 |
#!/sbin/runscript |
363 |
# Copyright 1999-2013 Gentoo Foundation |
364 |
# Distributed under the terms of the GNU General Public License v2 |
365 |
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd,v 1.3 2013/12/06 23:34:11 idella4 Exp $ |
366 |
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd,v 1.4 2013/12/07 06:49:41 idella4 Exp $ |
367 |
|
368 |
depend() { |
369 |
need xenstored |
370 |
@@ -19,6 +19,6 @@ |
371 |
stop() { |
372 |
ebegin "Stopping xenconsoled daemon" |
373 |
start-stop-daemon --stop --exec /usr/sbin/xenconsoled \ |
374 |
- --pidfile run/xenconsoled.pid |
375 |
+ --pidfile /run/xenconsoled.pid |
376 |
eend $* |
377 |
} |