aboutsummaryrefslogtreecommitdiffstats
path: root/laas/actions/workflows
diff options
context:
space:
mode:
Diffstat (limited to 'laas/actions/workflows')
-rw-r--r--laas/actions/workflows/access_master_workflow.yaml61
-rw-r--r--laas/actions/workflows/access_workflow.yaml116
-rw-r--r--laas/actions/workflows/apex_gambia_workflow.yaml45
-rw-r--r--laas/actions/workflows/apex_master_workflow.yaml41
-rw-r--r--laas/actions/workflows/bootBookedHostsWorkflow.yaml46
-rw-r--r--laas/actions/workflows/check_power_workflow.yaml51
-rw-r--r--laas/actions/workflows/compass_gambia_workflow.yaml44
-rw-r--r--laas/actions/workflows/compass_master_workflow.yaml43
-rw-r--r--laas/actions/workflows/fog_snapshotWorkflow.yaml36
-rw-r--r--laas/actions/workflows/fuel_gambia_workflow.yaml77
-rw-r--r--laas/actions/workflows/fuel_master_workflow.yaml44
-rw-r--r--laas/actions/workflows/hardware_master_workflow.yaml42
-rw-r--r--laas/actions/workflows/hardware_workflow.yaml170
-rw-r--r--laas/actions/workflows/jenkins_workflow.yaml40
-rw-r--r--laas/actions/workflows/master_workflow.yaml74
-rw-r--r--laas/actions/workflows/network_master_workflow.yaml74
-rw-r--r--laas/actions/workflows/network_workflow.yaml157
-rw-r--r--laas/actions/workflows/notify_ipmi_workflow.yaml61
-rw-r--r--laas/actions/workflows/opnfv_master_workflow.yaml72
-rw-r--r--laas/actions/workflows/provision_workflow.yaml37
-rw-r--r--laas/actions/workflows/restart_workflow.yaml59
-rw-r--r--laas/actions/workflows/set_boot_workflow.yaml60
-rw-r--r--laas/actions/workflows/set_hpe_bios_pass_workflow.yaml68
-rw-r--r--laas/actions/workflows/set_ipmi_account_workflow.yaml61
-rw-r--r--laas/actions/workflows/snapshot_master_workflow.yaml64
-rw-r--r--laas/actio
/*
 *  linux/fs/nfs/file.c
 *
 *  Copyright (C) 1992  Rick Sladkey
 */
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/falloc.h>
#include <linux/nfs_fs.h>
#include <uapi/linux/btrfs.h>	/* BTRFS_IOC_CLONE/BTRFS_IOC_CLONE_RANGE */
#include "delegation.h"
#include "internal.h"
#include "iostat.h"
#include "fscache.h"
#include "pnfs.h"

#include "nfstrace.h"

#ifdef CONFIG_NFS_V4_2
#include "nfs42.h"
#endif

#define NFSDBG_FACILITY		NFSDBG_FILE

static int
nfs4_file_open(struct inode *inode, struct file *filp)
{
	struct nfs_open_context *ctx;
	struct dentry *dentry = file_dentry(filp);
	struct dentry *parent = NULL;
	struct inode *dir;
	unsigned openflags = filp->f_flags;
	struct iattr attr;
	int err;

	/*
	 * If no cached dentry exists or if it's negative, NFSv4 handled the
	 * opens in ->lookup() or ->create().
	 *
	 * We only get this far for a cached positive dentry.  We skipped
	 * revalidation, so handle it here by dropping the dentry and returning
	 * -EOPENSTALE.  The VFS will retry the lookup/create/open.
	 */

	dprintk("NFS: open file(%pd2)\n", dentry);

	err = nfs_check_flags(openflags);
	if (err)
		return err;

	if ((openflags & O_ACCMODE) == 3)
		openflags--;

	/* We can't create new files here */
	openflags &= ~(O_CREAT|O_EXCL);

	parent = dget_parent(dentry);
	dir = d_inode(parent);

	ctx = alloc_nfs_open_context(file_dentry(filp), filp->f_mode);
	err = PTR_ERR(ctx);
	if (IS_ERR(ctx))
		goto out;

	attr.ia_valid = ATTR_OPEN;
	if (openflags & O_TRUNC) {
		attr.ia_valid |= ATTR_SIZE;
		attr.ia_size = 0;
		nfs_sync_inode(inode);
	}

	inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, NULL);
	if (IS_ERR(inode)) {
		err = PTR_ERR(inode);
		switch (err) {
		case -EPERM:
		case -EACCES:
		case -EDQUOT:
		case -ENOSPC:
		case -EROFS:
			goto out_put_ctx;
		default:
			goto out_drop;
		}
	}
	if (inode != d_inode(dentry))
		goto out_drop;

	nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
	nfs_file_set_open_context(filp, ctx);
	nfs_fscache_open_file(inode, filp);
	err = 0;

out_put_ctx:
	put_nfs_open_context(ctx);
out:
	dput(parent);
	return err;

out_drop:
	d_drop(dentry);
	err = -EOPENSTALE;
	goto out_put_ctx;
}

/*
 * Flush all dirty pages, and check for write errors.
 */
static int
nfs4_file_flush(struct file *file, fl_owner_t id)
{
	struct inode	*inode = file_inode(file);

	dprintk("NFS: flush(%pD2)\n", file);

	nfs_inc_stats(inode, NFSIOS_VFSFLUSH);
	if ((file->f_mode & FMODE_WRITE) == 0)
		return 0;

	/*
	 * If we're holding a write delegation, then check if we're required
	 * to flush the i/o on close. If not, then just start the i/o now.
	 */
	if (!nfs4_delegation_flush_on_close(inode))
		return filemap_fdatawrite(file->f_mapping);

	/* Flush writes to the server and return any errors */
	return vfs_fsync(file, 0);
}

