Permalink
Browse files

Without vnet, Linux and 32-bit jails work, so let's bring them back

  • Loading branch information...
jhixson74 committed Jun 7, 2013
1 parent 0ac1928 commit 677e6f3c4a500984126262ececd194f188b730dd
Showing with 99 additions and 71 deletions.
  1. +17 −1 gui/freeadmin/static/lib/js/freeadmin.js
  2. +21 −12 gui/jails/forms.py
  3. +46 −46 gui/jails/nav.py
  4. +15 −12 src/pcbsd/warden/scripts/backend/functions.sh
@@ -651,6 +651,20 @@ require([
}
+ scrollToFirst = function() {
+ dojox.fx.smoothScroll({
+ node: dojo.query('#progress:first-child')[0],
+ win: dojo.byId('progress')
+ }).play();
+ };
+
+ scrollToLast = function() {
+ dojox.fx.smoothScroll({
+ node: dojo.query('#progress:last-child')[0],
+ win: dojo.byId('progress')
+ }).play();
+ };
+
checkProgress = function(pbar, url, uuid, iter) {
if(!iter) iter = 0;
xhr.get(url, {
@@ -811,11 +825,13 @@ require([
} else if (attrs.progressfunc != undefined) {
pbar = new dijit.form.SimpleTextarea({
+ id: "progress",
title: "progress",
rows: "5",
cols: "80",
style: "width:auto;",
- readOnly: true
+ readOnly: true,
+ onChange: scrollToLast
}).placeAt(attrs.form.domNode);
rnode._size();
View
@@ -129,11 +129,11 @@ class JailCreateForm(ModelForm):
initial=True
)
-# jail_32bit = forms.BooleanField(
-# label=_("32 bit"),
-# required=False,
-# initial=False
-# )
+ jail_32bit = forms.BooleanField(
+ label=_("32 bit"),
+ required=False,
+ initial=False
+ )
jail_source = forms.BooleanField(
label=_("source"),
@@ -173,6 +173,7 @@ class JailCreateForm(ModelForm):
advanced_fields = [
'jail_type',
'jail_autostart',
+ 'jail_32bit',
'jail_source',
'jail_ports',
'jail_vanilla',
@@ -204,7 +205,7 @@ def __init__(self, *args, **kwargs):
(WARDEN_TYPE_PLUGINJAIL, WARDEN_TYPE_PLUGINJAIL),
(WARDEN_TYPE_STANDARD, WARDEN_TYPE_STANDARD),
(WARDEN_TYPE_PORTJAIL, WARDEN_TYPE_PORTJAIL),
-# (WARDEN_TYPE_LINUXJAIL, WARDEN_TYPE_LINUXJAIL)
+ (WARDEN_TYPE_LINUXJAIL, WARDEN_TYPE_LINUXJAIL)
)
high_ipv4 = None
@@ -318,8 +319,8 @@ def save(self):
w = Warden()
-# if self.cleaned_data['jail_32bit']:
-# jail_flags |= WARDEN_CREATE_FLAGS_32BIT
+ if self.cleaned_data['jail_32bit']:
+ jail_flags |= WARDEN_CREATE_FLAGS_32BIT
if self.cleaned_data['jail_source']:
jail_flags |= WARDEN_CREATE_FLAGS_SRC
if self.cleaned_data['jail_ports']:
@@ -406,7 +407,12 @@ def save(self):
jail_set_args['jail'] = jail_host
jail_flags = WARDEN_FLAGS_NONE
if jail_vnet:
- jail_flags |= WARDEN_SET_FLAGS_VNET_ENABLE
+ if self.cleaned_data['jail_type'] != WARDEN_TYPE_LINUXJAIL and \
+ not self.cleaned_data['jail_32bit']:
+ jail_flags |= WARDEN_SET_FLAGS_VNET_ENABLE
+ else:
+ jail_flags |= WARDEN_SET_FLAGS_VNET_DISABLE
+
jail_set_args['flags'] = jail_flags
try:
w.set(**jail_set_args)
@@ -578,11 +584,14 @@ def save(self):
args['defaultrouter-ipv6'] = self.cleaned_data.get(cf)
elif cf == 'jail_vnet':
- if self.cleaned_data.get(cf):
- flags |= WARDEN_SET_FLAGS_VNET_ENABLE
+ if self.cleaned_data.get(cf) and \
+ self.cleaned_data['jail_type'] != WARDEN_TYPE_LINUXJAIL and \
+ not self.cleaned_data['jail_32bit']:
+ flags |= WARDEN_SET_FLAGS_VNET_ENABLE
+ args['vnet-enable'] = self.cleaned_data.get(cf)
else:
flags |= WARDEN_SET_FLAGS_VNET_DISABLE
- args['vnet-enable'] = self.cleaned_data.get(cf)
+ args['vnet-disable'] = self.cleaned_data.get(cf)
args['jail'] = jail_host
args['flags'] = flags
View
@@ -168,13 +168,56 @@ class ViewJailsConfiguration(TreeNode):
order = 2
+class ViewLinuxJails(ViewJailsBase):
+
+ gname = 'Linux Jails'
+ name = _(u'Linux Jails')
+ icon = u'LinuxJailIcon'
+ skip = False
+ order = 3
+
+ def __init__(self, *args, **kwargs):
+ super(ViewLinuxJails, self).__init__(*args, **kwargs)
+
+ jails = Jails.objects.filter(jail_type=WARDEN_TYPE_LINUXJAIL)
+ for jail in jails:
+ jail_node = self.new_jail_node(jail, u'TuxIcon')
+ self.append_child(jail_node)
+
+ jail_node_view = self.new_jail_node_view(jail)
+ jail_node_view.order = 1
+ jail_node.append_child(jail_node_view)
+
+ storage_node = self.new_storage_node(jail)
+ storage_node.order = 2
+ jail_node.append_child(storage_node)
+
+ storage_order = 1
+ nmps = NullMountPoint.objects.filter(jail=jail.jail_host)
+ for nmp in nmps:
+
+ storage_node_view = self.new_storage_node_view(nmp)
+ storage_node_view.order = storage_order
+ storage_node.append_child(storage_node_view)
+ storage_order += 1
+
+ storage_node_mkdir = self.new_storage_node_mkdir(jail)
+ storage_node_mkdir.order = storage_order
+ storage_node.append_child(storage_node_mkdir)
+ storage_order += 1
+
+ storage_node_add = self.new_storage_node_add(jail)
+ storage_node_add.order = storage_order
+ storage_node.append_child(storage_node_add)
+
+
class ViewPluginJails(ViewJailsBase):
gname = 'Plugin Jails'
name = _(u'Plugin Jails')
icon = u'PluginJailIcon'
skip = False
- order = 3
+ order = 4
def __init__(self, *args, **kwargs):
super(ViewPluginJails, self).__init__(*args, **kwargs)
@@ -296,7 +339,7 @@ class ViewPortJails(ViewJailsBase):
name = _(u'Port Jails')
icon = u'PortJailIcon'
skip = False
- order = 4
+ order = 5
def __init__(self, *args, **kwargs):
super(ViewPortJails, self).__init__(*args, **kwargs)
@@ -339,7 +382,7 @@ class ViewStandardJails(ViewJailsBase):
name = _(u'Standard Jails')
icon = u'StandardJailIcon'
skip = False
- order = 5
+ order = 6
def __init__(self, *args, **kwargs):
super(ViewStandardJails, self).__init__(*args, **kwargs)
@@ -374,46 +417,3 @@ def __init__(self, *args, **kwargs):
storage_node_add = self.new_storage_node_add(jail)
storage_node_add.order = storage_order
storage_node.append_child(storage_node_add)
-
-
-#class ViewLinuxJails(ViewJailsBase):
-#
-# gname = 'Linux Jails'
-# name = _(u'Linux Jails')
-# icon = u'LinuxJailIcon'
-# skip = False
-# order = 5
-#
-# def __init__(self, *args, **kwargs):
-# super(ViewLinuxJails, self).__init__(*args, **kwargs)
-#
-# jails = Jails.objects.filter(jail_type=WARDEN_TYPE_LINUXJAIL)
-# for jail in jails:
-# jail_node = self.new_jail_node(jail, u'TuxIcon')
-# self.append_child(jail_node)
-#
-# jail_node_view = self.new_jail_node_view(jail)
-# jail_node_view.order = 1
-# jail_node.append_child(jail_node_view)
-#
-# storage_node = self.new_storage_node(jail)
-# storage_node.order = 2
-# jail_node.append_child(storage_node)
-#
-# storage_order = 1
-# nmps = NullMountPoint.objects.filter(jail=jail.jail_host)
-# for nmp in nmps:
-#
-# storage_node_view = self.new_storage_node_view(nmp)
-# storage_node_view.order = storage_order
-# storage_node.append_child(storage_node_view)
-# storage_order += 1
-#
-# storage_node_mkdir = self.new_storage_node_mkdir(jail)
-# storage_node_mkdir.order = storage_order
-# storage_node.append_child(storage_node_mkdir)
-# storage_order += 1
-#
-# storage_node_add = self.new_storage_node_add(jail)
-# storage_node_add.order = storage_order
-# storage_node.append_child(storage_node_add)
@@ -171,23 +171,23 @@ downloadchroot() {
warden_print "Downloading ${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/${FBSD_TARBALL} ..."
if [ ! -e "$FBSD_TARBALL" ] ; then
- trap "return 1; rm -f ${FBSD_TARBALL}" 2 3 6 9 15
+ trap "return 1; rm -f ${FBSD_TARBALL}" INT QUIT ABRT KILL TERM EXIT
get_file "${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/${FBSD_TARBALL}" "$FBSD_TARBALL" 3
if [ $? -ne 0 ] ; then
rm -f "${FBSD_TARBALL}"
warden_exit "Error while downloading the chroot."
fi
- trap 2 3 6 9 15
+ trap INT QUIT ABRT KILL TERM EXIT
fi
if [ ! -e "$FBSD_TARBALL_CKSUM" ] ; then
- trap "return 1; rm -f ${FBSD_TARBALL_CKSUM}" 2 3 6 9 15
+ trap "return 1; rm -f ${FBSD_TARBALL_CKSUM}" INT QUIT ABRT KILL TERM EXIT
get_file "${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/${FBSD_TARBALL_CKSUM}" "$FBSD_TARBALL_CKSUM" 3
if [ $? -ne 0 ] ; then
rm -f "${FBSD_TARBALL_CKSUM}"
warden_exit "Error while downloading the chroot checksum."
fi
- trap 2 3 6 9 15
+ trap INT QUIT ABRT KILL TERM EXIT
fi
[ "$(md5 -q ${FBSD_TARBALL})" != "$(cat ${FBSD_TARBALL_CKSUM})" ] &&
@@ -196,7 +196,7 @@ downloadchroot() {
# Creating ZFS dataset?
isDirZFS "${JDIR}"
if [ $? -eq 0 ] ; then
- trap "rmchroot ${CHROOT}" 2 3 6 9 15
+ trap "rmchroot ${CHROOT}" INT QUIT ABRT KILL TERM EXIT
local zfsp=`getZFSRelativePath "${CHROOT}"`
@@ -222,7 +222,7 @@ downloadchroot() {
if [ $? -ne 0 ] ; then warden_exit "Failed creating clean ZFS base snapshot"; fi
rm ${FBSD_TARBALL}
- trap 2 3 6 9 15
+ trap INT QUIT ABRT KILL TERM EXIT
else
# Save the chroot tarball
@@ -820,21 +820,24 @@ tar xvf pkg.txz --exclude +MANIFEST --exclude +MTREE_DIRS 2>/dev/null
pkg add pkg.txz
rm pkg.txz
-trap "umount devfs; touch /FAIL; exit 3;" 2 3 6 9 15
+trap "umount devfs; touch /FAIL; exit 3;" INT QUIT ABRT KILL TERM EXIT
echo "packagesite: ${mirror}/packages/${release}/${arch}" >/usr/local/etc/pkg.conf
echo "HTTP_MIRROR: http" >>/usr/local/etc/pkg.conf
echo "PUBKEY: /usr/local/etc/pkg-pubkey.cert" >>/usr/local/etc/pkg.conf
echo "PKG_CACHEDIR: /usr/local/tmp" >>/usr/local/etc/pkg.conf
+__EOF__
+
+echo '
pkg install -y pcbsd-utils
if [ "$?" != "0" ]
then
touch /FAIL
ret=1
fi
exit ${ret}
-__EOF__
+' >> "${outfile}"
}
make_bootstrap_pkgng_file_pluginjail()
@@ -862,13 +865,16 @@ rm pkg.txz
mount -t devfs devfs /dev
-trap "umount devfs; touch /FAIL; exit 3;" 2 3 6 9 15
+trap "umount devfs; touch /FAIL; exit 3;" INT QUIT ABRT KILL TERM EXIT
echo "packagesite: ${mirror}/packages/${release}/${arch}" >/usr/local/etc/pkg.conf
echo "HTTP_MIRROR: http" >>/usr/local/etc/pkg.conf
echo "PUBKEY: /usr/local/etc/pkg-pubkey.cert" >>/usr/local/etc/pkg.conf
echo "PKG_CACHEDIR: /usr/local/tmp" >>/usr/local/etc/pkg.conf
+__EOF__
+
+echo '
pkg install -y pcbsd-utils
if [ "$?" != "0" ]
then
@@ -877,9 +883,6 @@ then
exit 1
fi
-__EOF__
-
-echo '
i=0
count=`wc -l /pluginjail-packages| awk "{ print $1 }"`
for p in `cat /pluginjail-packages`

0 comments on commit 677e6f3

Please sign in to comment.