Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge git.joyent.com:illumos-live

  • Loading branch information...
commit 50fb1d245e135b3f20fb7007d68812007878b060 2 parents 30ced6c + 2bbea55
@JohnSonnenschein JohnSonnenschein authored
View
3  configure
@@ -86,8 +86,7 @@ echo "==> Checking for /opt/gcc/4.4.4/bin/gcc"
if [ ! -f "/opt/gcc/4.4.4/bin/gcc" ]; then
if [ ! -z "${GCC44_URL}" ]; then
cd /opt
- curl -k https://download.joyent.com/pub/build/gcc-4.tar.bz2 | bzcat \
- | ${ROOTCMD} tar -xf -
+ curl -k ${GCC44_URL} | bzcat | ${ROOTCMD} tar -xf -
cd - >/dev/null
else
echo "FATAL: unable to download gcc 4.4.4, no URL is set. Please set GCC44_URL in configure."
View
4 overlay/generic/etc/cron.d/crontabs/root
@@ -1,6 +1,6 @@
-## Rotate and trim the audit logs nightly at midnight.
+## Rotate and trim the audit logs nightly.
0 0 * * * /smartdc/bin/sdc-lastcomm -R 30
-## Rotate and trim the regular logs nightly at 10 after midnight.
+## Rotate and trim the regular logs nightly.
10 0 * * * /usr/sbin/logadm
# NOTE: all entries above are in root's system-defined crontab; see the
View
5 overlay/generic/etc/logadm.conf
@@ -19,6 +19,7 @@
# CDDL HEADER END
#
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# logadm.conf
#
@@ -35,8 +36,8 @@
# logadm typically runs early every morning via an entry in
# root's crontab (see crontab(1)).
#
-/var/log/syslog -C 8 -a 'kill -HUP `cat /var/run/syslog.pid`'
-/var/adm/messages -C 4 -a 'kill -HUP `cat /var/run/syslog.pid`'
+/var/log/syslog -C 8 -a 'kill -HUP `cat /var/run/*syslog*.pid`'
+/var/adm/messages -C 4 -a 'kill -HUP `cat /var/run/*syslog*.pid`'
/var/cron/log -c -s 512k -t /var/cron/olog
/var/lp/logs/lpsched -C 2 -N -t '$file.$N'
/var/fm/fmd/errlog -N -s 2m -M '/usr/sbin/fmadm -q rotate errlog && mv /var/fm/fmd/errlog.0- $nfile'
View
80 overlay/generic/lib/svc/method/svc-cron
@@ -0,0 +1,80 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+# Copyright 2012 Joyent, Inc. All rights reserved.
+#
+# Start method script for the cron service.
+#
+
+. /lib/svc/share/smf_include.sh
+
+if [ -p /etc/cron.d/FIFO ]; then
+ if /usr/bin/pgrep -x -u 0 -z `smf_zonename` cron >/dev/null 2>&1; then
+ echo "$0: cron is already running"
+ exit $SMF_EXIT_ERR_NOSMF
+ fi
+fi
+
+if smf_is_globalzone && [ -n "$(bootparams | grep '^headnode=true')" ]; then
+ #
+ # Randomize root's crontab so all HN's are not in sync.
+ #
+ utc_offset=`nawk -F= '{if ($1 == "utc_offset") print $2}' \
+ /usbkey/config.inc/generic`
+ [ -z "$utc_offset" ] && utc_offset=0
+
+ n=$(date +%S)
+ hr=$(($n % 5))
+ hr=$(($hr + $utc_offset))
+
+ n=$(date +%M)
+ mn=$(($n % 15))
+
+ nawk -v hr=$hr -v mn=$mn '{
+ if (substr($1, 1, 1) == "#") {
+ print $0
+ next
+ }
+ if (length($0) == 0) {
+ print $0
+ next
+ }
+
+ printf("%d %d %s %s %s %s", mn, hr, $3, $4, $5, $6)
+ for (i = 7; i <= NF; i++)
+ printf(" %s", $i)
+ printf("\n")
+ mn += 10
+ }' /etc/cron.d/crontabs/root >/etc/cron.d/crontabs/root.$$
+ cp /etc/cron.d/crontabs/root.$$ /etc/cron.d/crontabs/root
+ rm -f /etc/cron.d/crontabs/root.$$
+fi
+
+if [ -x /usr/sbin/cron ]; then
+ /usr/bin/rm -f /etc/cron.d/FIFO
+ /usr/sbin/cron &
+else
+ exit 1
+fi
+exit $SMF_EXIT_OK
View
11 overlay/generic/usr/lib/brand/joyent/manifests
@@ -56,7 +56,6 @@
# network/nfs/cbd.xml
# network/nfs/mapid.xml
# network/nfs/status.xml
-# network/smb/client.xml
# network/ipmievd.xml
# network/nis/client.xml
# network/rpc/rex.xml
@@ -66,7 +65,6 @@
# system/fm/notify-params.xml
# system/install/system-config.xml
# system/pkgserv.xml
-# system/sac.xml
#
#
@@ -80,6 +78,8 @@
# system/boot-archive-update.xml
# system/boot-archive.xml
# system/boot-config.xml
+# system/fmd.xml
+# system/sac.xml
#
#
@@ -102,12 +102,13 @@ network/dns/install.xml disabled
network/dns/multicast.xml disabled
network/forwarding.xml disabled
network/inetd-upgrade.xml enabled
-network/inetd.xml enabled
+network/inetd.xml disabled
network/ipfilter.xml disabled
network/ipsec/ike.xml disabled
network/ipsec/ipsecalgs.xml enabled
network/ipsec/manual-key.xml disabled
network/ipsec/policy.xml enabled
+network/loadbalancer/ilbd.xml disabled
network/login.xml enabled
network/network-initial.xml enabled
network/network-install.xml disabled
@@ -128,6 +129,7 @@ network/routing/rdisc.xml disabled
network/routing/ripng.xml disabled
network/routing/route.xml disabled
network/rpc/bind.xml enabled
+network/smb/client.xml disabled
network/shares/group.xml enabled
network/shares/reparsed.xml disabled
network/shell.xml disabled
@@ -135,7 +137,7 @@ network/slp.xml disabled
network/ssh.xml enabled
system/auditd.xml disabled
system/consadm.xml disabled
-system/console-login.xml enabled
+system/console-login.xml disabled
system/coreadm.xml enabled
system/cron.xml enabled
system/cryptosvc.xml enabled
@@ -150,7 +152,6 @@ system/filesystem/local-fs.xml enabled
system/filesystem/minimal-fs.xml enabled
system/filesystem/root-fs.xml enabled
system/filesystem/usr-fs.xml enabled
-system/fmd.xml enabled
system/hostid.xml enabled
system/hotplug.xml disabled
system/identity.xml enabled
View
1  src/Makefile
@@ -45,6 +45,7 @@ install: $(TARGETS) sysinfo
cp vm/smf/system-metadata.xml $(DESTDIR)/lib/svc/manifest/system/system-metadata.xml
mv $(DESTDIR)/usr/vm/sbin/vmadmd.js $(DESTDIR)/usr/vm/sbin/vmadmd
mv $(DESTDIR)/usr/vm/sbin/vmadm.js $(DESTDIR)/usr/vm/sbin/vmadm
+ mv $(DESTDIR)/usr/vm/sbin/build-user-script.js $(DESTDIR)/usr/vm/sbin/build-user-script
mv $(DESTDIR)/usr/vm/sbin/metadata.js $(DESTDIR)/usr/vm/sbin/metadata
cp -PR ds $(DESTDIR)/usr/
mkdir -m 0755 -p $(DESTDIR)/var/db/dsadm
View
1  src/manifest
@@ -29,6 +29,7 @@ d usr/vm/node_modules 0555 root bin
d usr/vm/sbin 0555 root bin
d usr/vm/smf 0555 root bin
d usr/vm/test 0555 root bin
+f usr/vm/sbin/build-user-script 0555 root bin
f usr/vm/sbin/vmadm 0555 root bin
f usr/vm/sbin/vmadmd 0555 root bin
f usr/vm/sbin/zoneevent 0555 root bin
View
113 src/vm/node_modules/VM.js
@@ -3804,13 +3804,10 @@ function deleteVolume(volume, callback)
});
}
-exports.delete = function (uuid, callback)
+function deleteZone(uuid, callback)
{
var zoneobj;
- VM.resetLog('delete');
- VM.log('INFO', 'Deleting VM ' + uuid);
-
async.series([
function (cb) {
VM.load(uuid, function (err, obj) {
@@ -3822,35 +3819,43 @@ exports.delete = function (uuid, callback)
});
}, function (cb) {
VM.log('DEBUG', 'setting autoboot=false');
- zonecfg(['-u', uuid, 'set autoboot=false'], function () {
- // TODO: log error?
+ zonecfg(['-u', uuid, 'set autoboot=false'], function (e) {
+ if (e) {
+ VM.log('WARN', 'Error setting autoboot=false:\n'
+ + e.message, e);
+ }
cb();
});
}, function (cb) {
VM.log('DEBUG', 'halting zone');
- zoneadm(['-u', uuid, 'halt', '-X'], function () {
- // TODO: log error?
+ zoneadm(['-u', uuid, 'halt', '-X'], function (e) {
+ if (e) {
+ VM.log('WARN', 'Error halting zone:\n' + e.message, e);
+ }
cb();
});
}, function (cb) {
VM.log('DEBUG', 'uninstalling zone');
- zoneadm(['-u', uuid, 'uninstall', '-F'], function () {
- // TODO: log error?
+ zoneadm(['-u', uuid, 'uninstall', '-F'], function (e) {
+ if (e) {
+ VM.log('WARN', 'Error uninstalling zone:\n' + e.message, e);
+ }
cb();
});
}, function (cb) {
if (zoneobj && zoneobj.brand === 'kvm') {
async.forEachSeries(zoneobj.disks, deleteVolume,
function (err) {
-
- if (err) {
- VM.log('ERROR', 'unknown error deleting volumes', err);
- cb(err);
- } else {
- VM.log('INFO', 'successfully deleted volumes');
- cb();
+ if (err) {
+ VM.log('ERROR', 'Unknown error deleting volumes: '
+ + err.message, err);
+ cb(err);
+ } else {
+ VM.log('INFO', 'successfully deleted volumes');
+ cb();
+ }
}
- });
+ );
} else {
VM.log('DEBUG', 'skipping volume destruction for '
+ 'non-VM ' + zoneobj.uuid);
@@ -3860,16 +3865,86 @@ exports.delete = function (uuid, callback)
if (zoneobj.zonename) {
VM.log('DEBUG', 'deleting zone');
// XXX for some reason -u <uuid> doesn't work with delete
- zonecfg(['-z', zoneobj.zonename, 'delete', '-F'], function () {
+ zonecfg(['-z', zoneobj.zonename, 'delete', '-F'], function (e) {
+ if (e) {
+ VM.log('WARN', 'Error deleting VM:\n' + e.message, e);
+ }
cb();
});
} else {
cb();
}
+ }, function (cb) {
+ VM.load(uuid, function (err, obj) {
+ if (err && err.message.match(/^zoneadm:.*: No such zone configured/)) {
+ // the zone is gone, that's good.
+ VM.log('DEBUG', 'confirmed VM is gone.');
+ cb();
+ } else if (err) {
+ // there was a non-good error.
+ cb(err);
+ } else {
+ // the VM still exists!
+ err = new Error('VM still exists after delete.');
+ err.code = 'EEXIST';
+ cb(err);
+ }
+ });
}
], function (error) {
callback(error);
});
+}
+
+exports.delete = function (uuid, callback)
+{
+ var attemptDelete;
+ var last_try = 16;
+ var next_try = 1;
+ var tries = 0;
+ var zoneobj;
+
+ VM.resetLog('delete');
+ VM.log('INFO', 'Deleting VM ' + uuid);
+
+ attemptDelete = function(cb) {
+ next_try = (next_try * 2);
+ deleteZone(uuid, function (err) {
+ tries++;
+ if (err && err.code === 'EEXIST') {
+ // zone still existed, try again if we've not tried too much.
+ if (next_try <= last_try) {
+ VM.log('INFO', 'VM.delete(' + tries + '): still there, '
+ + 'will try again in: ' + next_try + ' secs');
+ setTimeout(function () {
+ // try again
+ attemptDelete(cb);
+ }, next_try * 1000);
+ } else {
+ VM.log('WARN', 'VM.delete(' + tries + '): still there after '
+ + next_try + ' seconds, giving up.');
+ cb(new Error('delete failed after ' + tries + ' attempts. '
+ + '(check the log for details)'));
+ return;
+ }
+ } else if (err) {
+ // error but not one we can retry from.
+ VM.log('ERROR', 'VM.delete: FATAL: ' + err.message, err);
+ cb(err);
+ } else {
+ // success!
+ VM.log('DEBUG', 'VM.delete: SUCCESS');
+ cb();
+ }
+ });
+ };
+
+ attemptDelete(function (err) {
+ if (err) {
+ VM.log('ERROR', err.message);
+ }
+ callback(err);
+ });
};
function startZone(zoneobj, callback)
View
35 src/vm/sbin/build-user-script.js
@@ -0,0 +1,35 @@
+#!/usr/bin/node
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ *
+ * This tool takes a filename as the only parameter and generates an update
+ * payload for use with vmadm that turns the specified file into the
+ * user-script for the VM.
+ *
+ * For example:
+ *
+ * build-user-script /path/to/script.sh | vmadm update <UUID>
+ *
+ */
+
+var fs=require('fs');
+
+function usage ()
+{
+ console.log('Usage: ' + process.argv[1] + ' <filename>');
+ process.exit(1);
+}
+
+if (!process.argv[2]) {
+ usage();
+} else {
+ fs.readFile(process.argv[2], function (error, data) {
+ var payload = {};
+ if (error) {
+ console.error(error.message);
+ process.exit(1);
+ }
+ payload.set_customer_metadata = {'user-script': data.toString()};
+ console.log(JSON.stringify(payload, null, 2));
+ });
+}
View
1  src/vm/sbin/vmadm.js
@@ -690,6 +690,7 @@ function main(callback)
uuid = getUUID(command, parsed);
VM.delete(uuid, function (err) {
if (err) {
+ err.message = 'Failed to delete ' + uuid + ': ' + err.message;
callback(err);
} else {
callback(null, 'Successfully deleted ' + uuid);
View
2  src_addon/ipmi/Makefile
@@ -24,7 +24,7 @@
VER=ipmitool-1.8.11
BASE=$(PWD)
DESTDIR=$(BASE)/../../proto
-CC=$(DESTDIR)/usr/sfw/bin/gcc
+CC=$(DESTDIR)/usr/bin/gcc
CFLAGS=-I$(DESTDIR)/usr/include -g $(LARGEFILES)
LD=/usr/ccs/bin/ld
MAKE=gmake
View
21 tools/update_base
@@ -21,7 +21,7 @@
#
# CDDL HEADER END
#
-# Copyright 2011, Joyent, Inc.
+# Copyright (c) 2012, Joyent, Inc.
#
#
@@ -58,11 +58,20 @@ function git_update
return
}
-echo "Updating illumos-extra... \c "
-cd $upd_root/projects/illumos-extra
-[[ $? -eq 0 ]] || fail "can't find illumos-extra directory"
-git_update || rm -f $upd_extra_stamp
-echo "done"
+function update_extra
+{
+ echo "Updating illumos-extra... \c "
+ cd $upd_root/projects/illumos-extra
+ [[ $? -eq 0 ]] || fail "can't find illumos-extra directory"
+ git_update || rm -f $upd_extra_stamp
+ echo "done"
+}
+
+if [[ -d $upd_root/projects/illumos-extra ]]; then
+ update_extra
+else
+ echo "illumos-extra tarball in use. Update illumos-extra manually."
+fi
echo "Updating illumos-joyent... \c "
cd $upd_root/projects/illumos
Please sign in to comment.
Something went wrong with that request. Please try again.