static int
nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
{
	int ret;
	struct inode *inode = file_inode(file);

	trace_nfs_fsync_enter(inode);

	nfs_inode_dio_wait(inode);
	do {
		ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
		if (ret != 0)
			break;
		mutex_lock(&inode->i_mutex);
		ret = nfs_file_fsync_commit(file, start, end, datasync);
		if (!ret)
			ret = pnfs_sync_inode(inode, !!datasync);
		mutex_unlock(&inode->i_mutex);
		/*
		 * If nfs_file_fsync_commit detected a server reboot, then
		 * resend all dirty pages that might have been covered by
		 * the NFS_CONTEXT_RESEND_WRITES flag
		 */
		start = 0;
		end = LLONG_MAX;
	} while (ret == -EAGAIN);

	trace_nfs_fsync_exit(inode, ret);
	return ret;
}

#ifdef CONFIG_NFS_V4_2
static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence)
{
	loff_t ret;

	switch (whence) {
	case SEEK_HOLE:
	case SEEK_DATA:
		ret = nfs42_proc_llseek(filep, offset, whence);
		if (ret != -ENOTSUPP)
			return ret;
	default:
		return nfs_file_llseek(filep, offset, whence);
	}
}

static long nfs42_fallocate(struct file *filep, int mode, loff_t offset, loff_t len)
{
	struct inode *inode = file_inode(filep);
	long ret;

	if (!S_ISREG(inode->i_mode))
		return -EOPNOTSUPP;

	if ((mode != 0) && (mode != (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)))
		return -EOPNOTSUPP;

	ret = inode_newsize_ok(inode, offset + len);
	if (ret < 0)
		return ret;

	if (mode & FALLOC_FL_PUNCH_HOLE)
		return nfs42_proc_deallocate(filep, offset, len);
	return nfs42_proc_allocate(filep, offset, len);
}

static noinline long
nfs42_ioctl_clone(struct file *dst_file, unsigned long srcfd,
		  u64 src_off, u64 dst_off, u64 count)
{
	struct inode *dst_inode = file_inode(dst_file);
	struct nfs_server *server = NFS_SERVER(dst_inode);
	struct fd src_file;
	struct inode *src_inode;
	unsigned int bs = server->clone_blksize;
	bool same_inode = false;
	int ret;

	/* dst file must be opened for writing */
	if (!(dst_file->f_mode & FMODE_WRITE))
		return -EINVAL;

	ret = mnt_want_write_file(dst_file);
	if (ret)
		return ret;

	src_file = fdget(srcfd);
	if (!src_file.file) {
		ret = -EBADF;
		goto out_drop_write;
	}

	src_inode = file_inode(src_file.file);

	if (src_inode == dst_inode)
		same_inode = true;

	/* src file must be opened for reading */
	if (!(src_file.file->f_mode & FMODE_READ))
		goto out_fput;

	/* src and dst must be regular files */
	ret = -EISDIR;
	if (!S_ISREG(src_inode->i_mode) || !S_ISREG(dst_inode->i_mode))
		goto out_fput;

	ret = -EXDEV;
	if (src_file.file->f_path.mnt != dst_file->f_path.mnt ||
	    src_inode->i_sb != dst_inode->i_sb)
		goto out_fput;

	/* check alignment w.r.t. clone_blksize */
	ret = -EINVAL;
	if (bs) {
		if (!IS_ALIGNED(src_off, bs) || !IS_ALIGNED(dst_off, bs))
			goto out_fput;
		if (!IS_ALIGNED(count, bs) && i_size_read(src_inode) != (src_off + count))
			goto out_fput;
	}

	/* verify if ranges are overlapped within the same file */
	if (same_inode) {
		if (dst_off + count > src_off && dst_off < src_off + count)
			goto out_fput;
	}

	/* XXX: do we lock at all? what if server needs CB_RECALL_LAYOUT? */
	if (same_inode) {
		mutex_lock(&src_inode->i_mutex);
	} else if (dst_inode < src_inode) {
		mutex_lock_nested(&dst_inode->i_mutex, I_MUTEX_PARENT);
		mutex_lock_nested(&src_inode->i_mutex, I_MUTEX_CHILD);
	} else {
		mutex_lock_nested(&src_inode->i_mutex, I_MUTEX_PARENT);
		mutex_lock_nested(&dst_inode->i_mutex, I_MUTEX_CHILD);
	}

	/* flush all pending writes on both src and dst so that server
	 * has the latest data */
	ret = nfs_sync_inode(src_inode);
	if (ret)
		goto out_unlock;
	ret = nfs_sync_inode(dst_inode);
	if (ret)
		goto out_unlock;

	ret = nfs42_proc_clone(src_file.file, dst_file, src_off, dst_off, count);

	/* truncate inode page cache of the dst range so that future reads can fetch
	 * new data from server */
	if (!ret)
		truncate_inode_pages_range(&dst_inode->i_data, dst_off, dst_off + count - 1);

out_unlock:
	if (same_inode) {
		mutex_unlock(&src_inode->i_mutex);
	} else if (dst_inode < src_inode) {
		mutex_unlock(&src_inode->i_mutex);
		mutex_unlock(&dst_inode->i_mutex);
	} else {
		mutex_unlock(&dst_inode->i_mutex);
		mutex_unlock(&src_inode->i_mutex);
	}
out_fput:
	fdput(src_file);
out_drop_write:
	mnt_drop_write_file(dst_file);
	return ret;
}

static long nfs42_ioctl_clone_range(struct file *dst_file, void __user *argp)
{
	struct btrfs_ioctl_clone_range_args args;

	if (copy_from_user(&args, argp, sizeof(args)))
		return -EFAULT;

	return nfs42_ioctl_clone(dst_file, args.src_fd, args.src_offset,
				 args.dest_offset, args.src_length);
}

long nfs4_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	void __user *argp = (void __user *)arg;

	switch (cmd) {
	case BTRFS_IOC_CLONE:
		return nfs42_ioctl_clone(file, arg, 0, 0, 0);
	case BTRFS_IOC_CLONE_RANGE:
		return nfs42_ioctl_clone_range(file, argp);
	}

	return -ENOTTY;
}
#endif /* CONFIG_NFS_V4_2 */

