Blame SOURCES/bz1607607-podman.patch

05afe3
From 07d283a6e20b8e559257c9694f7e36e155075014 Mon Sep 17 00:00:00 2001
05afe3
From: Michele Baldessari <michele@acksyn.org>
05afe3
Date: Sun, 22 Jul 2018 17:54:29 +0200
05afe3
Subject: [PATCH] Initial podman support
05afe3
05afe3
Tested with the following container:
05afe3
     podman container set: test_bundle [docker.io/sdelrio/docker-minimal-nginx]
05afe3
       test_bundle-podman-0 (ocf::heartbeat:podman):        Started nodea
05afe3
       test_bundle-podman-1 (ocf::heartbeat:podman):        Started nodeb
05afe3
       test_bundle-podman-2 (ocf::heartbeat:podman):        Started nodec
05afe3
05afe3
Tested a couple of stop/start cycles successfully. Needs the
05afe3
corresponding pacemaker support https://github.com/ClusterLabs/pacemaker/pull/1564
05afe3
---
05afe3
 doc/man/Makefile.am   |   1 +
05afe3
 heartbeat/Makefile.am |   1 +
05afe3
 heartbeat/podman      | 488 ++++++++++++++++++++++++++++++++++++++++++
05afe3
 3 files changed, 490 insertions(+)
05afe3
 create mode 100755 heartbeat/podman
05afe3
05afe3
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
05afe3
index 145e5fd50..0bef88740 100644
05afe3
--- a/doc/man/Makefile.am
05afe3
+++ b/doc/man/Makefile.am
05afe3
@@ -151,6 +151,7 @@ man_MANS	       = ocf_heartbeat_AoEtarget.7 \
05afe3
                           ocf_heartbeat_pgagent.7 \
05afe3
                           ocf_heartbeat_pgsql.7 \
05afe3
                           ocf_heartbeat_pingd.7 \
05afe3
+                          ocf_heartbeat_podman.7 \
05afe3
                           ocf_heartbeat_portblock.7 \
05afe3
                           ocf_heartbeat_postfix.7 \
05afe3
                           ocf_heartbeat_pound.7 \
05afe3
diff --git a/heartbeat/Makefile.am b/heartbeat/Makefile.am
05afe3
index e7a3a4fac..993bff042 100644
05afe3
--- a/heartbeat/Makefile.am
05afe3
+++ b/heartbeat/Makefile.am
05afe3
@@ -146,6 +146,7 @@ ocf_SCRIPTS	     =  AoEtarget		\
05afe3
 			pgagent			\
05afe3
 			pgsql			\
05afe3
 			pingd			\
05afe3
+			podman			\
05afe3
 			portblock		\
05afe3
 			postfix			\
05afe3
 			pound			\
