svc-docker revision 6466
#
#
DOCKER_EXEC="/usr/bin/docker"
DOCKER_SVC = 'svc:/application/docker/docker'
DOCKER_ROOT="/var/run/docker"
return output
try:
print "Unable to retrieve property '%s': %s" % (pname, e)
sys.exit(1)
try:
print "Unable to set property '%s', value '%s': %s" % \
sys.exit(1)
try:
return SvcDockerCmd(
print "Unable to get root pool: %s" % e
sys.exit(1)
try:
return fsname.startswith(root_ds)
print "Unable to get active root dataset: %s" % e
sys.exit(1)
try:
return True
return False
print "Unable to list dataset: %s" % e
sys.exit(1)
return None
try:
return SvcDockerCmd(
print "Unable to get mounted Docker dataset: %s" % e
sys.exit(1)
try:
return SvcDockerCmd(
print "Unable to get mountpoint for dataset: %s" % e
sys.exit(1)
try:
print "Unable to mount Docker root: %s" % e
sys.exit(1)
try:
print "Unable to unmount Docker root: %s" % e
sys.exit(1)
# (off by default in VARSHARE).
try:
print "Failed to set '%s' prop on dataset '%s': %s" % \
sys.exit(1)
try:
os.mkdir(DOCKER_ROOT, 0770)
print "Unable to create dir '%s': %s" % (DOCKER_ROOT, e)
sys.exit(1)
# Default to 'docker' in varshare
if _fsname_exists(fsname):
print "Configured dataset '%s' mountpoint must be '%s'" % \
else:
# Dataset doesn't exist, try and create it. This may fail if
try:
'-o', 'setuid=on', '-o', 'exec=on', '-o', 'xattr=on',
print "Failed to create dataset '%s' on %s: %s" % \
(DOCKER_MOUNTPOINT, fsname, e)
sys.exit(1)
# Setup environment variables for the daemon
if v:
os.putenv(p, v)
# Set up the service command line to execut the daemon
dcmd += ' -D'
def stop():
# First, kill off the SMF contract
try:
# 1 is returncode if no SMF contract processes were matched,
# meaning they have already terminated.
if e.returncode != 1:
print "failed to kill the SMF contract: %s" % e
if __name__ == '__main__':
try:
print 'Unknown error: %s' % err
print