const struct file_operations nfs4_file_operations = {
	.read_iter	= nfs_file_read,
	.write_iter	= nfs_file_write,
	.mmap		= nfs_file_mmap,
	.open		= nfs4_file_open,
	.flush		= nfs4_file_flush,
	.release	= nfs_file_release,
	.fsync		= nfs4_file_fsync,
	.lock		= nfs_lock,
	.flock		= nfs_flock,
	.splice_read	= nfs_file_splice_read,
	.splice_write	= iter_file_splice_write,
	.check_flags	= nfs_check_flags,
	.setlease	= simple_nosetlease,
#ifdef CONFIG_NFS_V4_2
	.llseek		= nfs4_file_llseek,
	.fallocate	= nfs42_fallocate,
	.unlocked_ioctl = nfs4_ioctl,
	.compat_ioctl	= nfs4_ioctl,
#else
	.llseek		= nfs_file_llseek,
#endif
};
workflow:
+ description: fulfills all hardware tasks from the dashboard
+ type: direct
+ input:
+ - job_id
+
+ tasks:
+
+ get_tasks:
+ action: laas.get_task_list
+ input:
+ job_id: <% $.job_id %>
+ type: "hardware"
+ publish:
+ tasklist: <% task(get_tasks).result.result %>
+ on-success:
+ - hardware_task
+
+ hardware_task:
+ with-items: task_id in <% $.tasklist %>
+ action: laas.hardware_workflow
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
diff --git a/laas/actions/workflows/hardware_workflow.yaml b/laas/actions/workflows/hardware_workflow.yaml
new file mode 100644
index 0000000..93feb3b
--- /dev/null
+++ b/laas/actions/workflows/hardware_workflow.yaml
@@ -0,0 +1,170 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.hardware_workflow:
+ description: fulfills a single hardware task from the dashboard
+ input:
+ - task_id
+ - job_id
+
+ tasks:
+
+ start_task:
+ action: laas.start_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+ publish:
+ retry_count: <% int(0) %>
+ retry_max: <% int(1) %>
+ on-success: get_task
+
+ get_task:
+ action: laas.get_task
+ input:
+ task_id: <% $.task_id %>
+ type: "hardware"
+ job_id: <% $.job_id %>
+ publish:
+ task_data: <% task(get_task).result.result %>
+ on-success:
+ - detect_tasks
+
+ detect_tasks:
+ action: laas.detect_hardware_tasks
+ input:
+ job_id: <% $.job_id %>
+ task_id: <% $.task_id %>
+ publish:
+ todo_tasks: <% task(detect_tasks).result.result %>
+ on-success: prepare_host
+
+ prepare_host:
+ action: laas.add_management_vlan
+ input:
+ hosts: <% list($.task_data.id) %>
+ on-complete: wait_for_ipmi
+
+ wait_for_ipmi:
+ action: laas.get_ipmi_hostname host=<% $.task_data.id %>
+ publish:
+ ipmi_name: <% task(wait_for_ipmi).result.result %>
+ on-complete: ping_ipmi
+
+ ping_ipmi:
+ action: laas.wait_for_host
+ input:
+ hostname: <% $.ipmi_name %>
+ timeout: 200
+ on-complete: do_image
+ on-error: task_error
+
+ do_image:
+ action: core.local cmd="exit 0"
+ on-success:
+ - set_boot: <% $.todo_tasks.get(image, false) %>
+ - do_hostname: <% not $.todo_tasks.get(image, false) %>
+
+ set_boot:
+ action: laas.set_boot_workflow
+ input:
+ host: <% $.task_data.get(id) %>
+ on-success: image_host
+ on-error: task_error
+
+ image_host:
+ action: laas.fog_imageWorkflow
+ input:
+ host: <% $.task_data.get(id) %>
+ image: <% str($.task_data.get(image)) %>
+ on-success: do_hostname
+ on-error: retry
+
+ do_hostname:
+ action: core.local cmd="exit 0"
+ on-success:
+ - set_hostname: <% $.todo_tasks.get(hostname, false) %>
+ - do_ipmi: <% not $.todo_tasks.get(hostname, false) %>
+
+ set_hostname:
+ action: laas.set_hostname
+ input:
+ hostname: <% $.task_data.get(hostname) %>
+ host: <% $.task_data.get(id) %>
+ on-error: task_error
+ on-success: do_ipmi
+
+ do_ipmi:
+ action: core.local cmd="exit 0"
+ on-success:
+ - ipmi_create: <% $.todo_tasks.get(ipmi_create, false) %>
+ - do_power: <% not $.todo_tasks.get(ipmi_create, false) %>
+
+ ipmi_create:
+ action: laas.set_ipmi_account_workflow
+ input:
+ host: <% $.task_data.get(id) %>
+ on-error: task_error
+ on-success: notify_ipmi
+
+ notify_ipmi:
+ action: laas.notify_ipmi_workflow
+ input:
+ ipmi_key: "ipmiuser_<% $.task_data.get(id) %>"
+ job_id: <% $.job_id %>
+ task_id: <% $.task_id %>
+ ipmi_name: <% $.ipmi_name %>
+ host: <% $.task_data.get(id) %>
+ on-success: do_power
+
+ do_power:
+ action: core.local cmd="exit 0"
+ on-success:
+ - power: <% $.todo_tasks.get(power, false) %>
+ - finish: <% not $.todo_tasks.get(power, false) %>
+
+ power:
+ action: laas.restart_workflow
+ input:
+ host: <% $.task_data.get(id) %>
+ ipmi: true
+ cmd: <% $.task_data.get(power) %>
+ on-success: finish
+ on-error: task_error
+
+ retry:
+ action: core.local cmd="exit 0"
+ publish:
+ retry_count: <% $.retry_count + 1 %>
+ on-success:
+ - set_boot: <% $.retry_count <= $.retry_max %>
+ - task_error: <% $.retry_count > $.retry_max %>
+
+ finish:
+ action: laas.finish_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+
+ task_error:
+ action: laas.error_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+ on-complete:
+ - fail
diff --git a/laas/actions/workflows/jenkins_workflow.yaml b/laas/actions/workflows/jenkins_workflow.yaml
new file mode 100644
index 0000000..77d32e5
--- /dev/null
+++ b/laas/actions/workflows/jenkins_workflow.yaml
@@ -0,0 +1,40 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.jenkins_workflow:
+ description: "workflow to send jenkins sandbox script to remote host"
+ input:
+ - host
+
+ tasks:
+ gather_info:
+ action: laas.jenkins_info host=<% $.host %>
+ publish:
+ destination: <% task(gather_info).result.result.get(destination) %>
+ hostname: <% task(gather_info).result.result.get(hostname) %>
+ secret: <% task(gather_info).result.result.get(secret) %>
+ script: <% task(gather_info).result.result.get(script) %>
+ on-success: send_script
+
+ send_script:
+ action: laas.send_jenkins_script
+ input:
+ destination: <% $.destination %>
+ hostname: <% $.hostname %>
+ secret: <% $.secret %>
+ script: <% $.script %>
diff --git a/laas/actions/workflows/master_workflow.yaml b/laas/actions/workflows/master_workflow.yaml
new file mode 100644
index 0000000..821cfb8
--- /dev/null
+++ b/laas/actions/workflows/master_workflow.yaml
@@ -0,0 +1,74 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.master_workflow:
+ description: master workflow to fulfill a job
+ input:
+ - job_id
+
+ tasks:
+ start_job:
+ action: laas.start_job job_id=<% $.job_id %>
+ on-success:
+ - hardware_master_workflow
+ on-error:
+ - fail_job
+
+ hardware_master_workflow:
+ action: laas.hardware_master_workflow job_id=<% $.job_id %>
+ on-success:
+ - network_master_workflow
+ on-error:
+ - fail_job
+
+ network_master_workflow:
+ action: laas.network_master_workflow job_id=<% $.job_id %>
+ on-success:
+ - access_master_workflow
+ on-error:
+ - fail_job
+
+ access_master_workflow:
+ action: laas.access_master_workflow job_id=<% $.job_id %>
+ on-success:
+ - software_master_workflow
+ on-error:
+ - fail_job
+
+ software_master_workflow:
+ action: laas.software_master_workflow job_id=<% $.job_id %>
+ on-success:
+ - snapshot_master_workflow
+ on-error:
+ - fail_job
+
+ snapshot_master_workflow:
+ action: laas.snapshot_master_workflow job_id=<% $.job_id %>
+ on-success:
+ - finish_job
+ on-error:
+ - fail_job
+
+ fail_job:
+ action: laas.send_bot_failure
+ input:
+ job_id: <% $.job_id %>
+ execution_id: <% env().st2_execution_id %>
+
+ finish_job:
+ action: laas.finish_job job_id=<% $.job_id %>
diff --git a/laas/actions/workflows/network_master_workflow.yaml b/laas/actions/workflows/network_master_workflow.yaml
new file mode 100644
index 0000000..819759c
--- /dev/null
+++ b/laas/actions/workflows/network_master_workflow.yaml
@@ -0,0 +1,74 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.network_master_workflow:
+ description: fulfills all network tasks from the dashboard
+ input:
+ - job_id
+
+ tasks:
+
+ get_tasks:
+ action: laas.get_task_list
+ input:
+ job_id: <% $.job_id %>
+ type: "network"
+ publish:
+ tasklist: <% task(get_tasks).result.result %>
+ on-success:
+ - get_start_index
+
+ get_start_index:
+ action: core.local cmd="echo 0"
+ publish:
+ index: <% int(task(get_start_index).result.stdout) %>
+ on-success:
+ - finish: <% $.index >= len($.tasklist) %>
+ - network_task: <% $.index < len($.tasklist) %>
+
+ loop:
+ action: core.local
+ input:
+ cmd: 'echo $((<% $.index %>+1))'
+ publish:
+ index: <% int(task(loop).result.stdout) %>
+ on-success:
+ - finish: <% $.index >= len($.tasklist) %>
+ - network_task: <% $.index < len($.tasklist) %>
+
+ network_task:
+ action: laas.network_workflow
+ input:
+ task_id: <% $.tasklist[$.index] %>
+ job_id: <% $.job_id %>
+ on-success:
+ - loop
+ on-error:
+ - retry_network_task
+
+ retry_network_task:
+ action: laas.network_workflow
+ input:
+ task_id: <% $.tasklist[$.index] %>
+ job_id: <% $.job_id %>
+ on-success:
+ - loop
+
+ finish:
+ action: core.local cmd="exit 0"
+ on-success: succeed
diff --git a/laas/actions/workflows/network_workflow.yaml b/laas/actions/workflows/network_workflow.yaml
new file mode 100644
index 0000000..db24fcf
--- /dev/null
+++ b/laas/actions/workflows/network_workflow.yaml
@@ -0,0 +1,157 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.network_workflow:
+ input:
+ - task_id
+ - job_id
+ - to_configure_host
+
+ tasks:
+
+ start_task:
+ action: laas.start_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+ on-success: get_task
+
+ get_task:
+ action: laas.get_task
+ input:
+ task_id: <% $.task_id %>
+ type: "network"
+ job_id: <% $.job_id %>
+ publish:
+ task_data: <% task(get_task).result.result %>
+ on-success:
+ - parse_data: <% to_configure_host %>
+ - configure_switch: <% not to_configure_host %>
+
+ parse_data:
+ action: laas.parse_network_data task_data=<% $.task_data %>
+ publish:
+ mappings: <% task(parse_data).result.result.mappings %>
+ default: <% task(parse_data).result.result.default %>
+ host: <% task(parse_data).result.result.host %>
+ empty: <% task(parse_data).result.result.empty %>
+ on-success:
+ - prepare_host: <% not bool($.empty) %>
+ - configure_switch: <% bool($.empty) %>
+ on-error: task_error
+
+ prepare_host:
+ action: laas.add_management_vlan
+ input:
+ hosts: <% $.task_data.keys() %>
+ on-success: wait_for_host
+ on-error: task_error
+
+ wait_for_host:
+ action: laas.waitForBoot host=<% $.host %> timeout=1200
+ on-success: configure_host
+ on-error: task_error
+
+ configure_host:
+ action: laas.configure_host_networking
+ input:
+ mapping: <% $.mappings %>
+ default: <% $.default %>
+ hosts: <% $.host %>
+ on-success: configure_switch
+ on-error: task_error
+
+ configure_switch:
+ action: laas.network_task network_data=<% $.task_data %>
+ on-success:
+ - wait_for_ipmi: <% not bool($.empty) %>
+ - finish: <% bool($.empty) %>
+ on-error: task_error
+
+ wait_for_ipmi:
+ action: laas.get_ipmi_hostname host=<% $.host %>
+ publish:
+ ipmi_name: <% task(wait_for_ipmi).result.result %>
+ on-success: wait_for_ipmi_connection
+
+ wait_for_ipmi_connection:
+ action: laas.wait_for_host
+ input:
+ hostname: <% $.ipmi_name %>
+ timeout: 300
+ on-success: restart_host
+
+ restart_host:
+ action: laas.restart_workflow
+ input:
+ host: <% $.host %>
+ on-success: second_wait_for_host
+ on-error: task_error
+
+ second_wait_for_host:
+ action: laas.waitForBoot host=<% $.host %> timeout=1200
+ on-success: find_address
+ on-error: task_error
+
+ find_address:
+ action: laas.get_dhcp_address
+ input:
+ host: <% $.host %>
+ publish:
+ address: <% task(find_address).result.stdout %>
+ on-success: notify_ip
+ on-error: retry_find_address
+
+ retry_find_address:
+ action: core.local
+ input:
+ cmd: sleep 30
+ on-complete: second_find_address
+
+ second_find_address:
+ action: laas.get_dhcp_address
+ input:
+ host: <% $.host %>
+ publish:
+ address: <% task(second_find_address).result.stdout %>
+ on-success: notify_ip
+ on-error: task_error
+
+ notify_ip:
+ action: laas.notify_ip_address
+ input:
+ addresses: <% $.address %>
+ hostname: <% $.host %>
+ job_id: <% $.job_id %>
+ task_id: <% $.task_id %>
+ on-success: finish
+ on-error: task_error
+
+ finish:
+ action: laas.finish_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+
+ task_error:
+ action: laas.error_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+ on-complete:
+ - fail
diff --git a/laas/actions/workflows/notify_ipmi_workflow.yaml b/laas/actions/workflows/notify_ipmi_workflow.yaml
new file mode 100644
index 0000000..42d3a66
--- /dev/null
+++ b/laas/actions/workflows/notify_ipmi_workflow.yaml
@@ -0,0 +1,61 @@
+---
+##############################################################################
+# Copyright 2019 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.notify_ipmi_workflow:
+ description: ipmi notification workflow
+ input:
+ - ipmi_key
+ - job_id
+ - task_id
+ - ipmi_name
+ - host
+
+ tasks:
+ resolve_ipmi:
+ action: laas.resolve_host hostname=<% $.ipmi_name %>
+ publish:
+ ipmi_ip: <% task(resolve_ipmi).result.stdout %>
+ on-success: notify_ipmi_user
+
+ notify_ipmi_user:
+ action: laas.notify_ipmi_user
+ input:
+ ipmi_key: <% $.ipmi_key %>
+ job_id: <% $.job_id %>
+ task_id: <% $.task_id %>
+ hostname: <% $.ipmi_name %>
+ addr: <% $.ipmi_ip %>
+ on-success: get_ipmi_mac
+
+ get_ipmi_mac:
+ action: laas.get_mac_from_ip
+ input:
+ host: <% $.ipmi_ip %>
+ gateway: "10.10.29.1"
+ user: "st2"
+ publish:
+ ipmi_mac: <% task(get_ipmi_mac).result.stdout %>
+ on-success: notify_ipmi_api
+
+ notify_ipmi_api:
+ action: laas.notify_ipmi_api
+ input:
+ ipmi_key: <% $.ipmi_key %>
+ addr: <% $.ipmi_ip %>
+ mac: <% $.ipmi_mac %>
+ host: <% $.host %>
diff --git a/laas/actions/workflows/opnfv_master_workflow.yaml b/laas/actions/workflows/opnfv_master_workflow.yaml
new file mode 100644
index 0000000..f25f087
--- /dev/null
+++ b/laas/actions/workflows/opnfv_master_workflow.yaml
@@ -0,0 +1,72 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.opnfv_master_workflow:
+ description: The master workflow to provision, install, deploy hosts
+ input:
+ - hosts
+ - installer
+ - scenario
+ - virtual
+ - version
+ - subversion
+ - pdf
+ - idf
+ tasks:
+ find_jumphost:
+ action: laas.get_jumphost hosts=<% $.hosts %>
+ publish:
+ jumphost: <% task(find_jumphost).result.result %>
+ on-success:
+ - install_fuel: <% $.installer.toLower() = 'fuel' %>
+ - install_apex: <% $.installer.toLower() = 'apex' %>
+ - install_compass: <% $.installer.toLower() = 'compass' %>
+
+ install_fuel:
+ action: laas.fuel_master_workflow
+ input:
+ hosts: <% $.hosts %>
+ jumphost: <% $.jumphost %>
+ scenario: <% $.scenario %>
+ virtual: <% $.virtual %>
+ version: <% $.version %>
+ subversion: <% $.subversion %>
+ pdf: <% $.pdf %>
+ idf: <% $.idf %>
+ on-success: succeed
+
+ install_apex:
+ action: laas.apex_master_workflow
+ input:
+ hosts: <% $.hosts %>
+ jumphost: <% $.jumphost %>
+ scenario: <% $.scenario %>
+ virtual: <% $.virtual %>
+ version: <% $.version %>
+ on-success: succeed
+
+ install_compass:
+ action: laas.compass_master_workflow
+ input:
+ hosts: <% $.hosts %>
+ jumphost: <% $.jumphost %>
+ scenario: <% $.scenario %>
+ virtual: <% $.virtual %>
+ version: <% $.version %>
+ subversion: <% $.subversion %>
+ on-success: succeed
diff --git a/laas/actions/workflows/provision_workflow.yaml b/laas/actions/workflows/provision_workflow.yaml
new file mode 100644
index 0000000..e51facb
--- /dev/null
+++ b/laas/actions/workflows/provision_workflow.yaml
@@ -0,0 +1,37 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.provision_workflow:
+ description: Prepares and images a host
+ input:
+ - host
+ - os
+ - image
+ - hostname
+ tasks:
+ set_boot:
+ action: laas.set_boot_workflow host=<% $.host %>
+ on-success: set_ipmi
+
+ image_host:
+ action: laas.fog_imageWorkflow
+ input:
+ host: <% $.host %>
+ os: <% $.os %>
+ image: <% $.image %>
+ on-success: inject_ssh_keys
diff --git a/laas/actions/workflows/restart_workflow.yaml b/laas/actions/workflows/restart_workflow.yaml
new file mode 100644
index 0000000..bd30b1c
--- /dev/null
+++ b/laas/actions/workflows/restart_workflow.yaml
@@ -0,0 +1,59 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.restart_workflow:
+ description: restarts given host, using ipmi if asked
+ input:
+ - host
+ - ipmi
+ - cmd
+ tasks:
+ branch:
+ action: core.local cmd="exit 0"
+ on-success:
+ - get_ipmi_hostname: <% $.ipmi = true %>
+ - restart: <% $.ipmi = false %>
+
+ get_ipmi_hostname:
+ action: laas.get_ipmi_hostname host=<% $.host %>
+ publish:
+ ipmi_name: <% task(get_ipmi_hostname).result.result %>
+ on-success: get_ipmi_password
+
+ get_ipmi_password:
+ action: laas.get_ipmi_password host=<% $.ipmi_name %>
+ publish:
+ password: <% task(get_ipmi_password).result.result %>
+ on-success: get_ipmi_username
+
+ get_ipmi_username:
+ action: laas.get_ipmi_username host=<% $.ipmi_name %>
+ publish:
+ username: <% task(get_ipmi_username).result.result %>
+ on-success: ipmi_restart
+
+ ipmi_restart:
+ action: laas.ipmi_restartHost
+ input:
+ host: <% $.ipmi_name %>
+ user: <% $.username %>
+ password: <% $.password %>
+ cmd: <% $.cmd %>
+
+ restart:
+ action: laas.restartHost host=<% $.host %>
diff --git a/laas/actions/workflows/set_boot_workflow.yaml b/laas/actions/workflows/set_boot_workflow.yaml
new file mode 100644
index 0000000..53529b6
--- /dev/null
+++ b/laas/actions/workflows/set_boot_workflow.yaml
@@ -0,0 +1,60 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+
+laas.set_boot_workflow:
+ description: "Will set the host's boot option to the correct pxe option"
+ type: direct
+ input:
+ - host
+
+ tasks:
+
+ get_ipmi_hostname:
+ action: laas.get_ipmi_hostname host=<% $.host %>
+ publish:
+ ipmi_name: <% task(get_ipmi_hostname).result.result %>
+ on-success: get_ipmi_password
+
+ get_ipmi_password:
+ action: laas.get_ipmi_password host=<% $.ipmi_name %>
+ publish:
+ password: <% task(get_ipmi_password).result.result %>
+ on-success: get_host_type
+
+ get_host_type:
+ action: laas.get_host_type host=<% $.host %>
+ publish:
+ type: <% task(get_host_type).result.result %>
+ on-success:
+ - hpe: <% $.type = "hpe" %>
+ - arm: <% $.type = "arm" %>
+
+ hpe:
+ action: laas.set_hpe_boot
+ input:
+ user: "Administrator"
+ passwd: <% $.password %>
+ host: <% $.ipmi_name %>
+
+ arm:
+ action: laas.set_arm_boot
+ input:
+ user: "ADMIN"
+ passwd: <% $.password %>
+ host: <% $.ipmi_name %>
diff --git a/laas/actions/workflows/set_hpe_bios_pass_workflow.yaml b/laas/actions/workflows/set_hpe_bios_pass_workflow.yaml
new file mode 100644
index 0000000..d17413e
--- /dev/null
+++ b/laas/actions/workflows/set_hpe_bios_pass_workflow.yaml
@@ -0,0 +1,68 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+
+laas.set_hpe_bios_pass_workflow:
+ description: "Will set the password for the bios"
+ type: direct
+ input:
+ - host
+ - password
+
+ tasks:
+
+ get_ipmi_hostname:
+ action: laas.get_ipmi_hostname host=<% $.host %>
+ publish:
+ ipmi_name: <% task(get_ipmi_hostname).result.result %>
+ on-success: get_ipmi_password
+
+ get_ipmi_password:
+ action: laas.get_ipmi_password host=<% $.ipmi_name %>
+ publish:
+ ipmi_password: <% task(get_ipmi_password).result.result %>
+ on-success: get_ipmi_username
+
+ get_ipmi_username:
+ action: laas.get_ipmi_username host=<% $.ipmi_name %>
+ publish:
+ ipmi_user: <% task(get_ipmi_username).result.result %>
+ on-success: get_bios_password
+
+ get_bios_password:
+ action: laas.get_bios_password host=<% $.ipmi_name %>
+ publish:
+ bios_password: <% task(get_bios_password).result.result %>
+ on-success: set_hpe_bios_pass
+
+
+ set_hpe_bios_pass:
+ action: laas.set_hpe_bios_pass
+ input:
+ host: <% $.ipmi_name %>
+ user: <% $.ipmi_user %>
+ adminPass: <% $.ipmi_password %>
+ oldPass: <% $.bios_password %>
+ newPass: <% $.password %>
+ on-success: update_db
+
+ update_db:
+ action: laas.update_bios_password
+ input:
+ host: <% $.host %>
+ password: <% $.password %>
diff --git a/laas/actions/workflows/set_ipmi_account_workflow.yaml b/laas/actions/workflows/set_ipmi_account_workflow.yaml
new file mode 100644
index 0000000..0c5c0f1
--- /dev/null
+++ b/laas/actions/workflows/set_ipmi_account_workflow.yaml
@@ -0,0 +1,61 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+
+laas.set_ipmi_account_workflow:
+ description: "Will set the password for the ipmi account on the host"
+ type: direct
+ input:
+ - host
+ - notify_user
+ - url
+
+ tasks:
+
+ get_ipmi_hostname:
+ action: laas.get_ipmi_hostname host=<% $.host %>
+ publish:
+ ipmi_name: <% task(get_ipmi_hostname).result.result %>
+ on-success: get_ipmi_password
+
+ get_ipmi_password:
+ action: laas.get_ipmi_password host=<% $.ipmi_name %>
+ publish:
+ password: <% task(get_ipmi_password).result.result %>
+ on-success: get_ipmi_username
+
+ get_ipmi_username:
+ action: laas.get_ipmi_username host=<% $.ipmi_name %>
+ publish:
+ ipmi_user: <% task(get_ipmi_username).result.result %>
+ on-success: gen_pass
+
+ gen_pass:
+ action: laas.genPass
+ input:
+ key: "ipmiuser_<% $.host %>"
+ length: 15
+ on-success: set_ipmi_pass
+
+ set_ipmi_pass:
+ action: laas.set_ipmi_pass
+ input:
+ user: <% $.ipmi_user %>
+ pass: <% $.password %>
+ host: <% $.ipmi_name %>
+ pass_key: "ipmiuser_<% $.host %>"
diff --git a/laas/actions/workflows/snapshot_master_workflow.yaml b/laas/actions/workflows/snapshot_master_workflow.yaml
new file mode 100644
index 0000000..4964003
--- /dev/null
+++ b/laas/actions/workflows/snapshot_master_workflow.yaml
@@ -0,0 +1,64 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.snapshot_master_workflow:
+ description: fulfills all snapshot tasks from the dashboard
+ input:
+ - job_id
+
+ tasks:
+
+ get_tasks:
+ action: laas.get_task_list
+ input:
+ job_id: <% $.job_id %>
+ type: "snapshot"
+ publish:
+ tasklist: <% task(get_tasks).result.result %>
+ on-success:
+ - get_start_index
+
+ get_start_index:
+ action: core.local cmd="echo 0"
+ publish:
+ index: <% int(task(get_start_index).result.stdout) %>
+ on-success:
+ - finish: <% $.index >= len($.tasklist) %>
+ - snapshot_task: <% $.index < len($.tasklist) %>
+
+ loop:
+ action: core.local
+ input:
+ cmd: 'echo $((<% $.index %>+1))'
+ publish:
+ index: <% task(loop).result.stdout %>
+ on-success:
+ - finish: <% $.index >= len($.tasklist) %>
+ - snapshot_task: <% $.index < len($.tasklist) %>
+
+ snapshot_task:
+ action: laas.snapshot_workflow
+ input:
+ task_id: <% $.tasklist[$.index] %>
+ job_id: <% $.job_id %>
+ on-success:
+ - loop
+
+ finish:
+ action: core.local cmd="exit 0"
+ on-success: succeed
diff --git a/laas/actions/workflows/snapshot_workflow.yaml b/laas/actions/workflows/snapshot_workflow.yaml
new file mode 100644
index 0000000..0babf84
--- /dev/null
+++ b/laas/actions/workflows/snapshot_workflow.yaml
@@ -0,0 +1,71 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.snapshot_workflow:
+ input:
+ - task_id
+ - job_id
+
+ tasks:
+
+ start_task:
+ action: laas.start_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+ on-success: get_task
+
+ get_task:
+ action: laas.get_task
+ input:
+ task_id: <% $.task_id %>
+ type: "snapshot"
+ job_id: <% $.job_id %>
+ publish:
+ task_data: <% task(get_task).result.result %>
+ on-success: snapshot_task
+
+ snapshot_task:
+ action: laas.fog_snapshotWorkflow
+ input:
+ name: <% concat("snapshot_", str($.task_data.dashboard_id)
+ host: <% $.task_data.host %>
+ publish:
+ snapshot_id: <% task(snapshot_task).result.result.snapshot_id %>
+ host: <% task(snapshot_task).result.result.host %>
+ on-success: finish
+ on-error: retry
+
+ finish:
+ action: laas.finish_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+
+ retry:
+ action: core.local cmd="exit 0"
+ on-success: finish
+ on-error: task_error
+
+ task_error:
+ action: laas.error_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+ on-complete:
+ - fail
diff --git a/laas/actions/workflows/software_master_workflow.yaml b/laas/actions/workflows/software_master_workflow.yaml
new file mode 100644
index 0000000..51c63b4
--- /dev/null
+++ b/laas/actions/workflows/software_master_workflow.yaml
@@ -0,0 +1,70 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.software_master_workflow:
+ description: fulfills all software tasks from the dashboard
+ input:
+ - job_id
+
+ tasks:
+
+ jenkins:
+ action: core.local
+ input:
+ cmd: "echo 'use laas.jenkins_workflow'"
+ on-complete: get_tasks
+
+ get_tasks:
+ action: laas.get_task_list
+ input:
+ job_id: <% $.job_id %>
+ type: "software"
+ publish:
+ tasklist: <% task(get_tasks).result.result %>
+ on-success:
+ - get_start_index
+
+ get_start_index:
+ action: core.local cmd="echo 0"
+ publish:
+ index: <% int(task(get_start_index).result.stdout) %>
+ on-success:
+ - finish: <% $.index >= len($.tasklist) %>
+ - software_task: <% $.index < len($.tasklist) %>
+
+ loop:
+ action: core.local
+ input:
+ cmd: 'echo $((<% $.index %>+1))'
+ publish:
+ index: <% task(loop).result.stdout %>
+ on-success:
+ - finish: <% $.index >= len($.tasklist) %>
+ - software_task: <% $.index < len($.tasklist) %>
+
+ software_task:
+ action: laas.software_workflow
+ input:
+ task_id: <% $.tasklist[$.index] %>
+ job_id: <% $.job_id %>
+ on-complete:
+ - loop
+
+ finish:
+ action: core.local cmd="exit 0"
+ on-success: succeed
diff --git a/laas/actions/workflows/software_workflow.yaml b/laas/actions/workflows/software_workflow.yaml
new file mode 100644
index 0000000..4f22117
--- /dev/null
+++ b/laas/actions/workflows/software_workflow.yaml
@@ -0,0 +1,90 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.software_workflow:
+ description: fulfills a software install job
+ input:
+ - task_id
+ - job_id
+
+ tasks:
+
+ start_task:
+ action: laas.start_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+ on-success: get_task
+
+ get_task:
+ action: laas.get_task
+ input:
+ job_id: <% $.job_id %>
+ task_id: <% $.task_id %>
+ type: "software"
+ publish:
+ task_data: <% task(get_task).result.result %>
+ on-success:
+ - software_task
+
+ software_task:
+ action: core.local cmd="exit 0"
+ on-success:
+ - opnfv_install: <% $.task_data.containsKey("opnfv")
+ and $.task_data.opnfv.containsKey("installer") %>
+ on-error: retry
+
+ opnfv_install:
+ action: laas.get_xdf
+ input:
+ task_data: <% $.task_data %>
+ publish:
+ pdf: <% task(opnfv_install).result.result.pdf %>
+ idf: <% task(opnfv_install).result.result.idf %>
+ on-success:
+ start_opnfv_install
+
+ start_opnfv_install:
+ action: laas.opnfv_master_workflow
+ input:
+ hosts: <% $.task_data.opnfv.get("roles") %>
+ installer: <% $.task_data.opnfv.get("installer") %>
+ scenario: <% $.task_data.opnfv.get("scenario") %>
+ virtual: <% len($.task_data.opnfv.get("roles", [])) = 1 %>
+ pdf: <% $.pdf %>
+ idf: <% $.idf %>
+ on-complete: finish
+
+ finish:
+ action: laas.finish_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+
+ retry:
+ action: core.local cmd="exit 0"
+ on-success: software_task
+ on-error: task_error
+
+ task_error:
+ action: laas.error_task
+ input:
+ task_id: <% $.task_id %>
+ job_id: <% $.job_id %>
+ on-complete:
+ - fail
diff --git a/laas/actions/workflows/ssh_key_workflow.yaml b/laas/actions/workflows/ssh_key_workflow.yaml
new file mode 100644
index 0000000..b8f5255
--- /dev/null
+++ b/laas/actions/workflows/ssh_key_workflow.yaml
@@ -0,0 +1,33 @@
+---
+##############################################################################
+# Copyright 2018 Parker Berberian and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: '2.0'
+laas.ssh_key_workflow:
+ description: "workflow to inject user's keys from the dashboard"
+ input:
+ - booking
+ - host
+
+ tasks:
+ get_key:
+ action: laas.find_user_keys booking=<% $.booking %>
+ publish:
+ url: <% task(get_key).result.result %>
+ on-success: inject_key
+
+ inject_key:
+ action: laas.copy_user_keys url=<% $.url %> host=<% $.host %>
diff --git a/laas/actions/workflows/update_image_workflow.yaml b/laas/actions/workflows/update_image_workflow.yaml
new file mode 100644
index 0000000..812b829
--- /dev/null
+++ b/laas/actions/workflows/update_image_workflow.yaml
@@ -0,0 +1,100 @@
+---
+##############################################################################
+# Copyright 2019 Sawyer Bergeron and Others #
+# #
+# Licensed under the Apache License, Version 2.0 (the License); #
+# you may not use this file except in compliance with the License. #
+# You may obtain a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an AS IS BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+##############################################################################
+
+version: 1.0
+
+description: "Updates the given image using the given host for scratch space"
+input:
+ - host # stackstorm recognized host handle
+ - update_from_image # image to apply to the host and update
+ - update_from_os # os to apply to the host and update
+ - update_into_image # image to save the updated image into
+ - update_into_os # os to save the updated image into
+tasks:
+ get_target_image: # primary entry point
+ action: laas.fog_getTargetImage
+ input:
+ host: <% ctx().host %>
+ from_image: <% ctx().update_from_image %>
+ from_os: <% ctx().update_from_os %>
+ target_image: <% ctx().update_into_image %>
+ target_os: <% ctx().update_into_os %>
+ next:
+ - when: <% succeeded() %>
+ publish:
+ - target_image: <% result().result %>
+ do: prepare_host
+
+ prepare_host:
+ action: laas.add_management_vlan
+ input:
+ hosts: <% list(ctx().host) %>
+ next:
+ - when: <% succeeded() %>
+ do: get_ipmi_name
+
+ get_ipmi_name:
+ action: laas.get_ipmi_hostname
+ input:
+ host: <% ctx().host %>
+ next:
+ - when: <% succeeded() %>
+ publish:
+ - ipmi_name: <% result().result %>
+ do: ping_ipmi
+
+ ping_ipmi:
+ action: laas.wait_for_host
+ input:
+ hostname: <% ctx().ipmi_name %>
+ timeout: 200
+ next:
+ - when: <% succeeded() %>
+ do: set_boot
+
+ set_boot:
+ action: laas.set_boot_workflow
+ input:
+ host: <% ctx().host %>
+ next:
+ - when: <% succeeded %>
+ do: image_host
+
+ image_host:
+ action: laas.fog_imageWorkflow
+ input:
+ host: <% ctx().host %>
+ image: <% ctx().update_from_image %>
+ os: <% ctx().update_from_os %>
+ next:
+ - when: <% succeeded() %>
+ do: run_updates
+
+ run_updates:
+ action: laas.update
+ input:
+ hosts: <% ctx().host %>
+ timeout: 900
+ next:
+ - when: <% succeeded() %>
+ do: capture_image
+
+ capture_image: # exit node
+ action: laas.fog_captureWorkflow
+ input:
+ host: <% ctx().host %>
+ image: <% ctx().target_image %>