Permalink
Browse files

OS-1027 add 'provisioning' state for VMs when they're created until t…

…hey're actually 'running'.
  • Loading branch information...
1 parent 942fddb commit 1663802a8320e5f3eb9a3a8d27cdb5ca7698b229 @joshwilsdon joshwilsdon committed Nov 30, 2012
@@ -29,23 +29,16 @@ set -o xtrace
. /lib/svc/share/smf_include.sh
smf_is_globalzone && exit ${SMF_EXIT_OK}
- user_script_exit=${SMF_EXIT_OK}
- if [ -x /var/svc/mdata-user-script ]; then
+# If we got as far as running the user-script the 'provision' was a success
+# from here out a failure will leave the zone running.
+if [ -f /var/svc/provisioning ]; then
+ mv /var/svc/provision{ing,_success}
+fi
+
+user_script_exit=${SMF_EXIT_OK}
+if [ -x /var/svc/mdata-user-script ]; then
/var/svc/mdata-user-script
[ $? -gt 0 ] && user_script_exit=${SMF_EXIT_ERR_FATAL}
- fi
-
- # Finish the provisioning process (if the case)
-
- if [ -f /var/svc/provisioning ]; then
- if [ ${user_script_exit} -eq 0 ]; then
- # If 'provision_ongoing' exists, we assume the user wants to control
- # the final 'success' flag himself and will rename the 'provisioning'
- # file as appropriate. Otherwise, announce success ourselves.
- [ -f /var/svc/provision_ongoing ] || mv /var/svc/provision{ing,_success}
- else
- mv /var/svc/provision{ing,_failure}
- fi
- fi
+fi
exit ${user_script_exit}
@@ -76,31 +76,37 @@ PDS_NAME=`mount | nawk -v p=$dname '{if ($1 == p) print $3}'`
# it's possible to specify a zone root here if you specified the
# '-x nodataset' when installing the zone.
if [[ -n ${TMPLZONE} ]]; then
- QUOTA_ARG=
- if [[ ${ZQUOTA} != "0" ]]; then
- QUOTA_ARG="-o quota=${ZQUOTA}g"
- fi
+ QUOTA_ARG=
+ if [[ ${ZQUOTA} != "0" ]]; then
+ QUOTA_ARG="-o quota=${ZQUOTA}g"
+ fi
- zfs snapshot $PDS_NAME/${TMPLZONE}@${bname}
- zfs clone ${QUOTA_ARG} $PDS_NAME/${TMPLZONE}@${bname} $PDS_NAME/$bname
+ zfs snapshot $PDS_NAME/${TMPLZONE}@${bname}
+ zfs clone ${QUOTA_ARG} $PDS_NAME/${TMPLZONE}@${bname} $PDS_NAME/$bname
elif [[ ${ZQUOTA} != "0" ]]; then
- # don't have a template dataset, so we set the quota on the fresh zoneroot
- zfs set quota=${ZQUOTA}g ${PDS_NAME}/${bname}
+ # don't have a template dataset, so we set the quota on the fresh zoneroot
+ zfs set quota=${ZQUOTA}g ${PDS_NAME}/${bname}
fi
if [ ! -d ${ZONEPATH}/config ]; then
- mkdir -p ${ZONEPATH}/config
- chmod 755 ${ZONEPATH}/config
+ mkdir -p ${ZONEPATH}/config
+ chmod 755 ${ZONEPATH}/config
fi
if [ ! -d ${ZROOT} ]; then
- mkdir -p ${ZROOT}
- chmod 755 ${ZROOT}
+ mkdir -p ${ZROOT}
+ chmod 755 ${ZROOT}
fi
if [ ! -d ${ZROOT}/tmp ]; then
- mkdir -p ${ZROOT}/tmp
- chmod 1777 ${ZROOT}/tmp
+ mkdir -p ${ZROOT}/tmp
+ chmod 1777 ${ZROOT}/tmp
+fi
+
+# make /var/svc for the 'provisioning file'
+if [ ! -d ${ZROOT}/var/svc ]; then
+ mkdir -p ${ZROOT}/var/svc
+ chmod 0755 ${ZROOT}/var/svc
fi
# The dataset quota must be a number.
View
@@ -173,14 +173,24 @@ exports.on_new_vm = function(t, uuid, payload, state, fnlist, callback)
});
async.series(functions, function (err) {
+ var openThingies;
+
if (err) {
t.ok(false, err.message);
}
if (callback) {
// up to caller to call t.end!
return callback();
} else {
- t.end();
+ t.end();
+
+ /*
+
+ // Helpful bit from Isaac that tells what's still open.
+ openThingies = process._getActiveHandles();
+ console.dir(openThingies);
+
+ */
}
});
};
View
@@ -913,6 +913,22 @@ tab-complete UUIDs rather than having to type them out for every command.
update: yes (live update)
default: value of max_physical_memory
+ mdata_exec_timeout:
+
+ For OS VMs this parameter adjusts the timeout on the start method of
+ the svc:/smartdc/mdata:execute service running in the zone. This is the
+ service which runs user-script scripts.
+
+ This parameter only makes sense when creating a VM and is ignored
+ in other cases.
+
+ type: integer (0 for unlimited, >0 number of seconds)
+ vmtype: OS
+ listable: no
+ create: yes
+ update: no
+ default: 300
+
nics:
When creating a KVM VM or getting a KVM VM's JSON, you will use this
@@ -1373,9 +1389,11 @@ tab-complete UUIDs rather than having to type them out for every command.
When a KVM VM is in transition from running to either 'off' (in the
case of stop) or 'start' (in the case of reboot), the transition_to
field will be set to indicate which state the VM is transitioning to.
+ Additionally when a VM is provisioning you may see this with a value
+ of 'running'.
- type: string value, one of: ['stopped', 'start']
- vmtype: KVM
+ type: string value, one of: ['stopped', 'start', 'running']
+ vmtype: OS,KVM
listable: no
create: no
update: no
Oops, something went wrong.

0 comments on commit 1663802

Please sign in to comment.