Attaching the ZFS-dataset and configuring the CPUset didn't work when doing "start" without explicit jailnames. e.g. this happened during normal boot.

This commit is contained in:
cryx 2010-02-18 12:22:26 +00:00
parent df3a3ee133
commit 5ad647ec21

View File

@ -74,8 +74,6 @@ do_cmd()
eval ezjail_attachparams=\"\$jail_${ezjail}_attachparams\" eval ezjail_attachparams=\"\$jail_${ezjail}_attachparams\"
eval ezjail_attachblocking=\"\$jail_${ezjail}_attachblocking\" eval ezjail_attachblocking=\"\$jail_${ezjail}_attachblocking\"
eval ezjail_forceblocking=\"\$jail_${ezjail}_forceblocking\" eval ezjail_forceblocking=\"\$jail_${ezjail}_forceblocking\"
eval ezjail_zfs_datasets=\"\$jail_${ezjail}_zfs_datasets\"
eval ezjail_cpuset=\"\$jail_${ezjail}_cpuset\"
# Fix backward compatibility issue # Fix backward compatibility issue
eval ezjail_exec_start=\"\$jail_${ezjail}_exec_start\" eval ezjail_exec_start=\"\$jail_${ezjail}_exec_start\"
@ -105,11 +103,16 @@ do_cmd()
# Pass control to jail script which does the actual work # Pass control to jail script which does the actual work
[ "${ezjail_pass}" ] && sh /etc/rc.d/jail one${action%crypto} ${ezjail_pass} [ "${ezjail_pass}" ] && sh /etc/rc.d/jail one${action%crypto} ${ezjail_pass}
# Configure settings that need to be done after the jail has been started
if [ "${action}" = "start" ]; then if [ "${action}" = "start" ]; then
for ezjail in ${ezjail_list}; do
ezjail_safename=`echo -n "${ezjail}" | tr -c '[:alnum:]' _` ezjail_safename=`echo -n "${ezjail}" | tr -c '[:alnum:]' _`
# Get the JID of the jail # Get the JID of the jail
[ -f "/var/run/jail_${ezjail_safename}.id" ] && ezjail_id=`cat /var/run/jail_${ezjail_safename}.id` || return [ -f "/var/run/jail_${ezjail_safename}.id" ] && ezjail_id=`cat /var/run/jail_${ezjail_safename}.id` || return
eval ezjail_zfs_datasets=\"\$jail_${ezjail_safename}_zfs_datasets\"
eval ezjail_cpuset=\"\$jail_${ezjail_safename}_cpuset\"
# Attach ZFS-datasets to the jail # Attach ZFS-datasets to the jail
for zfs in ${ezjail_zfs_datasets}; do for zfs in ${ezjail_zfs_datasets}; do
/sbin/zfs jail ${ezjail_id} ${zfs} || echo -n "Error: ${zfs} could not be configured" /sbin/zfs jail ${ezjail_id} ${zfs} || echo -n "Error: ${zfs} could not be configured"
@ -117,6 +120,7 @@ do_cmd()
# Configure processor sets for the jail via cpuset(1) # Configure processor sets for the jail via cpuset(1)
[ -z "${ezjail_cpuset}" ] || /usr/bin/cpuset -l ${ezjail_cpuset} -j ${ezjail_id} || echo -n "Error: The defined cpuset is malformed" [ -z "${ezjail_cpuset}" ] || /usr/bin/cpuset -l ${ezjail_cpuset} -j ${ezjail_id} || echo -n "Error: The defined cpuset is malformed"
done
fi fi
# Can only detach after unmounting (from fstab.JAILNAME in /etc/rc.d/jail) # Can only detach after unmounting (from fstab.JAILNAME in /etc/rc.d/jail)