05afe3
diff --git a/heartbeat/podman b/heartbeat/podman
05afe3
new file mode 100755
05afe3
index 000000000..88475f1df
05afe3
--- /dev/null
05afe3
+++ b/heartbeat/podman
05afe3
@@ -0,0 +1,488 @@
05afe3
+#!/bin/sh
05afe3
+#
05afe3
+# The podman HA resource agent creates and launches a podman container
05afe3
+# based off a supplied podman image. Containers managed by this agent
05afe3
+# are both created and removed upon the agent's start and stop actions.
05afe3
+#
05afe3
+# Copyright (c) 2014 David Vossel <davidvossel@gmail.com>
05afe3
+#                    Michele Baldessari <michele@acksyn.org>
05afe3
+#                    All Rights Reserved.
05afe3
+#
05afe3
+# This program is free software; you can redistribute it and/or modify
05afe3
+# it under the terms of version 2 of the GNU General Public License as
05afe3
+# published by the Free Software Foundation.
05afe3
+#
05afe3
+# This program is distributed in the hope that it would be useful, but
05afe3
+# WITHOUT ANY WARRANTY; without even the implied warranty of
05afe3
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
05afe3
+#
05afe3
+# Further, this software is distributed without any warranty that it is
05afe3
+# free of the rightful claim of any third person regarding infringement
05afe3
+# or the like.  Any license provided herein, whether implied or
05afe3
+# otherwise, applies only to this software file.  Patent licenses, if
05afe3
+# any, provided herein do not apply to combinations of this program with
05afe3
+# other software, or any other product whatsoever.
05afe3
+#
05afe3
+# You should have received a copy of the GNU General Public License
05afe3
+# along with this program; if not, write the Free Software Foundation,
05afe3
+# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
05afe3
+#
05afe3
+
05afe3
+#######################################################################
05afe3
+# Initialization:
05afe3
+
05afe3
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
05afe3
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
05afe3
+
05afe3
+#######################################################################
05afe3
+
05afe3
+meta_data()
05afe3
+{
05afe3
+	cat <
05afe3
+
05afe3
+
05afe3
+<resource-agent name="podman">
05afe3
+<version>1.0</version>
05afe3
+
05afe3
+<longdesc lang="en">
05afe3
+The podman HA resource agent creates and launches a podman container
05afe3
+based off a supplied podman image. Containers managed by this agent
05afe3
+are both created and removed upon the agent's start and stop actions.
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">Podman container resource agent.</shortdesc>
05afe3
+
05afe3
+<parameters>
05afe3
+<parameter name="image" required="1" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+The podman image to base this container off of.
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">podman image</shortdesc>
05afe3
+<content type="string"/>
05afe3
+</parameter>
05afe3
+
05afe3
+<parameter name="name" required="0" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+The name to give the created container. By default this will
05afe3
+be that resource's instance name.
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">podman container name</shortdesc>
05afe3
+<content type="string"/>
05afe3
+</parameter>
05afe3
+
05afe3
+<parameter name="allow_pull" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+Allow the image to be pulled from the configured podman registry when
05afe3
+the image does not exist locally. NOTE, this can drastically increase
05afe3
+the time required to start the container if the image repository is
05afe3
+pulled over the network.
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">Allow pulling non-local images</shortdesc>
05afe3
+<content type="boolean"/>
05afe3
+</parameter>
05afe3
+
05afe3
+<parameter name="run_opts" required="0" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+Add options to be appended to the 'podman run' command which is used
05afe3
+when creating the container during the start action. This option allows
05afe3
+users to do things such as setting a custom entry point and injecting
05afe3
+environment variables into the newly created container. Note the '-d'
05afe3
+option is supplied regardless of this value to force containers to run
05afe3
+in the background.
05afe3
+
05afe3
+NOTE: Do not explicitly specify the --name argument in the run_opts. This
05afe3
+agent will set --name using either the resource's instance or the name
05afe3
+provided in the 'name' argument of this agent.
05afe3
+
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">run options</shortdesc>
05afe3
+<content type="string"/>
05afe3
+</parameter>
05afe3
+
05afe3
+<parameter name="run_cmd" required="0" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+Specify a command to launch within the container once
05afe3
+it has initialized.
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">run command</shortdesc>
05afe3
+<content type="string"/>
05afe3
+</parameter>
05afe3
+
05afe3
+<parameter name="mount_points" required="0" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+A comma separated list of directories that the container is expecting to use.
05afe3
+The agent will ensure they exist by running 'mkdir -p'
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">Required mount points</shortdesc>
05afe3
+<content type="string"/>
05afe3
+</parameter>
05afe3
+
05afe3
+<parameter name="monitor_cmd" required="0" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+Specify the full path of a command to launch within the container to check
05afe3
+the health of the container. This command must return 0 to indicate that
05afe3
+the container is healthy. A non-zero return code will indicate that the
05afe3
+container has failed and should be recovered.
05afe3
+
05afe3
+If 'podman exec' is supported, it is used to execute the command. If not,
05afe3
+nsenter is used.
05afe3
+
05afe3
+Note: Using this method for monitoring processes inside a container
05afe3
+is not recommended, as containerd tries to track processes running
05afe3
+inside the container and does not deal well with many short-lived
05afe3
+processes being spawned. Ensure that your container monitors its
05afe3
+own processes and terminates on fatal error rather than invoking
05afe3
+a command from the outside.
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">monitor command</shortdesc>
05afe3
+<content type="string"/>
05afe3
+</parameter>
05afe3
+
05afe3
+<parameter name="force_kill" required="0" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+Kill a container immediately rather than waiting for it to gracefully
05afe3
+shutdown
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">force kill</shortdesc>
05afe3
+<content type="boolean"/>
05afe3
+</parameter>
05afe3
+
05afe3
+<parameter name="reuse" required="0" unique="0">
05afe3
+<longdesc lang="en">
05afe3
+Allow the container to be reused after stopping the container. By default
05afe3
+containers are removed after stop. With the reuse option containers
05afe3
+will persist after the container stops.
05afe3
+</longdesc>
05afe3
+<shortdesc lang="en">reuse container</shortdesc>
05afe3
+<content type="boolean"/>
05afe3
+</parameter>
05afe3
+</parameters>
05afe3
+
05afe3
+<actions>
05afe3
+<action name="start"        timeout="90s" />
05afe3
+<action name="stop"         timeout="90s" />
05afe3
+<action name="monitor"      timeout="30s" interval="30s" depth="0" />
05afe3
+<action name="meta-data"    timeout="5s" />
05afe3
+<action name="validate-all"   timeout="30s" />
05afe3
+</actions>
05afe3
+</resource-agent>
05afe3
+END
05afe3
+}
05afe3
+
05afe3
+#######################################################################
05afe3
+REQUIRE_IMAGE_PULL=0
05afe3
+
05afe3
+podman_usage()
05afe3
+{
05afe3
+	cat <
05afe3
+usage: $0 {start|stop|monitor|validate-all|meta-data}
05afe3
+
05afe3
+Expects to have a fully populated OCF RA-compliant environment set.
05afe3
+END
05afe3
+}
05afe3
+
05afe3
+
05afe3
+monitor_cmd_exec()
05afe3
+{
05afe3
+	local rc=$OCF_SUCCESS
05afe3
+	local out
05afe3
+
05afe3
+	if [ -z "$OCF_RESKEY_monitor_cmd" ]; then
05afe3
+		return $rc
05afe3
+	fi
05afe3
+
05afe3
+	if podman exec --help >/dev/null 2>&1; then
05afe3
+		out=$(podman exec ${CONTAINER} $OCF_RESKEY_monitor_cmd 2>&1)
05afe3
+		rc=$?
05afe3
+	else
05afe3
+		out=$(echo "$OCF_RESKEY_monitor_cmd" | nsenter --target $(podman inspect --format {{.State.Pid}} ${CONTAINER}) --mount --uts --ipc --net --pid 2>&1)
05afe3
+		rc=$?
05afe3
+	fi
05afe3
+
05afe3
+	if [ $rc -eq 127 ]; then
05afe3
+		ocf_log err "monitor cmd failed (rc=$rc), output: $out"
05afe3
+		ocf_exit_reason "monitor_cmd, ${OCF_RESKEY_monitor_cmd} , not found within container."
05afe3
+		# there is no recovering from this, exit immediately
05afe3
+		exit $OCF_ERR_ARGS
05afe3
+	elif [ $rc -ne 0 ]; then
05afe3
+		ocf_exit_reason "monitor cmd failed (rc=$rc), output: $out"
05afe3
+		rc=$OCF_ERR_GENERIC
05afe3
+	else
05afe3
+		ocf_log debug "monitor cmd passed: exit code = $rc"
05afe3
+	fi
05afe3
+
05afe3
+	return $rc
05afe3
+}
05afe3
+
05afe3
+container_exists()
05afe3
+{
05afe3
+	podman inspect --format {{.State.Running}} $CONTAINER | egrep '(true|false)' >/dev/null 2>&1
05afe3
+}
05afe3
+
05afe3
+remove_container()
05afe3
+{
05afe3
+	if ocf_is_true "$OCF_RESKEY_reuse"; then
05afe3
+		# never remove the container if we have reuse enabled.
05afe3
+		return 0
05afe3
+	fi
05afe3
+
05afe3
+	container_exists
05afe3
+	if [ $? -ne 0 ]; then
05afe3
+		# don't attempt to remove a container that doesn't exist
05afe3
+		return 0
05afe3
+	fi
05afe3
+	ocf_log notice "Cleaning up inactive container, ${CONTAINER}."
05afe3
+	ocf_run podman rm $CONTAINER
05afe3
+}
05afe3
+
05afe3
+podman_simple_status()
05afe3
+{
05afe3
+	local val
05afe3
+
05afe3
+	container_exists
05afe3
+	if [ $? -ne 0 ]; then
05afe3
+		return $OCF_NOT_RUNNING
05afe3
+	fi
05afe3
+
05afe3
+	# retrieve the 'Running' attribute for the container
05afe3
+	val=$(podman inspect --format {{.State.Running}} $CONTAINER 2>/dev/null)
05afe3
+	if [ $? -ne 0 ]; then
05afe3
+		#not running as a result of container not being found
05afe3
+		return $OCF_NOT_RUNNING
05afe3
+	fi
05afe3
+
05afe3
+	if ocf_is_true "$val"; then
05afe3
+		# container exists and is running
05afe3
+		return $OCF_SUCCESS
05afe3
+	fi
05afe3
+
05afe3
+	return $OCF_NOT_RUNNING
05afe3
+}
05afe3
+
05afe3
+podman_monitor()
05afe3
+{
05afe3
+	local rc=0
05afe3
+
05afe3
+	podman_simple_status
05afe3
+	rc=$?
05afe3
+
05afe3
+	if [ $rc -ne 0 ]; then
05afe3
+		return $rc
05afe3
+	fi
05afe3
+
05afe3
+	monitor_cmd_exec
05afe3
+}
05afe3
+
05afe3
+podman_create_mounts() {
05afe3
+	oldIFS="$IFS"
05afe3
+	IFS=","
05afe3
+	for directory in $OCF_RESKEY_mount_points; do
05afe3
+		mkdir -p "$directory"
05afe3
+	done
05afe3
+	IFS="$oldIFS"
05afe3
+}
05afe3
+
05afe3
+podman_start()
05afe3
+{
05afe3
+	podman_create_mounts
05afe3
+	local run_opts="-d --name=${CONTAINER}"
05afe3
+	# check to see if the container has already started
05afe3
+	podman_simple_status
05afe3
+	if [ $? -eq $OCF_SUCCESS ]; then
05afe3
+		return $OCF_SUCCESS
05afe3
+	fi
05afe3
+
05afe3
+	if [ -n "$OCF_RESKEY_run_opts" ]; then
05afe3
+		run_opts="$run_opts $OCF_RESKEY_run_opts"
05afe3
+	fi
05afe3
+
05afe3
+	if [ $REQUIRE_IMAGE_PULL -eq 1 ]; then
05afe3
+		ocf_log notice "Beginning pull of image, ${OCF_RESKEY_image}"
05afe3
+		podman pull "${OCF_RESKEY_image}"
05afe3
+		if [ $? -ne 0 ]; then
05afe3
+			ocf_exit_reason "failed to pull image ${OCF_RESKEY_image}"
05afe3
+			return $OCF_ERR_GENERIC
05afe3
+		fi
05afe3
+	fi
05afe3
+
05afe3
+	if ocf_is_true "$OCF_RESKEY_reuse" && container_exists; then
05afe3
+		ocf_log info "starting existing container $CONTAINER."
05afe3
+		ocf_run podman start $CONTAINER
05afe3
+	else
05afe3
+		# make sure any previous container matching our container name is cleaned up first.
05afe3
+		# we already know at this point it wouldn't be running
05afe3
+		remove_container
05afe3
+		ocf_log info "running container $CONTAINER for the first time"
05afe3
+		ocf_run podman run $run_opts $OCF_RESKEY_image $OCF_RESKEY_run_cmd
05afe3
+	fi
05afe3
+
05afe3
+	if [ $? -ne 0 ]; then
05afe3
+		ocf_exit_reason "podman failed to launch container"
05afe3
+		return $OCF_ERR_GENERIC
05afe3
+	fi
05afe3
+
05afe3
+
05afe3
+	# wait for monitor to pass before declaring that the container is started
05afe3
+	while true; do
05afe3
+		podman_simple_status
05afe3
+		if [ $? -ne $OCF_SUCCESS ]; then
05afe3
+			ocf_exit_reason "Newly created podman container exited after start"
05afe3
+			return $OCF_ERR_GENERIC
05afe3
+		fi
05afe3
+
05afe3
+		monitor_cmd_exec
05afe3
+		if [ $? -eq $OCF_SUCCESS ]; then
05afe3
+			ocf_log notice "Container $CONTAINER  started successfully"
05afe3
+			return $OCF_SUCCESS
05afe3
+		fi
05afe3
+
05afe3
+		ocf_exit_reason "waiting on monitor_cmd to pass after start"
05afe3
+		sleep 1
05afe3
+	done
05afe3
+}
05afe3
+
05afe3
+podman_stop()
05afe3
+{
05afe3
+	local timeout=60
05afe3
+	podman_simple_status
05afe3
+	if [ $? -eq  $OCF_NOT_RUNNING ]; then
05afe3
+		remove_container
05afe3
+		return $OCF_SUCCESS
05afe3
+	fi
05afe3
+
05afe3
+	if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then
05afe3
+		timeout=$((($OCF_RESKEY_CRM_meta_timeout/1000) -10 ))
05afe3
+		if [ $timeout -lt 10 ]; then
05afe3
+			timeout=10
05afe3
+		fi
05afe3
+	fi
05afe3
+
05afe3
+	if ocf_is_true "$OCF_RESKEY_force_kill"; then
05afe3
+		ocf_run podman kill $CONTAINER
05afe3
+	else
05afe3
+		ocf_log debug "waiting $timeout second[s] before killing container"
05afe3
+		ocf_run podman stop -t=$timeout $CONTAINER
05afe3
+	fi
05afe3
+
05afe3
+	if [ $? -ne 0 ]; then
05afe3
+		ocf_exit_reason "Failed to stop container, ${CONTAINER}, based on image, ${OCF_RESKEY_image}."
05afe3
+		return $OCF_ERR_GENERIC
05afe3
+	fi
05afe3
+
05afe3
+	remove_container
05afe3
+	if [ $? -ne 0 ]; then
05afe3
+		ocf_exit_reason "Failed to remove stopped container, ${CONTAINER}, based on image, ${OCF_RESKEY_image}."
05afe3
+		return $OCF_ERR_GENERIC
05afe3
+	fi
05afe3
+
05afe3
+	return $OCF_SUCCESS
05afe3
+}
05afe3
+
05afe3
+image_exists()
05afe3
+{
05afe3
+	# if no tag was specified, use default "latest"
05afe3
+	local COLON_FOUND=0
05afe3
+	local SLASH_FOUND=0
05afe3
+	local SERVER_NAME=""
05afe3
+	local IMAGE_NAME="${OCF_RESKEY_image}"
05afe3
+	local IMAGE_TAG="latest"
05afe3
+
05afe3
+	SLASH_FOUND="$(echo "${OCF_RESKEY_image}" | grep -o '/' | grep -c .)"
05afe3
+
05afe3
+	if [ ${SLASH_FOUND} -ge 1 ]; then
05afe3
+		SERVER_NAME="$(echo ${IMAGE_NAME} | cut -d / -f 1-${SLASH_FOUND})"
05afe3
+		IMAGE_NAME="$(echo ${IMAGE_NAME} | awk -F'/' '{print $NF}')"
05afe3
+	fi
05afe3
+
05afe3
+	COLON_FOUND="$(echo "${IMAGE_NAME}" | grep -o ':' | grep -c .)"
05afe3
+	if [ ${COLON_FOUND} -ge 1 ]; then
05afe3
+		IMAGE_TAG="$(echo ${IMAGE_NAME} | awk -F':' '{print $NF}')"
05afe3
+		IMAGE_NAME="$(echo ${IMAGE_NAME} | cut -d : -f 1-${COLON_FOUND})"
05afe3
+	fi
05afe3
+
05afe3
+	# IMAGE_NAME might be following formats:
05afe3
+	# - image
05afe3
+	# - repository:port/image
05afe3
+	# - docker.io/image (some distro will display "docker.io/" as prefix)
05afe3
+	podman images | awk '{print $1 ":" $2}' | egrep -q -s "^(docker.io\/|${SERVER_NAME}\/)?${IMAGE_NAME}:${IMAGE_TAG}\$"
05afe3
+	if [ $? -eq 0 ]; then
05afe3
+		# image found
05afe3
+		return 0
05afe3
+	fi
05afe3
+
05afe3
+	if ocf_is_true "$OCF_RESKEY_allow_pull"; then
05afe3
+		REQUIRE_IMAGE_PULL=1
05afe3
+		ocf_log notice "Image (${OCF_RESKEY_image}) does not exist locally but will be pulled during start"
05afe3
+		return 0
05afe3
+	fi
05afe3
+	# image not found.
05afe3
+	return 1
05afe3
+}
05afe3
+
05afe3
+podman_validate()
05afe3
+{
05afe3
+	check_binary podman
05afe3
+	if [ -z "$OCF_RESKEY_image" ]; then
05afe3
+		ocf_exit_reason "'image' option is required"
05afe3
+		exit $OCF_ERR_CONFIGURED
05afe3
+	fi
05afe3
+
05afe3
+	if [ -n "$OCF_RESKEY_monitor_cmd" ]; then
05afe3
+		podman exec --help >/dev/null 2>&1
05afe3
+		if [ ! $? ]; then
05afe3
+			ocf_log info "checking for nsenter, which is required when 'monitor_cmd' is specified"
05afe3
+			check_binary nsenter
05afe3
+		fi
05afe3
+	fi
05afe3
+
05afe3
+	image_exists
05afe3
+	if [ $? -ne 0 ]; then
05afe3
+		ocf_exit_reason "base image, ${OCF_RESKEY_image}, could not be found."
05afe3
+		exit $OCF_ERR_CONFIGURED
05afe3
+	fi
05afe3
+
05afe3
+	return $OCF_SUCCESS
05afe3
+}
05afe3
+
05afe3
+# TODO :
05afe3
+# When a user starts plural clones in a node in globally-unique, a user cannot appoint plural name parameters.
05afe3
+# When a user appoints reuse, the resource agent cannot connect plural clones with a container.
05afe3
+
05afe3
+if ocf_is_true "$OCF_RESKEY_CRM_meta_globally_unique"; then
05afe3
+	if [ -n "$OCF_RESKEY_name" ]; then
05afe3
+		if [ -n "$OCF_RESKEY_CRM_meta_clone_node_max" ] && [ "$OCF_RESKEY_CRM_meta_clone_node_max" -ne 1 ]
05afe3
+		then
05afe3
+			ocf_exit_reason "Cannot make plural clones from the same name parameter."
05afe3
+			exit $OCF_ERR_CONFIGURED
05afe3
+		fi
05afe3
+		if [ -n "$OCF_RESKEY_CRM_meta_master_node_max" ] && [ "$OCF_RESKEY_CRM_meta_master_node_max" -ne 1 ]
05afe3
+		then
05afe3
+			ocf_exit_reason "Cannot make plural master from the same name parameter."
05afe3
+			exit $OCF_ERR_CONFIGURED
05afe3
+		fi
05afe3
+	fi
05afe3
+	: ${OCF_RESKEY_name=`echo ${OCF_RESOURCE_INSTANCE} | tr ':' '-'`}
05afe3
+else
05afe3
+	: ${OCF_RESKEY_name=${OCF_RESOURCE_INSTANCE}}
05afe3
+fi
05afe3
+
05afe3
+CONTAINER=$OCF_RESKEY_name
05afe3
+
05afe3
+case $__OCF_ACTION in
05afe3
+meta-data) meta_data
05afe3
+		exit $OCF_SUCCESS;;
05afe3
+start)
05afe3
+	podman_validate
05afe3
+	podman_start;;
05afe3
+stop)		podman_stop;;
05afe3
+monitor)	podman_monitor;;
05afe3
+validate-all)	podman_validate;;
05afe3
+usage|help)	podman_usage
05afe3
+		exit $OCF_SUCCESS
05afe3
+		;;
05afe3
+*)		podman_usage
05afe3
+		exit $OCF_ERR_UNIMPLEMENTED
05afe3
+		;;
05afe3
+esac
05afe3
+rc=$?
05afe3
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
05afe3
+exit $rc