diff --git a/include/crm/msg_xml.h b/include/crm/msg_xml.h
index 42f90037f8..15f1b3cf1b 100644
--- a/include/crm/msg_xml.h
+++ b/include/crm/msg_xml.h
@@ -1,412 +1,413 @@
 /*
  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef XML_TAGS__H
 #  define XML_TAGS__H
 
 #  ifndef F_ORIG
 #    define F_ORIG    "src"
 #  endif
 
 #  ifndef F_SEQ
 #    define F_SEQ		"seq"
 #  endif
 
 #  ifndef F_SUBTYPE
 #    define F_SUBTYPE "subt"
 #  endif
 
 #  ifndef F_TYPE
 #    define F_TYPE    "t"
 #  endif
 
 #  ifndef F_CLIENTNAME
 #    define	F_CLIENTNAME	"cn"
 #  endif
 
 #  ifndef F_XML_TAGNAME
 #    define F_XML_TAGNAME	"__name__"
 #  endif
 
 #  ifndef T_CRM
 #    define T_CRM     "crmd"
 #  endif
 
 #  ifndef T_ATTRD
 #    define T_ATTRD     "attrd"
 #  endif
 
 #  define CIB_OPTIONS_FIRST "cib-bootstrap-options"
 
 #  define F_CRM_DATA			"crm_xml"
 #  define F_CRM_TASK			"crm_task"
 #  define F_CRM_HOST_TO			"crm_host_to"
 #  define F_CRM_MSG_TYPE		F_SUBTYPE
 #  define F_CRM_SYS_TO			"crm_sys_to"
 #  define F_CRM_SYS_FROM		"crm_sys_from"
 #  define F_CRM_HOST_FROM		F_ORIG
 #  define F_CRM_REFERENCE		XML_ATTR_REFERENCE
 #  define F_CRM_VERSION			XML_ATTR_VERSION
 #  define F_CRM_ORIGIN			"origin"
 #  define F_CRM_USER			"crm_user"
 #  define F_CRM_JOIN_ID			"join_id"
 #  define F_CRM_ELECTION_ID		"election-id"
 #  define F_CRM_ELECTION_AGE_S		"election-age-sec"
 #  define F_CRM_ELECTION_AGE_US		"election-age-nano-sec"
 #  define F_CRM_ELECTION_OWNER		"election-owner"
 #  define F_CRM_TGRAPH			"crm-tgraph"
 #  define F_CRM_TGRAPH_INPUT		"crm-tgraph-in"
 
 #  define F_CRM_THROTTLE_MODE		"crm-limit-mode"
 #  define F_CRM_THROTTLE_MAX		"crm-limit-max"
 
 /*---- Common tags/attrs */
 #  define XML_DIFF_MARKER		"__crm_diff_marker__"
 #  define XML_ATTR_TAGNAME		F_XML_TAGNAME
 #  define XML_TAG_CIB			"cib"
 #  define XML_TAG_FAILED		"failed"
 
 #  define XML_ATTR_CRM_VERSION		"crm_feature_set"
 #  define XML_ATTR_DIGEST		"digest"
 #  define XML_ATTR_VALIDATION		"validate-with"
 
 #  define XML_ATTR_QUORUM_PANIC		"no-quorum-panic"
 #  define XML_ATTR_HAVE_QUORUM		"have-quorum"
 #  define XML_ATTR_HAVE_WATCHDOG	"have-watchdog"
 #  define XML_ATTR_EXPECTED_VOTES	"expected-quorum-votes"
 #  define XML_ATTR_GENERATION		"epoch"
 #  define XML_ATTR_GENERATION_ADMIN	"admin_epoch"
 #  define XML_ATTR_NUMUPDATES		"num_updates"
 #  define XML_ATTR_TIMEOUT		"timeout"
 #  define XML_ATTR_ORIGIN		"crm-debug-origin"
 #  define XML_ATTR_TSTAMP		"crm-timestamp"
 #  define XML_CIB_ATTR_WRITTEN		"cib-last-written"
 #  define XML_ATTR_VERSION		"version"
 #  define XML_ATTR_DESC			"description"
 #  define XML_ATTR_ID			"id"
 #  define XML_ATTR_IDREF			"id-ref"
 #  define XML_ATTR_ID_LONG		"long-id"
 #  define XML_ATTR_TYPE			"type"
 #  define XML_ATTR_FILTER_TYPE		"type-filter"
 #  define XML_ATTR_FILTER_ID		"id-filter"
 #  define XML_ATTR_FILTER_PRIORITY	"priority-filter"
 #  define XML_ATTR_VERBOSE		"verbose"
 #  define XML_ATTR_OP			"op"
 #  define XML_ATTR_DC			"is_dc"
 #  define XML_ATTR_DC_UUID		"dc-uuid"
 #  define XML_ATTR_UPDATE_ORIG		"update-origin"
 #  define XML_ATTR_UPDATE_CLIENT	"update-client"
 #  define XML_ATTR_UPDATE_USER		"update-user"
 
 #  define XML_BOOLEAN_TRUE		"true"
 #  define XML_BOOLEAN_FALSE		"false"
 #  define XML_BOOLEAN_YES		XML_BOOLEAN_TRUE
 #  define XML_BOOLEAN_NO		XML_BOOLEAN_FALSE
 
 #  define XML_TAG_OPTIONS		"options"
 
 /*---- top level tags/attrs */
 #  define XML_MSG_TAG			"crm_message"
 #  define XML_MSG_TAG_DATA		"msg_data"
 #  define XML_ATTR_REQUEST		"request"
 #  define XML_ATTR_RESPONSE		"response"
 
 #  define XML_ATTR_UNAME		"uname"
 #  define XML_ATTR_UUID			"id"
 #  define XML_ATTR_REFERENCE		"reference"
 
 #  define XML_FAIL_TAG_RESOURCE		"failed_resource"
 
 #  define XML_FAILRES_ATTR_RESID	"resource_id"
 #  define XML_FAILRES_ATTR_REASON	"reason"
 #  define XML_FAILRES_ATTR_RESSTATUS	"resource_status"
 
 #  define XML_CRM_TAG_PING		"ping_response"
 #  define XML_PING_ATTR_STATUS		"result"
 #  define XML_PING_ATTR_SYSFROM		"crm_subsystem"
 
 #  define XML_TAG_FRAGMENT		"cib_fragment"
 #  define XML_ATTR_RESULT		"result"
 #  define XML_ATTR_SECTION		"section"
 
 #  define XML_FAIL_TAG_CIB		"failed_update"
 
 #  define XML_FAILCIB_ATTR_ID		"id"
 #  define XML_FAILCIB_ATTR_OBJTYPE	"object_type"
 #  define XML_FAILCIB_ATTR_OP		"operation"
 #  define XML_FAILCIB_ATTR_REASON	"reason"
 
 /*---- CIB specific tags/attrs */
 #  define XML_CIB_TAG_SECTION_ALL	"all"
 #  define XML_CIB_TAG_CONFIGURATION	"configuration"
 #  define XML_CIB_TAG_STATUS       	"status"
 #  define XML_CIB_TAG_RESOURCES		"resources"
 #  define XML_CIB_TAG_NODES         	"nodes"
 #  define XML_CIB_TAG_DOMAINS         	"domains"
 #  define XML_CIB_TAG_CONSTRAINTS   	"constraints"
 #  define XML_CIB_TAG_CRMCONFIG   	"crm_config"
 #  define XML_CIB_TAG_OPCONFIG		"op_defaults"
 #  define XML_CIB_TAG_RSCCONFIG   	"rsc_defaults"
 #  define XML_CIB_TAG_ACLS   		"acls"
 
 #  define XML_CIB_TAG_STATE         	"node_state"
 #  define XML_CIB_TAG_NODE          	"node"
 #  define XML_CIB_TAG_DOMAIN          	"domain"
 #  define XML_CIB_TAG_CONSTRAINT    	"constraint"
 #  define XML_CIB_TAG_NVPAIR        	"nvpair"
 
 #  define XML_CIB_TAG_PROPSET	   	"cluster_property_set"
 #  define XML_TAG_ATTR_SETS	   	"instance_attributes"
 #  define XML_TAG_META_SETS	   	"meta_attributes"
 #  define XML_TAG_ATTRS			"attributes"
 #  define XML_TAG_PARAMS		"parameters"
 #  define XML_TAG_PARAM			"param"
 #  define XML_TAG_UTILIZATION		"utilization"
 
 #  define XML_TAG_RESOURCE_REF		"resource_ref"
 #  define XML_CIB_TAG_RESOURCE	  	"primitive"
 #  define XML_CIB_TAG_GROUP	  	"group"
 #  define XML_CIB_TAG_INCARNATION	"clone"
 #  define XML_CIB_TAG_MASTER		"master"
 
 #  define XML_CIB_TAG_RSC_TEMPLATE	"template"
 
 #  define XML_RSC_ATTR_ISOLATION_INSTANCE	"isolation-instance"
 #  define XML_RSC_ATTR_ISOLATION_WRAPPER    "isolation-wrapper"
 #  define XML_RSC_ATTR_ISOLATION_HOST   "isolation-host"
 #  define XML_RSC_ATTR_ISOLATION    	"isolation"
 #  define XML_RSC_ATTR_RESTART	  	"restart-type"
 #  define XML_RSC_ATTR_ORDERED		"ordered"
 #  define XML_RSC_ATTR_INTERLEAVE	"interleave"
 #  define XML_RSC_ATTR_INCARNATION	"clone"
 #  define XML_RSC_ATTR_INCARNATION_MAX	"clone-max"
+#  define XML_RSC_ATTR_INCARNATION_MIN	"clone-min"
 #  define XML_RSC_ATTR_INCARNATION_NODEMAX	"clone-node-max"
 #  define XML_RSC_ATTR_MASTER_MAX	"master-max"
 #  define XML_RSC_ATTR_MASTER_NODEMAX	"master-node-max"
 #  define XML_RSC_ATTR_STATE		"clone-state"
 #  define XML_RSC_ATTR_MANAGED		"is-managed"
 #  define XML_RSC_ATTR_TARGET_ROLE	"target-role"
 #  define XML_RSC_ATTR_UNIQUE		"globally-unique"
 #  define XML_RSC_ATTR_NOTIFY		"notify"
 #  define XML_RSC_ATTR_STICKINESS	"resource-stickiness"
 #  define XML_RSC_ATTR_FAIL_STICKINESS	"migration-threshold"
 #  define XML_RSC_ATTR_FAIL_TIMEOUT	"failure-timeout"
 #  define XML_RSC_ATTR_MULTIPLE		"multiple-active"
 #  define XML_RSC_ATTR_PRIORITY		"priority"
 #  define XML_RSC_ATTR_REQUIRES		"requires"
 #  define XML_RSC_ATTR_PROVIDES		"provides"
 #  define XML_RSC_ATTR_CONTAINER	"container"
 #  define XML_RSC_ATTR_INTERNAL_RSC	"internal_rsc"
 #  define XML_RSC_ATTR_MAINTENANCE	"maintenance"
 #  define XML_RSC_ATTR_REMOTE_NODE  	"remote-node"
 
 #  define XML_REMOTE_ATTR_RECONNECT_INTERVAL "reconnect_interval"
 
 #  define XML_OP_ATTR_ON_FAIL		"on-fail"
 #  define XML_OP_ATTR_START_DELAY	"start-delay"
 #  define XML_OP_ATTR_ALLOW_MIGRATE	"allow-migrate"
 #  define XML_OP_ATTR_DEPENDENT "dependent-on"
 #  define XML_OP_ATTR_ORIGIN		"interval-origin"
 #  define XML_OP_ATTR_PENDING		"record-pending"
 
 #  define XML_CIB_TAG_LRM		"lrm"
 #  define XML_LRM_TAG_RESOURCES     	"lrm_resources"
 #  define XML_LRM_TAG_RESOURCE     	"lrm_resource"
 #  define XML_LRM_TAG_AGENTS	     	"lrm_agents"
 #  define XML_LRM_TAG_AGENT		"lrm_agent"
 #  define XML_LRM_TAG_RSC_OP		"lrm_rsc_op"
 #  define XML_AGENT_ATTR_CLASS		"class"
 #  define XML_AGENT_ATTR_PROVIDER	"provider"
 #  define XML_LRM_TAG_ATTRIBUTES	"attributes"
 
 #  define XML_CIB_ATTR_REPLACE       	"replace"
 #  define XML_CIB_ATTR_SOURCE       	"source"
 
 #  define XML_CIB_ATTR_HEALTH       	"health"
 #  define XML_CIB_ATTR_WEIGHT       	"weight"
 #  define XML_CIB_ATTR_PRIORITY     	"priority"
 #  define XML_CIB_ATTR_CLEAR        	"clear_on"
 #  define XML_CIB_ATTR_SOURCE       	"source"
 
 #  define XML_NODE_JOIN_STATE    	"join"
 #  define XML_NODE_EXPECTED     	"expected"
 #  define XML_NODE_IN_CLUSTER        	"in_ccm"
 #  define XML_NODE_IS_PEER    	"crmd"
 #  define XML_NODE_IS_REMOTE    	"remote_node"
 #  define XML_NODE_IS_FENCED		"node_fenced"
 
 #  define XML_CIB_ATTR_SHUTDOWN       	"shutdown"
 #  define XML_CIB_ATTR_STONITH	    	"stonith"
 
 #  define XML_LRM_ATTR_INTERVAL		"interval"
 #  define XML_LRM_ATTR_TASK		"operation"
 #  define XML_LRM_ATTR_TASK_KEY		"operation_key"
 #  define XML_LRM_ATTR_TARGET		"on_node"
 /*! used for remote nodes.
  *  For remote nodes the action is routed to the 'on_node'
  *  node location, and then from there if 'exec_on' is set
  *  the host will execute the action on the remote node
  *  it controls. */
 #  define XML_LRM_ATTR_ROUTER_NODE  "router_node"
 #  define XML_LRM_ATTR_TARGET_UUID	"on_node_uuid"
 #  define XML_LRM_ATTR_RSCID		"rsc-id"
 #  define XML_LRM_ATTR_OPSTATUS		"op-status"
 #  define XML_LRM_ATTR_RC		"rc-code"
 #  define XML_LRM_ATTR_CALLID		"call-id"
 #  define XML_LRM_ATTR_OP_DIGEST	"op-digest"
 #  define XML_LRM_ATTR_OP_RESTART	"op-force-restart"
 #  define XML_LRM_ATTR_OP_SECURE	"op-secure-params"
 #  define XML_LRM_ATTR_RESTART_DIGEST	"op-restart-digest"
 #  define XML_LRM_ATTR_SECURE_DIGEST	"op-secure-digest"
 #  define XML_LRM_ATTR_EXIT_REASON	"exit-reason"
 
 #  define XML_RSC_OP_LAST_CHANGE        "last-rc-change"
 #  define XML_RSC_OP_LAST_RUN           "last-run"
 #  define XML_RSC_OP_T_EXEC             "exec-time"
 #  define XML_RSC_OP_T_QUEUE            "queue-time"
 
 #  define XML_LRM_ATTR_MIGRATE_SOURCE	"migrate_source"
 #  define XML_LRM_ATTR_MIGRATE_TARGET	"migrate_target"
 
 #  define XML_TAG_GRAPH			"transition_graph"
 #  define XML_GRAPH_TAG_RSC_OP		"rsc_op"
 #  define XML_GRAPH_TAG_PSEUDO_EVENT	"pseudo_event"
 #  define XML_GRAPH_TAG_CRM_EVENT	"crm_event"
 
 #  define XML_TAG_RULE			"rule"
 #  define XML_RULE_ATTR_SCORE		"score"
 #  define XML_RULE_ATTR_SCORE_ATTRIBUTE	"score-attribute"
 #  define XML_RULE_ATTR_SCORE_MANGLED	"score-attribute-mangled"
 #  define XML_RULE_ATTR_ROLE		"role"
 #  define XML_RULE_ATTR_RESULT		"result"
 #  define XML_RULE_ATTR_BOOLEAN_OP	"boolean-op"
 
 #  define XML_TAG_EXPRESSION		"expression"
 #  define XML_EXPR_ATTR_ATTRIBUTE	"attribute"
 #  define XML_EXPR_ATTR_OPERATION	"operation"
 #  define XML_EXPR_ATTR_VALUE		"value"
 #  define XML_EXPR_ATTR_TYPE		"type"
 
 #  define XML_CONS_TAG_RSC_DEPEND	"rsc_colocation"
 #  define XML_CONS_TAG_RSC_ORDER	"rsc_order"
 #  define XML_CONS_TAG_RSC_LOCATION	"rsc_location"
 #  define XML_CONS_TAG_RSC_TICKET	"rsc_ticket"
 #  define XML_CONS_TAG_RSC_SET		"resource_set"
 #  define XML_CONS_ATTR_SYMMETRICAL	"symmetrical"
 
 #  define XML_LOCATION_ATTR_DISCOVERY	"resource-discovery"
 
 #  define XML_COLOC_ATTR_SOURCE		"rsc"
 #  define XML_COLOC_ATTR_SOURCE_ROLE	"rsc-role"
 #  define XML_COLOC_ATTR_TARGET		"with-rsc"
 #  define XML_COLOC_ATTR_TARGET_ROLE	"with-rsc-role"
 #  define XML_COLOC_ATTR_NODE_ATTR	"node-attribute"
 #  define XML_COLOC_ATTR_SOURCE_INSTANCE	"rsc-instance"
 #  define XML_COLOC_ATTR_TARGET_INSTANCE	"with-rsc-instance"
 
 #  define XML_ORDER_ATTR_FIRST		"first"
 #  define XML_ORDER_ATTR_THEN		"then"
 #  define XML_ORDER_ATTR_FIRST_ACTION	"first-action"
 #  define XML_ORDER_ATTR_THEN_ACTION	"then-action"
 #  define XML_ORDER_ATTR_FIRST_INSTANCE	"first-instance"
 #  define XML_ORDER_ATTR_THEN_INSTANCE	"then-instance"
 #  define XML_ORDER_ATTR_KIND		"kind"
 
 #  define XML_TICKET_ATTR_TICKET	"ticket"
 #  define XML_TICKET_ATTR_LOSS_POLICY	"loss-policy"
 
 #  define XML_NVPAIR_ATTR_NAME        	"name"
 #  define XML_NVPAIR_ATTR_VALUE        	"value"
 
 #  define XML_NODE_ATTR_STATE		"state"
 #  define XML_NODE_ATTR_RSC_DISCOVERY   "resource-discovery-enabled"
 
 #  define XML_CONFIG_ATTR_DC_DEADTIME	"dc-deadtime"
 #  define XML_CONFIG_ATTR_ELECTION_FAIL	"election-timeout"
 #  define XML_CONFIG_ATTR_FORCE_QUIT	"shutdown-escalation"
 #  define XML_CONFIG_ATTR_RECHECK	"cluster-recheck-interval"
 
 #  define XML_CIB_TAG_GENERATION_TUPPLE	"generation_tuple"
 
 #  define XML_ATTR_TRANSITION_MAGIC	"transition-magic"
 #  define XML_ATTR_TRANSITION_KEY	"transition-key"
 
 #  define XML_ATTR_TE_NOWAIT		"op_no_wait"
 #  define XML_ATTR_TE_TARGET_RC		"op_target_rc"
 #  define XML_ATTR_LRM_PROBE		"lrm-is-probe"
 #  define XML_TAG_TRANSIENT_NODEATTRS	"transient_attributes"
 
 #  define XML_TAG_DIFF_ADDED		"diff-added"
 #  define XML_TAG_DIFF_REMOVED		"diff-removed"
 
 #  define XML_ACL_TAG_USER		"acl_target"
 #  define XML_ACL_TAG_USERv1		"acl_user"
 #  define XML_ACL_TAG_GROUP		"acl_group"
 #  define XML_ACL_TAG_ROLE		"acl_role"
 #  define XML_ACL_TAG_PERMISSION	"acl_permission"
 #  define XML_ACL_TAG_ROLE_REF 		"role"
 #  define XML_ACL_TAG_ROLE_REFv1	"role_ref"
 #  define XML_ACL_ATTR_KIND		"kind"
 #  define XML_ACL_TAG_READ		"read"
 #  define XML_ACL_TAG_WRITE		"write"
 #  define XML_ACL_TAG_DENY		"deny"
 #  define XML_ACL_ATTR_REF		"reference"
 #  define XML_ACL_ATTR_REFv1		"ref"
 #  define XML_ACL_ATTR_TAG		"object-type"
 #  define XML_ACL_ATTR_TAGv1		"tag"
 #  define XML_ACL_ATTR_XPATH		"xpath"
 #  define XML_ACL_ATTR_ATTRIBUTE	"attribute"
 
 #  define XML_CIB_TAG_TICKETS		"tickets"
 #  define XML_CIB_TAG_TICKET_STATE	"ticket_state"
 
 #  define XML_CIB_TAG_TAGS   		"tags"
 #  define XML_CIB_TAG_TAG   		"tag"
 #  define XML_CIB_TAG_OBJ_REF 		"obj_ref"
 
 #  define XML_TAG_FENCING_TOPOLOGY      "fencing-topology"
 #  define XML_TAG_FENCING_LEVEL         "fencing-level"
 #  define XML_ATTR_STONITH_INDEX        "index"
 #  define XML_ATTR_STONITH_TARGET       "target"
 #  define XML_ATTR_STONITH_TARGET_PATTERN       "target-pattern"
 #  define XML_ATTR_STONITH_DEVICES      "devices"
 
 #  define XML_TAG_DIFF                  "diff"
 #  define XML_DIFF_VERSION              "version"
 #  define XML_DIFF_VSOURCE              "source"
 #  define XML_DIFF_VTARGET              "target"
 #  define XML_DIFF_CHANGE               "change"
 #  define XML_DIFF_LIST                 "change-list"
 #  define XML_DIFF_ATTR                 "change-attr"
 #  define XML_DIFF_RESULT               "change-result"
 #  define XML_DIFF_OP                   "operation"
 #  define XML_DIFF_PATH                 "path"
 #  define XML_DIFF_POSITION             "position"
 
 /* Defined for backward API compatibility but no longer used by Pacemaker */
 #  define XML_ATTR_TE_ALLOWFAIL         "op_allow_fail"
 
 #  include <crm/common/xml.h>
 
 #  define ID(x) crm_element_value(x, XML_ATTR_ID)
 #  define INSTANCE(x) crm_element_value(x, XML_CIB_ATTR_INSTANCE)
 #  define TSTAMP(x) crm_element_value(x, XML_ATTR_TSTAMP)
 #  define TYPE(x) crm_element_name(x)
 #  define NAME(x) crm_element_value(x, XML_NVPAIR_ATTR_NAME)
 #  define VALUE(x) crm_element_value(x, XML_NVPAIR_ATTR_VALUE)
 
 #endif
diff --git a/include/crm/pengine/status.h b/include/crm/pengine/status.h
index 421495901a..94ecdd72f7 100644
--- a/include/crm/pengine/status.h
+++ b/include/crm/pengine/status.h
@@ -1,405 +1,425 @@
 /*
  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef PENGINE_STATUS__H
 #  define PENGINE_STATUS__H
 
 #  include <glib.h>
 #  include <crm/common/iso8601.h>
 #  include <crm/pengine/common.h>
 
 typedef struct node_s pe_node_t;
 typedef struct node_s node_t;
 typedef struct pe_action_s action_t;
 typedef struct pe_action_s pe_action_t;
 typedef struct resource_s resource_t;
 typedef struct ticket_s ticket_t;
 
 typedef enum no_quorum_policy_e {
     no_quorum_freeze,
     no_quorum_stop,
     no_quorum_ignore,
     no_quorum_suicide
 } no_quorum_policy_t;
 
 enum node_type {
     node_ping,
     node_member,
     node_remote
 };
 
 enum pe_restart {
     pe_restart_restart,
     pe_restart_ignore
 };
 
 enum pe_find {
     pe_find_renamed = 0x001,
     pe_find_clone = 0x004,
     pe_find_current = 0x008,
     pe_find_inactive = 0x010,
 };
 
 #  define pe_flag_have_quorum		0x00000001ULL
 #  define pe_flag_symmetric_cluster	0x00000002ULL
 #  define pe_flag_is_managed_default	0x00000004ULL
 #  define pe_flag_maintenance_mode	0x00000008ULL
 
 #  define pe_flag_stonith_enabled	0x00000010ULL
 #  define pe_flag_have_stonith_resource	0x00000020ULL
 #  define pe_flag_enable_unfencing	0x00000040ULL
 
 #  define pe_flag_stop_rsc_orphans	0x00000100ULL
 #  define pe_flag_stop_action_orphans	0x00000200ULL
 #  define pe_flag_stop_everything	0x00000400ULL
 
 #  define pe_flag_start_failure_fatal	0x00001000ULL
 #  define pe_flag_remove_after_stop	0x00002000ULL
 
 #  define pe_flag_startup_probes	0x00010000ULL
 #  define pe_flag_have_status		0x00020000ULL
 #  define pe_flag_have_remote_nodes	0x00040000ULL
 
 #  define pe_flag_quick_location  	0x00100000ULL
 #  define pe_flag_sanitized             0x00200000ULL
 
 typedef struct pe_working_set_s {
     xmlNode *input;
     crm_time_t *now;
 
     /* options extracted from the input */
     char *dc_uuid;
     node_t *dc_node;
     const char *stonith_action;
     const char *placement_strategy;
 
     unsigned long long flags;
 
     int stonith_timeout;
     int default_resource_stickiness;
     no_quorum_policy_t no_quorum_policy;
 
     GHashTable *config_hash;
     GHashTable *tickets;
     GHashTable *singletons; /* Actions for which there can be only one - ie. fence nodeX */
 
     GListPtr nodes;
     GListPtr resources;
     GListPtr placement_constraints;
     GListPtr ordering_constraints;
     GListPtr colocation_constraints;
     GListPtr ticket_constraints;
 
     GListPtr actions;
     xmlNode *failed;
     xmlNode *op_defaults;
     xmlNode *rsc_defaults;
 
     /* stats */
     int num_synapse;
     int max_valid_nodes;
     int order_id;
     int action_id;
 
     /* final output */
     xmlNode *graph;
 
     GHashTable *template_rsc_sets;
     const char *localhost;
     GHashTable *tags;
 
 } pe_working_set_t;
 
 struct node_shared_s {
     const char *id;
     const char *uname;
 /* Make all these flags into a bitfield one day */
     gboolean online;
     gboolean standby;
     gboolean standby_onfail;
     gboolean pending;
     gboolean unclean;
     gboolean unseen;
     gboolean shutdown;
     gboolean expected_up;
     gboolean is_dc;
 
     int num_resources;
     GListPtr running_rsc;       /* resource_t* */
     GListPtr allocated_rsc;     /* resource_t* */
 
     resource_t *remote_rsc;
 
     GHashTable *attrs;          /* char* => char* */
     enum node_type type;
 
     GHashTable *utilization;
 
     /*! cache of calculated rsc digests for this node. */
     GHashTable *digest_cache;
 
     gboolean maintenance;
     gboolean rsc_discovery_enabled;
     gboolean remote_requires_reset;
     gboolean remote_was_fenced;
 };
 
 struct node_s {
     int weight;
     gboolean fixed;
     int count;
     struct node_shared_s *details;
     int rsc_discover_mode;
 };
 
 #  include <crm/pengine/complex.h>
 
 #  define pe_rsc_orphan		0x00000001ULL
 #  define pe_rsc_managed	0x00000002ULL
 #  define pe_rsc_block          0x00000004ULL   /* Further operations are prohibited due to failure policy */
 #  define pe_rsc_orphan_container_filler	0x00000008ULL
 
 #  define pe_rsc_notify		0x00000010ULL
 #  define pe_rsc_unique		0x00000020ULL
 #  define pe_rsc_fence_device   0x00000040ULL
 
 #  define pe_rsc_provisional	0x00000100ULL
 #  define pe_rsc_allocating	0x00000200ULL
 #  define pe_rsc_merging	0x00000400ULL
 #  define pe_rsc_munging	0x00000800ULL
 
 #  define pe_rsc_try_reload     0x00001000ULL
 #  define pe_rsc_reload         0x00002000ULL
 
 #  define pe_rsc_failed		0x00010000ULL
 #  define pe_rsc_shutdown	0x00020000ULL
 #  define pe_rsc_runnable	0x00040000ULL
 #  define pe_rsc_start_pending	0x00080000ULL
 
 #  define pe_rsc_starting       0x00100000ULL
 #  define pe_rsc_stopping       0x00200000ULL
 #  define pe_rsc_migrating      0x00400000ULL
 #  define pe_rsc_allow_migrate  0x00800000ULL
 
 #  define pe_rsc_failure_ignored 0x01000000ULL
 #  define pe_rsc_unexpectedly_running 0x02000000ULL
 #  define pe_rsc_maintenance	 0x04000000ULL
 
 #  define pe_rsc_needs_quorum	 0x10000000ULL
 #  define pe_rsc_needs_fencing	 0x20000000ULL
 #  define pe_rsc_needs_unfencing 0x40000000ULL
 #  define pe_rsc_have_unfencing  0x80000000ULL
 
 enum pe_graph_flags {
     pe_graph_none = 0x00000,
     pe_graph_updated_first = 0x00001,
     pe_graph_updated_then = 0x00002,
     pe_graph_disable = 0x00004,
 };
 
 /* *INDENT-OFF* */
 enum pe_action_flags {
     pe_action_pseudo = 0x00001,
     pe_action_runnable = 0x00002,
     pe_action_optional = 0x00004,
     pe_action_print_always = 0x00008,
 
     pe_action_have_node_attrs = 0x00010,
     pe_action_failure_is_fatal = 0x00020, /* no longer used, here for API compatibility */
     pe_action_implied_by_stonith = 0x00040,
     pe_action_migrate_runnable =   0x00080,
 
     pe_action_dumped = 0x00100,
     pe_action_processed = 0x00200,
     pe_action_clear = 0x00400,
     pe_action_dangle = 0x00800,
 
     pe_action_requires_any = 0x01000, /* This action requires one or mre of its dependencies to be runnable
                                        * We use this to clear the runnable flag before checking dependencies
                                        */
     pe_action_reschedule = 0x02000,
     pe_action_tracking = 0x04000,
 };
 /* *INDENT-ON* */
 
 struct resource_s {
     char *id;
     char *clone_name;
     xmlNode *xml;
     xmlNode *orig_xml;
     xmlNode *ops_xml;
 
     resource_t *parent;
     void *variant_opaque;
     enum pe_obj_types variant;
     resource_object_functions_t *fns;
     resource_alloc_functions_t *cmds;
 
     enum rsc_recovery_type recovery_type;
     enum pe_restart restart_type;
 
     int priority;
     int stickiness;
     int sort_index;
     int failure_timeout;
     int remote_reconnect_interval;
     int effective_priority;
     int migration_threshold;
 
     gboolean is_remote_node;
 
     unsigned long long flags;
 
     GListPtr rsc_cons_lhs;      /* rsc_colocation_t* */
     GListPtr rsc_cons;          /* rsc_colocation_t* */
     GListPtr rsc_location;      /* rsc_to_node_t*    */
     GListPtr actions;           /* action_t*         */
     GListPtr rsc_tickets;       /* rsc_ticket*       */
 
     node_t *allocated_to;
     GListPtr running_on;        /* node_t*   */
     GHashTable *known_on;       /* node_t*   */
     GHashTable *allowed_nodes;  /* node_t*   */
 
     enum rsc_role_e role;
     enum rsc_role_e next_role;
 
     GHashTable *meta;
     GHashTable *parameters;
     GHashTable *utilization;
 
     GListPtr children;          /* resource_t*   */
     GListPtr dangling_migrations;       /* node_t*       */
 
     node_t *partial_migration_target;
     node_t *partial_migration_source;
 
     resource_t *container;
     GListPtr fillers;
 
     char *pending_task;
 
     const char *isolation_wrapper;
     gboolean exclusive_discover;
 };
 
 struct pe_action_s {
     int id;
     int priority;
 
     resource_t *rsc;
     node_t *node;
     xmlNode *op_entry;
 
     char *task;
     char *uuid;
     char *cancel_task;
 
     enum pe_action_flags flags;
     enum rsc_start_requirement needs;
     enum action_fail_response on_fail;
     enum rsc_role_e fail_role;
 
     action_t *pre_notify;
     action_t *pre_notified;
     action_t *post_notify;
     action_t *post_notified;
 
     int seen_count;
 
     GHashTable *meta;
     GHashTable *extra;
 
+    /* 
+     * These two varables are associated with the constraint logic
+     * that involves first having one or more actions runnable before
+     * then allowing this action to execute.
+     *
+     * These varables are used with features such as 'clone-min' which
+     * requires at minimum X number of cloned instances to be running
+     * before an order dependency can run. Another option that uses
+     * this is 'require-all=false' in ordering constrants. This option
+     * says "only required one instance of a resource to start before
+     * allowing dependencies to start" basicall require-all=false is
+     * the same as clone-min=1.
+     */
+
+    /* current number of known runnable actions in the before list. */
+    int runnable_before;
+    /* the number of "before" runnable actions required for this action
+     * to be considered runnable */ 
+    int required_runnable_before;
+
     GListPtr actions_before;    /* action_warpper_t* */
     GListPtr actions_after;     /* action_warpper_t* */
 };
 
 struct ticket_s {
     char *id;
     gboolean granted;
     time_t last_granted;
     gboolean standby;
     GHashTable *state;
 };
 
 typedef struct tag_s {
     char *id;
     GListPtr refs;
 } tag_t;
 
 enum pe_link_state {
     pe_link_not_dumped,
     pe_link_dumped,
     pe_link_dup,
 };
 
 /* *INDENT-OFF* */
 enum pe_ordering {
     pe_order_none                  = 0x0,       /* deleted */
     pe_order_optional              = 0x1,       /* pure ordering, nothing implied */
     pe_order_apply_first_non_migratable = 0x2,  /* Only apply this constraint's ordering if first is not migratable. */
 
     pe_order_implies_first         = 0x10,      /* If 'then' is required, ensure 'first' is too */
     pe_order_implies_then          = 0x20,      /* If 'first' is required, ensure 'then' is too */
     pe_order_implies_first_master  = 0x40,      /* Imply 'first' is required when 'then' is required and then's rsc holds Master role. */
 
     /* first requires then to be both runnable and migrate runnable. */
     pe_order_implies_first_migratable  = 0x80,
 
     pe_order_runnable_left         = 0x100,     /* 'then' requires 'first' to be runnable */
 
     pe_order_pseudo_left           = 0x200,     /* 'then' can only be pseudo if 'first' is runnable */
     pe_order_implies_then_on_node  = 0x400,     /* If 'first' is required on 'nodeX',
                                                  * ensure instances of 'then' on 'nodeX' are too.
                                                  * Only really useful if 'then' is a clone and 'first' is not
                                                  */
 
     pe_order_restart               = 0x1000,    /* 'then' is runnable if 'first' is optional or runnable */
     pe_order_stonith_stop          = 0x2000,    /* only applies if the action is non-pseudo */
     pe_order_serialize_only        = 0x4000,    /* serialize */
 
     pe_order_implies_first_printed = 0x10000,   /* Like ..implies_first but only ensures 'first' is printed, not manditory */
     pe_order_implies_then_printed  = 0x20000,   /* Like ..implies_then but only ensures 'then' is printed, not manditory */
 
     pe_order_asymmetrical          = 0x100000,  /* Indicates asymmetrical one way ordering constraint. */
     pe_order_load                  = 0x200000,  /* Only relevant if... */
     pe_order_one_or_more           = 0x400000,  /* 'then' is only runnable if one or more of it's dependencies are too */
     pe_order_anti_colocation       = 0x800000,
 
     pe_order_preserve              = 0x1000000, /* Hack for breaking user ordering constraints with container resources */
     pe_order_trace                 = 0x4000000, /* test marker */
 };
 /* *INDENT-ON* */
 
 typedef struct action_wrapper_s action_wrapper_t;
 struct action_wrapper_s {
     enum pe_ordering type;
     enum pe_link_state state;
     action_t *action;
 };
 
 const char *rsc_printable_id(resource_t *rsc);
 gboolean cluster_status(pe_working_set_t * data_set);
 void set_working_set_defaults(pe_working_set_t * data_set);
 void cleanup_calculations(pe_working_set_t * data_set);
 resource_t *pe_find_resource(GListPtr rsc_list, const char *id_rh);
 node_t *pe_find_node(GListPtr node_list, const char *uname);
 node_t *pe_find_node_id(GListPtr node_list, const char *id);
 node_t *pe_find_node_any(GListPtr node_list, const char *id, const char *uname);
 GListPtr find_operations(const char *rsc, const char *node, gboolean active_filter,
                          pe_working_set_t * data_set);
 #endif
diff --git a/pengine/allocate.c b/pengine/allocate.c
index 68cafd47cd..ec5a18d818 100644
--- a/pengine/allocate.c
+++ b/pengine/allocate.c
@@ -1,2687 +1,2686 @@
 /*
  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <crm_internal.h>
 
 #include <sys/param.h>
 
 #include <crm/crm.h>
 #include <crm/cib.h>
 #include <crm/msg_xml.h>
 #include <crm/common/xml.h>
 
 #include <glib.h>
 
 #include <crm/pengine/status.h>
 #include <pengine.h>
 #include <allocate.h>
 #include <utils.h>
 
 CRM_TRACE_INIT_DATA(pe_allocate);
 
 void set_alloc_actions(pe_working_set_t * data_set);
 void migrate_reload_madness(pe_working_set_t * data_set);
 
 resource_alloc_functions_t resource_class_alloc_functions[] = {
     {
      native_merge_weights,
      native_color,
      native_create_actions,
      native_create_probe,
      native_internal_constraints,
      native_rsc_colocation_lh,
      native_rsc_colocation_rh,
      native_rsc_location,
      native_action_flags,
      native_update_actions,
      native_expand,
      native_append_meta,
      },
     {
      group_merge_weights,
      group_color,
      group_create_actions,
      native_create_probe,
      group_internal_constraints,
      group_rsc_colocation_lh,
      group_rsc_colocation_rh,
      group_rsc_location,
      group_action_flags,
      group_update_actions,
      group_expand,
      group_append_meta,
      },
     {
      clone_merge_weights,
      clone_color,
      clone_create_actions,
      clone_create_probe,
      clone_internal_constraints,
      clone_rsc_colocation_lh,
      clone_rsc_colocation_rh,
      clone_rsc_location,
      clone_action_flags,
      clone_update_actions,
      clone_expand,
      clone_append_meta,
      },
     {
      master_merge_weights,
      master_color,
      master_create_actions,
      clone_create_probe,
      master_internal_constraints,
      clone_rsc_colocation_lh,
      master_rsc_colocation_rh,
      clone_rsc_location,
      clone_action_flags,
      clone_update_actions,
      clone_expand,
      master_append_meta,
      }
 };
 
 gboolean
 update_action_flags(action_t * action, enum pe_action_flags flags)
 {
     static unsigned long calls = 0;
     gboolean changed = FALSE;
     gboolean clear = is_set(flags, pe_action_clear);
     enum pe_action_flags last = action->flags;
 
     if (clear) {
         pe_clear_action_bit(action, flags);
     } else {
         pe_set_action_bit(action, flags);
     }
 
     if (last != action->flags) {
         calls++;
         changed = TRUE;
         /* Useful for tracking down _who_ changed a specific flag */
         /* CRM_ASSERT(calls != 534); */
         clear_bit(flags, pe_action_clear);
         crm_trace("%s on %s: %sset flags 0x%.6x (was 0x%.6x, now 0x%.6x, %lu)",
                   action->uuid, action->node ? action->node->details->uname : "[none]",
                   clear ? "un-" : "", flags, last, action->flags, calls);
     }
 
     return changed;
 }
 
 static gboolean
 check_rsc_parameters(resource_t * rsc, node_t * node, xmlNode * rsc_entry,
                      gboolean active_here, pe_working_set_t * data_set)
 {
     int attr_lpc = 0;
     gboolean force_restart = FALSE;
     gboolean delete_resource = FALSE;
     gboolean changed = FALSE;
 
     const char *value = NULL;
     const char *old_value = NULL;
 
     const char *attr_list[] = {
         XML_ATTR_TYPE,
         XML_AGENT_ATTR_CLASS,
         XML_AGENT_ATTR_PROVIDER
     };
 
     for (; attr_lpc < DIMOF(attr_list); attr_lpc++) {
         value = crm_element_value(rsc->xml, attr_list[attr_lpc]);
         old_value = crm_element_value(rsc_entry, attr_list[attr_lpc]);
         if (value == old_value  /* ie. NULL */
             || crm_str_eq(value, old_value, TRUE)) {
             continue;
         }
 
         changed = TRUE;
         trigger_unfencing(rsc, node, "Device definition changed", NULL, data_set);
         if (active_here) {
             force_restart = TRUE;
             crm_notice("Forcing restart of %s on %s, %s changed: %s -> %s",
                        rsc->id, node->details->uname, attr_list[attr_lpc],
                        crm_str(old_value), crm_str(value));
         }
     }
     if (force_restart) {
         /* make sure the restart happens */
         stop_action(rsc, node, FALSE);
         set_bit(rsc->flags, pe_rsc_start_pending);
         delete_resource = TRUE;
 
     } else if (changed) {
         delete_resource = TRUE;
     }
     return delete_resource;
 }
 
 static void
 CancelXmlOp(resource_t * rsc, xmlNode * xml_op, node_t * active_node,
             const char *reason, pe_working_set_t * data_set)
 {
     int interval = 0;
     action_t *cancel = NULL;
 
     char *key = NULL;
     const char *task = NULL;
     const char *call_id = NULL;
     const char *interval_s = NULL;
 
     CRM_CHECK(xml_op != NULL, return);
     CRM_CHECK(active_node != NULL, return);
 
     task = crm_element_value(xml_op, XML_LRM_ATTR_TASK);
     call_id = crm_element_value(xml_op, XML_LRM_ATTR_CALLID);
     interval_s = crm_element_value(xml_op, XML_LRM_ATTR_INTERVAL);
 
     interval = crm_parse_int(interval_s, "0");
 
     /* we need to reconstruct the key because of the way we used to construct resource IDs */
     key = generate_op_key(rsc->id, task, interval);
 
     crm_info("Action %s on %s will be stopped: %s",
              key, active_node->details->uname, reason ? reason : "unknown");
 
     /* TODO: This looks highly dangerous if we ever try to schedule 'key' too */
     cancel = custom_action(rsc, strdup(key), RSC_CANCEL, active_node, FALSE, TRUE, data_set);
 
     free(cancel->task);
     free(cancel->cancel_task);
     cancel->task = strdup(RSC_CANCEL);
     cancel->cancel_task = strdup(task);
 
     add_hash_param(cancel->meta, XML_LRM_ATTR_TASK, task);
     add_hash_param(cancel->meta, XML_LRM_ATTR_CALLID, call_id);
     add_hash_param(cancel->meta, XML_LRM_ATTR_INTERVAL, interval_s);
 
     custom_action_order(rsc, stop_key(rsc), NULL, rsc, NULL, cancel, pe_order_optional, data_set);
     free(key);
     key = NULL;
 }
 
 static gboolean
 check_action_definition(resource_t * rsc, node_t * active_node, xmlNode * xml_op,
                         pe_working_set_t * data_set)
 {
     char *key = NULL;
     int interval = 0;
     const char *interval_s = NULL;
     const op_digest_cache_t *digest_data = NULL;
     gboolean did_change = FALSE;
 
     const char *task = crm_element_value(xml_op, XML_LRM_ATTR_TASK);
     const char *op_version;
     const char *digest_secure = NULL;
 
     CRM_CHECK(active_node != NULL, return FALSE);
     if (safe_str_eq(task, RSC_STOP)) {
         return FALSE;
     }
 
     interval_s = crm_element_value(xml_op, XML_LRM_ATTR_INTERVAL);
     interval = crm_parse_int(interval_s, "0");
 
     if (interval > 0) {
         xmlNode *op_match = NULL;
 
         /* we need to reconstruct the key because of the way we used to construct resource IDs */
         key = generate_op_key(rsc->id, task, interval);
 
         pe_rsc_trace(rsc, "Checking parameters for %s", key);
         op_match = find_rsc_op_entry(rsc, key);
 
         if (op_match == NULL && is_set(data_set->flags, pe_flag_stop_action_orphans)) {
             CancelXmlOp(rsc, xml_op, active_node, "orphan", data_set);
             free(key);
             return TRUE;
 
         } else if (op_match == NULL) {
             pe_rsc_debug(rsc, "Orphan action detected: %s on %s", key, active_node->details->uname);
             free(key);
             return TRUE;
         }
         free(key);
         key = NULL;
     }
 
     crm_trace("Testing %s_%s_%d on %s", rsc->id, task, interval, active_node?active_node->details->uname:"N/A");
     if (interval == 0 && safe_str_eq(task, RSC_STATUS)) {
         /* Reload based on the start action not a probe */
         task = RSC_START;
 
     } else if (interval == 0 && safe_str_eq(task, RSC_MIGRATED)) {
         /* Reload based on the start action not a migrate */
         task = RSC_START;
     } else if (interval == 0 && safe_str_eq(task, RSC_PROMOTE)) {
         /* Reload based on the start action not a promote */
         task = RSC_START;
     }
 
     op_version = crm_element_value(xml_op, XML_ATTR_CRM_VERSION);
     digest_data = rsc_action_digest_cmp(rsc, xml_op, active_node, data_set);
 
     if(is_set(data_set->flags, pe_flag_sanitized)) {
         digest_secure = crm_element_value(xml_op, XML_LRM_ATTR_SECURE_DIGEST);
     }
 
     if(digest_data->rc != RSC_DIGEST_MATCH
        && digest_secure
        && digest_data->digest_secure_calc
        && strcmp(digest_data->digest_secure_calc, digest_secure) == 0) {
         fprintf(stdout, "Only 'private' parameters to %s_%s_%d on %s changed: %s\n",
                 rsc->id, task, interval, active_node->details->uname,
                 crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC));
 
     } else if (digest_data->rc == RSC_DIGEST_RESTART) {
         /* Changes that force a restart */
         const char *digest_restart = crm_element_value(xml_op, XML_LRM_ATTR_RESTART_DIGEST);
 
         did_change = TRUE;
         key = generate_op_key(rsc->id, task, interval);
         crm_log_xml_info(digest_data->params_restart, "params:restart");
         pe_rsc_info(rsc, "Parameters to %s on %s changed: was %s vs. now %s (restart:%s) %s",
                  key, active_node->details->uname,
                  crm_str(digest_restart), digest_data->digest_restart_calc,
                  op_version, crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC));
 
         custom_action(rsc, key, task, NULL, FALSE, TRUE, data_set);
         trigger_unfencing(rsc, NULL, "Device parameters changed", NULL, data_set);
 
     } else if ((digest_data->rc == RSC_DIGEST_ALL) || (digest_data->rc == RSC_DIGEST_UNKNOWN)) {
         /* Changes that can potentially be handled by a reload */
         const char *digest_restart = crm_element_value(xml_op, XML_LRM_ATTR_RESTART_DIGEST);
         const char *digest_all = crm_element_value(xml_op, XML_LRM_ATTR_OP_DIGEST);
 
         did_change = TRUE;
         trigger_unfencing(rsc, NULL, "Device parameters changed (reload)", NULL, data_set);
         crm_log_xml_info(digest_data->params_all, "params:reload");
         key = generate_op_key(rsc->id, task, interval);
         pe_rsc_info(rsc, "Parameters to %s on %s changed: was %s vs. now %s (reload:%s) %s",
                  key, active_node->details->uname,
                  crm_str(digest_all), digest_data->digest_all_calc, op_version,
                  crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC));
 
         if (interval > 0) {
             action_t *op = NULL;
 
 #if 0
             /* Always reload/restart the entire resource */
             op = custom_action(rsc, start_key(rsc), RSC_START, NULL, FALSE, TRUE, data_set);
             update_action_flags(op, pe_action_allow_reload_conversion);
 #else
             /* Re-sending the recurring op is sufficient - the old one will be cancelled automatically */
             op = custom_action(rsc, key, task, active_node, TRUE, TRUE, data_set);
             set_bit(op->flags, pe_action_reschedule);
 #endif
 
         } else if (digest_restart && rsc->isolation_wrapper == NULL && (uber_parent(rsc))->isolation_wrapper == NULL) {
             pe_rsc_trace(rsc, "Reloading '%s' action for resource %s", task, rsc->id);
 
             /* Allow this resource to reload - unless something else causes a full restart */
             set_bit(rsc->flags, pe_rsc_try_reload);
 
             /* Create these for now, it keeps the action IDs the same in the regression outputs */
             custom_action(rsc, key, task, NULL, TRUE, TRUE, data_set);
 
         } else {
             pe_rsc_trace(rsc, "Resource %s doesn't know how to reload", rsc->id);
 
             /* Re-send the start/demote/promote op
              * Recurring ops will be detected independantly
              */
             custom_action(rsc, key, task, NULL, FALSE, TRUE, data_set);
         }
     }
 
     return did_change;
 }
 
 extern gboolean DeleteRsc(resource_t * rsc, node_t * node, gboolean optional,
                           pe_working_set_t * data_set);
 
 static void
 check_actions_for(xmlNode * rsc_entry, resource_t * rsc, node_t * node, pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
     int offset = -1;
     int interval = 0;
     int stop_index = 0;
     int start_index = 0;
 
     const char *task = NULL;
     const char *interval_s = NULL;
 
     xmlNode *rsc_op = NULL;
     GListPtr op_list = NULL;
     GListPtr sorted_op_list = NULL;
     gboolean is_probe = FALSE;
     gboolean did_change = FALSE;
 
     CRM_CHECK(node != NULL, return);
 
     if (is_set(rsc->flags, pe_rsc_orphan)) {
         resource_t *parent = uber_parent(rsc);
         if(parent == NULL
            || parent->variant < pe_clone
            || is_set(parent->flags, pe_rsc_unique)) {
             pe_rsc_trace(rsc, "Skipping param check for %s and deleting: orphan", rsc->id);
             DeleteRsc(rsc, node, FALSE, data_set);
         } else {
             pe_rsc_trace(rsc, "Skipping param check for %s (orphan clone)", rsc->id);
         }
         return;
 
     } else if (pe_find_node_id(rsc->running_on, node->details->id) == NULL) {
         if (check_rsc_parameters(rsc, node, rsc_entry, FALSE, data_set)) {
             DeleteRsc(rsc, node, FALSE, data_set);
         }
         pe_rsc_trace(rsc, "Skipping param check for %s: no longer active on %s",
                      rsc->id, node->details->uname);
         return;
     }
 
     pe_rsc_trace(rsc, "Processing %s on %s", rsc->id, node->details->uname);
 
     if (check_rsc_parameters(rsc, node, rsc_entry, TRUE, data_set)) {
         DeleteRsc(rsc, node, FALSE, data_set);
     }
 
     for (rsc_op = __xml_first_child(rsc_entry); rsc_op != NULL; rsc_op = __xml_next_element(rsc_op)) {
         if (crm_str_eq((const char *)rsc_op->name, XML_LRM_TAG_RSC_OP, TRUE)) {
             op_list = g_list_prepend(op_list, rsc_op);
         }
     }
 
     sorted_op_list = g_list_sort(op_list, sort_op_by_callid);
     calculate_active_ops(sorted_op_list, &start_index, &stop_index);
 
     for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) {
         xmlNode *rsc_op = (xmlNode *) gIter->data;
 
         offset++;
 
         if (start_index < stop_index) {
             /* stopped */
             continue;
         } else if (offset < start_index) {
             /* action occurred prior to a start */
             continue;
         }
 
         is_probe = FALSE;
         did_change = FALSE;
         task = crm_element_value(rsc_op, XML_LRM_ATTR_TASK);
 
         interval_s = crm_element_value(rsc_op, XML_LRM_ATTR_INTERVAL);
         interval = crm_parse_int(interval_s, "0");
 
         if (interval == 0 && safe_str_eq(task, RSC_STATUS)) {
             is_probe = TRUE;
         }
 
         if (interval > 0 &&
             (is_set(rsc->flags, pe_rsc_maintenance) || node->details->maintenance)) {
             CancelXmlOp(rsc, rsc_op, node, "maintenance mode", data_set);
 
         } else if (is_probe || safe_str_eq(task, RSC_START) || safe_str_eq(task, RSC_PROMOTE) || interval > 0
                    || safe_str_eq(task, RSC_MIGRATED)) {
             did_change = check_action_definition(rsc, node, rsc_op, data_set);
         }
 
         if (did_change && get_failcount(node, rsc, NULL, data_set)) {
             char *key = NULL;
             action_t *action_clear = NULL;
 
             key = generate_op_key(rsc->id, CRM_OP_CLEAR_FAILCOUNT, 0);
             action_clear =
                 custom_action(rsc, key, CRM_OP_CLEAR_FAILCOUNT, node, FALSE, TRUE, data_set);
             set_bit(action_clear->flags, pe_action_runnable);
         }
     }
 
     g_list_free(sorted_op_list);
 
 }
 
 static GListPtr
 find_rsc_list(GListPtr result, resource_t * rsc, const char *id, gboolean renamed_clones,
               gboolean partial, pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
     gboolean match = FALSE;
 
     if (id == NULL) {
         return NULL;
 
     } else if (rsc == NULL && data_set) {
 
         for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) {
             resource_t *child = (resource_t *) gIter->data;
 
             result = find_rsc_list(result, child, id, renamed_clones, partial, NULL);
         }
 
         return result;
 
     } else if (rsc == NULL) {
         return NULL;
     }
 
     if (partial) {
         if (strstr(rsc->id, id)) {
             match = TRUE;
 
         } else if (renamed_clones && rsc->clone_name && strstr(rsc->clone_name, id)) {
             match = TRUE;
         }
 
     } else {
         if (strcmp(rsc->id, id) == 0) {
             match = TRUE;
 
         } else if (renamed_clones && rsc->clone_name && strcmp(rsc->clone_name, id) == 0) {
             match = TRUE;
         }
     }
 
     if (match) {
         result = g_list_prepend(result, rsc);
     }
 
     if (rsc->children) {
         gIter = rsc->children;
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child = (resource_t *) gIter->data;
 
             result = find_rsc_list(result, child, id, renamed_clones, partial, NULL);
         }
     }
 
     return result;
 }
 
 static void
 check_actions(pe_working_set_t * data_set)
 {
     const char *id = NULL;
     node_t *node = NULL;
     xmlNode *lrm_rscs = NULL;
     xmlNode *status = get_object_root(XML_CIB_TAG_STATUS, data_set->input);
 
     xmlNode *node_state = NULL;
 
     for (node_state = __xml_first_child(status); node_state != NULL;
          node_state = __xml_next_element(node_state)) {
         if (crm_str_eq((const char *)node_state->name, XML_CIB_TAG_STATE, TRUE)) {
             id = crm_element_value(node_state, XML_ATTR_ID);
             lrm_rscs = find_xml_node(node_state, XML_CIB_TAG_LRM, FALSE);
             lrm_rscs = find_xml_node(lrm_rscs, XML_LRM_TAG_RESOURCES, FALSE);
 
             node = pe_find_node_id(data_set->nodes, id);
 
             if (node == NULL) {
                 continue;
 
             /* Still need to check actions for a maintenance node to cancel existing monitor operations */
             } else if (can_run_resources(node) == FALSE && node->details->maintenance == FALSE) {
                 crm_trace("Skipping param check for %s: cant run resources", node->details->uname);
                 continue;
             }
 
             crm_trace("Processing node %s", node->details->uname);
             if (node->details->online || is_set(data_set->flags, pe_flag_stonith_enabled)) {
                 xmlNode *rsc_entry = NULL;
 
                 for (rsc_entry = __xml_first_child(lrm_rscs); rsc_entry != NULL;
                      rsc_entry = __xml_next_element(rsc_entry)) {
                     if (crm_str_eq((const char *)rsc_entry->name, XML_LRM_TAG_RESOURCE, TRUE)) {
 
                         if (xml_has_children(rsc_entry)) {
                             GListPtr gIter = NULL;
                             GListPtr result = NULL;
                             const char *rsc_id = ID(rsc_entry);
 
                             CRM_CHECK(rsc_id != NULL, return);
 
                             result = find_rsc_list(NULL, NULL, rsc_id, TRUE, FALSE, data_set);
                             for (gIter = result; gIter != NULL; gIter = gIter->next) {
                                 resource_t *rsc = (resource_t *) gIter->data;
 
                                 if (rsc->variant != pe_native) {
                                     continue;
                                 }
                                 check_actions_for(rsc_entry, rsc, node, data_set);
                             }
                             g_list_free(result);
                         }
                     }
                 }
             }
         }
     }
 }
 
 static gboolean
 apply_placement_constraints(pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
 
     crm_trace("Applying constraints...");
 
     for (gIter = data_set->placement_constraints; gIter != NULL; gIter = gIter->next) {
         rsc_to_node_t *cons = (rsc_to_node_t *) gIter->data;
 
         cons->rsc_lh->cmds->rsc_location(cons->rsc_lh, cons);
     }
 
     return TRUE;
 
 }
 
 static gboolean
 failcount_clear_action_exists(node_t * node, resource_t * rsc)
 {
     gboolean rc = FALSE;
     char *key = crm_concat(rsc->id, CRM_OP_CLEAR_FAILCOUNT, '_');
     GListPtr list = find_actions_exact(rsc->actions, key, node);
 
     if (list) {
         rc = TRUE;
     }
     g_list_free(list);
     free(key);
 
     return rc;
 }
 
 static void
 common_apply_stickiness(resource_t * rsc, node_t * node, pe_working_set_t * data_set)
 {
     int fail_count = 0;
     resource_t *failed = rsc;
 
     if (rsc->children) {
         GListPtr gIter = rsc->children;
 
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child_rsc = (resource_t *) gIter->data;
 
             common_apply_stickiness(child_rsc, node, data_set);
         }
         return;
     }
 
     if (is_set(rsc->flags, pe_rsc_managed)
         && rsc->stickiness != 0 && g_list_length(rsc->running_on) == 1) {
         node_t *current = pe_find_node_id(rsc->running_on, node->details->id);
         node_t *match = pe_hash_table_lookup(rsc->allowed_nodes, node->details->id);
 
         if (current == NULL) {
 
         } else if (match != NULL || is_set(data_set->flags, pe_flag_symmetric_cluster)) {
             resource_t *sticky_rsc = rsc;
 
             resource_location(sticky_rsc, node, rsc->stickiness, "stickiness", data_set);
             pe_rsc_debug(sticky_rsc, "Resource %s: preferring current location"
                          " (node=%s, weight=%d)", sticky_rsc->id,
                          node->details->uname, rsc->stickiness);
         } else {
             GHashTableIter iter;
             node_t *nIter = NULL;
 
             pe_rsc_debug(rsc, "Ignoring stickiness for %s: the cluster is asymmetric"
                          " and node %s is not explicitly allowed", rsc->id, node->details->uname);
             g_hash_table_iter_init(&iter, rsc->allowed_nodes);
             while (g_hash_table_iter_next(&iter, NULL, (void **)&nIter)) {
                 crm_err("%s[%s] = %d", rsc->id, nIter->details->uname, nIter->weight);
             }
         }
     }
 
     /* only check failcount here if a failcount clear action
      * has not already been placed for this resource on the node.
      * There is no sense in potentially forcing the rsc from this
      * node if the failcount is being reset anyway. */
     if (failcount_clear_action_exists(node, rsc) == FALSE) {
         fail_count = get_failcount_all(node, rsc, NULL, data_set);
     }
 
     if (fail_count > 0 && rsc->migration_threshold != 0) {
         if (is_not_set(rsc->flags, pe_rsc_unique)) {
             failed = uber_parent(rsc);
         }
         if (rsc->migration_threshold <= fail_count) {
             resource_location(failed, node, -INFINITY, "__fail_limit__", data_set);
             crm_warn("Forcing %s away from %s after %d failures (max=%d)",
                      failed->id, node->details->uname, fail_count, rsc->migration_threshold);
         } else {
             crm_info("%s can fail %d more times on %s before being forced off",
                      failed->id, rsc->migration_threshold - fail_count, node->details->uname);
         }
     }
 }
 
 static void
 complex_set_cmds(resource_t * rsc)
 {
     GListPtr gIter = rsc->children;
 
     rsc->cmds = &resource_class_alloc_functions[rsc->variant];
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         complex_set_cmds(child_rsc);
     }
 }
 
 void
 set_alloc_actions(pe_working_set_t * data_set)
 {
 
     GListPtr gIter = data_set->resources;
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *rsc = (resource_t *) gIter->data;
 
         complex_set_cmds(rsc);
     }
 }
 
 static void
 calculate_system_health(gpointer gKey, gpointer gValue, gpointer user_data)
 {
     const char *key = (const char *)gKey;
     const char *value = (const char *)gValue;
     int *system_health = (int *)user_data;
 
     if (!gKey || !gValue || !user_data) {
         return;
     }
 
     /* Does it start with #health? */
     if (0 == strncmp(key, "#health", 7)) {
         int score;
 
         /* Convert the value into an integer */
         score = char2score(value);
 
         /* Add it to the running total */
         *system_health = merge_weights(score, *system_health);
     }
 }
 
 static gboolean
 apply_system_health(pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
     const char *health_strategy = pe_pref(data_set->config_hash, "node-health-strategy");
 
     if (health_strategy == NULL || safe_str_eq(health_strategy, "none")) {
         /* Prevent any accidental health -> score translation */
         node_score_red = 0;
         node_score_yellow = 0;
         node_score_green = 0;
         return TRUE;
 
     } else if (safe_str_eq(health_strategy, "migrate-on-red")) {
 
         /* Resources on nodes which have health values of red are
          * weighted away from that node.
          */
         node_score_red = -INFINITY;
         node_score_yellow = 0;
         node_score_green = 0;
 
     } else if (safe_str_eq(health_strategy, "only-green")) {
 
         /* Resources on nodes which have health values of red or yellow
          * are forced away from that node.
          */
         node_score_red = -INFINITY;
         node_score_yellow = -INFINITY;
         node_score_green = 0;
 
     } else if (safe_str_eq(health_strategy, "progressive")) {
         /* Same as the above, but use the r/y/g scores provided by the user
          * Defaults are provided by the pe_prefs table
          */
 
     } else if (safe_str_eq(health_strategy, "custom")) {
 
         /* Requires the admin to configure the rsc_location constaints for
          * processing the stored health scores
          */
         /* TODO: Check for the existance of appropriate node health constraints */
         return TRUE;
 
     } else {
         crm_err("Unknown node health strategy: %s", health_strategy);
         return FALSE;
     }
 
     crm_info("Applying automated node health strategy: %s", health_strategy);
 
     for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) {
         int system_health = 0;
         node_t *node = (node_t *) gIter->data;
 
         /* Search through the node hash table for system health entries. */
         g_hash_table_foreach(node->details->attrs, calculate_system_health, &system_health);
 
         crm_info(" Node %s has an combined system health of %d",
                  node->details->uname, system_health);
 
         /* If the health is non-zero, then create a new rsc2node so that the
          * weight will be added later on.
          */
         if (system_health != 0) {
 
             GListPtr gIter2 = data_set->resources;
 
             for (; gIter2 != NULL; gIter2 = gIter2->next) {
                 resource_t *rsc = (resource_t *) gIter2->data;
 
                 rsc2node_new(health_strategy, rsc, system_health, NULL, node, data_set);
             }
         }
 
     }
 
     return TRUE;
 }
 
 gboolean
 stage0(pe_working_set_t * data_set)
 {
     xmlNode *cib_constraints = get_object_root(XML_CIB_TAG_CONSTRAINTS, data_set->input);
 
     if (data_set->input == NULL) {
         return FALSE;
     }
 
     if (is_set(data_set->flags, pe_flag_have_status) == FALSE) {
         crm_trace("Calculating status");
         cluster_status(data_set);
     }
 
     set_alloc_actions(data_set);
     apply_system_health(data_set);
     unpack_constraints(cib_constraints, data_set);
 
     return TRUE;
 }
 
 static void
 wait_for_probe(resource_t * rsc, const char *action, action_t * probe_complete,
                pe_working_set_t * data_set)
 {
     if (probe_complete == NULL) {
         return;
     }
 
     if (rsc->children) {
         GListPtr gIter = rsc->children;
 
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child = (resource_t *) gIter->data;
 
             wait_for_probe(child, action, probe_complete, data_set);
         }
 
     } else {
         char *key = NULL;
 
         if (safe_str_eq(action, RSC_STOP) && g_list_length(rsc->running_on) == 1) {
             node_t *node = (node_t *) rsc->running_on->data;
 
             /* Stop actions on nodes that are shutting down do not need to wait for probes to complete
              * Doing so prevents node shutdown in the presence of nodes that are coming up
              * The purpose of waiting is to not stop resources until we know for sure the
              *  intended destination is able to take them
              */
             if (node && node->details->shutdown) {
                 crm_debug("Skipping %s before %s_%s_0 due to %s shutdown",
                           probe_complete->uuid, rsc->id, action, node->details->uname);
                 return;
             }
         }
 
         key = generate_op_key(rsc->id, action, 0);
         custom_action_order(NULL, NULL, probe_complete, rsc, key, NULL,
                             pe_order_optional, data_set);
     }
 }
 
 /*
  * Check nodes for resources started outside of the LRM
  */
 gboolean
 probe_resources(pe_working_set_t * data_set)
 {
     action_t *probe_complete = NULL;
     action_t *probe_node_complete = NULL;
     action_t *probe_cluster_nodes_complete = NULL;
 
     GListPtr gIter = NULL;
     GListPtr gIter2 = NULL;
 
     gIter = data_set->nodes;
     for (; gIter != NULL; gIter = gIter->next) {
         node_t *node = (node_t *) gIter->data;
         const char *probed = g_hash_table_lookup(node->details->attrs, CRM_OP_PROBED);
 
         if (node->details->online == FALSE) {
             continue;
 
         } else if (node->details->unclean) {
             continue;
 
         } else if (is_remote_node(node) && node->details->shutdown) {
             /* Don't try and probe a remote node we're shutting down.
              * It causes constraint conflicts to try and run any sort of action
              * other that 'stop' on resources living within a remote-node when
              * it is being shutdown. */
             continue;
 
         } else if (is_container_remote_node(node)) {
             /* TODO enable container node probes once ordered probing is implemented. */
             continue;
 
         } else if (node->details->rsc_discovery_enabled == FALSE) {
             /* resource discovery is disabled for this node */
             continue;
 
         } else if (probe_complete == NULL) {
             probe_complete = get_pseudo_op(CRM_OP_PROBED, data_set);
             if (is_set(data_set->flags, pe_flag_have_remote_nodes)) {
                 probe_cluster_nodes_complete = get_pseudo_op(CRM_OP_NODES_PROBED, data_set);
             }
         }
 
         if (probed != NULL && crm_is_true(probed) == FALSE) {
             action_t *probe_op = custom_action(NULL, crm_strdup_printf("%s-%s", CRM_OP_REPROBE, node->details->uname),
                                                CRM_OP_REPROBE, node, FALSE, TRUE, data_set);
 
             add_hash_param(probe_op->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE);
             continue;
         }
 
         probe_node_complete = custom_action(NULL, crm_strdup_printf("%s-%s", CRM_OP_PROBED, node->details->uname),
                                             CRM_OP_PROBED, node, FALSE, TRUE, data_set);
         if (crm_is_true(probed)) {
             crm_trace("unset");
             update_action_flags(probe_node_complete, pe_action_optional);
         } else {
             crm_trace("set");
             update_action_flags(probe_node_complete, pe_action_optional | pe_action_clear);
         }
         crm_trace("%s - %d", node->details->uname, probe_node_complete->flags & pe_action_optional);
         probe_node_complete->priority = INFINITY;
         add_hash_param(probe_node_complete->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE);
 
         if (node->details->pending) {
             update_action_flags(probe_node_complete, pe_action_runnable | pe_action_clear);
             crm_info("Action %s on %s is unrunnable (pending)",
                      probe_node_complete->uuid, probe_node_complete->node->details->uname);
         }
 
         if (is_remote_node(node)) {
             order_actions(probe_node_complete, probe_complete,
                       pe_order_runnable_left /*|pe_order_implies_then */ );
         } else if (probe_cluster_nodes_complete == NULL) {
             order_actions(probe_node_complete, probe_complete,
                       pe_order_runnable_left /*|pe_order_implies_then */ );
         } else {
             order_actions(probe_node_complete, probe_cluster_nodes_complete,
                       pe_order_runnable_left /*|pe_order_implies_then */ );
         }
 
         gIter2 = data_set->resources;
         for (; gIter2 != NULL; gIter2 = gIter2->next) {
             resource_t *rsc = (resource_t *) gIter2->data;
 
             if (rsc->cmds->create_probe(rsc, node, probe_node_complete, FALSE, data_set)) {
                 update_action_flags(probe_complete, pe_action_optional | pe_action_clear);
                 update_action_flags(probe_node_complete, pe_action_optional | pe_action_clear);
 
                 if (probe_cluster_nodes_complete
                     && (rsc->is_remote_node || rsc_contains_remote_node(data_set, rsc))) {
                     update_action_flags(probe_cluster_nodes_complete, pe_action_optional | pe_action_clear);
                     /* allow remote connection resources and resources
                      * containing remote connection resources to run after all
                      * cluster nodes are probed */
                     wait_for_probe(rsc, RSC_START, probe_cluster_nodes_complete, data_set);
                 } else {
                     wait_for_probe(rsc, RSC_START, probe_complete, data_set);
                 }
             }
         }
     }
 
     gIter = data_set->resources;
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *rsc = (resource_t *) gIter->data;
 
         if (rsc->is_remote_node || rsc_contains_remote_node(data_set, rsc)) {
             /* allow remote connection resources and any resources containing
              * remote connection resources to run after cluster nodes are probed.*/
             wait_for_probe(rsc, RSC_STOP, probe_cluster_nodes_complete, data_set);
         } else {
             wait_for_probe(rsc, RSC_STOP, probe_complete, data_set);
         }
     }
 
     return TRUE;
 }
 
 static void
 rsc_discover_filter(resource_t *rsc, node_t *node)
 {
     GListPtr gIter = rsc->children;
     resource_t *top = uber_parent(rsc);
     node_t *match;
 
     if (rsc->exclusive_discover == FALSE && top->exclusive_discover == FALSE) {
         return;
     }
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
         rsc_discover_filter(child_rsc, node);
     }
 
     match = g_hash_table_lookup(rsc->allowed_nodes, node->details->id);
     if (match && match->rsc_discover_mode != discover_exclusive) {
         match->weight = -INFINITY;
     }
 }
 
 /*
  * Count how many valid nodes we have (so we know the maximum number of
  *  colors we can resolve).
  *
  * Apply node constraints (ie. filter the "allowed_nodes" part of resources
  */
 gboolean
 stage2(pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
 
     crm_trace("Applying placement constraints");
 
     gIter = data_set->nodes;
     for (; gIter != NULL; gIter = gIter->next) {
         node_t *node = (node_t *) gIter->data;
 
         if (node == NULL) {
             /* error */
 
         } else if (node->weight >= 0.0  /* global weight */
                    && node->details->online && node->details->type != node_ping) {
             data_set->max_valid_nodes++;
         }
     }
 
     apply_placement_constraints(data_set);
 
     gIter = data_set->nodes;
     for (; gIter != NULL; gIter = gIter->next) {
         GListPtr gIter2 = NULL;
         node_t *node = (node_t *) gIter->data;
 
         gIter2 = data_set->resources;
         for (; gIter2 != NULL; gIter2 = gIter2->next) {
             resource_t *rsc = (resource_t *) gIter2->data;
 
             common_apply_stickiness(rsc, node, data_set);
             rsc_discover_filter(rsc, node);
         }
     }
 
     return TRUE;
 }
 
 /*
  * Create internal resource constraints before allocation
  */
 gboolean
 stage3(pe_working_set_t * data_set)
 {
 
     GListPtr gIter = data_set->resources;
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *rsc = (resource_t *) gIter->data;
 
         rsc->cmds->internal_constraints(rsc, data_set);
     }
 
     return TRUE;
 }
 
 /*
  * Check for orphaned or redefined actions
  */
 gboolean
 stage4(pe_working_set_t * data_set)
 {
     check_actions(data_set);
     return TRUE;
 }
 
 static gint
 sort_rsc_process_order(gconstpointer a, gconstpointer b, gpointer data)
 {
     int rc = 0;
     int r1_weight = -INFINITY;
     int r2_weight = -INFINITY;
 
     const char *reason = "existance";
 
     const GListPtr nodes = (GListPtr) data;
     resource_t *resource1 = (resource_t *) convert_const_pointer(a);
     resource_t *resource2 = (resource_t *) convert_const_pointer(b);
 
     node_t *r1_node = NULL;
     node_t *r2_node = NULL;
     GListPtr gIter = NULL;
     GHashTable *r1_nodes = NULL;
     GHashTable *r2_nodes = NULL;
 
     if (a == NULL && b == NULL) {
         goto done;
     }
     if (a == NULL) {
         return 1;
     }
     if (b == NULL) {
         return -1;
     }
 
     reason = "priority";
     r1_weight = resource1->priority;
     r2_weight = resource2->priority;
 
     if (r1_weight > r2_weight) {
         rc = -1;
         goto done;
     }
 
     if (r1_weight < r2_weight) {
         rc = 1;
         goto done;
     }
 
     reason = "no node list";
     if (nodes == NULL) {
         goto done;
     }
 
     r1_nodes =
         rsc_merge_weights(resource1, resource1->id, NULL, NULL, 1,
                           pe_weights_forward | pe_weights_init);
     dump_node_scores(LOG_TRACE, NULL, resource1->id, r1_nodes);
     r2_nodes =
         rsc_merge_weights(resource2, resource2->id, NULL, NULL, 1,
                           pe_weights_forward | pe_weights_init);
     dump_node_scores(LOG_TRACE, NULL, resource2->id, r2_nodes);
 
     /* Current location score */
     reason = "current location";
     r1_weight = -INFINITY;
     r2_weight = -INFINITY;
 
     if (resource1->running_on) {
         r1_node = g_list_nth_data(resource1->running_on, 0);
         r1_node = g_hash_table_lookup(r1_nodes, r1_node->details->id);
         if (r1_node != NULL) {
             r1_weight = r1_node->weight;
         }
     }
     if (resource2->running_on) {
         r2_node = g_list_nth_data(resource2->running_on, 0);
         r2_node = g_hash_table_lookup(r2_nodes, r2_node->details->id);
         if (r2_node != NULL) {
             r2_weight = r2_node->weight;
         }
     }
 
     if (r1_weight > r2_weight) {
         rc = -1;
         goto done;
     }
 
     if (r1_weight < r2_weight) {
         rc = 1;
         goto done;
     }
 
     reason = "score";
     for (gIter = nodes; gIter != NULL; gIter = gIter->next) {
         node_t *node = (node_t *) gIter->data;
 
         r1_node = NULL;
         r2_node = NULL;
 
         r1_weight = -INFINITY;
         if (r1_nodes) {
             r1_node = g_hash_table_lookup(r1_nodes, node->details->id);
         }
         if (r1_node) {
             r1_weight = r1_node->weight;
         }
 
         r2_weight = -INFINITY;
         if (r2_nodes) {
             r2_node = g_hash_table_lookup(r2_nodes, node->details->id);
         }
         if (r2_node) {
             r2_weight = r2_node->weight;
         }
 
         if (r1_weight > r2_weight) {
             rc = -1;
             goto done;
         }
 
         if (r1_weight < r2_weight) {
             rc = 1;
             goto done;
         }
     }
 
   done:
     crm_trace("%s (%d) on %s %c %s (%d) on %s: %s",
               resource1->id, r1_weight, r1_node ? r1_node->details->id : "n/a",
               rc < 0 ? '>' : rc > 0 ? '<' : '=',
               resource2->id, r2_weight, r2_node ? r2_node->details->id : "n/a", reason);
 
     if (r1_nodes) {
         g_hash_table_destroy(r1_nodes);
     }
     if (r2_nodes) {
         g_hash_table_destroy(r2_nodes);
     }
 
     return rc;
 }
 
 static void
 allocate_resources(pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
 
     if (is_set(data_set->flags, pe_flag_have_remote_nodes)) {
         /* Force remote connection resources to be allocated first. This
          * also forces any colocation dependencies to be allocated as well */
         for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) {
             resource_t *rsc = (resource_t *) gIter->data;
             if (rsc->is_remote_node == FALSE) {
                 continue;
             }
             pe_rsc_trace(rsc, "Allocating: %s", rsc->id);
             /* for remote node connection resources, always prefer the partial migration
              * target during resource allocation if the rsc is in the middle of a
              * migration */ 
             rsc->cmds->allocate(rsc, rsc->partial_migration_target, data_set);
         }
     }
 
     /* now do the rest of the resources */
     for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) {
         resource_t *rsc = (resource_t *) gIter->data;
         if (rsc->is_remote_node == TRUE) {
             continue;
         }
         pe_rsc_trace(rsc, "Allocating: %s", rsc->id);
         rsc->cmds->allocate(rsc, NULL, data_set);
     }
 }
 
 gboolean
 stage5(pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
 
     if (safe_str_neq(data_set->placement_strategy, "default")) {
         GListPtr nodes = g_list_copy(data_set->nodes);
 
         nodes = g_list_sort_with_data(nodes, sort_node_weight, NULL);
 
         data_set->resources =
             g_list_sort_with_data(data_set->resources, sort_rsc_process_order, nodes);
 
         g_list_free(nodes);
     }
 
     gIter = data_set->nodes;
     for (; gIter != NULL; gIter = gIter->next) {
         node_t *node = (node_t *) gIter->data;
 
         dump_node_capacity(show_utilization ? 0 : utilization_log_level, "Original", node);
     }
 
     crm_trace("Allocating services");
     /* Take (next) highest resource, assign it and create its actions */
 
     allocate_resources(data_set);
 
     gIter = data_set->nodes;
     for (; gIter != NULL; gIter = gIter->next) {
         node_t *node = (node_t *) gIter->data;
 
         dump_node_capacity(show_utilization ? 0 : utilization_log_level, "Remaining", node);
     }
 
     if (is_set(data_set->flags, pe_flag_startup_probes)) {
         crm_trace("Calculating needed probes");
         /* This code probably needs optimization
          * ptest -x with 100 nodes, 100 clones and clone-max=100:
 
          With probes:
 
          ptest[14781]: 2010/09/27_17:56:46 notice: TRACE: do_calculations: pengine.c:258 Calculate cluster status
          ptest[14781]: 2010/09/27_17:56:46 notice: TRACE: do_calculations: pengine.c:278 Applying placement constraints
          ptest[14781]: 2010/09/27_17:56:47 notice: TRACE: do_calculations: pengine.c:285 Create internal constraints
          ptest[14781]: 2010/09/27_17:56:47 notice: TRACE: do_calculations: pengine.c:292 Check actions
          ptest[14781]: 2010/09/27_17:56:48 notice: TRACE: do_calculations: pengine.c:299 Allocate resources
          ptest[14781]: 2010/09/27_17:56:48 notice: TRACE: stage5: allocate.c:881 Allocating services
          ptest[14781]: 2010/09/27_17:56:49 notice: TRACE: stage5: allocate.c:894 Calculating needed probes
          ptest[14781]: 2010/09/27_17:56:51 notice: TRACE: stage5: allocate.c:899 Creating actions
          ptest[14781]: 2010/09/27_17:56:52 notice: TRACE: stage5: allocate.c:905 Creating done
          ptest[14781]: 2010/09/27_17:56:52 notice: TRACE: do_calculations: pengine.c:306 Processing fencing and shutdown cases
          ptest[14781]: 2010/09/27_17:56:52 notice: TRACE: do_calculations: pengine.c:313 Applying ordering constraints
          36s
          ptest[14781]: 2010/09/27_17:57:28 notice: TRACE: do_calculations: pengine.c:320 Create transition graph
 
          Without probes:
 
          ptest[14637]: 2010/09/27_17:56:21 notice: TRACE: do_calculations: pengine.c:258 Calculate cluster status
          ptest[14637]: 2010/09/27_17:56:22 notice: TRACE: do_calculations: pengine.c:278 Applying placement constraints
          ptest[14637]: 2010/09/27_17:56:22 notice: TRACE: do_calculations: pengine.c:285 Create internal constraints
          ptest[14637]: 2010/09/27_17:56:22 notice: TRACE: do_calculations: pengine.c:292 Check actions
          ptest[14637]: 2010/09/27_17:56:23 notice: TRACE: do_calculations: pengine.c:299 Allocate resources
          ptest[14637]: 2010/09/27_17:56:23 notice: TRACE: stage5: allocate.c:881 Allocating services
          ptest[14637]: 2010/09/27_17:56:24 notice: TRACE: stage5: allocate.c:899 Creating actions
          ptest[14637]: 2010/09/27_17:56:25 notice: TRACE: stage5: allocate.c:905 Creating done
          ptest[14637]: 2010/09/27_17:56:25 notice: TRACE: do_calculations: pengine.c:306 Processing fencing and shutdown cases
          ptest[14637]: 2010/09/27_17:56:25 notice: TRACE: do_calculations: pengine.c:313 Applying ordering constraints
          ptest[14637]: 2010/09/27_17:56:25 notice: TRACE: do_calculations: pengine.c:320 Create transition graph
          */
 
         probe_resources(data_set);
     }
 
     crm_trace("Creating actions");
 
     gIter = data_set->resources;
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *rsc = (resource_t *) gIter->data;
 
         rsc->cmds->create_actions(rsc, data_set);
     }
 
     crm_trace("Creating done");
     return TRUE;
 }
 
 static gboolean
 is_managed(const resource_t * rsc)
 {
     GListPtr gIter = rsc->children;
 
     if (is_set(rsc->flags, pe_rsc_managed)) {
         return TRUE;
     }
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         if (is_managed(child_rsc)) {
             return TRUE;
         }
     }
 
     return FALSE;
 }
 
 static gboolean
 any_managed_resources(pe_working_set_t * data_set)
 {
 
     GListPtr gIter = data_set->resources;
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *rsc = (resource_t *) gIter->data;
 
         if (is_managed(rsc)) {
             return TRUE;
         }
     }
     return FALSE;
 }
 
 /*
  * Create dependencies for stonith and shutdown operations
  */
 gboolean
 stage6(pe_working_set_t * data_set)
 {
     action_t *dc_down = NULL;
     action_t *dc_fence = NULL;
     action_t *stonith_op = NULL;
     action_t *last_stonith = NULL;
     gboolean integrity_lost = FALSE;
     action_t *all_stopped = get_pseudo_op(ALL_STOPPED, data_set);
     action_t *done = get_pseudo_op(STONITH_DONE, data_set);
     gboolean need_stonith = TRUE;
     GListPtr gIter = data_set->nodes;
 
     crm_trace("Processing fencing and shutdown cases");
 
     if (any_managed_resources(data_set) == FALSE) {
         crm_notice("Delaying fencing operations until there are resources to manage");
         need_stonith = FALSE;
     }
 
     for (; gIter != NULL; gIter = gIter->next) {
         node_t *node = (node_t *) gIter->data;
 
         /* remote-nodes associated with a container resource (such as a vm) are not fenced */
         if (is_container_remote_node(node)) {
             continue;
         }
 
         stonith_op = NULL;
         if (need_stonith && node->details->unclean && pe_can_fence(data_set, node)) {
             pe_warn("Scheduling Node %s for STONITH", node->details->uname);
 
             stonith_op = pe_fence_op(node, NULL, FALSE, data_set);
 
             stonith_constraints(node, stonith_op, data_set);
 
             if (node->details->is_dc) {
                 dc_down = stonith_op;
                 dc_fence = stonith_op;
 
             } else {
                 if (last_stonith) {
                     order_actions(last_stonith, stonith_op, pe_order_optional);
                 }
                 last_stonith = stonith_op;
             }
 
         } else if (node->details->online && node->details->shutdown &&
                 /* TODO define what a shutdown op means for a baremetal remote node.
                  * For now we do not send shutdown operations for remote nodes, but
                  * if we can come up with a good use for this in the future, we will. */
                     is_remote_node(node) == FALSE) {
 
             action_t *down_op = NULL;
 
             crm_notice("Scheduling Node %s for shutdown", node->details->uname);
 
             down_op = custom_action(NULL, crm_strdup_printf("%s-%s", CRM_OP_SHUTDOWN, node->details->uname),
                                     CRM_OP_SHUTDOWN, node, FALSE, TRUE, data_set);
 
             shutdown_constraints(node, down_op, data_set);
             add_hash_param(down_op->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE);
 
             if (node->details->is_dc) {
                 dc_down = down_op;
             }
         }
 
         if (node->details->unclean && stonith_op == NULL) {
             integrity_lost = TRUE;
             pe_warn("Node %s is unclean!", node->details->uname);
         }
     }
 
     if (integrity_lost) {
         if (is_set(data_set->flags, pe_flag_stonith_enabled) == FALSE) {
             pe_warn("YOUR RESOURCES ARE NOW LIKELY COMPROMISED");
             pe_err("ENABLE STONITH TO KEEP YOUR RESOURCES SAFE");
 
         } else if (is_set(data_set->flags, pe_flag_have_quorum) == FALSE) {
             crm_notice("Cannot fence unclean nodes until quorum is"
                        " attained (or no-quorum-policy is set to ignore)");
         }
     }
 
     if (dc_down != NULL) {
         GListPtr gIter = NULL;
 
         crm_trace("Ordering shutdowns before %s on %s (DC)",
                   dc_down->task, dc_down->node->details->uname);
 
         add_hash_param(dc_down->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE);
 
         for (gIter = data_set->actions; gIter != NULL; gIter = gIter->next) {
             action_t *node_stop = (action_t *) gIter->data;
 
             if (safe_str_neq(CRM_OP_SHUTDOWN, node_stop->task)) {
                 continue;
             } else if (node_stop->node->details->is_dc) {
                 continue;
             }
 
             crm_debug("Ordering shutdown on %s before %s on %s",
                       node_stop->node->details->uname,
                       dc_down->task, dc_down->node->details->uname);
 
             order_actions(node_stop, dc_down, pe_order_optional);
         }
 
         if (last_stonith && dc_down != last_stonith) {
             order_actions(last_stonith, dc_down, pe_order_optional);
         }
     }
 
     if (last_stonith) {
         order_actions(last_stonith, done, pe_order_implies_then);
 
     } else if (dc_fence) {
         order_actions(dc_down, done, pe_order_implies_then);
     }
 
     order_actions(done, all_stopped, pe_order_implies_then);
     return TRUE;
 }
 
 /*
  * Determin the sets of independant actions and the correct order for the
  *  actions in each set.
  *
  * Mark dependencies of un-runnable actions un-runnable
  *
  */
 static GListPtr
 find_actions_by_task(GListPtr actions, resource_t * rsc, const char *original_key)
 {
     GListPtr list = NULL;
 
     list = find_actions(actions, original_key, NULL);
     if (list == NULL) {
         /* we're potentially searching a child of the original resource */
         char *key = NULL;
         char *tmp = NULL;
         char *task = NULL;
         int interval = 0;
 
         if (parse_op_key(original_key, &tmp, &task, &interval)) {
             key = generate_op_key(rsc->id, task, interval);
             /* crm_err("looking up %s instead of %s", key, original_key); */
             /* slist_iter(action, action_t, actions, lpc, */
             /*         crm_err("  - %s", action->uuid)); */
             list = find_actions(actions, key, NULL);
 
         } else {
             crm_err("search key: %s", original_key);
         }
 
         free(key);
         free(tmp);
         free(task);
     }
 
     return list;
 }
 
 static void
 rsc_order_then(action_t * lh_action, resource_t * rsc, order_constraint_t * order)
 {
     GListPtr gIter = NULL;
     GListPtr rh_actions = NULL;
     action_t *rh_action = NULL;
     enum pe_ordering type = order->type;
 
     CRM_CHECK(rsc != NULL, return);
     CRM_CHECK(order != NULL, return);
 
     rh_action = order->rh_action;
     crm_trace("Processing RH of ordering constraint %d", order->id);
 
     if (rh_action != NULL) {
         rh_actions = g_list_prepend(NULL, rh_action);
 
     } else if (rsc != NULL) {
         rh_actions = find_actions_by_task(rsc->actions, rsc, order->rh_action_task);
     }
 
     if (rh_actions == NULL) {
         pe_rsc_trace(rsc, "No RH-Side (%s/%s) found for constraint..."
                      " ignoring", rsc->id, order->rh_action_task);
         if (lh_action) {
             pe_rsc_trace(rsc, "LH-Side was: %s", lh_action->uuid);
         }
         return;
     }
 
     if (lh_action && lh_action->rsc == rsc && is_set(lh_action->flags, pe_action_dangle)) {
         pe_rsc_trace(rsc, "Detected dangling operation %s -> %s", lh_action->uuid,
                      order->rh_action_task);
         clear_bit(type, pe_order_implies_then);
     }
 
     gIter = rh_actions;
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *rh_action_iter = (action_t *) gIter->data;
 
         if (lh_action) {
             order_actions(lh_action, rh_action_iter, type);
 
         } else if (type & pe_order_implies_then) {
             update_action_flags(rh_action_iter, pe_action_runnable | pe_action_clear);
             crm_warn("Unrunnable %s 0x%.6x", rh_action_iter->uuid, type);
         } else {
             crm_warn("neither %s 0x%.6x", rh_action_iter->uuid, type);
         }
     }
 
     g_list_free(rh_actions);
 }
 
 static void
 rsc_order_first(resource_t * lh_rsc, order_constraint_t * order, pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
     GListPtr lh_actions = NULL;
     action_t *lh_action = order->lh_action;
     resource_t *rh_rsc = order->rh_rsc;
 
     crm_trace("Processing LH of ordering constraint %d", order->id);
     CRM_ASSERT(lh_rsc != NULL);
 
     if (lh_action != NULL) {
         lh_actions = g_list_prepend(NULL, lh_action);
 
     } else if (lh_action == NULL) {
         lh_actions = find_actions_by_task(lh_rsc->actions, lh_rsc, order->lh_action_task);
     }
 
     if (lh_actions == NULL && lh_rsc != rh_rsc) {
         char *key = NULL;
         char *rsc_id = NULL;
         char *op_type = NULL;
         int interval = 0;
 
         parse_op_key(order->lh_action_task, &rsc_id, &op_type, &interval);
         key = generate_op_key(lh_rsc->id, op_type, interval);
 
         if (lh_rsc->fns->state(lh_rsc, TRUE) == RSC_ROLE_STOPPED && safe_str_eq(op_type, RSC_STOP)) {
             free(key);
             pe_rsc_trace(lh_rsc, "No LH-Side (%s/%s) found for constraint %d with %s - ignoring",
                          lh_rsc->id, order->lh_action_task, order->id, order->rh_action_task);
 
         } else if (lh_rsc->fns->state(lh_rsc, TRUE) == RSC_ROLE_SLAVE && safe_str_eq(op_type, RSC_DEMOTE)) {
             free(key);
             pe_rsc_trace(lh_rsc, "No LH-Side (%s/%s) found for constraint %d with %s - ignoring",
                          lh_rsc->id, order->lh_action_task, order->id, order->rh_action_task);
 
         } else {
             pe_rsc_trace(lh_rsc, "No LH-Side (%s/%s) found for constraint %d with %s - creating",
                          lh_rsc->id, order->lh_action_task, order->id, order->rh_action_task);
             lh_action = custom_action(lh_rsc, key, op_type, NULL, TRUE, TRUE, data_set);
             lh_actions = g_list_prepend(NULL, lh_action);
         }
 
         free(op_type);
         free(rsc_id);
     }
 
     gIter = lh_actions;
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *lh_action_iter = (action_t *) gIter->data;
 
         if (rh_rsc == NULL && order->rh_action) {
             rh_rsc = order->rh_action->rsc;
         }
         if (rh_rsc) {
             rsc_order_then(lh_action_iter, rh_rsc, order);
 
         } else if (order->rh_action) {
             order_actions(lh_action_iter, order->rh_action, order->type);
         }
     }
 
     g_list_free(lh_actions);
 }
 
 extern gboolean update_action(action_t * action);
 extern void update_colo_start_chain(action_t * action);
 
 static void
 apply_remote_node_ordering(pe_working_set_t *data_set)
 {
     GListPtr gIter = data_set->actions;
 
     if (is_set(data_set->flags, pe_flag_have_remote_nodes) == FALSE) {
         return;
     }
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *action = (action_t *) gIter->data;
         resource_t *remote_rsc = NULL;
         resource_t *container = NULL;
 
         if (action->rsc == NULL) {
             continue;
         }
 
         /* Special case. */
         if (action->rsc &&
             action->rsc->is_remote_node &&
             safe_str_eq(action->task, CRM_OP_CLEAR_FAILCOUNT)) {
 
             /* if we are clearing the failcount of an actual remote node connect
              * resource, then make sure this happens before allowing the connection
              * to start if we are planning on starting the connection during this
              * transition */ 
             custom_action_order(action->rsc,
                 NULL,
                 action,
                 action->rsc,
                 generate_op_key(action->rsc->id, RSC_START, 0),
                 NULL,
                 pe_order_optional,
                 data_set);
 
                 continue;
         }
 
         /* detect if the action occurs on a remote node. if so create
          * ordering constraints that guarantee the action occurs while
          * the remote node is active (after start, before stop...) things
          * like that */ 
         if (action->node == NULL ||
             is_remote_node(action->node) == FALSE ||
             action->node->details->remote_rsc == NULL ||
             is_set(action->flags, pe_action_pseudo)) {
             continue;
         }
 
         remote_rsc = action->node->details->remote_rsc;
         container = remote_rsc->container;
 
         if (safe_str_eq(action->task, "monitor") ||
             safe_str_eq(action->task, "start") ||
             safe_str_eq(action->task, "promote") ||
             safe_str_eq(action->task, "notify") ||
             safe_str_eq(action->task, CRM_OP_LRM_REFRESH) ||
             safe_str_eq(action->task, CRM_OP_CLEAR_FAILCOUNT) ||
             safe_str_eq(action->task, "delete")) {
 
             custom_action_order(remote_rsc,
                 generate_op_key(remote_rsc->id, RSC_START, 0),
                 NULL,
                 action->rsc,
                 NULL,
                 action,
                 pe_order_preserve | pe_order_implies_then | pe_order_runnable_left,
                 data_set);
 
         } else if (safe_str_eq(action->task, "demote")) {
 
             /* If the connection is being torn down, we don't want
              * to build a constraint between a resource's demotion and
              * the connection resource starting... because the connection
              * resource can not start. The connection might already be up,
              * but the START action would not be allowed which in turn would
              * block the demotion of any resournces living in the remote-node.
              *
              * In this case, only build the constraint between the demotion and
              * the connection's stop action. This allows the connection and all the
              * resources within the remote-node to be torn down properly. */
             if (remote_rsc->next_role == RSC_ROLE_STOPPED) {
                 custom_action_order(action->rsc,
                     NULL,
                     action,
                     remote_rsc,
                     generate_op_key(remote_rsc->id, RSC_STOP, 0),
                     NULL,
                     pe_order_preserve | pe_order_implies_first,
                     data_set);
             } else {
 
                 custom_action_order(remote_rsc,
                     generate_op_key(remote_rsc->id, RSC_START, 0),
                     NULL,
                     action->rsc,
                     NULL,
                     action,
                     pe_order_preserve | pe_order_implies_then | pe_order_runnable_left,
                     data_set);
             }
 
         } else if (safe_str_eq(action->task, "stop") &&
                    container &&
                    is_set(container->flags, pe_rsc_failed)) {
 
             /* when the container representing a remote node fails, the stop
              * action for all the resources living in that container is implied
              * by the container stopping.  This is similar to how fencing operations
              * work for cluster nodes. */
             pe_set_action_bit(action, pe_action_pseudo);
             custom_action_order(container,
                 generate_op_key(container->id, RSC_STOP, 0),
                 NULL,
                 action->rsc,
                 NULL,
                 action,
                 pe_order_preserve | pe_order_implies_then | pe_order_runnable_left,
                 data_set);
         } else if (safe_str_eq(action->task, "stop")) {
             gboolean after_start = FALSE;
 
             /* handle special case with baremetal remote where stop actions need to be
              * ordered after the connection resource starts somewhere else. */
             if (is_baremetal_remote_node(action->node)) {
                 node_t *cluster_node = remote_rsc->running_on ? remote_rsc->running_on->data : NULL;
 
                 /* if the current cluster node a baremetal connection resource
                  * is residing on is unclean or went offline we can't process any
                  * operations on that remote node until after it starts somewhere else. */
                 if (cluster_node == NULL ||
                     cluster_node->details->unclean == TRUE ||
                     cluster_node->details->online == FALSE) {
                     after_start = TRUE;
                 } else if (g_list_length(remote_rsc->running_on) > 1 &&
                            remote_rsc->partial_migration_source &&
                             remote_rsc->partial_migration_target) {
                     /* if we're caught in the middle of migrating a connection resource,
                      * then we have to wait until after the resource migrates before performing
                      * any actions. */
                     after_start = TRUE;
                 }
             }
 
             if (after_start) {
                 custom_action_order(remote_rsc,
                     generate_op_key(remote_rsc->id, RSC_START, 0),
                     NULL,
                     action->rsc,
                     NULL,
                     action,
                     pe_order_preserve | pe_order_implies_then | pe_order_runnable_left,
                     data_set);
             } else {
                 custom_action_order(action->rsc,
                     NULL,
                     action,
                     remote_rsc,
                     generate_op_key(remote_rsc->id, RSC_STOP, 0),
                     NULL,
                     pe_order_preserve | pe_order_implies_first,
                     data_set);
             }
         }
     }
 }
 
 gboolean
 stage7(pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
 
     apply_remote_node_ordering(data_set);
     crm_trace("Applying ordering constraints");
 
     /* Don't ask me why, but apparently they need to be processed in
      * the order they were created in... go figure
      *
      * Also g_list_prepend() has horrendous performance characteristics
      * So we need to use g_list_prepend() and then reverse the list here
      */
     data_set->ordering_constraints = g_list_reverse(data_set->ordering_constraints);
 
     gIter = data_set->ordering_constraints;
     for (; gIter != NULL; gIter = gIter->next) {
         order_constraint_t *order = (order_constraint_t *) gIter->data;
         resource_t *rsc = order->lh_rsc;
 
         crm_trace("Applying ordering constraint: %d", order->id);
 
         if (rsc != NULL) {
             crm_trace("rsc_action-to-*");
             rsc_order_first(rsc, order, data_set);
             continue;
         }
 
         rsc = order->rh_rsc;
         if (rsc != NULL) {
             crm_trace("action-to-rsc_action");
             rsc_order_then(order->lh_action, rsc, order);
 
         } else {
             crm_trace("action-to-action");
             order_actions(order->lh_action, order->rh_action, order->type);
         }
     }
 
     crm_trace("Updating %d actions", g_list_length(data_set->actions));
 
     gIter = data_set->actions;
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *action = (action_t *) gIter->data;
 
         update_colo_start_chain(action);
         update_action(action);
     }
 
     crm_trace("Processing reloads");
 
     gIter = data_set->resources;
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *rsc = (resource_t *) gIter->data;
 
         rsc_reload(rsc, data_set);
         LogActions(rsc, data_set, FALSE);
     }
     return TRUE;
 }
 
 static gint
 sort_notify_entries(gconstpointer a, gconstpointer b)
 {
     int tmp;
     const notify_entry_t *entry_a = a;
     const notify_entry_t *entry_b = b;
 
     if (entry_a == NULL && entry_b == NULL) {
         return 0;
     }
     if (entry_a == NULL) {
         return 1;
     }
     if (entry_b == NULL) {
         return -1;
     }
 
     if (entry_a->rsc == NULL && entry_b->rsc == NULL) {
         return 0;
     }
     if (entry_a->rsc == NULL) {
         return 1;
     }
     if (entry_b->rsc == NULL) {
         return -1;
     }
 
     tmp = strcmp(entry_a->rsc->id, entry_b->rsc->id);
     if (tmp != 0) {
         return tmp;
     }
 
     if (entry_a->node == NULL && entry_b->node == NULL) {
         return 0;
     }
     if (entry_a->node == NULL) {
         return 1;
     }
     if (entry_b->node == NULL) {
         return -1;
     }
 
     return strcmp(entry_a->node->details->id, entry_b->node->details->id);
 }
 
 static char *
 expand_node_list(GListPtr list)
 {
     GListPtr gIter = NULL;
     char *node_list = NULL;
 
     if (list == NULL) {
         return strdup(" ");
     }
 
     for (gIter = list; gIter != NULL; gIter = gIter->next) {
         node_t *node = (node_t *) gIter->data;
 
         if (node->details->uname) {
             int existing_len = 0;
             int len = 2 + strlen(node->details->uname);
 
             if(node_list) {
                 existing_len = strlen(node_list);
             }
-
             crm_trace("Adding %s (%dc) at offset %d", node->details->uname, len - 2, existing_len);
             node_list = realloc_safe(node_list, len + existing_len);
             sprintf(node_list + existing_len, "%s%s", existing_len == 0 ? "":" ", node->details->uname);
         }
     }
 
     return node_list;
 }
 
 static void
 expand_list(GListPtr list, char **rsc_list, char **node_list)
 {
     GListPtr gIter = NULL;
     const char *uname = NULL;
     const char *rsc_id = NULL;
     const char *last_rsc_id = NULL;
 
     if (rsc_list) {
         *rsc_list = NULL;
     }
 
     if (list == NULL) {
         if (rsc_list) {
             *rsc_list = strdup(" ");
         }
         if (node_list) {
             *node_list = strdup(" ");
         }
         return;
     }
 
     if (node_list) {
         *node_list = NULL;
     }
 
     for (gIter = list; gIter != NULL; gIter = gIter->next) {
         notify_entry_t *entry = (notify_entry_t *) gIter->data;
 
         CRM_LOG_ASSERT(entry != NULL);
         CRM_LOG_ASSERT(entry && entry->rsc != NULL);
 
         if(entry == NULL || entry->rsc == NULL) {
             continue;
         }
 
         /* Uh, why? */
         CRM_LOG_ASSERT(node_list == NULL || entry->node != NULL);
         if(node_list != NULL && entry->node == NULL) {
             continue;
         }
 
         uname = NULL;
         rsc_id = entry->rsc->id;
         CRM_ASSERT(rsc_id != NULL);
 
         /* filter dups */
         if (safe_str_eq(rsc_id, last_rsc_id)) {
             continue;
         }
         last_rsc_id = rsc_id;
 
         if (rsc_list != NULL) {
             int existing_len = 0;
             int len = 2 + strlen(rsc_id);       /* +1 space, +1 EOS */
 
             if (rsc_list && *rsc_list) {
                 existing_len = strlen(*rsc_list);
             }
 
             crm_trace("Adding %s (%dc) at offset %d", rsc_id, len - 2, existing_len);
             *rsc_list = realloc_safe(*rsc_list, len + existing_len);
             sprintf(*rsc_list + existing_len, "%s%s", existing_len == 0 ? "":" ", rsc_id);
         }
 
         if (entry->node != NULL) {
             uname = entry->node->details->uname;
         }
 
         if (node_list != NULL && uname) {
             int existing_len = 0;
             int len = 2 + strlen(uname);
 
             if (node_list && *node_list) {
                 existing_len = strlen(*node_list);
             }
 
             crm_trace("Adding %s (%dc) at offset %d", uname, len - 2, existing_len);
             *node_list = realloc_safe(*node_list, len + existing_len);
             sprintf(*node_list + existing_len, "%s%s", existing_len == 0 ? "":" ", uname);
         }
     }
 
 }
 
 static void
 dup_attr(gpointer key, gpointer value, gpointer user_data)
 {
     add_hash_param(user_data, key, value);
 }
 
 static action_t *
 pe_notify(resource_t * rsc, node_t * node, action_t * op, action_t * confirm,
           notify_data_t * n_data, pe_working_set_t * data_set)
 {
     char *key = NULL;
     action_t *trigger = NULL;
     const char *value = NULL;
     const char *task = NULL;
 
     if (op == NULL || confirm == NULL) {
         pe_rsc_trace(rsc, "Op=%p confirm=%p", op, confirm);
         return NULL;
     }
 
     CRM_CHECK(rsc != NULL, return NULL);
     CRM_CHECK(node != NULL, return NULL);
 
     if (node->details->online == FALSE) {
         pe_rsc_trace(rsc, "Skipping notification for %s: node offline", rsc->id);
         return NULL;
     } else if (is_set(op->flags, pe_action_runnable) == FALSE) {
         pe_rsc_trace(rsc, "Skipping notification for %s: not runnable", op->uuid);
         return NULL;
     }
 
     value = g_hash_table_lookup(op->meta, "notify_type");
     task = g_hash_table_lookup(op->meta, "notify_operation");
 
     pe_rsc_trace(rsc, "Creating notify actions for %s: %s (%s-%s)", op->uuid, rsc->id, value, task);
 
     key = generate_notify_key(rsc->id, value, task);
     trigger = custom_action(rsc, key, op->task, node,
                             is_set(op->flags, pe_action_optional), TRUE, data_set);
     g_hash_table_foreach(op->meta, dup_attr, trigger->meta);
     g_hash_table_foreach(n_data->keys, dup_attr, trigger->meta);
 
     /* pseudo_notify before notify */
     pe_rsc_trace(rsc, "Ordering %s before %s (%d->%d)", op->uuid, trigger->uuid, trigger->id,
                  op->id);
 
     order_actions(op, trigger, pe_order_optional);
     order_actions(trigger, confirm, pe_order_optional);
     return trigger;
 }
 
 static void
 pe_post_notify(resource_t * rsc, node_t * node, notify_data_t * n_data, pe_working_set_t * data_set)
 {
     action_t *notify = NULL;
 
     CRM_CHECK(rsc != NULL, return);
 
     if (n_data->post == NULL) {
         return;                 /* Nothing to do */
     }
 
     notify = pe_notify(rsc, node, n_data->post, n_data->post_done, n_data, data_set);
 
     if (notify != NULL) {
         notify->priority = INFINITY;
     }
 
     if (n_data->post_done) {
         GListPtr gIter = rsc->actions;
 
         for (; gIter != NULL; gIter = gIter->next) {
             action_t *mon = (action_t *) gIter->data;
             const char *interval = g_hash_table_lookup(mon->meta, "interval");
 
             if (interval == NULL || safe_str_eq(interval, "0")) {
                 pe_rsc_trace(rsc, "Skipping %s: interval", mon->uuid);
                 continue;
             } else if (safe_str_eq(mon->task, RSC_CANCEL)) {
                 pe_rsc_trace(rsc, "Skipping %s: cancel", mon->uuid);
                 continue;
             }
 
             order_actions(n_data->post_done, mon, pe_order_optional);
         }
     }
 }
 
 notify_data_t *
 create_notification_boundaries(resource_t * rsc, const char *action, action_t * start,
                                action_t * end, pe_working_set_t * data_set)
 {
     /* Create the pseudo ops that preceed and follow the actual notifications */
 
     /*
      * Creates two sequences (conditional on start and end being supplied):
      *   pre_notify -> pre_notify_complete -> start, and
      *   end -> post_notify -> post_notify_complete
      *
      * 'start' and 'end' may be the same event or ${X} and ${X}ed as per clones
      */
     char *key = NULL;
     notify_data_t *n_data = NULL;
 
     if (is_not_set(rsc->flags, pe_rsc_notify)) {
         return NULL;
     }
 
     n_data = calloc(1, sizeof(notify_data_t));
     n_data->action = action;
     n_data->keys =
         g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
 
     if (start) {
         /* create pre-event notification wrappers */
         key = generate_notify_key(rsc->id, "pre", start->task);
         n_data->pre =
             custom_action(rsc, key, RSC_NOTIFY, NULL, is_set(start->flags, pe_action_optional),
                           TRUE, data_set);
 
         update_action_flags(n_data->pre, pe_action_pseudo);
         update_action_flags(n_data->pre, pe_action_runnable);
 
         add_hash_param(n_data->pre->meta, "notify_type", "pre");
         add_hash_param(n_data->pre->meta, "notify_operation", n_data->action);
 
         add_hash_param(n_data->pre->meta, "notify_key_type", "pre");
         add_hash_param(n_data->pre->meta, "notify_key_operation", start->task);
 
         /* create pre_notify_complete */
         key = generate_notify_key(rsc->id, "confirmed-pre", start->task);
         n_data->pre_done =
             custom_action(rsc, key, RSC_NOTIFIED, NULL, is_set(start->flags, pe_action_optional),
                           TRUE, data_set);
 
         update_action_flags(n_data->pre_done, pe_action_pseudo);
         update_action_flags(n_data->pre_done, pe_action_runnable);
 
         add_hash_param(n_data->pre_done->meta, "notify_type", "pre");
         add_hash_param(n_data->pre_done->meta, "notify_operation", n_data->action);
 
         add_hash_param(n_data->pre_done->meta, "notify_key_type", "confirmed-pre");
         add_hash_param(n_data->pre_done->meta, "notify_key_operation", start->task);
 
         order_actions(n_data->pre_done, start, pe_order_optional);
         order_actions(n_data->pre, n_data->pre_done, pe_order_optional);
     }
 
     if (end) {
         /* create post-event notification wrappers */
         key = generate_notify_key(rsc->id, "post", end->task);
         n_data->post =
             custom_action(rsc, key, RSC_NOTIFY, NULL, is_set(end->flags, pe_action_optional), TRUE,
                           data_set);
 
         n_data->post->priority = INFINITY;
         update_action_flags(n_data->post, pe_action_pseudo);
         if (is_set(end->flags, pe_action_runnable)) {
             update_action_flags(n_data->post, pe_action_runnable);
         } else {
             update_action_flags(n_data->post, pe_action_runnable | pe_action_clear);
         }
 
         add_hash_param(n_data->post->meta, "notify_type", "post");
         add_hash_param(n_data->post->meta, "notify_operation", n_data->action);
 
         add_hash_param(n_data->post->meta, "notify_key_type", "post");
         add_hash_param(n_data->post->meta, "notify_key_operation", end->task);
 
         /* create post_notify_complete */
         key = generate_notify_key(rsc->id, "confirmed-post", end->task);
         n_data->post_done =
             custom_action(rsc, key, RSC_NOTIFIED, NULL, is_set(end->flags, pe_action_optional),
                           TRUE, data_set);
 
         n_data->post_done->priority = INFINITY;
         update_action_flags(n_data->post_done, pe_action_pseudo);
         if (is_set(end->flags, pe_action_runnable)) {
             update_action_flags(n_data->post_done, pe_action_runnable);
         } else {
             update_action_flags(n_data->post_done, pe_action_runnable | pe_action_clear);
         }
 
         add_hash_param(n_data->post_done->meta, "notify_type", "post");
         add_hash_param(n_data->post_done->meta, "notify_operation", n_data->action);
 
         add_hash_param(n_data->post_done->meta, "notify_key_type", "confirmed-post");
         add_hash_param(n_data->post_done->meta, "notify_key_operation", end->task);
 
         order_actions(end, n_data->post, pe_order_implies_then);
         order_actions(n_data->post, n_data->post_done, pe_order_implies_then);
     }
 
     if (start && end) {
         order_actions(n_data->pre_done, n_data->post, pe_order_optional);
     }
 
     if (safe_str_eq(action, RSC_STOP)) {
         action_t *all_stopped = get_pseudo_op(ALL_STOPPED, data_set);
 
         order_actions(n_data->post_done, all_stopped, pe_order_optional);
     }
 
     return n_data;
 }
 
 void
 collect_notification_data(resource_t * rsc, gboolean state, gboolean activity,
                           notify_data_t * n_data)
 {
 
     if(n_data->allowed_nodes == NULL) {
         n_data->allowed_nodes = rsc->allowed_nodes;
     }
 
     if (rsc->children) {
         GListPtr gIter = rsc->children;
 
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child = (resource_t *) gIter->data;
 
             collect_notification_data(child, state, activity, n_data);
         }
         return;
     }
 
     if (state) {
         notify_entry_t *entry = NULL;
 
         entry = calloc(1, sizeof(notify_entry_t));
         entry->rsc = rsc;
         if (rsc->running_on) {
             /* we only take the first one */
             entry->node = rsc->running_on->data;
         }
 
         pe_rsc_trace(rsc, "%s state: %s", rsc->id, role2text(rsc->role));
 
         switch (rsc->role) {
             case RSC_ROLE_STOPPED:
                 n_data->inactive = g_list_prepend(n_data->inactive, entry);
                 break;
             case RSC_ROLE_STARTED:
                 n_data->active = g_list_prepend(n_data->active, entry);
                 break;
             case RSC_ROLE_SLAVE:
                 n_data->slave = g_list_prepend(n_data->slave, entry);
                 break;
             case RSC_ROLE_MASTER:
                 n_data->master = g_list_prepend(n_data->master, entry);
                 break;
             default:
                 crm_err("Unsupported notify role");
                 free(entry);
                 break;
         }
     }
 
     if (activity) {
         notify_entry_t *entry = NULL;
         enum action_tasks task;
 
         GListPtr gIter = rsc->actions;
 
         for (; gIter != NULL; gIter = gIter->next) {
             action_t *op = (action_t *) gIter->data;
 
             if (is_set(op->flags, pe_action_optional) == FALSE && op->node != NULL) {
 
                 entry = calloc(1, sizeof(notify_entry_t));
                 entry->node = op->node;
                 entry->rsc = rsc;
 
                 task = text2task(op->task);
                 switch (task) {
                     case start_rsc:
                         n_data->start = g_list_prepend(n_data->start, entry);
                         break;
                     case stop_rsc:
                         n_data->stop = g_list_prepend(n_data->stop, entry);
                         break;
                     case action_promote:
                         n_data->promote = g_list_prepend(n_data->promote, entry);
                         break;
                     case action_demote:
                         n_data->demote = g_list_prepend(n_data->demote, entry);
                         break;
                     default:
                         free(entry);
                         break;
                 }
             }
         }
     }
 }
 
 gboolean
 expand_notification_data(notify_data_t * n_data, pe_working_set_t * data_set)
 {
     /* Expand the notification entries into a key=value hashtable
      * This hashtable is later used in action2xml()
      */
     gboolean required = FALSE;
     char *rsc_list = NULL;
     char *node_list = NULL;
     GListPtr nodes = NULL;
 
     if (n_data->stop) {
         n_data->stop = g_list_sort(n_data->stop, sort_notify_entries);
     }
     expand_list(n_data->stop, &rsc_list, &node_list);
     if (rsc_list != NULL && safe_str_neq(" ", rsc_list)) {
         if (safe_str_eq(n_data->action, RSC_STOP)) {
             required = TRUE;
         }
     }
     g_hash_table_insert(n_data->keys, strdup("notify_stop_resource"), rsc_list);
     g_hash_table_insert(n_data->keys, strdup("notify_stop_uname"), node_list);
 
     if (n_data->start) {
         n_data->start = g_list_sort(n_data->start, sort_notify_entries);
         if (rsc_list && safe_str_eq(n_data->action, RSC_START)) {
             required = TRUE;
         }
     }
     expand_list(n_data->start, &rsc_list, &node_list);
     g_hash_table_insert(n_data->keys, strdup("notify_start_resource"), rsc_list);
     g_hash_table_insert(n_data->keys, strdup("notify_start_uname"), node_list);
 
     if (n_data->demote) {
         n_data->demote = g_list_sort(n_data->demote, sort_notify_entries);
         if (safe_str_eq(n_data->action, RSC_DEMOTE)) {
             required = TRUE;
         }
     }
 
     expand_list(n_data->demote, &rsc_list, &node_list);
     g_hash_table_insert(n_data->keys, strdup("notify_demote_resource"), rsc_list);
     g_hash_table_insert(n_data->keys, strdup("notify_demote_uname"), node_list);
 
     if (n_data->promote) {
         n_data->promote = g_list_sort(n_data->promote, sort_notify_entries);
         if (safe_str_eq(n_data->action, RSC_PROMOTE)) {
             required = TRUE;
         }
     }
     expand_list(n_data->promote, &rsc_list, &node_list);
     g_hash_table_insert(n_data->keys, strdup("notify_promote_resource"), rsc_list);
     g_hash_table_insert(n_data->keys, strdup("notify_promote_uname"), node_list);
 
     if (n_data->active) {
         n_data->active = g_list_sort(n_data->active, sort_notify_entries);
     }
     expand_list(n_data->active, &rsc_list, &node_list);
     g_hash_table_insert(n_data->keys, strdup("notify_active_resource"), rsc_list);
     g_hash_table_insert(n_data->keys, strdup("notify_active_uname"), node_list);
 
     if (n_data->slave) {
         n_data->slave = g_list_sort(n_data->slave, sort_notify_entries);
     }
     expand_list(n_data->slave, &rsc_list, &node_list);
     g_hash_table_insert(n_data->keys, strdup("notify_slave_resource"), rsc_list);
     g_hash_table_insert(n_data->keys, strdup("notify_slave_uname"), node_list);
 
     if (n_data->master) {
         n_data->master = g_list_sort(n_data->master, sort_notify_entries);
     }
     expand_list(n_data->master, &rsc_list, &node_list);
     g_hash_table_insert(n_data->keys, strdup("notify_master_resource"), rsc_list);
     g_hash_table_insert(n_data->keys, strdup("notify_master_uname"), node_list);
 
     if (n_data->inactive) {
         n_data->inactive = g_list_sort(n_data->inactive, sort_notify_entries);
     }
     expand_list(n_data->inactive, &rsc_list, NULL);
     g_hash_table_insert(n_data->keys, strdup("notify_inactive_resource"), rsc_list);
 
     nodes = g_hash_table_get_values(n_data->allowed_nodes);
     node_list = expand_node_list(nodes);
     g_hash_table_insert(n_data->keys, strdup("notify_available_uname"), node_list);
     g_list_free(nodes);
 
     node_list = expand_node_list(data_set->nodes);
     g_hash_table_insert(n_data->keys, strdup("notify_all_uname"), node_list);
 
     if (required && n_data->pre) {
         update_action_flags(n_data->pre, pe_action_optional | pe_action_clear);
         update_action_flags(n_data->pre_done, pe_action_optional | pe_action_clear);
     }
 
     if (required && n_data->post) {
         update_action_flags(n_data->post, pe_action_optional | pe_action_clear);
         update_action_flags(n_data->post_done, pe_action_optional | pe_action_clear);
     }
     return required;
 }
 
 void
 create_notifications(resource_t * rsc, notify_data_t * n_data, pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
     action_t *stop = NULL;
     action_t *start = NULL;
     enum action_tasks task = text2task(n_data->action);
 
     if (rsc->children) {
         gIter = rsc->children;
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child = (resource_t *) gIter->data;
 
             create_notifications(child, n_data, data_set);
         }
         return;
     }
 
     /* Copy notification details into standard ops */
 
     gIter = rsc->actions;
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *op = (action_t *) gIter->data;
 
         if (is_set(op->flags, pe_action_optional) == FALSE && op->node != NULL) {
             enum action_tasks t = text2task(op->task);
 
             switch (t) {
                 case start_rsc:
                 case stop_rsc:
                 case action_promote:
                 case action_demote:
                     g_hash_table_foreach(n_data->keys, dup_attr, op->meta);
                     break;
                 default:
                     break;
             }
         }
     }
 
     pe_rsc_trace(rsc, "Creating notificaitons for: %s.%s (%s->%s)",
                  n_data->action, rsc->id, role2text(rsc->role), role2text(rsc->next_role));
 
     stop = find_first_action(rsc->actions, NULL, RSC_STOP, NULL);
     start = find_first_action(rsc->actions, NULL, RSC_START, NULL);
 
     /* stop / demote */
     if (rsc->role != RSC_ROLE_STOPPED) {
         if (task == stop_rsc || task == action_demote) {
             gIter = rsc->running_on;
             for (; gIter != NULL; gIter = gIter->next) {
                 node_t *current_node = (node_t *) gIter->data;
 
                 /* if this stop action is a pseudo action as a result of the current
                  * node being fenced, this stop action is implied by the fencing 
                  * action. There's no reason to send the fenced node a stop notification */ 
                 if (stop &&
                     is_set(stop->flags, pe_action_pseudo) &&
                     current_node->details->unclean) {
 
                     continue;
                 }
 
                 pe_notify(rsc, current_node, n_data->pre, n_data->pre_done, n_data, data_set);
                 if (task == action_demote || stop == NULL
                     || is_set(stop->flags, pe_action_optional)) {
                     pe_post_notify(rsc, current_node, n_data, data_set);
                 }
             }
         }
     }
 
     /* start / promote */
     if (rsc->next_role != RSC_ROLE_STOPPED) {
         if (rsc->allocated_to == NULL) {
             pe_proc_err("Next role '%s' but %s is not allocated", role2text(rsc->next_role),
                         rsc->id);
 
         } else if (task == start_rsc || task == action_promote) {
             if (task != start_rsc || start == NULL || is_set(start->flags, pe_action_optional)) {
                 pe_notify(rsc, rsc->allocated_to, n_data->pre, n_data->pre_done, n_data, data_set);
             }
             pe_post_notify(rsc, rsc->allocated_to, n_data, data_set);
         }
     }
 }
 
 void
 free_notification_data(notify_data_t * n_data)
 {
     if (n_data == NULL) {
         return;
     }
 
     g_list_free_full(n_data->stop, free);
     g_list_free_full(n_data->start, free);
     g_list_free_full(n_data->demote, free);
     g_list_free_full(n_data->promote, free);
     g_list_free_full(n_data->master, free);
     g_list_free_full(n_data->slave, free);
     g_list_free_full(n_data->active, free);
     g_list_free_full(n_data->inactive, free);
     g_hash_table_destroy(n_data->keys);
     free(n_data);
 }
 
 int transition_id = -1;
 
 /*
  * Create a dependency graph to send to the transitioner (via the CRMd)
  */
 gboolean
 stage8(pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
     const char *value = NULL;
 
     transition_id++;
     crm_trace("Creating transition graph %d.", transition_id);
 
     data_set->graph = create_xml_node(NULL, XML_TAG_GRAPH);
 
     value = pe_pref(data_set->config_hash, "cluster-delay");
     crm_xml_add(data_set->graph, "cluster-delay", value);
 
     value = pe_pref(data_set->config_hash, "stonith-timeout");
     crm_xml_add(data_set->graph, "stonith-timeout", value);
 
     crm_xml_add(data_set->graph, "failed-stop-offset", "INFINITY");
 
     if (is_set(data_set->flags, pe_flag_start_failure_fatal)) {
         crm_xml_add(data_set->graph, "failed-start-offset", "INFINITY");
     } else {
         crm_xml_add(data_set->graph, "failed-start-offset", "1");
     }
 
     value = pe_pref(data_set->config_hash, "batch-limit");
     crm_xml_add(data_set->graph, "batch-limit", value);
 
     crm_xml_add_int(data_set->graph, "transition_id", transition_id);
 
     value = pe_pref(data_set->config_hash, "migration-limit");
     if (crm_int_helper(value, NULL) > 0) {
         crm_xml_add(data_set->graph, "migration-limit", value);
     }
 
 /* errors...
    slist_iter(action, action_t, action_list, lpc,
    if(action->optional == FALSE && action->runnable == FALSE) {
    print_action("Ignoring", action, TRUE);
    }
    );
 */
 
     gIter = data_set->resources;
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *rsc = (resource_t *) gIter->data;
 
         pe_rsc_trace(rsc, "processing actions for rsc=%s", rsc->id);
         rsc->cmds->expand(rsc, data_set);
     }
 
     crm_log_xml_trace(data_set->graph, "created resource-driven action list");
 
     /* catch any non-resource specific actions */
     crm_trace("processing non-resource actions");
 
     gIter = data_set->actions;
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *action = (action_t *) gIter->data;
 
         if (action->rsc
             && action->node
             && action->node->details->shutdown
             && is_not_set(action->rsc->flags, pe_rsc_maintenance)
             && is_not_set(action->flags, pe_action_optional)
             && is_not_set(action->flags, pe_action_runnable)
             && crm_str_eq(action->task, RSC_STOP, TRUE)
             ) {
             /* Eventually we should just ignore the 'fence' case
              * But for now its the best way to detect (in CTS) when
              * CIB resource updates are being lost
              */
             if (is_set(data_set->flags, pe_flag_have_quorum)
                 || data_set->no_quorum_policy == no_quorum_ignore) {
                 crm_crit("Cannot %s node '%s' because of %s:%s%s",
                          action->node->details->unclean ? "fence" : "shut down",
                          action->node->details->uname, action->rsc->id,
                          is_not_set(action->rsc->flags, pe_rsc_managed) ? " unmanaged" : " blocked",
                          is_set(action->rsc->flags, pe_rsc_failed) ? " failed" : "");
             }
         }
 
         graph_element_from_action(action, data_set);
     }
 
     crm_log_xml_trace(data_set->graph, "created generic action list");
     crm_trace("Created transition graph %d.", transition_id);
 
     return TRUE;
 }
 
 void
 cleanup_alloc_calculations(pe_working_set_t * data_set)
 {
     if (data_set == NULL) {
         return;
     }
 
     crm_trace("deleting %d order cons: %p",
               g_list_length(data_set->ordering_constraints), data_set->ordering_constraints);
     pe_free_ordering(data_set->ordering_constraints);
     data_set->ordering_constraints = NULL;
 
     crm_trace("deleting %d node cons: %p",
               g_list_length(data_set->placement_constraints), data_set->placement_constraints);
     pe_free_rsc_to_node(data_set->placement_constraints);
     data_set->placement_constraints = NULL;
 
     crm_trace("deleting %d inter-resource cons: %p",
               g_list_length(data_set->colocation_constraints), data_set->colocation_constraints);
     g_list_free_full(data_set->colocation_constraints, free);
     data_set->colocation_constraints = NULL;
 
     crm_trace("deleting %d ticket deps: %p",
               g_list_length(data_set->ticket_constraints), data_set->ticket_constraints);
     g_list_free_full(data_set->ticket_constraints, free);
     data_set->ticket_constraints = NULL;
 
     cleanup_calculations(data_set);
 }
diff --git a/pengine/allocate.h b/pengine/allocate.h
index f6602c6ecb..73f750e296 100644
--- a/pengine/allocate.h
+++ b/pengine/allocate.h
@@ -1,175 +1,176 @@
 /* 
  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  * 
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  * 
  * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef CRM_PENGINE_COMPLEX_ALLOC__H
 #  define CRM_PENGINE_COMPLEX_ALLOC__H
 
 #  include <glib.h>
 #  include <crm/common/xml.h>
 #  include <crm/pengine/status.h>
 #  include <crm/pengine/complex.h>
 #  include <crm/pengine/internal.h>
 #  include <pengine.h>
 
 typedef struct notify_entry_s {
     resource_t *rsc;
     node_t *node;
 } notify_entry_t;
 
 struct resource_alloc_functions_s {
     GHashTable *(*merge_weights) (resource_t *, const char *, GHashTable *, const char *, float,
                                   enum pe_weights);
     node_t *(*allocate) (resource_t *, node_t *, pe_working_set_t *);
     void (*create_actions) (resource_t *, pe_working_set_t *);
      gboolean(*create_probe) (resource_t *, node_t *, action_t *, gboolean, pe_working_set_t *);
     void (*internal_constraints) (resource_t *, pe_working_set_t *);
 
     void (*rsc_colocation_lh) (resource_t *, resource_t *, rsc_colocation_t *);
     void (*rsc_colocation_rh) (resource_t *, resource_t *, rsc_colocation_t *);
 
     void (*rsc_location) (resource_t *, rsc_to_node_t *);
 
     enum pe_action_flags (*action_flags) (action_t *, node_t *);
     enum pe_graph_flags (*update_actions) (action_t *, action_t *, node_t *, enum pe_action_flags,
                                            enum pe_action_flags, enum pe_ordering);
 
     void (*expand) (resource_t *, pe_working_set_t *);
     void (*append_meta) (resource_t * rsc, xmlNode * xml);
 };
 
 extern GHashTable *rsc_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
                                      const char *attr, float factor, enum pe_weights flags);
 
 extern GHashTable *clone_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
                                        const char *attr, float factor, enum pe_weights flags);
 
 extern GHashTable *master_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
                                         const char *attr, float factor, enum pe_weights flags);
 
 extern GHashTable *native_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
                                         const char *attr, float factor, enum pe_weights flags);
 
 extern GHashTable *group_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
                                        const char *attr, float factor, enum pe_weights flags);
 
 extern node_t *native_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
 extern void native_create_actions(resource_t * rsc, pe_working_set_t * data_set);
 extern void native_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
 extern void native_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc,
                                      rsc_colocation_t * constraint);
 extern void native_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
                                      rsc_colocation_t * constraint);
 extern void rsc_ticket_constraint(resource_t * lh_rsc, rsc_ticket_t * rsc_ticket,
                                   pe_working_set_t * data_set);
 extern enum pe_action_flags native_action_flags(action_t * action, node_t * node);
 
 extern void native_rsc_location(resource_t * rsc, rsc_to_node_t * constraint);
 extern void native_expand(resource_t * rsc, pe_working_set_t * data_set);
 extern void native_dump(resource_t * rsc, const char *pre_text, gboolean details);
 extern void create_notify_element(resource_t * rsc, action_t * op,
                                   notify_data_t * n_data, pe_working_set_t * data_set);
 extern gboolean native_create_probe(resource_t * rsc, node_t * node, action_t * complete,
                                     gboolean force, pe_working_set_t * data_set);
 extern void native_append_meta(resource_t * rsc, xmlNode * xml);
 
 extern int group_num_allowed_nodes(resource_t * rsc);
 extern node_t *group_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
 extern void group_create_actions(resource_t * rsc, pe_working_set_t * data_set);
 extern void group_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
 extern void group_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc,
                                     rsc_colocation_t * constraint);
 extern void group_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
                                     rsc_colocation_t * constraint);
 extern enum pe_action_flags group_action_flags(action_t * action, node_t * node);
 extern void group_rsc_location(resource_t * rsc, rsc_to_node_t * constraint);
 extern void group_expand(resource_t * rsc, pe_working_set_t * data_set);
 extern void group_append_meta(resource_t * rsc, xmlNode * xml);
 
 extern int clone_num_allowed_nodes(resource_t * rsc);
 extern node_t *clone_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
 extern void clone_create_actions(resource_t * rsc, pe_working_set_t * data_set);
 extern void clone_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
 extern void clone_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc,
                                     rsc_colocation_t * constraint);
 extern void clone_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
                                     rsc_colocation_t * constraint);
 extern void clone_rsc_location(resource_t * rsc, rsc_to_node_t * constraint);
 extern enum pe_action_flags clone_action_flags(action_t * action, node_t * node);
 extern void clone_expand(resource_t * rsc, pe_working_set_t * data_set);
 extern gboolean clone_create_probe(resource_t * rsc, node_t * node, action_t * complete,
                                    gboolean force, pe_working_set_t * data_set);
 extern void clone_append_meta(resource_t * rsc, xmlNode * xml);
 
 extern gboolean master_unpack(resource_t * rsc, pe_working_set_t * data_set);
 extern node_t *master_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
 extern void master_create_actions(resource_t * rsc, pe_working_set_t * data_set);
 extern void master_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
 extern void master_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
                                      rsc_colocation_t * constraint);
 extern void master_append_meta(resource_t * rsc, xmlNode * xml);
 
 /* extern resource_object_functions_t resource_variants[]; */
 extern resource_alloc_functions_t resource_class_alloc_functions[];
 extern gboolean is_active(rsc_to_node_t * cons);
 
 extern gboolean native_constraint_violated(resource_t * rsc_lh, resource_t * rsc_rh,
                                            rsc_colocation_t * constraint);
 
 extern gboolean unpack_rsc_to_attr(xmlNode * xml_obj, pe_working_set_t * data_set);
 
 extern gboolean unpack_rsc_to_node(xmlNode * xml_obj, pe_working_set_t * data_set);
 
 extern gboolean unpack_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set);
 
 extern gboolean unpack_rsc_colocation(xmlNode * xml_obj, pe_working_set_t * data_set);
 
 extern gboolean unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set);
 
 extern gboolean unpack_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set);
 
 extern void LogActions(resource_t * rsc, pe_working_set_t * data_set, gboolean terminal);
 
 extern void cleanup_alloc_calculations(pe_working_set_t * data_set);
 
 extern notify_data_t *create_notification_boundaries(resource_t * rsc, const char *action,
                                                      action_t * start, action_t * end,
                                                      pe_working_set_t * data_set);
 
 extern void collect_notification_data(resource_t * rsc, gboolean state, gboolean activity,
                                       notify_data_t * n_data);
 extern gboolean expand_notification_data(notify_data_t * n_data, pe_working_set_t * data_set);
 extern void create_notifications(resource_t * rsc, notify_data_t * n_data,
                                  pe_working_set_t * data_set);
 extern void free_notification_data(notify_data_t * n_data);
 extern void rsc_reload(resource_t * rsc, pe_working_set_t * data_set);
 extern void rsc_stonith_ordering(resource_t * rsc, action_t * stonith_op,
                                  pe_working_set_t * data_set);
 
 extern enum pe_graph_flags native_update_actions(action_t * first, action_t * then, node_t * node,
                                                  enum pe_action_flags flags,
                                                  enum pe_action_flags filter,
                                                  enum pe_ordering type);
 extern enum pe_graph_flags group_update_actions(action_t * first, action_t * then, node_t * node,
                                                 enum pe_action_flags flags,
                                                 enum pe_action_flags filter, enum pe_ordering type);
 extern enum pe_graph_flags clone_update_actions(action_t * first, action_t * then, node_t * node,
                                                 enum pe_action_flags flags,
                                                 enum pe_action_flags filter, enum pe_ordering type);
 
 gboolean update_action_flags(action_t * action, enum pe_action_flags flags);
+gboolean update_action(action_t * action);
 
 #endif
diff --git a/pengine/clone.c b/pengine/clone.c
index 3840a0ae79..ebf53ed0f5 100644
--- a/pengine/clone.c
+++ b/pengine/clone.c
@@ -1,1620 +1,1631 @@
 /* 
  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  * 
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  * 
  * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <crm_internal.h>
 
 #include <crm/msg_xml.h>
 #include <allocate.h>
 #include <utils.h>
+#include <allocate.h>
 
 #define VARIANT_CLONE 1
 #include <lib/pengine/variant.h>
 
 gint sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set);
 static void append_parent_colocation(resource_t * rsc, resource_t * child, gboolean all);
 
 static gint
 sort_rsc_id(gconstpointer a, gconstpointer b)
 {
     const resource_t *resource1 = (const resource_t *)a;
     const resource_t *resource2 = (const resource_t *)b;
 
     CRM_ASSERT(resource1 != NULL);
     CRM_ASSERT(resource2 != NULL);
 
     return strcmp(resource1->id, resource2->id);
 }
 
 static node_t *
 parent_node_instance(const resource_t * rsc, node_t * node)
 {
     node_t *ret = NULL;
 
     if (node != NULL) {
         ret = pe_hash_table_lookup(rsc->parent->allowed_nodes, node->details->id);
     }
     return ret;
 }
 
 static gboolean
 did_fail(const resource_t * rsc)
 {
     GListPtr gIter = rsc->children;
 
     if (is_set(rsc->flags, pe_rsc_failed)) {
         return TRUE;
     }
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         if (did_fail(child_rsc)) {
             return TRUE;
         }
     }
     return FALSE;
 }
 
 gint
 sort_clone_instance(gconstpointer a, gconstpointer b, gpointer data_set)
 {
     int rc = 0;
     node_t *node1 = NULL;
     node_t *node2 = NULL;
 
     gboolean can1 = TRUE;
     gboolean can2 = TRUE;
 
     const resource_t *resource1 = (const resource_t *)a;
     const resource_t *resource2 = (const resource_t *)b;
 
     CRM_ASSERT(resource1 != NULL);
     CRM_ASSERT(resource2 != NULL);
 
     /* allocation order:
      *  - active instances
      *  - instances running on nodes with the least copies
      *  - active instances on nodes that cant support them or are to be fenced
      *  - failed instances
      *  - inactive instances
      */
 
     if (resource1->running_on && resource2->running_on) {
         if (g_list_length(resource1->running_on) < g_list_length(resource2->running_on)) {
             crm_trace("%s < %s: running_on", resource1->id, resource2->id);
             return -1;
 
         } else if (g_list_length(resource1->running_on) > g_list_length(resource2->running_on)) {
             crm_trace("%s > %s: running_on", resource1->id, resource2->id);
             return 1;
         }
     }
 
     if (resource1->running_on) {
         node1 = resource1->running_on->data;
     }
     if (resource2->running_on) {
         node2 = resource2->running_on->data;
     }
 
     if (node1) {
         node_t *match = pe_hash_table_lookup(resource1->allowed_nodes, node1->details->id);
 
         if (match == NULL || match->weight < 0) {
             crm_trace("%s: current location is unavailable", resource1->id);
             node1 = NULL;
             can1 = FALSE;
         }
     }
 
     if (node2) {
         node_t *match = pe_hash_table_lookup(resource2->allowed_nodes, node2->details->id);
 
         if (match == NULL || match->weight < 0) {
             crm_trace("%s: current location is unavailable", resource2->id);
             node2 = NULL;
             can2 = FALSE;
         }
     }
 
     if (can1 != can2) {
         if (can1) {
             crm_trace("%s < %s: availability of current location", resource1->id, resource2->id);
             return -1;
         }
         crm_trace("%s > %s: availability of current location", resource1->id, resource2->id);
         return 1;
     }
 
     if (resource1->priority < resource2->priority) {
         crm_trace("%s < %s: priority", resource1->id, resource2->id);
         return 1;
 
     } else if (resource1->priority > resource2->priority) {
         crm_trace("%s > %s: priority", resource1->id, resource2->id);
         return -1;
     }
 
     if (node1 == NULL && node2 == NULL) {
         crm_trace("%s == %s: not active", resource1->id, resource2->id);
         return 0;
     }
 
     if (node1 != node2) {
         if (node1 == NULL) {
             crm_trace("%s > %s: active", resource1->id, resource2->id);
             return 1;
         } else if (node2 == NULL) {
             crm_trace("%s < %s: active", resource1->id, resource2->id);
             return -1;
         }
     }
 
     can1 = can_run_resources(node1);
     can2 = can_run_resources(node2);
     if (can1 != can2) {
         if (can1) {
             crm_trace("%s < %s: can", resource1->id, resource2->id);
             return -1;
         }
         crm_trace("%s > %s: can", resource1->id, resource2->id);
         return 1;
     }
 
     node1 = parent_node_instance(resource1, node1);
     node2 = parent_node_instance(resource2, node2);
     if (node1 != NULL && node2 == NULL) {
         crm_trace("%s < %s: not allowed", resource1->id, resource2->id);
         return -1;
     } else if (node1 == NULL && node2 != NULL) {
         crm_trace("%s > %s: not allowed", resource1->id, resource2->id);
         return 1;
     }
 
     if (node1 == NULL || node2 == NULL) {
         crm_trace("%s == %s: not allowed", resource1->id, resource2->id);
         return 0;
     }
 
     if (node1->count < node2->count) {
         crm_trace("%s < %s: count", resource1->id, resource2->id);
         return -1;
 
     } else if (node1->count > node2->count) {
         crm_trace("%s > %s: count", resource1->id, resource2->id);
         return 1;
     }
 
     can1 = did_fail(resource1);
     can2 = did_fail(resource2);
     if (can1 != can2) {
         if (can1) {
             crm_trace("%s > %s: failed", resource1->id, resource2->id);
             return 1;
         }
         crm_trace("%s < %s: failed", resource1->id, resource2->id);
         return -1;
     }
 
     if (node1 && node2) {
         int lpc = 0;
         int max = 0;
         node_t *n = NULL;
         GListPtr gIter = NULL;
         GListPtr list1 = NULL;
         GListPtr list2 = NULL;
         GHashTable *hash1 =
             g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, g_hash_destroy_str);
         GHashTable *hash2 =
             g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, g_hash_destroy_str);
 
         n = node_copy(resource1->running_on->data);
         g_hash_table_insert(hash1, (gpointer) n->details->id, n);
 
         n = node_copy(resource2->running_on->data);
         g_hash_table_insert(hash2, (gpointer) n->details->id, n);
 
         for (gIter = resource1->parent->rsc_cons; gIter; gIter = gIter->next) {
             rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
 
             crm_trace("Applying %s to %s", constraint->id, resource1->id);
 
             hash1 = native_merge_weights(constraint->rsc_rh, resource1->id, hash1,
                                          constraint->node_attribute,
                                          (float)constraint->score / INFINITY, 0);
         }
 
         for (gIter = resource1->parent->rsc_cons_lhs; gIter; gIter = gIter->next) {
             rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
 
             crm_trace("Applying %s to %s", constraint->id, resource1->id);
 
             hash1 = native_merge_weights(constraint->rsc_lh, resource1->id, hash1,
                                          constraint->node_attribute,
                                          (float)constraint->score / INFINITY, pe_weights_positive);
         }
 
         for (gIter = resource2->parent->rsc_cons; gIter; gIter = gIter->next) {
             rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
 
             crm_trace("Applying %s to %s", constraint->id, resource2->id);
 
             hash2 = native_merge_weights(constraint->rsc_rh, resource2->id, hash2,
                                          constraint->node_attribute,
                                          (float)constraint->score / INFINITY, 0);
         }
 
         for (gIter = resource2->parent->rsc_cons_lhs; gIter; gIter = gIter->next) {
             rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
 
             crm_trace("Applying %s to %s", constraint->id, resource2->id);
 
             hash2 = native_merge_weights(constraint->rsc_lh, resource2->id, hash2,
                                          constraint->node_attribute,
                                          (float)constraint->score / INFINITY, pe_weights_positive);
         }
 
         /* Current location score */
         node1 = g_list_nth_data(resource1->running_on, 0);
         node1 = g_hash_table_lookup(hash1, node1->details->id);
 
         node2 = g_list_nth_data(resource2->running_on, 0);
         node2 = g_hash_table_lookup(hash2, node2->details->id);
 
         if (node1->weight < node2->weight) {
             if (node1->weight < 0) {
                 crm_trace("%s > %s: current score", resource1->id, resource2->id);
                 rc = -1;
                 goto out;
 
             } else {
                 crm_trace("%s < %s: current score", resource1->id, resource2->id);
                 rc = 1;
                 goto out;
             }
 
         } else if (node1->weight > node2->weight) {
             crm_trace("%s > %s: current score", resource1->id, resource2->id);
             rc = -1;
             goto out;
         }
 
         /* All location scores */
         list1 = g_hash_table_get_values(hash1);
         list2 = g_hash_table_get_values(hash2);
 
         list1 =
             g_list_sort_with_data(list1, sort_node_weight,
                                   g_list_nth_data(resource1->running_on, 0));
         list2 =
             g_list_sort_with_data(list2, sort_node_weight,
                                   g_list_nth_data(resource2->running_on, 0));
         max = g_list_length(list1);
         if (max < g_list_length(list2)) {
             max = g_list_length(list2);
         }
 
         for (; lpc < max; lpc++) {
             node1 = g_list_nth_data(list1, lpc);
             node2 = g_list_nth_data(list2, lpc);
             if (node1 == NULL) {
                 crm_trace("%s < %s: colocated score NULL", resource1->id, resource2->id);
                 rc = 1;
                 break;
 
             } else if (node2 == NULL) {
                 crm_trace("%s > %s: colocated score NULL", resource1->id, resource2->id);
                 rc = -1;
                 break;
             }
 
             if (node1->weight < node2->weight) {
                 crm_trace("%s < %s: colocated score", resource1->id, resource2->id);
                 rc = 1;
                 break;
 
             } else if (node1->weight > node2->weight) {
                 crm_trace("%s > %s: colocated score", resource1->id, resource2->id);
                 rc = -1;
                 break;
             }
         }
 
         /* Order by reverse uname - same as sort_node_weight() does? */
   out:
         g_hash_table_destroy(hash1);    /* Free mem */
         g_hash_table_destroy(hash2);    /* Free mem */
         g_list_free(list1);
         g_list_free(list2);
 
         if (rc != 0) {
             return rc;
         }
     }
 
     rc = strcmp(resource1->id, resource2->id);
     crm_trace("%s %c %s: default", resource1->id, rc < 0 ? '<' : '>', resource2->id);
     return rc;
 }
 
 static node_t *
 can_run_instance(resource_t * rsc, node_t * node)
 {
     node_t *local_node = NULL;
     clone_variant_data_t *clone_data = NULL;
 
     if (can_run_resources(node) == FALSE) {
         goto bail;
 
     } else if (is_set(rsc->flags, pe_rsc_orphan)) {
         goto bail;
     }
 
     local_node = parent_node_instance(rsc, node);
     get_clone_variant_data(clone_data, rsc->parent);
 
     if (local_node == NULL) {
         crm_warn("%s cannot run on %s: node not allowed", rsc->id, node->details->uname);
         goto bail;
 
     } else if (local_node->weight < 0) {
         common_update_score(rsc, node->details->id, local_node->weight);
         pe_rsc_trace(rsc, "%s cannot run on %s: Parent node weight doesn't allow it.",
                      rsc->id, node->details->uname);
     } else if (local_node->count < clone_data->clone_node_max) {
         pe_rsc_trace(rsc, "%s can run on %s: %d", rsc->id, node->details->uname, local_node->count);
         return local_node;
 
     } else {
         pe_rsc_trace(rsc, "%s cannot run on %s: node full (%d >= %d)",
                      rsc->id, node->details->uname, local_node->count, clone_data->clone_node_max);
     }
 
   bail:
     if (node) {
         common_update_score(rsc, node->details->id, -INFINITY);
     }
     return NULL;
 }
 
 static node_t *
 color_instance(resource_t * rsc, node_t * prefer, gboolean all_coloc, pe_working_set_t * data_set)
 {
     node_t *chosen = NULL;
     node_t *local_node = NULL;
     GHashTable *backup = NULL;
 
     CRM_ASSERT(rsc);
     pe_rsc_trace(rsc, "Processing %s %d", rsc->id, all_coloc);
 
     if (is_not_set(rsc->flags, pe_rsc_provisional)) {
         return rsc->fns->location(rsc, NULL, FALSE);
 
     } else if (is_set(rsc->flags, pe_rsc_allocating)) {
         pe_rsc_debug(rsc, "Dependency loop detected involving %s", rsc->id);
         return NULL;
     }
 
     /* Only include positive colocation preferences of dependant resources
      * if not every node will get a copy of the clone
      */
     append_parent_colocation(rsc->parent, rsc, all_coloc);
 
     if (prefer) {
         node_t *local_prefer = g_hash_table_lookup(rsc->allowed_nodes, prefer->details->id);
 
         if (local_prefer == NULL || local_prefer->weight < 0) {
             pe_rsc_trace(rsc, "Not pre-allocating %s to %s - unavailable", rsc->id,
                          prefer->details->uname);
             return NULL;
         }
     }
 
     if (rsc->allowed_nodes) {
         GHashTableIter iter;
         node_t *try_node = NULL;
 
         g_hash_table_iter_init(&iter, rsc->allowed_nodes);
         while (g_hash_table_iter_next(&iter, NULL, (void **)&try_node)) {
             can_run_instance(rsc, try_node);
         }
     }
 
     backup = node_hash_dup(rsc->allowed_nodes);
     chosen = rsc->cmds->allocate(rsc, prefer, data_set);
     if (chosen) {
         local_node = pe_hash_table_lookup(rsc->parent->allowed_nodes, chosen->details->id);
 
         if (prefer && chosen && chosen->details != prefer->details) {
             crm_notice("Pre-allocation failed: got %s instead of %s",
                        chosen->details->uname, prefer->details->uname);
             g_hash_table_destroy(rsc->allowed_nodes);
             rsc->allowed_nodes = backup;
             native_deallocate(rsc);
             chosen = NULL;
             backup = NULL;
 
         } else if (local_node) {
             local_node->count++;
 
         } else if (is_set(rsc->flags, pe_rsc_managed)) {
             /* what to do? we can't enforce per-node limits in this case */
             crm_config_err("%s not found in %s (list=%d)",
                            chosen->details->id, rsc->parent->id,
                            g_hash_table_size(rsc->parent->allowed_nodes));
         }
     }
 
     if(backup) {
         g_hash_table_destroy(backup);
     }
     return chosen;
 }
 
 static void
 append_parent_colocation(resource_t * rsc, resource_t * child, gboolean all)
 {
 
     GListPtr gIter = NULL;
 
     gIter = rsc->rsc_cons;
     for (; gIter != NULL; gIter = gIter->next) {
         rsc_colocation_t *cons = (rsc_colocation_t *) gIter->data;
 
         if (all || cons->score < 0 || cons->score == INFINITY) {
             child->rsc_cons = g_list_prepend(child->rsc_cons, cons);
         }
     }
 
     gIter = rsc->rsc_cons_lhs;
     for (; gIter != NULL; gIter = gIter->next) {
         rsc_colocation_t *cons = (rsc_colocation_t *) gIter->data;
 
         if (all || cons->score < 0) {
             child->rsc_cons_lhs = g_list_prepend(child->rsc_cons_lhs, cons);
         }
     }
 }
 
 node_t *
 clone_color(resource_t * rsc, node_t * prefer, pe_working_set_t * data_set)
 {
     GHashTableIter iter;
     GListPtr nIter = NULL;
     GListPtr gIter = NULL;
     GListPtr nodes = NULL;
     node_t *node = NULL;
 
     int allocated = 0;
     int loop_max = 0;
     int clone_max = 0;
     int available_nodes = 0;
     clone_variant_data_t *clone_data = NULL;
 
     get_clone_variant_data(clone_data, rsc);
 
     if (is_not_set(rsc->flags, pe_rsc_provisional)) {
         return NULL;
 
     } else if (is_set(rsc->flags, pe_rsc_allocating)) {
         pe_rsc_debug(rsc, "Dependency loop detected involving %s", rsc->id);
         return NULL;
     }
 
     set_bit(rsc->flags, pe_rsc_allocating);
     pe_rsc_trace(rsc, "Processing %s", rsc->id);
 
     /* this information is used by sort_clone_instance() when deciding in which 
      * order to allocate clone instances
      */
     gIter = rsc->rsc_cons;
     for (; gIter != NULL; gIter = gIter->next) {
         rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
 
         pe_rsc_trace(rsc, "%s: Coloring %s first", rsc->id, constraint->rsc_rh->id);
         constraint->rsc_rh->cmds->allocate(constraint->rsc_rh, prefer, data_set);
     }
 
     gIter = rsc->rsc_cons_lhs;
     for (; gIter != NULL; gIter = gIter->next) {
         rsc_colocation_t *constraint = (rsc_colocation_t *) gIter->data;
 
         rsc->allowed_nodes =
             constraint->rsc_lh->cmds->merge_weights(constraint->rsc_lh, rsc->id, rsc->allowed_nodes,
                                                     constraint->node_attribute,
                                                     (float)constraint->score / INFINITY,
                                                     (pe_weights_rollback | pe_weights_positive));
     }
 
     dump_node_scores(show_scores ? 0 : scores_log_level, rsc, __FUNCTION__, rsc->allowed_nodes);
 
     /* count now tracks the number of clones currently allocated */
     g_hash_table_iter_init(&iter, rsc->allowed_nodes);
     while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) {
         node->count = 0;
         if (can_run_resources(node)) {
             available_nodes++;
         }
     }
 
     clone_max = clone_data->clone_max;
     if(available_nodes) {
         loop_max = clone_data->clone_max / available_nodes;
     }
     if (loop_max < 1) {
         loop_max = 1;
     }
 
     rsc->children = g_list_sort_with_data(rsc->children, sort_clone_instance, data_set);
 
     /* Pre-allocate as many instances as we can to their current location
      * First pre-sort the list of nodes by their placement score
      */
     nodes = g_hash_table_get_values(rsc->allowed_nodes);
     nodes = g_list_sort_with_data(nodes, sort_node_weight, NULL);
 
     for(nIter = nodes; nIter; nIter = nIter->next) {
         int lpc;
 
         node = nIter->data;
 
         if(clone_max <= 0) {
             break;
         }
 
         if (can_run_resources(node) == FALSE || node->weight < 0) {
             pe_rsc_trace(rsc, "Not Pre-allocatiing %s", node->details->uname);
             continue;
         }
 
         clone_max--;
         pe_rsc_trace(rsc, "Pre-allocating %s (%d remaining)", node->details->uname, clone_max);
         for (lpc = 0;
              allocated < clone_data->clone_max
              && node->count < clone_data->clone_node_max
              && lpc < clone_data->clone_node_max && lpc < loop_max; lpc++) {
             for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
                 resource_t *child = (resource_t *) gIter->data;
 
                 if (child->running_on && is_set(child->flags, pe_rsc_provisional)
                     && is_not_set(child->flags, pe_rsc_failed)) {
                     node_t *child_node = child->running_on->data;
 
                     if (child_node->details == node->details
                         && color_instance(child, node, clone_data->clone_max < available_nodes,
                                           data_set)) {
                         pe_rsc_trace(rsc, "Pre-allocated %s to %s", child->id,
                                      node->details->uname);
                         allocated++;
                         break;
                     }
                 }
             }
         }
     }
 
     pe_rsc_trace(rsc, "Done pre-allocating (%d of %d)", allocated, clone_data->clone_max);
     g_list_free(nodes);
 
     for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
         resource_t *child = (resource_t *) gIter->data;
 
         if (g_list_length(child->running_on) > 0) {
             node_t *child_node = child->running_on->data;
             node_t *local_node = parent_node_instance(child, child->running_on->data);
 
             if (local_node == NULL) {
                 crm_err("%s is running on %s which isn't allowed",
                         child->id, child_node->details->uname);
             }
         }
 
         if (is_not_set(child->flags, pe_rsc_provisional)) {
         } else if (allocated >= clone_data->clone_max) {
             pe_rsc_debug(rsc, "Child %s not allocated - limit reached", child->id);
             resource_location(child, NULL, -INFINITY, "clone_color:limit_reached", data_set);
 
         } else if (color_instance(child, NULL, clone_data->clone_max < available_nodes, data_set)) {
             allocated++;
         }
     }
 
     pe_rsc_debug(rsc, "Allocated %d %s instances of a possible %d",
                  allocated, rsc->id, clone_data->clone_max);
 
     clear_bit(rsc->flags, pe_rsc_provisional);
     clear_bit(rsc->flags, pe_rsc_allocating);
 
     pe_rsc_trace(rsc, "Done allocating %s", rsc->id);
     return NULL;
 }
 
 static void
 clone_update_pseudo_status(resource_t * rsc, gboolean * stopping, gboolean * starting,
                            gboolean * active)
 {
     GListPtr gIter = NULL;
 
     if (rsc->children) {
 
         gIter = rsc->children;
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child = (resource_t *) gIter->data;
 
             clone_update_pseudo_status(child, stopping, starting, active);
         }
 
         return;
     }
 
     CRM_ASSERT(active != NULL);
     CRM_ASSERT(starting != NULL);
     CRM_ASSERT(stopping != NULL);
 
     if (rsc->running_on) {
         *active = TRUE;
     }
 
     gIter = rsc->actions;
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *action = (action_t *) gIter->data;
 
         if (*starting && *stopping) {
             return;
 
         } else if (is_set(action->flags, pe_action_optional)) {
             pe_rsc_trace(rsc, "Skipping optional: %s", action->uuid);
             continue;
 
         } else if (is_set(action->flags, pe_action_pseudo) == FALSE
                    && is_set(action->flags, pe_action_runnable) == FALSE) {
             pe_rsc_trace(rsc, "Skipping unrunnable: %s", action->uuid);
             continue;
 
         } else if (safe_str_eq(RSC_STOP, action->task)) {
             pe_rsc_trace(rsc, "Stopping due to: %s", action->uuid);
             *stopping = TRUE;
 
         } else if (safe_str_eq(RSC_START, action->task)) {
             if (is_set(action->flags, pe_action_runnable) == FALSE) {
                 pe_rsc_trace(rsc, "Skipping pseudo-op: %s run=%d, pseudo=%d",
                              action->uuid, is_set(action->flags, pe_action_runnable),
                              is_set(action->flags, pe_action_pseudo));
             } else {
                 pe_rsc_trace(rsc, "Starting due to: %s", action->uuid);
                 pe_rsc_trace(rsc, "%s run=%d, pseudo=%d",
                              action->uuid, is_set(action->flags, pe_action_runnable),
                              is_set(action->flags, pe_action_pseudo));
                 *starting = TRUE;
             }
         }
     }
 }
 
 static action_t *
 find_rsc_action(resource_t * rsc, const char *key, gboolean active_only, GListPtr * list)
 {
     action_t *match = NULL;
     GListPtr possible = NULL;
     GListPtr active = NULL;
 
     possible = find_actions(rsc->actions, key, NULL);
 
     if (active_only) {
         GListPtr gIter = possible;
 
         for (; gIter != NULL; gIter = gIter->next) {
             action_t *op = (action_t *) gIter->data;
 
             if (is_set(op->flags, pe_action_optional) == FALSE) {
                 active = g_list_prepend(active, op);
             }
         }
 
         if (active && g_list_length(active) == 1) {
             match = g_list_nth_data(active, 0);
         }
 
         if (list) {
             *list = active;
             active = NULL;
         }
 
     } else if (possible && g_list_length(possible) == 1) {
         match = g_list_nth_data(possible, 0);
 
     }
     if (list) {
         *list = possible;
         possible = NULL;
     }
 
     if (possible) {
         g_list_free(possible);
     }
     if (active) {
         g_list_free(active);
     }
 
     return match;
 }
 
 static void
 child_ordering_constraints(resource_t * rsc, pe_working_set_t * data_set)
 {
     char *key = NULL;
     action_t *stop = NULL;
     action_t *start = NULL;
     action_t *last_stop = NULL;
     action_t *last_start = NULL;
     GListPtr gIter = NULL;
     gboolean active_only = TRUE;        /* change to false to get the old behavior */
     clone_variant_data_t *clone_data = NULL;
 
     get_clone_variant_data(clone_data, rsc);
 
     if (clone_data->ordered == FALSE) {
         return;
     }
     /* we have to maintain a consistent sorted child list when building order constraints */
     rsc->children = g_list_sort(rsc->children, sort_rsc_id);
 
     for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
         resource_t *child = (resource_t *) gIter->data;
 
         key = stop_key(child);
         stop = find_rsc_action(child, key, active_only, NULL);
         free(key);
 
         key = start_key(child);
         start = find_rsc_action(child, key, active_only, NULL);
         free(key);
 
         if (stop) {
             if (last_stop) {
                 /* child/child relative stop */
                 order_actions(stop, last_stop, pe_order_optional);
             }
             last_stop = stop;
         }
 
         if (start) {
             if (last_start) {
                 /* child/child relative start */
                 order_actions(last_start, start, pe_order_optional);
             }
             last_start = start;
         }
     }
 }
 
 void
 clone_create_actions(resource_t * rsc, pe_working_set_t * data_set)
 {
     gboolean child_active = FALSE;
     gboolean child_starting = FALSE;
     gboolean child_stopping = FALSE;
     gboolean allow_dependent_migrations = TRUE;
 
     action_t *stop = NULL;
     action_t *stopped = NULL;
 
     action_t *start = NULL;
     action_t *started = NULL;
 
     GListPtr gIter = rsc->children;
     clone_variant_data_t *clone_data = NULL;
 
     get_clone_variant_data(clone_data, rsc);
 
     pe_rsc_trace(rsc, "Creating actions for %s", rsc->id);
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
         gboolean starting = FALSE;
         gboolean stopping = FALSE;
 
         child_rsc->cmds->create_actions(child_rsc, data_set);
         clone_update_pseudo_status(child_rsc, &stopping, &starting, &child_active);
         if (stopping && starting) {
             allow_dependent_migrations = FALSE;
         }
 
         child_stopping |= stopping;
         child_starting |= starting;
     }
 
     /* start */
     start = start_action(rsc, NULL, !child_starting);
     started = custom_action(rsc, started_key(rsc),
                             RSC_STARTED, NULL, !child_starting, TRUE, data_set);
 
     update_action_flags(start, pe_action_pseudo | pe_action_runnable);
     update_action_flags(started, pe_action_pseudo);
     started->priority = INFINITY;
 
     if (child_active || child_starting) {
         update_action_flags(started, pe_action_runnable);
     }
 
     child_ordering_constraints(rsc, data_set);
     if (clone_data->start_notify == NULL) {
         clone_data->start_notify =
             create_notification_boundaries(rsc, RSC_START, start, started, data_set);
     }
 
     /* stop */
     stop = stop_action(rsc, NULL, !child_stopping);
     stopped = custom_action(rsc, stopped_key(rsc),
                             RSC_STOPPED, NULL, !child_stopping, TRUE, data_set);
 
     stopped->priority = INFINITY;
     update_action_flags(stop, pe_action_pseudo | pe_action_runnable);
     if (allow_dependent_migrations) {
         update_action_flags(stop, pe_action_migrate_runnable);
     }
     update_action_flags(stopped, pe_action_pseudo | pe_action_runnable);
     if (clone_data->stop_notify == NULL) {
         clone_data->stop_notify =
             create_notification_boundaries(rsc, RSC_STOP, stop, stopped, data_set);
 
         if (clone_data->stop_notify && clone_data->start_notify) {
             order_actions(clone_data->stop_notify->post_done, clone_data->start_notify->pre,
                           pe_order_optional);
         }
     }
 }
 
 void
 clone_internal_constraints(resource_t * rsc, pe_working_set_t * data_set)
 {
     resource_t *last_rsc = NULL;
     GListPtr gIter;
     clone_variant_data_t *clone_data = NULL;
 
     get_clone_variant_data(clone_data, rsc);
 
     pe_rsc_trace(rsc, "Internal constraints for %s", rsc->id);
     new_rsc_order(rsc, RSC_STOPPED, rsc, RSC_START, pe_order_optional, data_set);
     new_rsc_order(rsc, RSC_START, rsc, RSC_STARTED, pe_order_runnable_left, data_set);
     new_rsc_order(rsc, RSC_STOP, rsc, RSC_STOPPED, pe_order_runnable_left, data_set);
 
     if (rsc->variant == pe_master) {
         new_rsc_order(rsc, RSC_DEMOTED, rsc, RSC_STOP, pe_order_optional, data_set);
         new_rsc_order(rsc, RSC_STARTED, rsc, RSC_PROMOTE, pe_order_runnable_left, data_set);
     }
 
     if (clone_data->ordered) {
         /* we have to maintain a consistent sorted child list when building order constraints */
         rsc->children = g_list_sort(rsc->children, sort_rsc_id);
     }
     for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         child_rsc->cmds->internal_constraints(child_rsc, data_set);
 
         order_start_start(rsc, child_rsc, pe_order_runnable_left | pe_order_implies_first_printed);
         new_rsc_order(child_rsc, RSC_START, rsc, RSC_STARTED, pe_order_implies_then_printed,
                       data_set);
         if (clone_data->ordered && last_rsc) {
             order_start_start(last_rsc, child_rsc, pe_order_optional);
         }
 
         order_stop_stop(rsc, child_rsc, pe_order_implies_first_printed);
         new_rsc_order(child_rsc, RSC_STOP, rsc, RSC_STOPPED, pe_order_implies_then_printed,
                       data_set);
         if (clone_data->ordered && last_rsc) {
             order_stop_stop(child_rsc, last_rsc, pe_order_optional);
         }
 
         last_rsc = child_rsc;
     }
 }
 
 static void
 assign_node(resource_t * rsc, node_t * node, gboolean force)
 {
     if (rsc->children) {
 
         GListPtr gIter = rsc->children;
 
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child_rsc = (resource_t *) gIter->data;
 
             native_assign_node(child_rsc, NULL, node, force);
         }
 
         return;
     }
     native_assign_node(rsc, NULL, node, force);
 }
 
 static resource_t *
 find_compatible_child_by_node(resource_t * local_child, node_t * local_node, resource_t * rsc,
                               enum rsc_role_e filter, gboolean current)
 {
     node_t *node = NULL;
     GListPtr gIter = NULL;
 
     if (local_node == NULL) {
         crm_err("Can't colocate unrunnable child %s with %s", local_child->id, rsc->id);
         return NULL;
     }
 
     crm_trace("Looking for compatible child from %s for %s on %s",
               local_child->id, rsc->id, local_node->details->uname);
 
     gIter = rsc->children;
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
         enum rsc_role_e next_role = child_rsc->fns->state(child_rsc, current);
 
         if (is_set_recursive(child_rsc, pe_rsc_block, TRUE) == FALSE) {
             /* We only want instances that haven't failed */
             node = child_rsc->fns->location(child_rsc, NULL, current);
         }
 
         if (filter != RSC_ROLE_UNKNOWN && next_role != filter) {
             crm_trace("Filtered %s", child_rsc->id);
             continue;
         }
 
         if (node && local_node && node->details == local_node->details) {
             crm_trace("Pairing %s with %s on %s",
                       local_child->id, child_rsc->id, node->details->uname);
             return child_rsc;
 
         } else if (node) {
             crm_trace("%s - %s vs %s", child_rsc->id, node->details->uname,
                       local_node->details->uname);
 
         } else {
             crm_trace("%s - not allocated %d", child_rsc->id, current);
         }
     }
 
     crm_trace("Can't pair %s with %s", local_child->id, rsc->id);
     return NULL;
 }
 
 resource_t *
 find_compatible_child(resource_t * local_child, resource_t * rsc, enum rsc_role_e filter,
                       gboolean current)
 {
     resource_t *pair = NULL;
     GListPtr gIter = NULL;
     GListPtr scratch = NULL;
     node_t *local_node = NULL;
 
     local_node = local_child->fns->location(local_child, NULL, current);
     if (local_node) {
         return find_compatible_child_by_node(local_child, local_node, rsc, filter, current);
     }
 
     scratch = g_hash_table_get_values(local_child->allowed_nodes);
     scratch = g_list_sort_with_data(scratch, sort_node_weight, NULL);
 
     gIter = scratch;
     for (; gIter != NULL; gIter = gIter->next) {
         node_t *node = (node_t *) gIter->data;
 
         pair = find_compatible_child_by_node(local_child, node, rsc, filter, current);
         if (pair) {
             goto done;
         }
     }
 
     pe_rsc_debug(rsc, "Can't pair %s with %s", local_child->id, rsc->id);
   done:
     g_list_free(scratch);
     return pair;
 }
 
 void
 clone_rsc_colocation_lh(resource_t * rsc_lh, resource_t * rsc_rh, rsc_colocation_t * constraint)
 {
     /* -- Never called --
      *
      * Instead we add the colocation constraints to the child and call from there
      */
 
     GListPtr gIter = rsc_lh->children;
 
     CRM_CHECK(FALSE, crm_err("This functionality is not thought to be used. Please report a bug."));
     CRM_CHECK(rsc_lh, return);
     CRM_CHECK(rsc_rh, return);
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         child_rsc->cmds->rsc_colocation_lh(child_rsc, rsc_rh, constraint);
     }
 
     return;
 }
 
 void
 clone_rsc_colocation_rh(resource_t * rsc_lh, resource_t * rsc_rh, rsc_colocation_t * constraint)
 {
     GListPtr gIter = NULL;
     gboolean do_interleave = FALSE;
     clone_variant_data_t *clone_data = NULL;
     clone_variant_data_t *clone_data_lh = NULL;
 
     CRM_CHECK(constraint != NULL, return);
     CRM_CHECK(rsc_lh != NULL, pe_err("rsc_lh was NULL for %s", constraint->id); return);
     CRM_CHECK(rsc_rh != NULL, pe_err("rsc_rh was NULL for %s", constraint->id); return);
     CRM_CHECK(rsc_lh->variant == pe_native, return);
 
     get_clone_variant_data(clone_data, constraint->rsc_rh);
     pe_rsc_trace(rsc_rh, "Processing constraint %s: %s -> %s %d",
                  constraint->id, rsc_lh->id, rsc_rh->id, constraint->score);
 
     if (constraint->rsc_lh->variant >= pe_clone) {
 
         get_clone_variant_data(clone_data_lh, constraint->rsc_lh);
         if (clone_data_lh->interleave
             && clone_data->clone_node_max != clone_data_lh->clone_node_max) {
             crm_config_err("Cannot interleave " XML_CIB_TAG_INCARNATION " %s and %s because"
                            " they do not support the same number of" " resources per node",
                            constraint->rsc_lh->id, constraint->rsc_rh->id);
 
             /* only the LHS side needs to be labeled as interleave */
         } else if (clone_data_lh->interleave) {
             do_interleave = TRUE;
         }
     }
 
     if (is_set(rsc_rh->flags, pe_rsc_provisional)) {
         pe_rsc_trace(rsc_rh, "%s is still provisional", rsc_rh->id);
         return;
 
     } else if (do_interleave) {
         resource_t *rh_child = NULL;
 
         rh_child = find_compatible_child(rsc_lh, rsc_rh, RSC_ROLE_UNKNOWN, FALSE);
 
         if (rh_child) {
             pe_rsc_debug(rsc_rh, "Pairing %s with %s", rsc_lh->id, rh_child->id);
             rsc_lh->cmds->rsc_colocation_lh(rsc_lh, rh_child, constraint);
 
         } else if (constraint->score >= INFINITY) {
             crm_notice("Cannot pair %s with instance of %s", rsc_lh->id, rsc_rh->id);
             assign_node(rsc_lh, NULL, TRUE);
 
         } else {
             pe_rsc_debug(rsc_rh, "Cannot pair %s with instance of %s", rsc_lh->id, rsc_rh->id);
         }
 
         return;
 
     } else if (constraint->score >= INFINITY) {
         GListPtr rhs = NULL;
 
         gIter = rsc_rh->children;
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child_rsc = (resource_t *) gIter->data;
             node_t *chosen = child_rsc->fns->location(child_rsc, NULL, FALSE);
 
             if (chosen != NULL && is_set_recursive(child_rsc, pe_rsc_block, TRUE) == FALSE) {
                 rhs = g_list_prepend(rhs, chosen);
             }
         }
 
         node_list_exclude(rsc_lh->allowed_nodes, rhs, FALSE);
         g_list_free(rhs);
         return;
     }
 
     gIter = rsc_rh->children;
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         child_rsc->cmds->rsc_colocation_rh(rsc_lh, child_rsc, constraint);
     }
 }
 
 static enum action_tasks
 clone_child_action(action_t * action)
 {
     enum action_tasks result = no_action;
     resource_t *child = (resource_t *) action->rsc->children->data;
 
     if (safe_str_eq(action->task, "notify")
         || safe_str_eq(action->task, "notified")) {
 
         /* Find the action we're notifying about instead */
 
         int stop = 0;
         char *key = action->uuid;
         int lpc = strlen(key);
 
         for (; lpc > 0; lpc--) {
             if (key[lpc] == '_' && stop == 0) {
                 stop = lpc;
 
             } else if (key[lpc] == '_') {
                 char *task_mutable = NULL;
 
                 lpc++;
                 task_mutable = strdup(key + lpc);
                 task_mutable[stop - lpc] = 0;
 
                 crm_trace("Extracted action '%s' from '%s'", task_mutable, key);
                 result = get_complex_task(child, task_mutable, TRUE);
                 free(task_mutable);
                 break;
             }
         }
 
     } else {
         result = get_complex_task(child, action->task, TRUE);
     }
     return result;
 }
 
 enum pe_action_flags
 clone_action_flags(action_t * action, node_t * node)
 {
     GListPtr gIter = NULL;
     gboolean any_runnable = FALSE;
     gboolean check_runnable = TRUE;
     enum action_tasks task = clone_child_action(action);
     enum pe_action_flags flags = (pe_action_optional | pe_action_runnable | pe_action_pseudo);
     const char *task_s = task2text(task);
 
     gIter = action->rsc->children;
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *child_action = NULL;
         resource_t *child = (resource_t *) gIter->data;
 
         child_action =
             find_first_action(child->actions, NULL, task_s, child->children ? NULL : node);
         pe_rsc_trace(child, "Checking for %s in %s on %s", task_s, child->id,
                      node ? node->details->uname : "none");
         if (child_action) {
             enum pe_action_flags child_flags = child->cmds->action_flags(child_action, node);
 
             if (is_set(flags, pe_action_optional)
                 && is_set(child_flags, pe_action_optional) == FALSE) {
                 pe_rsc_trace(child, "%s is manditory because of %s", action->uuid,
                              child_action->uuid);
                 flags = crm_clear_bit(__FUNCTION__, action->rsc->id, flags, pe_action_optional);
                 pe_clear_action_bit(action, pe_action_optional);
             }
             if (is_set(child_flags, pe_action_runnable)) {
                 any_runnable = TRUE;
             }
 
         } else {
 
             GListPtr gIter2 = child->actions;
 
             for (; gIter2 != NULL; gIter2 = gIter2->next) {
                 action_t *op = (action_t *) gIter2->data;
 
                 pe_rsc_trace(child, "%s on %s (%s)", op->uuid,
                              op->node ? op->node->details->uname : "none", op->task);
             }
         }
     }
 
     if (check_runnable && any_runnable == FALSE) {
         pe_rsc_trace(action->rsc, "%s is not runnable because no children are", action->uuid);
         flags = crm_clear_bit(__FUNCTION__, action->rsc->id, flags, pe_action_runnable);
         if (node == NULL) {
             pe_clear_action_bit(action, pe_action_runnable);
         }
     }
 
     return flags;
 }
 
 static enum pe_graph_flags
 clone_update_actions_interleave(action_t * first, action_t * then, node_t * node,
                                 enum pe_action_flags flags, enum pe_action_flags filter,
                                 enum pe_ordering type)
 {
     gboolean current = FALSE;
     resource_t *first_child = NULL;
     GListPtr gIter = then->rsc->children;
     enum pe_graph_flags changed = pe_graph_none;        /*pe_graph_disable */
 
     enum action_tasks task = clone_child_action(first);
     const char *first_task = task2text(task);
 
     /* Fix this - lazy */
     if (strstr(first->uuid, "_stopped_0") || strstr(first->uuid, "_demoted_0")) {
         current = TRUE;
     }
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *then_child = (resource_t *) gIter->data;
 
         CRM_ASSERT(then_child != NULL);
         first_child = find_compatible_child(then_child, first->rsc, RSC_ROLE_UNKNOWN, current);
         if (first_child == NULL && current) {
             crm_trace("Ignore");
 
         } else if (first_child == NULL) {
             crm_debug("No match found for %s (%d / %s / %s)", then_child->id, current, first->uuid,
                       then->uuid);
 
             /* Me no like this hack - but what else can we do?
              *
              * If there is no-one active or about to be active
              *   on the same node as then_child, then they must
              *   not be allowed to start
              */
             if (type & (pe_order_runnable_left | pe_order_implies_then) /* Mandatory */ ) {
                 pe_rsc_info(then->rsc, "Inhibiting %s from being active", then_child->id);
                 assign_node(then_child, NULL, TRUE);
                 /* TODO - set changed correctly? */
             }
 
         } else {
             action_t *first_action = NULL;
             action_t *then_action = NULL;
 
             pe_rsc_debug(then->rsc, "Pairing %s with %s", first_child->id, then_child->id);
 
             first_action = find_first_action(first_child->actions, NULL, first_task, node);
             then_action = find_first_action(then_child->actions, NULL, then->task, node);
 
             CRM_CHECK(first_action != NULL || is_set(first_child->flags, pe_rsc_orphan),
                       crm_err("No action found for %s in %s (first)", first_task, first_child->id));
 
             if (then_action == NULL && is_not_set(then_child->flags, pe_rsc_orphan)
                 && crm_str_eq(then->task, RSC_STOP, TRUE) == FALSE
                 && crm_str_eq(then->task, RSC_DEMOTED, TRUE) == FALSE) {
                 crm_err("Internal error: No action found for %s in %s (then)", then->task,
                         then_child->id);
             }
 
             if (first_action == NULL || then_action == NULL) {
                 continue;
             }
             if (order_actions(first_action, then_action, type)) {
                 crm_debug("Created constraint for %s -> %s", first_action->uuid, then_action->uuid);
                 changed |= (pe_graph_updated_first | pe_graph_updated_then);
             }
             changed |=
                 then_child->cmds->update_actions(first_action, then_action, node,
                                                  first_child->cmds->action_flags(first_action,
                                                                                  node), filter,
                                                  type);
         }
     }
     return changed;
 }
 
 enum pe_graph_flags
 clone_update_actions(action_t * first, action_t * then, node_t * node, enum pe_action_flags flags,
                      enum pe_action_flags filter, enum pe_ordering type)
 {
     const char *rsc = "none";
     gboolean interleave = FALSE;
     enum pe_graph_flags changed = pe_graph_none;
 
     if (first->rsc != then->rsc
         && first->rsc && first->rsc->variant >= pe_clone
         && then->rsc && then->rsc->variant >= pe_clone) {
         clone_variant_data_t *clone_data = NULL;
 
         if (strstr(then->uuid, "_stop_0") || strstr(then->uuid, "_demote_0")) {
             get_clone_variant_data(clone_data, first->rsc);
             rsc = first->rsc->id;
         } else {
             get_clone_variant_data(clone_data, then->rsc);
             rsc = then->rsc->id;
         }
         interleave = clone_data->interleave;
     }
 
     crm_trace("Interleave %s -> %s: %s (based on %s)",
               first->uuid, then->uuid, interleave ? "yes" : "no", rsc);
 
     if (interleave) {
         changed = clone_update_actions_interleave(first, then, node, flags, filter, type);
 
     } else if (then->rsc) {
         GListPtr gIter = then->rsc->children;
 
         changed |= native_update_actions(first, then, node, flags, filter, type);
 
         for (; gIter != NULL; gIter = gIter->next) {
+            enum pe_graph_flags child_changed = pe_graph_none;
+            GListPtr lpc = NULL;
             resource_t *child = (resource_t *) gIter->data;
             action_t *child_action = find_first_action(child->actions, NULL, then->task, node);
 
             if (child_action) {
                 enum pe_action_flags child_flags = child->cmds->action_flags(child_action, node);
 
                 if (is_set(child_flags, pe_action_runnable)) {
-                    changed |=
+                                     
+                    child_changed |=
                         child->cmds->update_actions(first, child_action, node, flags, filter, type);
                 }
+                changed |= child_changed;
+                if (child_changed & pe_graph_updated_then) {
+                   for (lpc = child_action->actions_after; lpc != NULL; lpc = lpc->next) {
+                        action_wrapper_t *other = (action_wrapper_t *) lpc->data;
+                        update_action(other->action);
+                    }
+                }
             }
         }
     }
 
     return changed;
 }
 
 void
 clone_rsc_location(resource_t * rsc, rsc_to_node_t * constraint)
 {
     GListPtr gIter = rsc->children;
 
     pe_rsc_trace(rsc, "Processing location constraint %s for %s", constraint->id, rsc->id);
 
     native_rsc_location(rsc, constraint);
 
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         child_rsc->cmds->rsc_location(child_rsc, constraint);
     }
 }
 
 void
 clone_expand(resource_t * rsc, pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
     clone_variant_data_t *clone_data = NULL;
 
     get_clone_variant_data(clone_data, rsc);
 
     gIter = rsc->actions;
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *op = (action_t *) gIter->data;
 
         rsc->cmds->action_flags(op, NULL);
     }
 
     if (clone_data->start_notify) {
         collect_notification_data(rsc, TRUE, TRUE, clone_data->start_notify);
         expand_notification_data(clone_data->start_notify, data_set);
         create_notifications(rsc, clone_data->start_notify, data_set);
     }
 
     if (clone_data->stop_notify) {
         collect_notification_data(rsc, TRUE, TRUE, clone_data->stop_notify);
         expand_notification_data(clone_data->stop_notify, data_set);
         create_notifications(rsc, clone_data->stop_notify, data_set);
     }
 
     if (clone_data->promote_notify) {
         collect_notification_data(rsc, TRUE, TRUE, clone_data->promote_notify);
         expand_notification_data(clone_data->promote_notify, data_set);
         create_notifications(rsc, clone_data->promote_notify, data_set);
     }
 
     if (clone_data->demote_notify) {
         collect_notification_data(rsc, TRUE, TRUE, clone_data->demote_notify);
         expand_notification_data(clone_data->demote_notify, data_set);
         create_notifications(rsc, clone_data->demote_notify, data_set);
     }
 
     /* Now that the notifcations have been created we can expand the children */
 
     gIter = rsc->children;
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         child_rsc->cmds->expand(child_rsc, data_set);
     }
 
     native_expand(rsc, data_set);
 
     /* The notifications are in the graph now, we can destroy the notify_data */
     free_notification_data(clone_data->demote_notify);
     clone_data->demote_notify = NULL;
     free_notification_data(clone_data->stop_notify);
     clone_data->stop_notify = NULL;
     free_notification_data(clone_data->start_notify);
     clone_data->start_notify = NULL;
     free_notification_data(clone_data->promote_notify);
     clone_data->promote_notify = NULL;
 }
 
 node_t *
 rsc_known_on(resource_t * rsc, GListPtr * list)
 {
     GListPtr gIter = NULL;
     node_t *one = NULL;
     GListPtr result = NULL;
 
     if (rsc->children) {
 
         gIter = rsc->children;
         for (; gIter != NULL; gIter = gIter->next) {
             resource_t *child = (resource_t *) gIter->data;
 
             rsc_known_on(child, &result);
         }
 
     } else if (rsc->known_on) {
         result = g_hash_table_get_values(rsc->known_on);
     }
 
     if (result && g_list_length(result) == 1) {
         one = g_list_nth_data(result, 0);
     }
 
     if (list) {
         GListPtr gIter = NULL;
 
         gIter = result;
         for (; gIter != NULL; gIter = gIter->next) {
             node_t *node = (node_t *) gIter->data;
 
             if (*list == NULL || pe_find_node_id(*list, node->details->id) == NULL) {
                 *list = g_list_prepend(*list, node);
             }
         }
     }
 
     g_list_free(result);
     return one;
 }
 
 static resource_t *
 find_instance_on(resource_t * rsc, node_t * node)
 {
     GListPtr gIter = NULL;
 
     gIter = rsc->children;
     for (; gIter != NULL; gIter = gIter->next) {
         GListPtr gIter2 = NULL;
         GListPtr known_list = NULL;
         resource_t *child = (resource_t *) gIter->data;
 
         rsc_known_on(child, &known_list);
 
         gIter2 = known_list;
         for (; gIter2 != NULL; gIter2 = gIter2->next) {
             node_t *known = (node_t *) gIter2->data;
 
             if (node->details == known->details) {
                 g_list_free(known_list);
                 return child;
             }
         }
         g_list_free(known_list);
     }
 
     return NULL;
 }
 
 gboolean
 clone_create_probe(resource_t * rsc, node_t * node, action_t * complete,
                    gboolean force, pe_working_set_t * data_set)
 {
     GListPtr gIter = NULL;
     gboolean any_created = FALSE;
     clone_variant_data_t *clone_data = NULL;
 
     CRM_ASSERT(rsc);
     get_clone_variant_data(clone_data, rsc);
 
     rsc->children = g_list_sort(rsc->children, sort_rsc_id);
     if (rsc->children == NULL) {
         pe_warn("Clone %s has no children", rsc->id);
         return FALSE;
     }
 
     if (rsc->exclusive_discover) {
         node_t *allowed = g_hash_table_lookup(rsc->allowed_nodes, node->details->id);
         if (allowed && allowed->rsc_discover_mode != discover_exclusive) {
             /* exclusive discover is enabled and this node is not marked
              * as a node this resource should be discovered on
              *
              * remove the node from allowed_nodes so that the
              * notification contains only nodes that we might ever run
              * on
              */
             g_hash_table_remove(rsc->allowed_nodes, node->details->id);
 
             /* Bit of a shortcut - might as well take it */
             return FALSE;
         }
     }
 
     if (is_not_set(rsc->flags, pe_rsc_unique)
         && clone_data->clone_node_max == 1) {
         /* only look for one copy */
         resource_t *child = NULL;
 
         /* Try whoever we probed last time */
         child = find_instance_on(rsc, node);
         if (child) {
             return child->cmds->create_probe(child, node, complete, force, data_set);
         }
 
         /* Try whoever we plan on starting there */
         gIter = rsc->children;
         for (; gIter != NULL; gIter = gIter->next) {
             node_t *local_node = NULL;
             resource_t *child_rsc = (resource_t *) gIter->data;
 
             CRM_ASSERT(child_rsc);
             local_node = child_rsc->fns->location(child_rsc, NULL, FALSE);
             if (local_node == NULL) {
                 continue;
             }
 
             if (local_node->details == node->details) {
                 return child_rsc->cmds->create_probe(child_rsc, node, complete, force, data_set);
             }
         }
 
         /* Fall back to the first clone instance */
         CRM_ASSERT(rsc->children);
         child = rsc->children->data;
         return child->cmds->create_probe(child, node, complete, force, data_set);
     }
 
     gIter = rsc->children;
     for (; gIter != NULL; gIter = gIter->next) {
         resource_t *child_rsc = (resource_t *) gIter->data;
 
         if (child_rsc->cmds->create_probe(child_rsc, node, complete, force, data_set)) {
             any_created = TRUE;
         }
 
         if (any_created && is_not_set(rsc->flags, pe_rsc_unique)
             && clone_data->clone_node_max == 1) {
             /* only look for one copy (clone :0) */
             break;
         }
     }
 
     return any_created;
 }
 
 void
 clone_append_meta(resource_t * rsc, xmlNode * xml)
 {
     char *name = NULL;
     clone_variant_data_t *clone_data = NULL;
 
     get_clone_variant_data(clone_data, rsc);
 
     name = crm_meta_name(XML_RSC_ATTR_UNIQUE);
     crm_xml_add(xml, name, is_set(rsc->flags, pe_rsc_unique) ? "true" : "false");
     free(name);
 
     name = crm_meta_name(XML_RSC_ATTR_NOTIFY);
     crm_xml_add(xml, name, is_set(rsc->flags, pe_rsc_notify) ? "true" : "false");
     free(name);
 
     name = crm_meta_name(XML_RSC_ATTR_INCARNATION_MAX);
     crm_xml_add_int(xml, name, clone_data->clone_max);
     free(name);
 
     name = crm_meta_name(XML_RSC_ATTR_INCARNATION_NODEMAX);
     crm_xml_add_int(xml, name, clone_data->clone_node_max);
     free(name);
 }
 
 GHashTable *
 clone_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes, const char *attr,
                     float factor, enum pe_weights flags)
 {
     return rsc_merge_weights(rsc, rhs, nodes, attr, factor, flags);
 }
diff --git a/pengine/constraints.c b/pengine/constraints.c
index 1f44811929..7527aa6d1f 100644
--- a/pengine/constraints.c
+++ b/pengine/constraints.c
@@ -1,2818 +1,2835 @@
 /*
  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <crm_internal.h>
 
 #include <sys/param.h>
 #include <sys/types.h>
 #include <regex.h>
 
 #include <crm/crm.h>
 #include <crm/cib.h>
 #include <crm/msg_xml.h>
 #include <crm/common/xml.h>
 
 #include <glib.h>
 
 #include <crm/pengine/status.h>
 #include <pengine.h>
 #include <allocate.h>
 #include <utils.h>
 #include <crm/pengine/rules.h>
 
 enum pe_order_kind {
     pe_order_kind_optional,
     pe_order_kind_mandatory,
     pe_order_kind_serialize,
 };
 
 #define EXPAND_CONSTRAINT_IDREF(__set, __rsc, __name) do {				\
 	__rsc = pe_find_constraint_resource(data_set->resources, __name);		\
 	if(__rsc == NULL) {						\
 	    crm_config_err("%s: No resource found for %s", __set, __name); \
 	    return FALSE;						\
 	}								\
     } while(0)
 
 enum pe_ordering get_flags(const char *id, enum pe_order_kind kind,
                            const char *action_first, const char *action_then, gboolean invert);
 enum pe_ordering get_asymmetrical_flags(enum pe_order_kind kind);
 static rsc_to_node_t *generate_location_rule(resource_t * rsc, xmlNode * rule_xml,
                                              const char *discovery, pe_working_set_t * data_set);
 
 gboolean
 unpack_constraints(xmlNode * xml_constraints, pe_working_set_t * data_set)
 {
     xmlNode *xml_obj = NULL;
     xmlNode *lifetime = NULL;
 
     for (xml_obj = __xml_first_child(xml_constraints); xml_obj != NULL;
          xml_obj = __xml_next_element(xml_obj)) {
         const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
         const char *tag = crm_element_name(xml_obj);
 
         if (id == NULL) {
             crm_config_err("Constraint <%s...> must have an id", tag);
             continue;
         }
 
         crm_trace("Processing constraint %s %s", tag, id);
 
         lifetime = first_named_child(xml_obj, "lifetime");
         if (lifetime) {
             crm_config_warn("Support for the lifetime tag, used by %s, is deprecated."
                             " The rules it contains should instead be direct decendants of the constraint object",
                             id);
         }
 
         if (test_ruleset(lifetime, NULL, data_set->now) == FALSE) {
             crm_info("Constraint %s %s is not active", tag, id);
 
         } else if (safe_str_eq(XML_CONS_TAG_RSC_ORDER, tag)) {
             unpack_rsc_order(xml_obj, data_set);
 
         } else if (safe_str_eq(XML_CONS_TAG_RSC_DEPEND, tag)) {
             unpack_rsc_colocation(xml_obj, data_set);
 
         } else if (safe_str_eq(XML_CONS_TAG_RSC_LOCATION, tag)) {
             unpack_location(xml_obj, data_set);
 
         } else if (safe_str_eq(XML_CONS_TAG_RSC_TICKET, tag)) {
             unpack_rsc_ticket(xml_obj, data_set);
 
         } else {
             pe_err("Unsupported constraint type: %s", tag);
         }
     }
 
     return TRUE;
 }
 
 static const char *
 invert_action(const char *action)
 {
     if (safe_str_eq(action, RSC_START)) {
         return RSC_STOP;
 
     } else if (safe_str_eq(action, RSC_STOP)) {
         return RSC_START;
 
     } else if (safe_str_eq(action, RSC_PROMOTE)) {
         return RSC_DEMOTE;
 
     } else if (safe_str_eq(action, RSC_DEMOTE)) {
         return RSC_PROMOTE;
 
     } else if (safe_str_eq(action, RSC_PROMOTED)) {
         return RSC_DEMOTED;
 
     } else if (safe_str_eq(action, RSC_DEMOTED)) {
         return RSC_PROMOTED;
 
     } else if (safe_str_eq(action, RSC_STARTED)) {
         return RSC_STOPPED;
 
     } else if (safe_str_eq(action, RSC_STOPPED)) {
         return RSC_STARTED;
     }
     crm_config_warn("Unknown action: %s", action);
     return NULL;
 }
 
 static enum pe_order_kind
 get_ordering_type(xmlNode * xml_obj)
 {
     enum pe_order_kind kind_e = pe_order_kind_mandatory;
     const char *kind = crm_element_value(xml_obj, XML_ORDER_ATTR_KIND);
 
     if (kind == NULL) {
         const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE);
 
         kind_e = pe_order_kind_mandatory;
 
         if (score) {
             int score_i = char2score(score);
 
             if (score_i == 0) {
                 kind_e = pe_order_kind_optional;
             }
 
             /* } else if(rsc_then->variant == pe_native && rsc_first->variant > pe_group) { */
             /*     kind_e = pe_order_kind_optional; */
         }
 
     } else if (safe_str_eq(kind, "Mandatory")) {
         kind_e = pe_order_kind_mandatory;
 
     } else if (safe_str_eq(kind, "Optional")) {
         kind_e = pe_order_kind_optional;
 
     } else if (safe_str_eq(kind, "Serialize")) {
         kind_e = pe_order_kind_serialize;
 
     } else {
         const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
 
         crm_config_err("Constraint %s: Unknown type '%s'", id, kind);
     }
     return kind_e;
 }
 
 static resource_t *
 pe_find_constraint_resource(GListPtr rsc_list, const char *id)
 {
     GListPtr rIter = NULL;
 
     for (rIter = rsc_list; id && rIter; rIter = rIter->next) {
         resource_t *parent = rIter->data;
 
         resource_t *match =
             parent->fns->find_rsc(parent, id, NULL, pe_find_renamed | pe_find_current);
 
         if (match != NULL) {
             if(safe_str_neq(match->id, id)) {
                 /* We found an instance of a clone instead */
                 match = uber_parent(match);
                 crm_debug("Found %s for %s", match->id, id);
             }
             return match;
         }
     }
     crm_trace("No match for %s", id);
     return NULL;
 }
 
 static gboolean
 pe_find_constraint_tag(pe_working_set_t * data_set, const char * id, tag_t ** tag)
 {
     gboolean rc = FALSE;
 
     *tag = NULL;
     rc = g_hash_table_lookup_extended(data_set->template_rsc_sets, id,
                                        NULL, (gpointer*) tag);
 
     if (rc == FALSE) {
         rc = g_hash_table_lookup_extended(data_set->tags, id,
                                           NULL, (gpointer*) tag);
 
         if (rc == FALSE) {
             crm_config_warn("No template/tag named '%s'", id);
             return FALSE;
 
         } else if (*tag == NULL) {
             crm_config_warn("No resource is tagged with '%s'", id);
             return FALSE;
         }
 
     } else if (*tag == NULL) {
         crm_config_warn("No resource is derived from template '%s'", id);
         return FALSE;
     }
 
     return rc;
 }
 
 static gboolean
 valid_resource_or_tag(pe_working_set_t * data_set, const char * id,
                       resource_t ** rsc, tag_t ** tag)
 {
     gboolean rc = FALSE;
 
     if (rsc) {
         *rsc = NULL;
         *rsc = pe_find_constraint_resource(data_set->resources, id);
         if (*rsc) {
             return TRUE;
         }
     }
 
     if (tag) {
         *tag = NULL;
         rc = pe_find_constraint_tag(data_set, id, tag);
     }
 
     return rc;
 }
 
 static gboolean
 unpack_simple_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set)
 {
     int order_id = 0;
     resource_t *rsc_then = NULL;
     resource_t *rsc_first = NULL;
     gboolean invert_bool = TRUE;
-    gboolean require_all = TRUE;
+    int min_required_before = 0;
     enum pe_order_kind kind = pe_order_kind_mandatory;
     enum pe_ordering cons_weight = pe_order_optional;
 
     const char *id_first = NULL;
     const char *id_then = NULL;
     const char *action_then = NULL;
     const char *action_first = NULL;
     const char *instance_then = NULL;
     const char *instance_first = NULL;
     const char *require_all_s = NULL;
 
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
     const char *invert = crm_element_value(xml_obj, XML_CONS_ATTR_SYMMETRICAL);
 
     crm_str_to_boolean(invert, &invert_bool);
 
     if (xml_obj == NULL) {
         crm_config_err("No constraint object to process.");
         return FALSE;
 
     } else if (id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     id_then = crm_element_value(xml_obj, XML_ORDER_ATTR_THEN);
     id_first = crm_element_value(xml_obj, XML_ORDER_ATTR_FIRST);
 
     action_then = crm_element_value(xml_obj, XML_ORDER_ATTR_THEN_ACTION);
     action_first = crm_element_value(xml_obj, XML_ORDER_ATTR_FIRST_ACTION);
 
     instance_then = crm_element_value(xml_obj, XML_ORDER_ATTR_THEN_INSTANCE);
     instance_first = crm_element_value(xml_obj, XML_ORDER_ATTR_FIRST_INSTANCE);
 
     if (action_first == NULL) {
         action_first = RSC_START;
     }
     if (action_then == NULL) {
         action_then = action_first;
     }
 
     if (id_then == NULL || id_first == NULL) {
         crm_config_err("Constraint %s needs two sides lh: %s rh: %s",
                        id, crm_str(id_then), crm_str(id_first));
         return FALSE;
     }
 
     rsc_then = pe_find_constraint_resource(data_set->resources, id_then);
     rsc_first = pe_find_constraint_resource(data_set->resources, id_first);
 
     if (rsc_then == NULL) {
         crm_config_err("Constraint %s: no resource found for name '%s'", id, id_then);
         return FALSE;
 
     } else if (rsc_first == NULL) {
         crm_config_err("Constraint %s: no resource found for name '%s'", id, id_first);
         return FALSE;
 
     } else if (instance_then && rsc_then->variant < pe_clone) {
         crm_config_err("Invalid constraint '%s':"
                        " Resource '%s' is not a clone but instance %s was requested",
                        id, id_then, instance_then);
         return FALSE;
 
     } else if (instance_first && rsc_first->variant < pe_clone) {
         crm_config_err("Invalid constraint '%s':"
                        " Resource '%s' is not a clone but instance %s was requested",
                        id, id_first, instance_first);
         return FALSE;
     }
 
     if (instance_then) {
         rsc_then = find_clone_instance(rsc_then, instance_then, data_set);
         if (rsc_then == NULL) {
             crm_config_warn("Invalid constraint '%s': No instance '%s' of '%s'", id, instance_then,
                             id_then);
             return FALSE;
         }
     }
 
     if (instance_first) {
         rsc_first = find_clone_instance(rsc_first, instance_first, data_set);
         if (rsc_first == NULL) {
             crm_config_warn("Invalid constraint '%s': No instance '%s' of '%s'", id, instance_first,
                             id_first);
             return FALSE;
         }
     }
 
     require_all_s = crm_element_value(xml_obj, "require-all");
     if (require_all_s
         && crm_is_true(require_all_s) == FALSE
         && rsc_first->variant >= pe_clone) {
 
-        require_all = FALSE;
+        /* require-all=false means only one instance of the clone is required */
+        min_required_before = 1;
+    } else if (rsc_first->variant >= pe_clone) {
+        const char *min_clones_s = g_hash_table_lookup(rsc_first->meta, XML_RSC_ATTR_INCARNATION_MIN);
+        if (min_clones_s) {
+            /* if clone min is set, we require at a minimum X number of instances
+             * to be runnable before allowing dependencies to be runnable. */
+            min_required_before = crm_parse_int(min_clones_s, "0");
+        }
     }
 
     cons_weight = pe_order_optional;
     kind = get_ordering_type(xml_obj);
 
     if (kind == pe_order_kind_optional && rsc_then->restart_type == pe_restart_restart) {
         crm_trace("Upgrade : recovery - implies right");
         cons_weight |= pe_order_implies_then;
     }
 
     if (invert_bool == FALSE) {
         cons_weight |= get_asymmetrical_flags(kind);
     } else {
         cons_weight |= get_flags(id, kind, action_first, action_then, FALSE);
     }
 
-    if (require_all == FALSE) {
+    /* If there is a minimum number of instances that must be runnable before
+     * the 'then' action is runnable, we use a pseudo action as an intermediate step
+     * start min number of clones -> pseudo action is runnable -> dependency runnable. */
+    if (min_required_before) {
         GListPtr rIter = NULL;
         char *task = crm_concat(CRM_OP_RELAXED_CLONE, id, ':');
         action_t *unordered_action = get_pseudo_op(task, data_set);
         free(task);
 
+        /* require the pseudo action to have "min_required_before" number of
+         * actions to be considered runnable before allowing the pseudo action
+         * to be runnable. */ 
+        unordered_action->required_runnable_before = min_required_before;
         update_action_flags(unordered_action, pe_action_requires_any);
 
         for (rIter = rsc_first->children; id && rIter; rIter = rIter->next) {
             resource_t *child = rIter->data;
-
+            /* order each clone instance before the pseudo action */
             custom_action_order(child, generate_op_key(child->id, action_first, 0), NULL,
                                 NULL, NULL, unordered_action,
                                 pe_order_one_or_more | pe_order_implies_then_printed, data_set);
         }
 
+        /* order the "then" dependency to occur after the pseudo action only if
+         * the pseudo action is runnable */ 
         order_id = custom_action_order(NULL, NULL, unordered_action,
                        rsc_then, generate_op_key(rsc_then->id, action_then, 0), NULL,
                        cons_weight | pe_order_runnable_left, data_set);
     } else {
         order_id = new_rsc_order(rsc_first, action_first, rsc_then, action_then, cons_weight, data_set);
     }
 
     pe_rsc_trace(rsc_first, "order-%d (%s): %s_%s before %s_%s flags=0x%.6x",
                  order_id, id, rsc_first->id, action_first, rsc_then->id, action_then, cons_weight);
 
     if (invert_bool == FALSE) {
         return TRUE;
 
     } else if (invert && kind == pe_order_kind_serialize) {
         crm_config_warn("Cannot invert serialized constraint set %s", id);
         return TRUE;
 
     } else if (kind == pe_order_kind_serialize) {
         return TRUE;
     }
 
     action_then = invert_action(action_then);
     action_first = invert_action(action_first);
     if (action_then == NULL || action_first == NULL) {
         crm_config_err("Cannot invert rsc_order constraint %s."
                        " Please specify the inverse manually.", id);
         return TRUE;
     }
 
     cons_weight = pe_order_optional;
     if (kind == pe_order_kind_optional && rsc_then->restart_type == pe_restart_restart) {
         crm_trace("Upgrade : recovery - implies left");
         cons_weight |= pe_order_implies_first;
     }
 
     cons_weight |= get_flags(id, kind, action_first, action_then, TRUE);
 
     order_id = new_rsc_order(rsc_then, action_then, rsc_first, action_first, cons_weight, data_set);
 
     pe_rsc_trace(rsc_then, "order-%d (%s): %s_%s before %s_%s flags=0x%.6x",
                  order_id, id, rsc_then->id, action_then, rsc_first->id, action_first, cons_weight);
 
     return TRUE;
 }
 
 static gboolean
 expand_tags_in_sets(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_set_t * data_set)
 {
     xmlNode *new_xml = NULL;
     xmlNode *set = NULL;
     gboolean any_refs = FALSE;
     const char *cons_id = NULL;
 
     *expanded_xml = NULL;
 
     if (xml_obj == NULL) {
         crm_config_err("No constraint object to process.");
         return FALSE;
     }
 
     new_xml = copy_xml(xml_obj);
     cons_id = ID(new_xml);
 
     for (set = __xml_first_child(new_xml); set != NULL; set = __xml_next_element(set)) {
         xmlNode *xml_rsc = NULL;
         GListPtr tag_refs = NULL;
         GListPtr gIter = NULL;
 
         if (safe_str_neq((const char *)set->name, XML_CONS_TAG_RSC_SET)) {
             continue;
         }
 
         for (xml_rsc = __xml_first_child(set); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             resource_t *rsc = NULL;
             tag_t *tag = NULL;
             const char *id = ID(xml_rsc);
 
             if (safe_str_neq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF)) {
                 continue;
             }
 
             if (valid_resource_or_tag(data_set, id, &rsc, &tag) == FALSE) {
                 crm_config_err("Constraint '%s': Invalid reference to '%s'", cons_id, id);
                 free_xml(new_xml);
                 return FALSE;
 
             } else if (rsc) {
                 continue;
 
             } else if (tag) {
                 /* The resource_ref under the resource_set references a template/tag */
                 xmlNode *last_ref = xml_rsc;
 
                 /* A sample:
 
                    Original XML:
 
                    <resource_set id="tag1-colocation-0" sequential="true">
                      <resource_ref id="rsc1"/>
                      <resource_ref id="tag1"/>
                      <resource_ref id="rsc4"/>
                    </resource_set>
 
                    Now we are appending rsc2 and rsc3 which are tagged with tag1 right after it:
 
                    <resource_set id="tag1-colocation-0" sequential="true">
                      <resource_ref id="rsc1"/>
                      <resource_ref id="tag1"/>
                      <resource_ref id="rsc2"/>
                      <resource_ref id="rsc3"/>
                      <resource_ref id="rsc4"/>
                    </resource_set>
 
                  */
 
                 for (gIter = tag->refs; gIter != NULL; gIter = gIter->next) {
                     const char *obj_ref = (const char *) gIter->data;
                     xmlNode *new_rsc_ref = NULL;
 
                     new_rsc_ref = xmlNewDocRawNode(getDocPtr(set), NULL,
                                                    (const xmlChar *)XML_TAG_RESOURCE_REF, NULL);
                     crm_xml_add(new_rsc_ref, XML_ATTR_ID, obj_ref);
                     xmlAddNextSibling(last_ref, new_rsc_ref);
 
                     last_ref = new_rsc_ref;
                 }
 
                 any_refs = TRUE;
 
                 /* Do not directly free '<resource_ref id="tag1"/>'.
                    That would break the further __xml_next_element(xml_rsc)) and cause "Invalid read" seen by valgrind.
                    So just record it into a hash table for freeing it later.
                  */
                 tag_refs = g_list_append(tag_refs, xml_rsc);
             }
         }
 
         /* Now free '<resource_ref id="tag1"/>', and finally get:
 
            <resource_set id="tag1-colocation-0" sequential="true">
              <resource_ref id="rsc1"/>
              <resource_ref id="rsc2"/>
              <resource_ref id="rsc3"/>
              <resource_ref id="rsc4"/>
            </resource_set>
 
          */
         for (gIter = tag_refs; gIter != NULL; gIter = gIter->next) {
             xmlNode *tag_ref = gIter->data;
 
             free_xml(tag_ref);
         }
         g_list_free(tag_refs);
     }
 
     if (any_refs) {
         *expanded_xml = new_xml;
     } else {
         free_xml(new_xml);
     }
 
     return TRUE;
 }
 
 static gboolean
 tag_to_set(xmlNode * xml_obj, xmlNode ** rsc_set, const char * attr,
                 gboolean convert_rsc, pe_working_set_t * data_set)
 {
     const char *cons_id = NULL;
     const char *id = NULL;
 
     resource_t *rsc = NULL;
     tag_t *tag = NULL;
 
     *rsc_set = NULL;
 
     if (xml_obj == NULL) {
         crm_config_err("No constraint object to process.");
         return FALSE;
     }
 
     if (attr == NULL) {
         crm_config_err("No attribute name to process.");
         return FALSE;
     }
 
     cons_id = crm_element_value(xml_obj, XML_ATTR_ID);
     if (cons_id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     id = crm_element_value(xml_obj, attr);
     if (id == NULL) {
         return TRUE;
     }
 
     if (valid_resource_or_tag(data_set, id, &rsc, &tag) == FALSE) {
         crm_config_err("Constraint '%s': Invalid reference to '%s'", cons_id, id);
         return FALSE;
 
     } else if (tag) {
         GListPtr gIter = NULL;
 
         /* A template/tag is referenced by the "attr" attribute (first, then, rsc or with-rsc).
            Add the template/tag's corresponding "resource_set" which contains the resources derived
            from it or tagged with it under the constraint. */
         *rsc_set = create_xml_node(xml_obj, XML_CONS_TAG_RSC_SET);
         crm_xml_add(*rsc_set, XML_ATTR_ID, id);
 
         for (gIter = tag->refs; gIter != NULL; gIter = gIter->next) {
             const char *obj_ref = (const char *) gIter->data;
             xmlNode *rsc_ref = NULL;
 
             rsc_ref = create_xml_node(*rsc_set, XML_TAG_RESOURCE_REF);
             crm_xml_add(rsc_ref, XML_ATTR_ID, obj_ref);
         }
 
         /* Set sequential="false" for the resource_set */
         crm_xml_add(*rsc_set, "sequential", XML_BOOLEAN_FALSE);
 
     } else if (rsc && convert_rsc) {
         /* Even a regular resource is referenced by "attr", convert it into a resource_set.
            Because the other side of the constraint could be a template/tag reference. */
         xmlNode *rsc_ref = NULL;
 
         *rsc_set = create_xml_node(xml_obj, XML_CONS_TAG_RSC_SET);
         crm_xml_add(*rsc_set, XML_ATTR_ID, id);
 
         rsc_ref = create_xml_node(*rsc_set, XML_TAG_RESOURCE_REF);
         crm_xml_add(rsc_ref, XML_ATTR_ID, id);
 
     } else {
         return TRUE;
     }
 
     /* Remove the "attr" attribute referencing the template/tag */
     if (*rsc_set) {
         xml_remove_prop(xml_obj, attr);
     }
 
     return TRUE;
 }
 
 gboolean unpack_rsc_location(xmlNode * xml_obj, resource_t * rsc_lh, const char * role,
                              const char * score, pe_working_set_t * data_set);
 
 static gboolean
 unpack_simple_location(xmlNode * xml_obj, pe_working_set_t * data_set)
 {
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
     const char *value = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
 
     if(value) {
         resource_t *rsc_lh = pe_find_constraint_resource(data_set->resources, value);
 
         return unpack_rsc_location(xml_obj, rsc_lh, NULL, NULL, data_set);
     }
 
     value = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE"-pattern");
     if(value) {
         regex_t *r_patt = calloc(1, sizeof(regex_t));
         bool invert = FALSE;
         GListPtr rIter = NULL;
 
         if(value[0] == '!') {
             value++;
             invert = TRUE;
         }
 
         if (regcomp(r_patt, value, REG_EXTENDED)) {
             crm_config_err("Bad regex '%s' for constraint '%s'\n", value, id);
             regfree(r_patt);
             free(r_patt);
             return FALSE;
         }
 
         for (rIter = data_set->resources; rIter; rIter = rIter->next) {
             resource_t *r = rIter->data;
             int status = regexec(r_patt, r->id, 0, NULL, 0);
 
             if(invert == FALSE && status == 0) {
                 crm_debug("'%s' matched '%s' for %s", r->id, value, id);
                 unpack_rsc_location(xml_obj, r, NULL, NULL, data_set);
 
             } if(invert && status != 0) {
                 crm_debug("'%s' is an inverted match of '%s' for %s", r->id, value, id);
                 unpack_rsc_location(xml_obj, r, NULL, NULL, data_set);
 
             } else {
                 crm_trace("'%s' does not match '%s' for %s", r->id, value, id);
             }
         }
 
         regfree(r_patt);
         free(r_patt);
     }
 
     return FALSE;
 }
 
 gboolean
 unpack_rsc_location(xmlNode * xml_obj, resource_t * rsc_lh, const char * role,
                     const char * score, pe_working_set_t * data_set)
 {
     gboolean empty = TRUE;
     rsc_to_node_t *location = NULL;
     const char *id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
     const char *node = crm_element_value(xml_obj, XML_CIB_TAG_NODE);
     const char *discovery = crm_element_value(xml_obj, XML_LOCATION_ATTR_DISCOVERY);
 
     if (rsc_lh == NULL) {
         /* only a warn as BSC adds the constraint then the resource */
         crm_config_warn("No resource (con=%s, rsc=%s)", id, id_lh);
         return FALSE;
     }
     
     if (score == NULL) {
         score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE);
     }
 
     if (node != NULL && score != NULL) {
         int score_i = char2score(score);
         node_t *match = pe_find_node(data_set->nodes, node);
 
         if (!match) {
             return FALSE;
         }
         location = rsc2node_new(id, rsc_lh, score_i, discovery, match, data_set);
 
     } else {
         xmlNode *rule_xml = NULL;
 
         for (rule_xml = __xml_first_child(xml_obj); rule_xml != NULL;
              rule_xml = __xml_next_element(rule_xml)) {
             if (crm_str_eq((const char *)rule_xml->name, XML_TAG_RULE, TRUE)) {
                 empty = FALSE;
                 crm_trace("Unpacking %s/%s", id, ID(rule_xml));
                 generate_location_rule(rsc_lh, rule_xml, discovery, data_set);
             }
         }
 
         if (empty) {
             crm_config_err("Invalid location constraint %s:"
                            " rsc_location must contain at least one rule", ID(xml_obj));
         }
     }
 
     if (role == NULL) {
         role = crm_element_value(xml_obj, XML_RULE_ATTR_ROLE);
     }
 
     if (location && role) {
         if (text2role(role) == RSC_ROLE_UNKNOWN) {
             pe_err("Invalid constraint %s: Bad role %s", id, role);
             return FALSE;
 
         } else {
             enum rsc_role_e r = text2role(role);
             switch(r) {
                 case RSC_ROLE_UNKNOWN:
                 case RSC_ROLE_STARTED:
                 case RSC_ROLE_SLAVE:
                     /* Applies to all */
                     location->role_filter = RSC_ROLE_UNKNOWN;
                     break;
                 default:
                     location->role_filter = r;
                     break;
             }
         }
     }
 
     return TRUE;
 }
 
 static gboolean
 unpack_location_tags(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_set_t * data_set)
 {
     const char *id = NULL;
     const char *id_lh = NULL;
     const char *state_lh = NULL;
 
     resource_t *rsc_lh = NULL;
 
     tag_t *tag_lh = NULL;
 
     xmlNode *new_xml = NULL;
     xmlNode *rsc_set_lh = NULL;
     gboolean any_sets = FALSE;
 
     *expanded_xml = NULL;
 
     if (xml_obj == NULL) {
         crm_config_err("No constraint object to process.");
         return FALSE;
     }
 
     id = crm_element_value(xml_obj, XML_ATTR_ID);
     if (id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     /* Attempt to expand any template/tag references in possible resource sets. */
     expand_tags_in_sets(xml_obj, &new_xml, data_set);
     if (new_xml) {
         /* There are resource sets referencing templates. Return with the expanded XML. */
         crm_log_xml_trace(new_xml, "Expanded rsc_location...");
         *expanded_xml = new_xml;
         return TRUE;
     }
 
     id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
     if (id_lh == NULL) {
         return TRUE;
     }
 
     if (valid_resource_or_tag(data_set, id_lh, &rsc_lh, &tag_lh) == FALSE) {
         crm_config_err("Constraint '%s': Invalid reference to '%s'", id, id_lh);
         return FALSE;
 
     } else if (rsc_lh) {
         /* No template is referenced. */
         return TRUE;
     }
 
     state_lh = crm_element_value(xml_obj, XML_RULE_ATTR_ROLE);
 
     new_xml = copy_xml(xml_obj);
 
     /* Convert the template/tag reference in "rsc" into a resource_set under the rsc_location constraint. */
     if (tag_to_set(new_xml, &rsc_set_lh, XML_COLOC_ATTR_SOURCE, FALSE, data_set) == FALSE) {
         free_xml(new_xml);
         return FALSE;
     }
 
     if (rsc_set_lh) {
         if (state_lh) {
             /* A "rsc-role" is specified.
                Move it into the converted resource_set as a "role"" attribute. */
             crm_xml_add(rsc_set_lh, "role", state_lh);
             xml_remove_prop(new_xml, XML_RULE_ATTR_ROLE);
         }
         any_sets = TRUE;
     }
 
     if (any_sets) {
         crm_log_xml_trace(new_xml, "Expanded rsc_location...");
         *expanded_xml = new_xml;
     } else {
         free_xml(new_xml);
     }
 
     return TRUE;
 }
 
 static gboolean
 unpack_location_set(xmlNode * location, xmlNode * set, pe_working_set_t * data_set)
 {
     xmlNode *xml_rsc = NULL;
     resource_t *resource = NULL;
     const char *set_id = ID(set);
     const char *role = crm_element_value(set, "role");
     const char *local_score = crm_element_value(set, XML_RULE_ATTR_SCORE);
 
     if (set == NULL) {
         crm_config_err("No resource_set object to process.");
         return FALSE;
     }
 
     if (set_id == NULL) {
         crm_config_err("resource_set must have an id");
         return FALSE;
     }
 
     for (xml_rsc = __xml_first_child(set); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
         if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
             EXPAND_CONSTRAINT_IDREF(set_id, resource, ID(xml_rsc));
             unpack_rsc_location(location, resource, role, local_score, data_set);
         }
     }
 
     return TRUE;
 }
 
 gboolean
 unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set)
 {
     xmlNode *set = NULL;
     gboolean any_sets = FALSE;
 
     xmlNode *orig_xml = NULL;
     xmlNode *expanded_xml = NULL;
 
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
 
     gboolean rc = TRUE;
 
     if (xml_obj == NULL) {
         crm_config_err("No rsc_location constraint object to process.");
         return FALSE;
     }
 
     if (id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     rc = unpack_location_tags(xml_obj, &expanded_xml, data_set);
     if (expanded_xml) {
         orig_xml = xml_obj;
         xml_obj = expanded_xml;
 
     } else if (rc == FALSE) {
         return FALSE;
     }
 
     for (set = __xml_first_child(xml_obj); set != NULL; set = __xml_next_element(set)) {
         if (crm_str_eq((const char *)set->name, XML_CONS_TAG_RSC_SET, TRUE)) {
             any_sets = TRUE;
             set = expand_idref(set, data_set->input);
             if (unpack_location_set(xml_obj, set, data_set) == FALSE) {
                 return FALSE;
             }
         }
     }
 
     if (expanded_xml) {
         free_xml(expanded_xml);
         xml_obj = orig_xml;
     }
 
     if (any_sets == FALSE) {
         return unpack_simple_location(xml_obj, data_set);
     }
 
     return TRUE;
 }
 
 static int
 get_node_score(const char *rule, const char *score, gboolean raw, node_t * node)
 {
     int score_f = 0;
 
     if (score == NULL) {
         pe_err("Rule %s: no score specified.  Assuming 0.", rule);
 
     } else if (raw) {
         score_f = char2score(score);
 
     } else {
         const char *attr_score = g_hash_table_lookup(node->details->attrs, score);
 
         if (attr_score == NULL) {
             crm_debug("Rule %s: node %s did not have a value for %s",
                       rule, node->details->uname, score);
             score_f = -INFINITY;
 
         } else {
             crm_debug("Rule %s: node %s had value %s for %s",
                       rule, node->details->uname, attr_score, score);
             score_f = char2score(attr_score);
         }
     }
     return score_f;
 }
 
 static rsc_to_node_t *
 generate_location_rule(resource_t * rsc, xmlNode * rule_xml, const char *discovery, pe_working_set_t * data_set)
 {
     const char *rule_id = NULL;
     const char *score = NULL;
     const char *boolean = NULL;
     const char *role = NULL;
 
     GListPtr gIter = NULL;
     GListPtr match_L = NULL;
 
     gboolean do_and = TRUE;
     gboolean accept = TRUE;
     gboolean raw_score = TRUE;
 
     rsc_to_node_t *location_rule = NULL;
 
     rule_xml = expand_idref(rule_xml, data_set->input);
     rule_id = crm_element_value(rule_xml, XML_ATTR_ID);
     boolean = crm_element_value(rule_xml, XML_RULE_ATTR_BOOLEAN_OP);
     role = crm_element_value(rule_xml, XML_RULE_ATTR_ROLE);
 
     crm_trace("Processing rule: %s", rule_id);
 
     if (role != NULL && text2role(role) == RSC_ROLE_UNKNOWN) {
         pe_err("Bad role specified for %s: %s", rule_id, role);
         return NULL;
     }
 
     score = crm_element_value(rule_xml, XML_RULE_ATTR_SCORE);
     if (score == NULL) {
         score = crm_element_value(rule_xml, XML_RULE_ATTR_SCORE_ATTRIBUTE);
         if (score == NULL) {
             score = crm_element_value(rule_xml, XML_RULE_ATTR_SCORE_MANGLED);
         }
         if (score != NULL) {
             raw_score = FALSE;
         }
     }
     if (safe_str_eq(boolean, "or")) {
         do_and = FALSE;
     }
 
     location_rule = rsc2node_new(rule_id, rsc, 0, discovery, NULL, data_set);
 
     if (location_rule == NULL) {
         return NULL;
     }
     if (role != NULL) {
         crm_trace("Setting role filter: %s", role);
         location_rule->role_filter = text2role(role);
         if (location_rule->role_filter == RSC_ROLE_SLAVE) {
             /* Any master/slave cannot be promoted without being a slave first
              * Ergo, any constraint for the slave role applies to every role
              */
             location_rule->role_filter = RSC_ROLE_UNKNOWN;
         }
     }
     if (do_and) {
         GListPtr gIter = NULL;
 
         match_L = node_list_dup(data_set->nodes, TRUE, FALSE);
         for (gIter = match_L; gIter != NULL; gIter = gIter->next) {
             node_t *node = (node_t *) gIter->data;
 
             node->weight = get_node_score(rule_id, score, raw_score, node);
         }
     }
 
     for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) {
         int score_f = 0;
         node_t *node = (node_t *) gIter->data;
 
         accept = test_rule(rule_xml, node->details->attrs, RSC_ROLE_UNKNOWN, data_set->now);
 
         crm_trace("Rule %s %s on %s", ID(rule_xml), accept ? "passed" : "failed",
                   node->details->uname);
 
         score_f = get_node_score(rule_id, score, raw_score, node);
 /* 			if(accept && score_f == -INFINITY) { */
 /* 				accept = FALSE; */
 /* 			} */
 
         if (accept) {
             node_t *local = pe_find_node_id(match_L, node->details->id);
 
             if (local == NULL && do_and) {
                 continue;
 
             } else if (local == NULL) {
                 local = node_copy(node);
                 match_L = g_list_append(match_L, local);
             }
 
             if (do_and == FALSE) {
                 local->weight = merge_weights(local->weight, score_f);
             }
             crm_trace("node %s now has weight %d", node->details->uname, local->weight);
 
         } else if (do_and && !accept) {
             /* remove it */
             node_t *delete = pe_find_node_id(match_L, node->details->id);
 
             if (delete != NULL) {
                 match_L = g_list_remove(match_L, delete);
                 crm_trace("node %s did not match", node->details->uname);
             }
             free(delete);
         }
     }
 
     location_rule->node_list_rh = match_L;
     if (location_rule->node_list_rh == NULL) {
         crm_trace("No matching nodes for rule %s", rule_id);
         return NULL;
     }
 
     crm_trace("%s: %d nodes matched", rule_id, g_list_length(location_rule->node_list_rh));
     return location_rule;
 }
 
 static gint
 sort_cons_priority_lh(gconstpointer a, gconstpointer b)
 {
     const rsc_colocation_t *rsc_constraint1 = (const rsc_colocation_t *)a;
     const rsc_colocation_t *rsc_constraint2 = (const rsc_colocation_t *)b;
 
     if (a == NULL) {
         return 1;
     }
     if (b == NULL) {
         return -1;
     }
 
     CRM_ASSERT(rsc_constraint1->rsc_lh != NULL);
     CRM_ASSERT(rsc_constraint1->rsc_rh != NULL);
 
     if (rsc_constraint1->rsc_lh->priority > rsc_constraint2->rsc_lh->priority) {
         return -1;
     }
 
     if (rsc_constraint1->rsc_lh->priority < rsc_constraint2->rsc_lh->priority) {
         return 1;
     }
 
     /* Process clones before primitives and groups */
     if (rsc_constraint1->rsc_lh->variant > rsc_constraint2->rsc_lh->variant) {
         return -1;
     } else if (rsc_constraint1->rsc_lh->variant < rsc_constraint2->rsc_lh->variant) {
         return 1;
     }
 
     return strcmp(rsc_constraint1->rsc_lh->id, rsc_constraint2->rsc_lh->id);
 }
 
 static gint
 sort_cons_priority_rh(gconstpointer a, gconstpointer b)
 {
     const rsc_colocation_t *rsc_constraint1 = (const rsc_colocation_t *)a;
     const rsc_colocation_t *rsc_constraint2 = (const rsc_colocation_t *)b;
 
     if (a == NULL) {
         return 1;
     }
     if (b == NULL) {
         return -1;
     }
 
     CRM_ASSERT(rsc_constraint1->rsc_lh != NULL);
     CRM_ASSERT(rsc_constraint1->rsc_rh != NULL);
 
     if (rsc_constraint1->rsc_rh->priority > rsc_constraint2->rsc_rh->priority) {
         return -1;
     }
 
     if (rsc_constraint1->rsc_rh->priority < rsc_constraint2->rsc_rh->priority) {
         return 1;
     }
 
     /* Process clones before primitives and groups */
     if (rsc_constraint1->rsc_rh->variant > rsc_constraint2->rsc_rh->variant) {
         return -1;
     } else if (rsc_constraint1->rsc_rh->variant < rsc_constraint2->rsc_rh->variant) {
         return 1;
     }
 
     return strcmp(rsc_constraint1->rsc_rh->id, rsc_constraint2->rsc_rh->id);
 }
 
 gboolean
 rsc_colocation_new(const char *id, const char *node_attr, int score,
                    resource_t * rsc_lh, resource_t * rsc_rh,
                    const char *state_lh, const char *state_rh, pe_working_set_t * data_set)
 {
     rsc_colocation_t *new_con = NULL;
 
     if (rsc_lh == NULL) {
         crm_config_err("No resource found for LHS %s", id);
         return FALSE;
 
     } else if (rsc_rh == NULL) {
         crm_config_err("No resource found for RHS of %s", id);
         return FALSE;
     }
 
     new_con = calloc(1, sizeof(rsc_colocation_t));
     if (new_con == NULL) {
         return FALSE;
     }
 
     if (state_lh == NULL || safe_str_eq(state_lh, RSC_ROLE_STARTED_S)) {
         state_lh = RSC_ROLE_UNKNOWN_S;
     }
 
     if (state_rh == NULL || safe_str_eq(state_rh, RSC_ROLE_STARTED_S)) {
         state_rh = RSC_ROLE_UNKNOWN_S;
     }
 
     new_con->id = id;
     new_con->rsc_lh = rsc_lh;
     new_con->rsc_rh = rsc_rh;
     new_con->score = score;
     new_con->role_lh = text2role(state_lh);
     new_con->role_rh = text2role(state_rh);
     new_con->node_attribute = node_attr;
 
     if (node_attr == NULL) {
         node_attr = "#" XML_ATTR_UNAME;
     }
 
     pe_rsc_trace(rsc_lh, "%s ==> %s (%s %d)", rsc_lh->id, rsc_rh->id, node_attr, score);
 
     rsc_lh->rsc_cons = g_list_insert_sorted(rsc_lh->rsc_cons, new_con, sort_cons_priority_rh);
 
     rsc_rh->rsc_cons_lhs =
         g_list_insert_sorted(rsc_rh->rsc_cons_lhs, new_con, sort_cons_priority_lh);
 
     data_set->colocation_constraints = g_list_append(data_set->colocation_constraints, new_con);
 
     if (score <= -INFINITY) {
         new_rsc_order(rsc_lh, CRMD_ACTION_STOP, rsc_rh, CRMD_ACTION_START,
                       pe_order_anti_colocation, data_set);
         new_rsc_order(rsc_rh, CRMD_ACTION_STOP, rsc_lh, CRMD_ACTION_START,
                       pe_order_anti_colocation, data_set);
     }
 
     return TRUE;
 }
 
 /* LHS before RHS */
 int
 new_rsc_order(resource_t * lh_rsc, const char *lh_task,
               resource_t * rh_rsc, const char *rh_task,
               enum pe_ordering type, pe_working_set_t * data_set)
 {
     char *lh_key = NULL;
     char *rh_key = NULL;
 
     CRM_CHECK(lh_rsc != NULL, return -1);
     CRM_CHECK(lh_task != NULL, return -1);
     CRM_CHECK(rh_rsc != NULL, return -1);
     CRM_CHECK(rh_task != NULL, return -1);
 
     /* We no longer need to test if these reference stonith resources
      * now that stonithd has access to them even when they're not "running"
      *
     if (validate_order_resources(lh_rsc, lh_task, rh_rsc, rh_task)) {
         return -1;
     }
     */
 
     lh_key = generate_op_key(lh_rsc->id, lh_task, 0);
     rh_key = generate_op_key(rh_rsc->id, rh_task, 0);
 
     return custom_action_order(lh_rsc, lh_key, NULL, rh_rsc, rh_key, NULL, type, data_set);
 }
 
 static char *
 task_from_action_or_key(action_t *action, const char *key)
 {
     char *res = NULL;
     char *rsc_id = NULL;
     char *op_type = NULL;
     int interval = 0;
 
     if (action) {
         res = strdup(action->task);
     } else if (key) {
         int rc = 0;
         rc = parse_op_key(key, &rsc_id, &op_type, &interval);
         if (rc == TRUE) {
             res = op_type;
             op_type = NULL;
         }
         free(rsc_id);
         free(op_type);
     }
 
     return res;
 }
 
 /* when order constraints are made between two resources start and stop actions
  * those constraints have to be mirrored against the corresponding
  * migration actions to ensure start/stop ordering is preserved during
  * a migration */
 static void
 handle_migration_ordering(order_constraint_t *order, pe_working_set_t *data_set)
 {
     char *lh_task = NULL;
     char *rh_task = NULL;
     gboolean rh_migratable;
     gboolean lh_migratable;
 
     if (order->lh_rsc == NULL || order->rh_rsc == NULL) {
         return;
     } else if (order->lh_rsc == order->rh_rsc) {
         return;
     /* don't mess with those constraints built between parent
      * resources and the children */
     } else if (is_parent(order->lh_rsc, order->rh_rsc)) {
         return;
     } else if (is_parent(order->rh_rsc, order->lh_rsc)) {
         return;
     }
 
     lh_migratable = is_set(order->lh_rsc->flags, pe_rsc_allow_migrate);
     rh_migratable = is_set(order->rh_rsc->flags, pe_rsc_allow_migrate);
 
     /* one of them has to be migratable for
      * the migrate ordering logic to be applied */
     if (lh_migratable == FALSE && rh_migratable == FALSE) {
         return;
     }
 
     /* at this point we have two resources which allow migrations that have an
      * order dependency set between them.  If those order dependencies involve
      * start/stop actions, we need to mirror the corresponding migrate actions
      * so order will be preserved. */
     lh_task = task_from_action_or_key(order->lh_action, order->lh_action_task);
     rh_task = task_from_action_or_key(order->rh_action, order->rh_action_task);
     if (lh_task == NULL || rh_task == NULL) {
         goto cleanup_order;
     }
 
     if (safe_str_eq(lh_task, RSC_START) && safe_str_eq(rh_task, RSC_START)) {
         int flags = pe_order_optional;
 
         if (lh_migratable && rh_migratable) {
             /* A start then B start
              * A migrate_from then B migrate_to */
             custom_action_order(order->lh_rsc, generate_op_key(order->lh_rsc->id, RSC_MIGRATED, 0), NULL,
                                 order->rh_rsc, generate_op_key(order->rh_rsc->id, RSC_MIGRATE, 0), NULL,
                                 flags, data_set);
         }
 
         if (rh_migratable) {
             if (lh_migratable) {
                 flags |= pe_order_apply_first_non_migratable;
             }
 
             /* A start then B start
              * A start then B migrate_to... only if A start is not a part of a migration*/
             custom_action_order(order->lh_rsc, generate_op_key(order->lh_rsc->id, RSC_START, 0), NULL,
                                 order->rh_rsc, generate_op_key(order->rh_rsc->id, RSC_MIGRATE, 0), NULL,
                                 flags, data_set);
         }
 
     } else if (rh_migratable == TRUE && safe_str_eq(lh_task, RSC_STOP) && safe_str_eq(rh_task, RSC_STOP)) {
         int flags = pe_order_optional;
 
         if (lh_migratable) {
             flags |= pe_order_apply_first_non_migratable;
         }
 
         /* rh side is at the bottom of the stack during a stop. If we have a constraint
          * stop B then stop A, if B is migrating via stop/start, and A is migrating using migration actions,
          * we need to enforce that A's migrate_to action occurs after B's stop action. */
         custom_action_order(order->lh_rsc, generate_op_key(order->lh_rsc->id, RSC_STOP, 0), NULL,
                             order->rh_rsc, generate_op_key(order->rh_rsc->id, RSC_MIGRATE, 0), NULL,
                             flags, data_set);
 
         /* We need to build the stop constraint against migrate_from as well
          * to account for partial migrations. */
         if (order->rh_rsc->partial_migration_target) {
             custom_action_order(order->lh_rsc, generate_op_key(order->lh_rsc->id, RSC_STOP, 0), NULL,
                                 order->rh_rsc, generate_op_key(order->rh_rsc->id, RSC_MIGRATED, 0), NULL,
                                 flags, data_set);
         }
 
     } else if (safe_str_eq(lh_task, RSC_PROMOTE) && safe_str_eq(rh_task, RSC_START)) {
         int flags = pe_order_optional;
 
         if (rh_migratable) {
             /* A promote then B start
              * A promote then B migrate_to */
             custom_action_order(order->lh_rsc, generate_op_key(order->lh_rsc->id, RSC_PROMOTE, 0), NULL,
                                 order->rh_rsc, generate_op_key(order->rh_rsc->id, RSC_MIGRATE, 0), NULL,
                                 flags, data_set);
         }
 
     } else if (safe_str_eq(lh_task, RSC_DEMOTE) && safe_str_eq(rh_task, RSC_STOP)) {
         int flags = pe_order_optional;
 
         if (rh_migratable) {
             /* A demote then B stop
              * A demote then B migrate_to */
             custom_action_order(order->lh_rsc, generate_op_key(order->lh_rsc->id, RSC_DEMOTE, 0), NULL,
                                 order->rh_rsc, generate_op_key(order->rh_rsc->id, RSC_MIGRATE, 0), NULL,
                                 flags, data_set);
 
             /* We need to build the demote constraint against migrate_from as well
              * to account for partial migrations. */
             if (order->rh_rsc->partial_migration_target) {
                 custom_action_order(order->lh_rsc, generate_op_key(order->lh_rsc->id, RSC_DEMOTE, 0), NULL,
                                     order->rh_rsc, generate_op_key(order->rh_rsc->id, RSC_MIGRATED, 0), NULL,
                                     flags, data_set);
             }
         }
     }
 
 cleanup_order:
     free(lh_task);
     free(rh_task);
 }
 
 /* LHS before RHS */
 int
 custom_action_order(resource_t * lh_rsc, char *lh_action_task, action_t * lh_action,
                     resource_t * rh_rsc, char *rh_action_task, action_t * rh_action,
                     enum pe_ordering type, pe_working_set_t * data_set)
 {
     order_constraint_t *order = NULL;
 
     if (lh_rsc == NULL && lh_action) {
         lh_rsc = lh_action->rsc;
     }
     if (rh_rsc == NULL && rh_action) {
         rh_rsc = rh_action->rsc;
     }
 
     if ((lh_action == NULL && lh_rsc == NULL)
         || (rh_action == NULL && rh_rsc == NULL)) {
         crm_config_err("Invalid inputs %p.%p %p.%p", lh_rsc, lh_action, rh_rsc, rh_action);
         free(lh_action_task);
         free(rh_action_task);
         return -1;
     }
 
     order = calloc(1, sizeof(order_constraint_t));
 
     order->id = data_set->order_id++;
     order->type = type;
     order->lh_rsc = lh_rsc;
     order->rh_rsc = rh_rsc;
     order->lh_action = lh_action;
     order->rh_action = rh_action;
     order->lh_action_task = lh_action_task;
     order->rh_action_task = rh_action_task;
 
     if (order->lh_action_task == NULL && lh_action) {
         order->lh_action_task = strdup(lh_action->uuid);
     }
 
     if (order->rh_action_task == NULL && rh_action) {
         order->rh_action_task = strdup(rh_action->uuid);
     }
 
     if (order->lh_rsc == NULL && lh_action) {
         order->lh_rsc = lh_action->rsc;
     }
 
     if (order->rh_rsc == NULL && rh_action) {
         order->rh_rsc = rh_action->rsc;
     }
 
     data_set->ordering_constraints = g_list_prepend(data_set->ordering_constraints, order);
     handle_migration_ordering(order, data_set);
 
     return order->id;
 }
 
 enum pe_ordering
 get_asymmetrical_flags(enum pe_order_kind kind)
 {
     enum pe_ordering flags = pe_order_optional;
 
     if (kind == pe_order_kind_mandatory) {
         flags |= pe_order_asymmetrical;
     } else if (kind == pe_order_kind_serialize) {
         flags |= pe_order_serialize_only;
     }
     return flags;
 }
 
 enum pe_ordering
 get_flags(const char *id, enum pe_order_kind kind,
           const char *action_first, const char *action_then, gboolean invert)
 {
     enum pe_ordering flags = pe_order_optional;
 
     if (invert && kind == pe_order_kind_mandatory) {
         crm_trace("Upgrade %s: implies left", id);
         flags |= pe_order_implies_first;
 
     } else if (kind == pe_order_kind_mandatory) {
         crm_trace("Upgrade %s: implies right", id);
         flags |= pe_order_implies_then;
         if (safe_str_eq(action_first, RSC_START)
             || safe_str_eq(action_first, RSC_PROMOTE)) {
             crm_trace("Upgrade %s: runnable", id);
             flags |= pe_order_runnable_left;
         }
 
     } else if (kind == pe_order_kind_serialize) {
         flags |= pe_order_serialize_only;
     }
 
     return flags;
 }
 
 static gboolean
 unpack_order_set(xmlNode * set, enum pe_order_kind kind, resource_t ** rsc,
                  action_t ** begin, action_t ** end, action_t ** inv_begin, action_t ** inv_end,
                  const char *symmetrical, pe_working_set_t * data_set)
 {
     xmlNode *xml_rsc = NULL;
     GListPtr set_iter = NULL;
     GListPtr resources = NULL;
 
     resource_t *last = NULL;
     resource_t *resource = NULL;
 
     int local_kind = kind;
     gboolean sequential = FALSE;
     enum pe_ordering flags = pe_order_optional;
 
     char *key = NULL;
     const char *id = ID(set);
     const char *action = crm_element_value(set, "action");
     const char *sequential_s = crm_element_value(set, "sequential");
     const char *kind_s = crm_element_value(set, XML_ORDER_ATTR_KIND);
 
     /*
        char *pseudo_id = NULL;
        char *end_id    = NULL;
        char *begin_id  = NULL;
      */
 
     if (action == NULL) {
         action = RSC_START;
     }
 
     if (kind_s) {
         local_kind = get_ordering_type(set);
     }
     if (sequential_s == NULL) {
         sequential_s = "1";
     }
 
     sequential = crm_is_true(sequential_s);
     if (crm_is_true(symmetrical)) {
         flags = get_flags(id, local_kind, action, action, FALSE);
     } else {
         flags = get_asymmetrical_flags(local_kind);
     }
 
     for (xml_rsc = __xml_first_child(set); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
         if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
             EXPAND_CONSTRAINT_IDREF(id, resource, ID(xml_rsc));
             resources = g_list_append(resources, resource);
         }
     }
 
     if (g_list_length(resources) == 1) {
         crm_trace("Single set: %s", id);
         *rsc = resource;
         *end = NULL;
         *begin = NULL;
         *inv_end = NULL;
         *inv_begin = NULL;
         goto done;
     }
 
     /*
        pseudo_id = crm_concat(id, action, '-');
        end_id    = crm_concat(pseudo_id, "end", '-');
        begin_id  = crm_concat(pseudo_id, "begin", '-');
      */
 
     *rsc = NULL;
     /*
      *end = get_pseudo_op(end_id, data_set);
      *begin = get_pseudo_op(begin_id, data_set);
 
      free(pseudo_id);
      free(begin_id);
      free(end_id);
      */
 
     set_iter = resources;
     while (set_iter != NULL) {
         resource = (resource_t *) set_iter->data;
         set_iter = set_iter->next;
 
         key = generate_op_key(resource->id, action, 0);
 
         /*
            custom_action_order(NULL, NULL, *begin, resource, strdup(key), NULL,
            flags|pe_order_implies_first_printed, data_set);
 
            custom_action_order(resource, strdup(key), NULL, NULL, NULL, *end,
            flags|pe_order_implies_then_printed, data_set);
          */
 
         if (local_kind == pe_order_kind_serialize) {
             /* Serialize before everything that comes after */
 
             GListPtr gIter = NULL;
 
             for (gIter = set_iter; gIter != NULL; gIter = gIter->next) {
                 resource_t *then_rsc = (resource_t *) gIter->data;
                 char *then_key = generate_op_key(then_rsc->id, action, 0);
 
                 custom_action_order(resource, strdup(key), NULL, then_rsc, then_key, NULL,
                                     flags, data_set);
             }
 
         } else if (sequential) {
             if (last != NULL) {
                 new_rsc_order(last, action, resource, action, flags, data_set);
             }
             last = resource;
         }
         free(key);
     }
 
     if (crm_is_true(symmetrical) == FALSE) {
         goto done;
 
     } else if (symmetrical && local_kind == pe_order_kind_serialize) {
         crm_config_warn("Cannot invert serialized constraint set %s", id);
         goto done;
 
     } else if (local_kind == pe_order_kind_serialize) {
         goto done;
     }
 
     last = NULL;
     action = invert_action(action);
 
     /*
        pseudo_id = crm_concat(id, action, '-');
        end_id    = crm_concat(pseudo_id, "end", '-');
        begin_id  = crm_concat(pseudo_id, "begin", '-');
 
        *inv_end = get_pseudo_op(end_id, data_set);
        *inv_begin = get_pseudo_op(begin_id, data_set);
 
        free(pseudo_id);
        free(begin_id);
        free(end_id);
      */
 
     flags = get_flags(id, local_kind, action, action, TRUE);
 
     set_iter = resources;
     while (set_iter != NULL) {
         resource = (resource_t *) set_iter->data;
         set_iter = set_iter->next;
 
         /*
            key = generate_op_key(resource->id, action, 0);
 
            custom_action_order(NULL, NULL, *inv_begin, resource, strdup(key), NULL,
            flags|pe_order_implies_first_printed, data_set);
 
            custom_action_order(resource, key, NULL, NULL, NULL, *inv_end,
            flags|pe_order_implies_then_printed, data_set);
          */
 
         if (sequential) {
             if (last != NULL) {
                 new_rsc_order(resource, action, last, action, flags, data_set);
             }
             last = resource;
         }
     }
 
   done:
     g_list_free(resources);
     return TRUE;
 }
 
 static gboolean
 order_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, enum pe_order_kind kind,
                pe_working_set_t * data_set, gboolean invert, gboolean symmetrical)
 {
 
     xmlNode *xml_rsc = NULL;
     xmlNode *xml_rsc_2 = NULL;
 
     resource_t *rsc_1 = NULL;
     resource_t *rsc_2 = NULL;
 
     const char *action_1 = crm_element_value(set1, "action");
     const char *action_2 = crm_element_value(set2, "action");
 
     const char *sequential_1 = crm_element_value(set1, "sequential");
     const char *sequential_2 = crm_element_value(set2, "sequential");
 
     const char *require_all_s = crm_element_value(set1, "require-all");
     gboolean require_all = require_all_s ? crm_is_true(require_all_s) : TRUE;
 
     enum pe_ordering flags = pe_order_none;
 
     if (action_1 == NULL) {
         action_1 = RSC_START;
     };
 
     if (action_2 == NULL) {
         action_2 = RSC_START;
     };
 
     if (invert) {
         action_1 = invert_action(action_1);
         action_2 = invert_action(action_2);
     }
 
     if(safe_str_eq(RSC_STOP, action_1) || safe_str_eq(RSC_DEMOTE, action_1)) {
         /* Assuming: A -> ( B || C) -> D
          * The one-or-more logic only applies during the start/promote phase
          * During shutdown neither B nor can shutdown until D is down, so simply turn require_all back on.
          */
         require_all = TRUE;
     }
 
     if (symmetrical == FALSE) {
         flags = get_asymmetrical_flags(kind);
     } else {
         flags = get_flags(id, kind, action_2, action_1, invert);
     }
 
     /* If we have an un-ordered set1, whether it is sequential or not is irrelevant in regards to set2. */
     if (!require_all) {
         char *task = crm_concat(CRM_OP_RELAXED_SET, ID(set1), ':');
         action_t *unordered_action = get_pseudo_op(task, data_set);
 
         free(task);
         update_action_flags(unordered_action, pe_action_requires_any);
 
         for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (!crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 continue;
             }
 
             EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
 
             /* Add an ordering constraint between every element in set1 and the pseudo action.
              * If any action in set1 is runnable the pseudo action will be runnable. */
             custom_action_order(rsc_1, generate_op_key(rsc_1->id, action_1, 0), NULL,
                                 NULL, NULL, unordered_action,
                                 pe_order_one_or_more | pe_order_implies_then_printed, data_set);
         }
         for (xml_rsc_2 = __xml_first_child(set2); xml_rsc_2 != NULL; xml_rsc_2 = __xml_next_element(xml_rsc_2)) {
             if (!crm_str_eq((const char *)xml_rsc_2->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 continue;
             }
 
             EXPAND_CONSTRAINT_IDREF(id, rsc_2, ID(xml_rsc_2));
 
             /* Add an ordering constraint between the pseudo action and every element in set2.
              * If the pseudo action is runnable, every action in set2 will be runnable */
             custom_action_order(NULL, NULL, unordered_action,
                                 rsc_2, generate_op_key(rsc_2->id, action_2, 0), NULL,
                                 flags | pe_order_runnable_left, data_set);
         }
 
         return TRUE;
     }
 
     if (crm_is_true(sequential_1)) {
         if (invert == FALSE) {
             /* get the last one */
             const char *rid = NULL;
 
             for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
                 if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                     rid = ID(xml_rsc);
                 }
             }
             EXPAND_CONSTRAINT_IDREF(id, rsc_1, rid);
 
         } else {
             /* get the first one */
             for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
                 if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                     EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
                     break;
                 }
             }
         }
     }
 
     if (crm_is_true(sequential_2)) {
         if (invert == FALSE) {
             /* get the first one */
             for (xml_rsc = __xml_first_child(set2); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
                 if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                     EXPAND_CONSTRAINT_IDREF(id, rsc_2, ID(xml_rsc));
                     break;
                 }
             }
 
         } else {
             /* get the last one */
             const char *rid = NULL;
 
             for (xml_rsc = __xml_first_child(set2); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
                 if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                     rid = ID(xml_rsc);
                 }
             }
             EXPAND_CONSTRAINT_IDREF(id, rsc_2, rid);
         }
     }
 
     if (rsc_1 != NULL && rsc_2 != NULL) {
         new_rsc_order(rsc_1, action_1, rsc_2, action_2, flags, data_set);
 
     } else if (rsc_1 != NULL) {
         for (xml_rsc = __xml_first_child(set2); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 EXPAND_CONSTRAINT_IDREF(id, rsc_2, ID(xml_rsc));
                 new_rsc_order(rsc_1, action_1, rsc_2, action_2, flags, data_set);
             }
         }
 
     } else if (rsc_2 != NULL) {
         xmlNode *xml_rsc = NULL;
 
         for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
                 new_rsc_order(rsc_1, action_1, rsc_2, action_2, flags, data_set);
             }
         }
 
     } else {
         for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 xmlNode *xml_rsc_2 = NULL;
 
                 EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
 
                 for (xml_rsc_2 = __xml_first_child(set2); xml_rsc_2 != NULL;
                      xml_rsc_2 = __xml_next_element(xml_rsc_2)) {
                     if (crm_str_eq((const char *)xml_rsc_2->name, XML_TAG_RESOURCE_REF, TRUE)) {
                         EXPAND_CONSTRAINT_IDREF(id, rsc_2, ID(xml_rsc_2));
                         new_rsc_order(rsc_1, action_1, rsc_2, action_2, flags, data_set);
                     }
                 }
             }
         }
     }
 
     return TRUE;
 }
 
 static gboolean
 unpack_order_tags(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_set_t * data_set)
 {
     const char *id = NULL;
     const char *id_first = NULL;
     const char *id_then = NULL;
     const char *action_first = NULL;
     const char *action_then = NULL;
 
     resource_t *rsc_first = NULL;
     resource_t *rsc_then = NULL;
     tag_t *tag_first = NULL;
     tag_t *tag_then = NULL;
 
     xmlNode *new_xml = NULL;
     xmlNode *rsc_set_first = NULL;
     xmlNode *rsc_set_then = NULL;
     gboolean any_sets = FALSE;
 
     *expanded_xml = NULL;
 
     if (xml_obj == NULL) {
         crm_config_err("No constraint object to process.");
         return FALSE;
     }
 
     id = crm_element_value(xml_obj, XML_ATTR_ID);
     if (id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     /* Attempt to expand any template/tag references in possible resource sets. */
     expand_tags_in_sets(xml_obj, &new_xml, data_set);
     if (new_xml) {
         /* There are resource sets referencing templates/tags. Return with the expanded XML. */
         crm_log_xml_trace(new_xml, "Expanded rsc_order...");
         *expanded_xml = new_xml;
         return TRUE;
     }
 
     id_first = crm_element_value(xml_obj, XML_ORDER_ATTR_FIRST);
     id_then = crm_element_value(xml_obj, XML_ORDER_ATTR_THEN);
     if (id_first == NULL || id_then == NULL) {
         return TRUE;
     }
 
     if (valid_resource_or_tag(data_set, id_first, &rsc_first, &tag_first) == FALSE) {
         crm_config_err("Constraint '%s': Invalid reference to '%s'", id, id_first);
         return FALSE;
     }
 
     if (valid_resource_or_tag(data_set, id_then, &rsc_then, &tag_then) == FALSE) {
         crm_config_err("Constraint '%s': Invalid reference to '%s'", id, id_then);
         return FALSE;
     }
 
     if (rsc_first && rsc_then) {
         /* Neither side references any template/tag. */
         return TRUE;
     }
 
     action_first = crm_element_value(xml_obj, XML_ORDER_ATTR_FIRST_ACTION);
     action_then = crm_element_value(xml_obj, XML_ORDER_ATTR_THEN_ACTION);
 
     new_xml = copy_xml(xml_obj);
 
     /* Convert the template/tag reference in "first" into a resource_set under the order constraint. */
     if (tag_to_set(new_xml, &rsc_set_first, XML_ORDER_ATTR_FIRST, TRUE, data_set) == FALSE) {
         free_xml(new_xml);
         return FALSE;
     }
 
     if (rsc_set_first) {
         if (action_first) {
             /* A "first-action" is specified.
                Move it into the converted resource_set as an "action" attribute. */
             crm_xml_add(rsc_set_first, "action", action_first);
             xml_remove_prop(new_xml, XML_ORDER_ATTR_FIRST_ACTION);
         }
         any_sets = TRUE;
     }
 
     /* Convert the template/tag reference in "then" into a resource_set under the order constraint. */
     if (tag_to_set(new_xml, &rsc_set_then, XML_ORDER_ATTR_THEN, TRUE, data_set) == FALSE) {
         free_xml(new_xml);
         return FALSE;
     }
 
     if (rsc_set_then) {
         if (action_then) {
             /* A "then-action" is specified.
                Move it into the converted resource_set as an "action" attribute. */
             crm_xml_add(rsc_set_then, "action", action_then);
             xml_remove_prop(new_xml, XML_ORDER_ATTR_THEN_ACTION);
         }
         any_sets = TRUE;
     }
 
     if (any_sets) {
         crm_log_xml_trace(new_xml, "Expanded rsc_order...");
         *expanded_xml = new_xml;
     } else {
         free_xml(new_xml);
     }
 
     return TRUE;
 }
 
 gboolean
 unpack_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set)
 {
     gboolean any_sets = FALSE;
 
     resource_t *rsc = NULL;
 
     /*
        resource_t *last_rsc = NULL;
      */
 
     action_t *set_end = NULL;
     action_t *set_begin = NULL;
 
     action_t *set_inv_end = NULL;
     action_t *set_inv_begin = NULL;
 
     xmlNode *set = NULL;
     xmlNode *last = NULL;
 
     xmlNode *orig_xml = NULL;
     xmlNode *expanded_xml = NULL;
 
     /*
        action_t *last_end = NULL;
        action_t *last_begin = NULL;
        action_t *last_inv_end = NULL;
        action_t *last_inv_begin = NULL;
      */
 
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
     const char *invert = crm_element_value(xml_obj, XML_CONS_ATTR_SYMMETRICAL);
     enum pe_order_kind kind = get_ordering_type(xml_obj);
 
     gboolean invert_bool = TRUE;
     gboolean rc = TRUE;
 
     if (invert == NULL) {
         invert = "true";
     }
 
     invert_bool = crm_is_true(invert);
 
     rc = unpack_order_tags(xml_obj, &expanded_xml, data_set);
     if (expanded_xml) {
         orig_xml = xml_obj;
         xml_obj = expanded_xml;
 
     } else if (rc == FALSE) {
         return FALSE;
     }
 
     for (set = __xml_first_child(xml_obj); set != NULL; set = __xml_next_element(set)) {
         if (crm_str_eq((const char *)set->name, XML_CONS_TAG_RSC_SET, TRUE)) {
             any_sets = TRUE;
             set = expand_idref(set, data_set->input);
             if (unpack_order_set(set, kind, &rsc, &set_begin, &set_end,
                                  &set_inv_begin, &set_inv_end, invert, data_set) == FALSE) {
                 return FALSE;
 
                 /* Expand orders in order_rsc_sets() instead of via pseudo actions. */
                 /*
                    } else if(last) {
                    const char *set_action = crm_element_value(set, "action");
                    const char *last_action = crm_element_value(last, "action");
                    enum pe_ordering flags = get_flags(id, kind, last_action, set_action, FALSE);
 
                    if(!set_action) { set_action = RSC_START; }
                    if(!last_action) { last_action = RSC_START; }
 
                    if(rsc == NULL && last_rsc == NULL) {
                    order_actions(last_end, set_begin, flags);
                    } else {
                    custom_action_order(
                    last_rsc, null_or_opkey(last_rsc, last_action), last_end,
                    rsc, null_or_opkey(rsc, set_action), set_begin,
                    flags, data_set);
                    }
 
                    if(crm_is_true(invert)) {
                    set_action = invert_action(set_action);
                    last_action = invert_action(last_action);
 
                    flags = get_flags(id, kind, last_action, set_action, TRUE);
                    if(rsc == NULL && last_rsc == NULL) {
                    order_actions(last_inv_begin, set_inv_end, flags);
 
                    } else {
                    custom_action_order(
                    last_rsc, null_or_opkey(last_rsc, last_action), last_inv_begin,
                    rsc, null_or_opkey(rsc, set_action), set_inv_end,
                    flags, data_set);
                    }
                    }
                  */
 
             } else if (         /* never called -- Now call it for supporting clones in resource sets */
                           last) {
                 if (order_rsc_sets(id, last, set, kind, data_set, FALSE, invert_bool) == FALSE) {
                     return FALSE;
                 }
 
                 if (invert_bool
                     && order_rsc_sets(id, set, last, kind, data_set, TRUE, invert_bool) == FALSE) {
                     return FALSE;
                 }
 
             }
             last = set;
             /*
                last_rsc = rsc;
                last_end = set_end;
                last_begin = set_begin;
                last_inv_end = set_inv_end;
                last_inv_begin = set_inv_begin;
              */
         }
     }
 
     if (expanded_xml) {
         free_xml(expanded_xml);
         xml_obj = orig_xml;
     }
 
     if (any_sets == FALSE) {
         return unpack_simple_rsc_order(xml_obj, data_set);
     }
 
     return TRUE;
 }
 
 static gboolean
 unpack_colocation_set(xmlNode * set, int score, pe_working_set_t * data_set)
 {
     xmlNode *xml_rsc = NULL;
     resource_t *with = NULL;
     resource_t *resource = NULL;
     const char *set_id = ID(set);
     const char *role = crm_element_value(set, "role");
     const char *sequential = crm_element_value(set, "sequential");
     const char *ordering = crm_element_value(set, "ordering");
     int local_score = score;
 
     const char *score_s = crm_element_value(set, XML_RULE_ATTR_SCORE);
 
     if (score_s) {
         local_score = char2score(score_s);
     }
 
     if(ordering == NULL) {
         ordering = "group";
     }
 
     if (sequential != NULL && crm_is_true(sequential) == FALSE) {
         return TRUE;
 
     } else if (local_score >= 0 && safe_str_eq(ordering, "group")) {
         for (xml_rsc = __xml_first_child(set); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 EXPAND_CONSTRAINT_IDREF(set_id, resource, ID(xml_rsc));
                 if (with != NULL) {
                     pe_rsc_trace(resource, "Colocating %s with %s", resource->id, with->id);
                     rsc_colocation_new(set_id, NULL, local_score, resource, with, role, role,
                                        data_set);
                 }
 
                 with = resource;
             }
         }
     } else if (local_score >= 0) {
         resource_t *last = NULL;
         for (xml_rsc = __xml_first_child(set); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 EXPAND_CONSTRAINT_IDREF(set_id, resource, ID(xml_rsc));
                 if (last != NULL) {
                     pe_rsc_trace(resource, "Colocating %s with %s", last->id, resource->id);
                     rsc_colocation_new(set_id, NULL, local_score, last, resource, role, role,
                                        data_set);
                 }
 
                 last = resource;
             }
         }
 
     } else {
         /* Anti-colocating with every prior resource is
          * the only way to ensure the intuitive result
          * (ie. that no-one in the set can run with anyone
          * else in the set)
          */
 
         for (xml_rsc = __xml_first_child(set); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 xmlNode *xml_rsc_with = NULL;
 
                 EXPAND_CONSTRAINT_IDREF(set_id, resource, ID(xml_rsc));
 
                 for (xml_rsc_with = __xml_first_child(set); xml_rsc_with != NULL;
                      xml_rsc_with = __xml_next_element(xml_rsc_with)) {
                     if (crm_str_eq((const char *)xml_rsc_with->name, XML_TAG_RESOURCE_REF, TRUE)) {
                         if (safe_str_eq(resource->id, ID(xml_rsc_with))) {
                             break;
                         } else if (resource == NULL) {
                             crm_config_err("%s: No resource found for %s", set_id,
                                            ID(xml_rsc_with));
                             return FALSE;
                         }
                         EXPAND_CONSTRAINT_IDREF(set_id, with, ID(xml_rsc_with));
                         pe_rsc_trace(resource, "Anti-Colocating %s with %s", resource->id,
                                      with->id);
                         rsc_colocation_new(set_id, NULL, local_score, resource, with, role, role,
                                            data_set);
                     }
                 }
             }
         }
     }
 
     return TRUE;
 }
 
 static gboolean
 colocate_rsc_sets(const char *id, xmlNode * set1, xmlNode * set2, int score,
                   pe_working_set_t * data_set)
 {
     xmlNode *xml_rsc = NULL;
     resource_t *rsc_1 = NULL;
     resource_t *rsc_2 = NULL;
 
     const char *role_1 = crm_element_value(set1, "role");
     const char *role_2 = crm_element_value(set2, "role");
 
     const char *sequential_1 = crm_element_value(set1, "sequential");
     const char *sequential_2 = crm_element_value(set2, "sequential");
 
     if (sequential_1 == NULL || crm_is_true(sequential_1)) {
         /* get the first one */
         for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
                 break;
             }
         }
     }
 
     if (sequential_2 == NULL || crm_is_true(sequential_2)) {
         /* get the last one */
         const char *rid = NULL;
 
         for (xml_rsc = __xml_first_child(set2); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 rid = ID(xml_rsc);
             }
         }
         EXPAND_CONSTRAINT_IDREF(id, rsc_2, rid);
     }
 
     if (rsc_1 != NULL && rsc_2 != NULL) {
         rsc_colocation_new(id, NULL, score, rsc_1, rsc_2, role_1, role_2, data_set);
 
     } else if (rsc_1 != NULL) {
         for (xml_rsc = __xml_first_child(set2); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 EXPAND_CONSTRAINT_IDREF(id, rsc_2, ID(xml_rsc));
                 rsc_colocation_new(id, NULL, score, rsc_1, rsc_2, role_1, role_2, data_set);
             }
         }
 
     } else if (rsc_2 != NULL) {
         for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
                 rsc_colocation_new(id, NULL, score, rsc_1, rsc_2, role_1, role_2, data_set);
             }
         }
 
     } else {
         for (xml_rsc = __xml_first_child(set1); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
             if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
                 xmlNode *xml_rsc_2 = NULL;
 
                 EXPAND_CONSTRAINT_IDREF(id, rsc_1, ID(xml_rsc));
 
                 for (xml_rsc_2 = __xml_first_child(set2); xml_rsc_2 != NULL;
                      xml_rsc_2 = __xml_next_element(xml_rsc_2)) {
                     if (crm_str_eq((const char *)xml_rsc_2->name, XML_TAG_RESOURCE_REF, TRUE)) {
                         EXPAND_CONSTRAINT_IDREF(id, rsc_2, ID(xml_rsc_2));
                         rsc_colocation_new(id, NULL, score, rsc_1, rsc_2, role_1, role_2, data_set);
                     }
                 }
             }
         }
     }
 
     return TRUE;
 }
 
 static gboolean
 unpack_simple_colocation(xmlNode * xml_obj, pe_working_set_t * data_set)
 {
     int score_i = 0;
 
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
     const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE);
 
     const char *id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
     const char *id_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET);
     const char *state_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_ROLE);
     const char *state_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET_ROLE);
     const char *instance_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_INSTANCE);
     const char *instance_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET_INSTANCE);
     const char *attr = crm_element_value(xml_obj, XML_COLOC_ATTR_NODE_ATTR);
 
     const char *symmetrical = crm_element_value(xml_obj, XML_CONS_ATTR_SYMMETRICAL);
 
     resource_t *rsc_lh = pe_find_constraint_resource(data_set->resources, id_lh);
     resource_t *rsc_rh = pe_find_constraint_resource(data_set->resources, id_rh);
 
     if (rsc_lh == NULL) {
         crm_config_err("Invalid constraint '%s': No resource named '%s'", id, id_lh);
         return FALSE;
 
     } else if (rsc_rh == NULL) {
         crm_config_err("Invalid constraint '%s': No resource named '%s'", id, id_rh);
         return FALSE;
 
     } else if (instance_lh && rsc_lh->variant < pe_clone) {
         crm_config_err
             ("Invalid constraint '%s': Resource '%s' is not a clone but instance %s was requested",
              id, id_lh, instance_lh);
         return FALSE;
 
     } else if (instance_rh && rsc_rh->variant < pe_clone) {
         crm_config_err
             ("Invalid constraint '%s': Resource '%s' is not a clone but instance %s was requested",
              id, id_rh, instance_rh);
         return FALSE;
     }
 
     if (instance_lh) {
         rsc_lh = find_clone_instance(rsc_lh, instance_lh, data_set);
         if (rsc_lh == NULL) {
             crm_config_warn("Invalid constraint '%s': No instance '%s' of '%s'", id, instance_lh,
                             id_lh);
             return FALSE;
         }
     }
 
     if (instance_rh) {
         rsc_rh = find_clone_instance(rsc_rh, instance_rh, data_set);
         if (rsc_rh == NULL) {
             crm_config_warn("Invalid constraint '%s': No instance '%s' of '%s'", id, instance_rh,
                             id_rh);
             return FALSE;
         }
     }
 
     if (crm_is_true(symmetrical)) {
         crm_config_warn("The %s colocation constraint attribute has been removed."
                         "  It didn't do what you think it did anyway.", XML_CONS_ATTR_SYMMETRICAL);
     }
 
     if (score) {
         score_i = char2score(score);
     }
 
     rsc_colocation_new(id, attr, score_i, rsc_lh, rsc_rh, state_lh, state_rh, data_set);
     return TRUE;
 }
 
 static gboolean
 unpack_colocation_tags(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_set_t * data_set)
 {
     const char *id = NULL;
     const char *id_lh = NULL;
     const char *id_rh = NULL;
     const char *state_lh = NULL;
     const char *state_rh = NULL;
 
     resource_t *rsc_lh = NULL;
     resource_t *rsc_rh = NULL;
 
     tag_t *tag_lh = NULL;
     tag_t *tag_rh = NULL;
 
     xmlNode *new_xml = NULL;
     xmlNode *rsc_set_lh = NULL;
     xmlNode *rsc_set_rh = NULL;
     gboolean any_sets = FALSE;
 
     *expanded_xml = NULL;
 
     if (xml_obj == NULL) {
         crm_config_err("No constraint object to process.");
         return FALSE;
     }
 
     id = crm_element_value(xml_obj, XML_ATTR_ID);
     if (id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     /* Attempt to expand any template/tag references in possible resource sets. */
     expand_tags_in_sets(xml_obj, &new_xml, data_set);
     if (new_xml) {
         /* There are resource sets referencing templates/tags. Return with the expanded XML. */
         crm_log_xml_trace(new_xml, "Expanded rsc_colocation...");
         *expanded_xml = new_xml;
         return TRUE;
     }
 
     id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
     id_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET);
     if (id_lh == NULL || id_rh == NULL) {
         return TRUE;
     }
 
     if (valid_resource_or_tag(data_set, id_lh, &rsc_lh, &tag_lh) == FALSE) {
         crm_config_err("Constraint '%s': Invalid reference to '%s'", id, id_lh);
         return FALSE;
     }
 
     if (valid_resource_or_tag(data_set, id_rh, &rsc_rh, &tag_rh) == FALSE) {
         crm_config_err("Constraint '%s': Invalid reference to '%s'", id, id_rh);
         return FALSE;
     }
 
     if (rsc_lh && rsc_rh) {
         /* Neither side references any template/tag. */
         return TRUE;
     }
 
     if (tag_lh && tag_rh) {
         /* A colocation constraint between two templates/tags makes no sense. */
         crm_config_err("Either LHS or RHS of %s should be a normal resource instead of a template/tag",
                        id);
         return FALSE;
     }
 
     state_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_ROLE);
     state_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET_ROLE);
 
     new_xml = copy_xml(xml_obj);
 
     /* Convert the template/tag reference in "rsc" into a resource_set under the colocation constraint. */
     if (tag_to_set(new_xml, &rsc_set_lh, XML_COLOC_ATTR_SOURCE, TRUE, data_set) == FALSE) {
         free_xml(new_xml);
         return FALSE;
     }
 
     if (rsc_set_lh) {
         if (state_lh) {
             /* A "rsc-role" is specified.
                Move it into the converted resource_set as a "role"" attribute. */
             crm_xml_add(rsc_set_lh, "role", state_lh);
             xml_remove_prop(new_xml, XML_COLOC_ATTR_SOURCE_ROLE);
         }
         any_sets = TRUE;
     }
 
     /* Convert the template/tag reference in "with-rsc" into a resource_set under the colocation constraint. */
     if (tag_to_set(new_xml, &rsc_set_rh, XML_COLOC_ATTR_TARGET, TRUE, data_set) == FALSE) {
         free_xml(new_xml);
         return FALSE;
     }
 
     if (rsc_set_rh) {
         if (state_rh) {
             /* A "with-rsc-role" is specified.
                Move it into the converted resource_set as a "role"" attribute. */
             crm_xml_add(rsc_set_rh, "role", state_rh);
             xml_remove_prop(new_xml, XML_COLOC_ATTR_TARGET_ROLE);
         }
         any_sets = TRUE;
     }
 
     if (any_sets) {
         crm_log_xml_trace(new_xml, "Expanded rsc_colocation...");
         *expanded_xml = new_xml;
     } else {
         free_xml(new_xml);
     }
 
     return TRUE;
 }
 
 gboolean
 unpack_rsc_colocation(xmlNode * xml_obj, pe_working_set_t * data_set)
 {
     int score_i = 0;
     xmlNode *set = NULL;
     xmlNode *last = NULL;
     gboolean any_sets = FALSE;
 
     xmlNode *orig_xml = NULL;
     xmlNode *expanded_xml = NULL;
 
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
     const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE);
 
     gboolean rc = TRUE;
 
     if (score) {
         score_i = char2score(score);
     }
 
     rc = unpack_colocation_tags(xml_obj, &expanded_xml, data_set);
     if (expanded_xml) {
         orig_xml = xml_obj;
         xml_obj = expanded_xml;
 
     } else if (rc == FALSE) {
         return FALSE;
     }
 
     for (set = __xml_first_child(xml_obj); set != NULL; set = __xml_next_element(set)) {
         if (crm_str_eq((const char *)set->name, XML_CONS_TAG_RSC_SET, TRUE)) {
             any_sets = TRUE;
             set = expand_idref(set, data_set->input);
             if (unpack_colocation_set(set, score_i, data_set) == FALSE) {
                 return FALSE;
 
             } else if (last && colocate_rsc_sets(id, last, set, score_i, data_set) == FALSE) {
                 return FALSE;
             }
             last = set;
         }
     }
 
     if (expanded_xml) {
         free_xml(expanded_xml);
         xml_obj = orig_xml;
     }
 
     if (any_sets == FALSE) {
         return unpack_simple_colocation(xml_obj, data_set);
     }
 
     return TRUE;
 }
 
 gboolean
 rsc_ticket_new(const char *id, resource_t * rsc_lh, ticket_t * ticket,
                const char *state_lh, const char *loss_policy, pe_working_set_t * data_set)
 {
     rsc_ticket_t *new_rsc_ticket = NULL;
 
     if (rsc_lh == NULL) {
         crm_config_err("No resource found for LHS %s", id);
         return FALSE;
     }
 
     new_rsc_ticket = calloc(1, sizeof(rsc_ticket_t));
     if (new_rsc_ticket == NULL) {
         return FALSE;
     }
 
     if (state_lh == NULL || safe_str_eq(state_lh, RSC_ROLE_STARTED_S)) {
         state_lh = RSC_ROLE_UNKNOWN_S;
     }
 
     new_rsc_ticket->id = id;
     new_rsc_ticket->ticket = ticket;
     new_rsc_ticket->rsc_lh = rsc_lh;
     new_rsc_ticket->role_lh = text2role(state_lh);
 
     if (safe_str_eq(loss_policy, "fence")) {
         crm_debug("On loss of ticket '%s': Fence the nodes running %s (%s)",
                   new_rsc_ticket->ticket->id, new_rsc_ticket->rsc_lh->id,
                   role2text(new_rsc_ticket->role_lh));
         new_rsc_ticket->loss_policy = loss_ticket_fence;
 
     } else if (safe_str_eq(loss_policy, "freeze")) {
         crm_debug("On loss of ticket '%s': Freeze %s (%s)",
                   new_rsc_ticket->ticket->id, new_rsc_ticket->rsc_lh->id,
                   role2text(new_rsc_ticket->role_lh));
         new_rsc_ticket->loss_policy = loss_ticket_freeze;
 
     } else if (safe_str_eq(loss_policy, "demote")) {
         crm_debug("On loss of ticket '%s': Demote %s (%s)",
                   new_rsc_ticket->ticket->id, new_rsc_ticket->rsc_lh->id,
                   role2text(new_rsc_ticket->role_lh));
         new_rsc_ticket->loss_policy = loss_ticket_demote;
 
     } else if (safe_str_eq(loss_policy, "stop")) {
         crm_debug("On loss of ticket '%s': Stop %s (%s)",
                   new_rsc_ticket->ticket->id, new_rsc_ticket->rsc_lh->id,
                   role2text(new_rsc_ticket->role_lh));
         new_rsc_ticket->loss_policy = loss_ticket_stop;
 
     } else {
         if (new_rsc_ticket->role_lh == RSC_ROLE_MASTER) {
             crm_debug("On loss of ticket '%s': Default to demote %s (%s)",
                       new_rsc_ticket->ticket->id, new_rsc_ticket->rsc_lh->id,
                       role2text(new_rsc_ticket->role_lh));
             new_rsc_ticket->loss_policy = loss_ticket_demote;
 
         } else {
             crm_debug("On loss of ticket '%s': Default to stop %s (%s)",
                       new_rsc_ticket->ticket->id, new_rsc_ticket->rsc_lh->id,
                       role2text(new_rsc_ticket->role_lh));
             new_rsc_ticket->loss_policy = loss_ticket_stop;
         }
     }
 
     pe_rsc_trace(rsc_lh, "%s (%s) ==> %s", rsc_lh->id, role2text(new_rsc_ticket->role_lh),
                  ticket->id);
 
     rsc_lh->rsc_tickets = g_list_append(rsc_lh->rsc_tickets, new_rsc_ticket);
 
     data_set->ticket_constraints = g_list_append(data_set->ticket_constraints, new_rsc_ticket);
 
     if (new_rsc_ticket->ticket->granted == FALSE || new_rsc_ticket->ticket->standby) {
         rsc_ticket_constraint(rsc_lh, new_rsc_ticket, data_set);
     }
 
     return TRUE;
 }
 
 static gboolean
 unpack_rsc_ticket_set(xmlNode * set, ticket_t * ticket, const char *loss_policy,
                       pe_working_set_t * data_set)
 {
     xmlNode *xml_rsc = NULL;
     resource_t *resource = NULL;
     const char *set_id = ID(set);
     const char *role = crm_element_value(set, "role");
 
     if (set == NULL) {
         crm_config_err("No resource_set object to process.");
         return FALSE;
     }
 
     if (set_id == NULL) {
         crm_config_err("resource_set must have an id");
         return FALSE;
     }
 
     if (ticket == NULL) {
         crm_config_err("No dependented ticket specified for '%s'", set_id);
         return FALSE;
     }
 
     for (xml_rsc = __xml_first_child(set); xml_rsc != NULL; xml_rsc = __xml_next_element(xml_rsc)) {
         if (crm_str_eq((const char *)xml_rsc->name, XML_TAG_RESOURCE_REF, TRUE)) {
             EXPAND_CONSTRAINT_IDREF(set_id, resource, ID(xml_rsc));
             pe_rsc_trace(resource, "Resource '%s' depends on ticket '%s'", resource->id,
                          ticket->id);
             rsc_ticket_new(set_id, resource, ticket, role, loss_policy, data_set);
         }
     }
 
     return TRUE;
 }
 
 static gboolean
 unpack_simple_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set)
 {
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
     const char *ticket_str = crm_element_value(xml_obj, XML_TICKET_ATTR_TICKET);
     const char *loss_policy = crm_element_value(xml_obj, XML_TICKET_ATTR_LOSS_POLICY);
 
     ticket_t *ticket = NULL;
 
     const char *id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
     const char *state_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_ROLE);
     const char *instance_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_INSTANCE);
 
     resource_t *rsc_lh = NULL;
 
     if (xml_obj == NULL) {
         crm_config_err("No rsc_ticket constraint object to process.");
         return FALSE;
     }
 
     if (id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     if (ticket_str == NULL) {
         crm_config_err("Invalid constraint '%s': No ticket specified", id);
         return FALSE;
     } else {
         ticket = g_hash_table_lookup(data_set->tickets, ticket_str);
     }
 
     if (ticket == NULL) {
         crm_config_err("Invalid constraint '%s': No ticket named '%s'", id, ticket_str);
         return FALSE;
     }
 
     if (id_lh == NULL) {
         crm_config_err("Invalid constraint '%s': No resource specified", id);
         return FALSE;
     } else {
         rsc_lh = pe_find_constraint_resource(data_set->resources, id_lh);
     }
 
     if (rsc_lh == NULL) {
         crm_config_err("Invalid constraint '%s': No resource named '%s'", id, id_lh);
         return FALSE;
 
     } else if (instance_lh && rsc_lh->variant < pe_clone) {
         crm_config_err
             ("Invalid constraint '%s': Resource '%s' is not a clone but instance %s was requested",
              id, id_lh, instance_lh);
         return FALSE;
     }
 
     if (instance_lh) {
         rsc_lh = find_clone_instance(rsc_lh, instance_lh, data_set);
         if (rsc_lh == NULL) {
             crm_config_warn("Invalid constraint '%s': No instance '%s' of '%s'", id, instance_lh,
                             id_lh);
             return FALSE;
         }
     }
 
     rsc_ticket_new(id, rsc_lh, ticket, state_lh, loss_policy, data_set);
     return TRUE;
 }
 
 static gboolean
 unpack_rsc_ticket_tags(xmlNode * xml_obj, xmlNode ** expanded_xml, pe_working_set_t * data_set)
 {
     const char *id = NULL;
     const char *id_lh = NULL;
     const char *state_lh = NULL;
 
     resource_t *rsc_lh = NULL;
     tag_t *tag_lh = NULL;
 
     xmlNode *new_xml = NULL;
     xmlNode *rsc_set_lh = NULL;
     gboolean any_sets = FALSE;
 
     *expanded_xml = NULL;
 
     if (xml_obj == NULL) {
         crm_config_err("No constraint object to process.");
         return FALSE;
     }
 
     id = crm_element_value(xml_obj, XML_ATTR_ID);
     if (id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     /* Attempt to expand any template/tag references in possible resource sets. */
     expand_tags_in_sets(xml_obj, &new_xml, data_set);
     if (new_xml) {
         /* There are resource sets referencing templates/tags. Return with the expanded XML. */
         crm_log_xml_trace(new_xml, "Expanded rsc_ticket...");
         *expanded_xml = new_xml;
         return TRUE;
     }
 
     id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
     if (id_lh == NULL) {
         return TRUE;
     }
 
     if (valid_resource_or_tag(data_set, id_lh, &rsc_lh, &tag_lh) == FALSE) {
         crm_config_err("Constraint '%s': Invalid reference to '%s'", id, id_lh);
         return FALSE;
 
     } else if (rsc_lh) {
         /* No template/tag is referenced. */
         return TRUE;
     }
 
     state_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_ROLE);
 
     new_xml = copy_xml(xml_obj);
 
     /* Convert the template/tag reference in "rsc" into a resource_set under the rsc_ticket constraint. */
     if (tag_to_set(new_xml, &rsc_set_lh, XML_COLOC_ATTR_SOURCE, FALSE, data_set) == FALSE) {
         free_xml(new_xml);
         return FALSE;
     }
 
     if (rsc_set_lh) {
         if (state_lh) {
             /* A "rsc-role" is specified.
                Move it into the converted resource_set as a "role"" attribute. */
             crm_xml_add(rsc_set_lh, "role", state_lh);
             xml_remove_prop(new_xml, XML_COLOC_ATTR_SOURCE_ROLE);
         }
         any_sets = TRUE;
     }
 
     if (any_sets) {
         crm_log_xml_trace(new_xml, "Expanded rsc_ticket...");
         *expanded_xml = new_xml;
     } else {
         free_xml(new_xml);
     }
 
     return TRUE;
 }
 
 gboolean
 unpack_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set)
 {
     xmlNode *set = NULL;
     gboolean any_sets = FALSE;
 
     const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
     const char *ticket_str = crm_element_value(xml_obj, XML_TICKET_ATTR_TICKET);
     const char *loss_policy = crm_element_value(xml_obj, XML_TICKET_ATTR_LOSS_POLICY);
 
     ticket_t *ticket = NULL;
 
     xmlNode *orig_xml = NULL;
     xmlNode *expanded_xml = NULL;
 
     gboolean rc = TRUE;
 
     if (xml_obj == NULL) {
         crm_config_err("No rsc_ticket constraint object to process.");
         return FALSE;
     }
 
     if (id == NULL) {
         crm_config_err("%s constraint must have an id", crm_element_name(xml_obj));
         return FALSE;
     }
 
     if (data_set->tickets == NULL) {
         data_set->tickets =
             g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, destroy_ticket);
     }
 
     if (ticket_str == NULL) {
         crm_config_err("Invalid constraint '%s': No ticket specified", id);
         return FALSE;
     } else {
         ticket = g_hash_table_lookup(data_set->tickets, ticket_str);
     }
 
     if (ticket == NULL) {
         ticket = ticket_new(ticket_str, data_set);
         if (ticket == NULL) {
             return FALSE;
         }
     }
 
     rc = unpack_rsc_ticket_tags(xml_obj, &expanded_xml, data_set);
     if (expanded_xml) {
         orig_xml = xml_obj;
         xml_obj = expanded_xml;
 
     } else if (rc == FALSE) {
         return FALSE;
     }
 
     for (set = __xml_first_child(xml_obj); set != NULL; set = __xml_next_element(set)) {
         if (crm_str_eq((const char *)set->name, XML_CONS_TAG_RSC_SET, TRUE)) {
             any_sets = TRUE;
             set = expand_idref(set, data_set->input);
             if (unpack_rsc_ticket_set(set, ticket, loss_policy, data_set) == FALSE) {
                 return FALSE;
             }
         }
     }
 
     if (expanded_xml) {
         free_xml(expanded_xml);
         xml_obj = orig_xml;
     }
 
     if (any_sets == FALSE) {
         return unpack_simple_rsc_ticket(xml_obj, data_set);
     }
 
     return TRUE;
 }
 
 gboolean
 is_active(rsc_to_node_t * cons)
 {
     return TRUE;
 }
diff --git a/pengine/graph.c b/pengine/graph.c
index 9cfede63de..3d832f0a26 100644
--- a/pengine/graph.c
+++ b/pengine/graph.c
@@ -1,1416 +1,1435 @@
 /*
  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <crm_internal.h>
 
 #include <sys/param.h>
 #include <crm/crm.h>
 #include <crm/cib.h>
 #include <crm/msg_xml.h>
 #include <crm/common/xml.h>
 
 #include <glib.h>
 
 #include <allocate.h>
 #include <utils.h>
 
-gboolean update_action(action_t * action);
 void update_colo_start_chain(action_t * action);
 gboolean rsc_update_action(action_t * first, action_t * then, enum pe_ordering type);
 
 static enum pe_action_flags
 get_action_flags(action_t * action, node_t * node)
 {
     enum pe_action_flags flags = action->flags;
 
     if (action->rsc) {
         flags = action->rsc->cmds->action_flags(action, NULL);
 
         if (action->rsc->variant >= pe_clone && node) {
 
             /* We only care about activity on $node */
             enum pe_action_flags clone_flags = action->rsc->cmds->action_flags(action, node);
 
             /* Go to great lengths to ensure the correct value for pe_action_runnable...
              *
              * If we are a clone, then for _ordering_ constraints, its only relevant
              * if we are runnable _anywhere_.
              *
              * This only applies to _runnable_ though, and only for ordering constraints.
              * If this function is ever used during colocation, then we'll need additional logic
              *
              * Not very satisfying, but its logical and appears to work well.
              */
             if (is_not_set(clone_flags, pe_action_runnable)
                 && is_set(flags, pe_action_runnable)) {
                 pe_rsc_trace(action->rsc, "Fixing up runnable flag for %s", action->uuid);
                 set_bit(clone_flags, pe_action_runnable);
             }
             flags = clone_flags;
         }
     }
     return flags;
 }
 
 static char *
 convert_non_atomic_uuid(char *old_uuid, resource_t * rsc, gboolean allow_notify,
                         gboolean free_original)
 {
     int interval = 0;
     char *uuid = NULL;
     char *rid = NULL;
     char *raw_task = NULL;
     int task = no_action;
 
     CRM_ASSERT(rsc);
     pe_rsc_trace(rsc, "Processing %s", old_uuid);
     if (old_uuid == NULL) {
         return NULL;
 
     } else if (strstr(old_uuid, "notify") != NULL) {
         goto done;              /* no conversion */
 
     } else if (rsc->variant < pe_group) {
         goto done;              /* no conversion */
     }
 
     CRM_ASSERT(parse_op_key(old_uuid, &rid, &raw_task, &interval));
     if (interval > 0) {
         goto done;              /* no conversion */
     }
 
     task = text2task(raw_task);
     switch (task) {
         case stop_rsc:
         case start_rsc:
         case action_notify:
         case action_promote:
         case action_demote:
             break;
         case stopped_rsc:
         case started_rsc:
         case action_notified:
         case action_promoted:
         case action_demoted:
             task--;
             break;
         case monitor_rsc:
         case shutdown_crm:
         case stonith_node:
             task = no_action;
             break;
         default:
             crm_err("Unknown action: %s", raw_task);
             task = no_action;
             break;
     }
 
     if (task != no_action) {
         if (is_set(rsc->flags, pe_rsc_notify) && allow_notify) {
             uuid = generate_notify_key(rid, "confirmed-post", task2text(task + 1));
 
         } else {
             uuid = generate_op_key(rid, task2text(task + 1), 0);
         }
         pe_rsc_trace(rsc, "Converted %s -> %s", old_uuid, uuid);
     }
 
   done:
     if (uuid == NULL) {
         uuid = strdup(old_uuid);
     }
 
     if (free_original) {
         free(old_uuid);
     }
 
     free(raw_task);
     free(rid);
     return uuid;
 }
 
 static action_t *
 rsc_expand_action(action_t * action)
 {
     action_t *result = action;
 
     if (action->rsc && action->rsc->variant >= pe_group) {
         /* Expand 'start' -> 'started' */
         char *uuid = NULL;
         gboolean notify = FALSE;
 
         if (action->rsc->parent == NULL) {
             /* Only outter-most resources have notification actions */
             notify = is_set(action->rsc->flags, pe_rsc_notify);
         }
 
         uuid = convert_non_atomic_uuid(action->uuid, action->rsc, notify, FALSE);
         if (uuid) {
             pe_rsc_trace(action->rsc, "Converting %s to %s %d", action->uuid, uuid,
                          is_set(action->rsc->flags, pe_rsc_notify));
             result = find_first_action(action->rsc->actions, uuid, NULL, NULL);
             if (result == NULL) {
                 crm_err("Couldn't expand %s", action->uuid);
                 result = action;
             }
             free(uuid);
         }
     }
     return result;
 }
 
 static enum pe_graph_flags
 graph_update_action(action_t * first, action_t * then, node_t * node, enum pe_action_flags flags,
                     enum pe_ordering type)
 {
     enum pe_graph_flags changed = pe_graph_none;
     gboolean processed = FALSE;
 
     /* TODO: Do as many of these in parallel as possible */
 
     if (type & pe_order_implies_then) {
         processed = TRUE;
         if (then->rsc) {
             changed |=
                 then->rsc->cmds->update_actions(first, then, node, flags & pe_action_optional,
                                                 pe_action_optional, pe_order_implies_then);
 
         } else if (is_set(flags, pe_action_optional) == FALSE) {
             if (update_action_flags(then, pe_action_optional | pe_action_clear)) {
                 changed |= pe_graph_updated_then;
             }
         }
         if (changed) {
             pe_rsc_trace(then->rsc, "implies right: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("implies right: %s then %s %p", first->uuid, then->uuid, then->rsc);
         }
     }
 
     if ((type & pe_order_restart) && then->rsc) {
         enum pe_action_flags restart = (pe_action_optional | pe_action_runnable);
 
         processed = TRUE;
         changed |=
             then->rsc->cmds->update_actions(first, then, node, flags, restart, pe_order_restart);
         if (changed) {
             pe_rsc_trace(then->rsc, "restart: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("restart: %s then %s", first->uuid, then->uuid);
         }
     }
 
     if (type & pe_order_implies_first) {
         processed = TRUE;
         if (first->rsc) {
             changed |=
                 first->rsc->cmds->update_actions(first, then, node, flags,
                                                  pe_action_optional, pe_order_implies_first);
 
         } else if (is_set(flags, pe_action_optional) == FALSE) {
             if (update_action_flags(first, pe_action_runnable | pe_action_clear)) {
                 changed |= pe_graph_updated_first;
             }
         }
 
         if (changed) {
             pe_rsc_trace(then->rsc, "implies left: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("implies left: %s then %s", first->uuid, then->uuid);
         }
     }
 
     if (type & pe_order_implies_first_master) {
         processed = TRUE;
         if (then->rsc) {
             changed |=
                 then->rsc->cmds->update_actions(first, then, node, flags & pe_action_optional,
                                                 pe_action_optional, pe_order_implies_first_master);
         }
 
         if (changed) {
             pe_rsc_trace(then->rsc,
                          "implies left when right rsc is Master role: %s then %s: changed",
                          first->uuid, then->uuid);
         } else {
             crm_trace("implies left when right rsc is Master role: %s then %s", first->uuid,
                       then->uuid);
         }
     }
 
     if (type & pe_order_one_or_more) {
         processed = TRUE;
         if (then->rsc) {
             changed |=
                 then->rsc->cmds->update_actions(first, then, node, flags,
                                                 pe_action_runnable, pe_order_one_or_more);
 
         } else if (is_set(flags, pe_action_runnable)) {
-            if (update_action_flags(then, pe_action_runnable)) {
-                changed |= pe_graph_updated_then;
+            /* alright. a "first" action is considered runnable, incremente
+             * the 'runnable_before' counter */
+            then->runnable_before++;
+
+            /* if the runnable before count for then exceeds the required number
+             * of "before" runnable actions... mark then as runnable */
+            if (then->runnable_before >= then->required_runnable_before) {
+                if (update_action_flags(then, pe_action_runnable)) {
+                    changed |= pe_graph_updated_then;
+                }
             }
         }
         if (changed) {
             pe_rsc_trace(then->rsc, "runnable_one_or_more: %s then %s: changed", first->uuid,
                          then->uuid);
         } else {
             crm_trace("runnable_one_or_more: %s then %s", first->uuid, then->uuid);
         }
     }
 
     if (type & pe_order_runnable_left) {
         processed = TRUE;
         if (then->rsc) {
             changed |=
                 then->rsc->cmds->update_actions(first, then, node, flags,
                                                 pe_action_runnable, pe_order_runnable_left);
 
         } else if (is_set(flags, pe_action_runnable) == FALSE) {
             if (update_action_flags(then, pe_action_runnable | pe_action_clear)) {
                 changed |= pe_graph_updated_then;
             }
         }
         if (changed) {
             pe_rsc_trace(then->rsc, "runnable: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("runnable: %s then %s", first->uuid, then->uuid);
         }
     }
 
     if (type & pe_order_implies_first_migratable) {
         processed = TRUE;
         if (then->rsc) {
             changed |=
                 then->rsc->cmds->update_actions(first, then, node, flags,
                                                 pe_action_optional, pe_order_implies_first_migratable);
         }
         if (changed) {
             pe_rsc_trace(then->rsc, "optional: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("optional: %s then %s", first->uuid, then->uuid);
         }
     }
 
     if (type & pe_order_pseudo_left) {
         processed = TRUE;
         if (then->rsc) {
             changed |=
                 then->rsc->cmds->update_actions(first, then, node, flags,
                                                 pe_action_optional, pe_order_pseudo_left);
         }
         if (changed) {
             pe_rsc_trace(then->rsc, "optional: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("optional: %s then %s", first->uuid, then->uuid);
         }
     }
 
     if (type & pe_order_optional) {
         processed = TRUE;
         if (then->rsc) {
             changed |=
                 then->rsc->cmds->update_actions(first, then, node, flags,
                                                 pe_action_runnable, pe_order_optional);
         }
         if (changed) {
             pe_rsc_trace(then->rsc, "optional: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("optional: %s then %s", first->uuid, then->uuid);
         }
     }
 
     if (type & pe_order_asymmetrical) {
         processed = TRUE;
         if (then->rsc) {
             changed |=
                 then->rsc->cmds->update_actions(first, then, node, flags,
                                                 pe_action_runnable, pe_order_asymmetrical);
         }
 
         if (changed) {
             pe_rsc_trace(then->rsc, "asymmetrical: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("asymmetrical: %s then %s", first->uuid, then->uuid);
         }
 
     }
 
     if ((first->flags & pe_action_runnable) && (type & pe_order_implies_then_printed)
         && (flags & pe_action_optional) == 0) {
         processed = TRUE;
         crm_trace("%s implies %s printed", first->uuid, then->uuid);
         update_action_flags(then, pe_action_print_always);      /* dont care about changed */
     }
 
     if ((type & pe_order_implies_first_printed) && (flags & pe_action_optional) == 0) {
         processed = TRUE;
         crm_trace("%s implies %s printed", then->uuid, first->uuid);
         update_action_flags(first, pe_action_print_always);     /* dont care about changed */
     }
 
     if ((type & pe_order_implies_then
          || type & pe_order_implies_first
          || type & pe_order_restart)
         && first->rsc
         && safe_str_eq(first->task, RSC_STOP)
         && is_not_set(first->rsc->flags, pe_rsc_managed)
         && is_set(first->rsc->flags, pe_rsc_block)
         && is_not_set(first->flags, pe_action_runnable)) {
 
         if (update_action_flags(then, pe_action_runnable | pe_action_clear)) {
             changed |= pe_graph_updated_then;
         }
 
         if (changed) {
             pe_rsc_trace(then->rsc, "unmanaged left: %s then %s: changed", first->uuid, then->uuid);
         } else {
             crm_trace("unmanaged left: %s then %s", first->uuid, then->uuid);
         }
     }
 
     if (processed == FALSE) {
         crm_trace("Constraint 0x%.6x not applicable", type);
     }
 
     return changed;
 }
 
 static void
 mark_start_blocked(resource_t *rsc)
 {
     GListPtr gIter = rsc->actions;
 
     for (; gIter != NULL; gIter = gIter->next) {
         action_t *action = (action_t *) gIter->data;
 
         if (safe_str_neq(action->task, RSC_START)) {
             continue;
         }
         if (is_set(action->flags, pe_action_runnable)) {
             clear_bit(action->flags, pe_action_runnable);
             update_colo_start_chain(action);
             update_action(action);
         }
     }
 }
 
 void
 update_colo_start_chain(action_t *action)
 {
     GListPtr gIter = NULL;
     resource_t *rsc = NULL;
 
     if (is_not_set(action->flags, pe_action_runnable) && safe_str_eq(action->task, RSC_START)) {
         rsc = uber_parent(action->rsc);
     }
 
     if (rsc == NULL || rsc->rsc_cons_lhs == NULL) {
         return;
     }
 
     /* if rsc has children, all the children need to have start set to
      * unrunnable before we follow the colo chain for the parent. */
     for (gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
         resource_t *child = (resource_t *)gIter->data;
         action_t *start = find_first_action(child->actions, NULL, RSC_START, NULL);
         if (start == NULL || is_set(start->flags, pe_action_runnable)) {
             return;
         }
     }
 
     for (gIter = rsc->rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
         rsc_colocation_t *colocate_with = (rsc_colocation_t *)gIter->data;
         if (colocate_with->score == INFINITY) {
             mark_start_blocked(colocate_with->rsc_lh);
         }
     }
 }
 
 gboolean
 update_action(action_t * then)
 {
     GListPtr lpc = NULL;
     enum pe_graph_flags changed = pe_graph_none;
     int last_flags = then->flags;
 
     crm_trace("Processing %s (%s %s %s)",
               then->uuid,
               is_set(then->flags, pe_action_optional) ? "optional" : "required",
               is_set(then->flags, pe_action_runnable) ? "runnable" : "unrunnable",
               is_set(then->flags,
                      pe_action_pseudo) ? "pseudo" : then->node ? then->node->details->uname : "");
 
     if (is_set(then->flags, pe_action_requires_any)) {
+        /* initialize current known runnable before actions to 0
+         * from here as graph_update_action is called for each of
+         * then's before actions, this number will increment as
+         * runnable 'first' actions are encountered */
+        then->runnable_before = 0;
+
+        /* for backwards compatibility with previous options that use
+         * the 'requires_any' flag, initalize required to 1 if it is
+         * not set. */ 
+        if (then->required_runnable_before == 0) {
+            then->required_runnable_before = 1;
+        }
         clear_bit(then->flags, pe_action_runnable);
         /* We are relying on the pe_order_one_or_more clause of
          * graph_update_action(), called as part of the:
          *
          *    'if (first == other->action)'
          *
          * block below, to set this back if appropriate
          */
     }
 
     for (lpc = then->actions_before; lpc != NULL; lpc = lpc->next) {
         action_wrapper_t *other = (action_wrapper_t *) lpc->data;
         action_t *first = other->action;
 
         node_t *then_node = then->node;
         node_t *first_node = first->node;
 
         enum pe_action_flags then_flags = 0;
         enum pe_action_flags first_flags = 0;
 
         if (first->rsc && first->rsc->variant == pe_group && safe_str_eq(first->task, RSC_START)) {
             first_node = first->rsc->fns->location(first->rsc, NULL, FALSE);
             if (first_node) {
                 crm_trace("First: Found node %s for %s", first_node->details->uname, first->uuid);
             }
         }
 
         if (then->rsc && then->rsc->variant == pe_group && safe_str_eq(then->task, RSC_START)) {
             then_node = then->rsc->fns->location(then->rsc, NULL, FALSE);
             if (then_node) {
                 crm_trace("Then: Found node %s for %s", then_node->details->uname, then->uuid);
             }
         }
 
         clear_bit(changed, pe_graph_updated_first);
 
         if (first->rsc != then->rsc
             && first->rsc != NULL && then->rsc != NULL && first->rsc != then->rsc->parent) {
             first = rsc_expand_action(first);
         }
         if (first != other->action) {
             crm_trace("Ordering %s afer %s instead of %s", then->uuid, first->uuid,
                       other->action->uuid);
         }
 
         first_flags = get_action_flags(first, then_node);
         then_flags = get_action_flags(then, first_node);
 
         crm_trace("Checking %s (%s %s %s) against %s (%s %s %s) filter=0x%.6x type=0x%.6x",
                   then->uuid,
                   is_set(then_flags, pe_action_optional) ? "optional" : "required",
                   is_set(then_flags, pe_action_runnable) ? "runnable" : "unrunnable",
                   is_set(then_flags,
                          pe_action_pseudo) ? "pseudo" : then->node ? then->node->details->
                   uname : "", first->uuid, is_set(first_flags,
                                                   pe_action_optional) ? "optional" : "required",
                   is_set(first_flags, pe_action_runnable) ? "runnable" : "unrunnable",
                   is_set(first_flags,
                          pe_action_pseudo) ? "pseudo" : first->node ? first->node->details->
                   uname : "", first_flags, other->type);
 
         if (first == other->action) {
             /*
              * 'first' was not expanded (ie. from 'start' to 'running'), which could mean it:
              * - has no associated resource,
              * - was a primitive,
              * - was pre-expanded (ie. 'running' instead of 'start')
              *
              * The third argument here to graph_update_action() is a node which is used under two conditions:
              * - Interleaving, in which case first->node and
              *   then->node are equal (and NULL)
              * - If 'then' is a clone, to limit the scope of the
              *   constraint to instances on the supplied node
              *
              */
             int otype = other->type;
             node_t *node = then->node;
 
             if(is_set(otype, pe_order_implies_then_on_node)) {
                 /* Normally we want the _whole_ 'then' clone to
                  * restart if 'first' is restarted, so then->node is
                  * needed.
                  *
                  * However for unfencing, we want to limit this to
                  * instances on the same node as 'first' (the
                  * unfencing operation), so first->node is supplied.
                  *
                  * Swap the node, from then on we can can treat it
                  * like any other 'pe_order_implies_then'
                  */
 
                 clear_bit(otype, pe_order_implies_then_on_node);
                 set_bit(otype, pe_order_implies_then);
                 node = first->node;
             }
             clear_bit(first_flags, pe_action_pseudo);
             changed |= graph_update_action(first, then, node, first_flags, otype);
 
             /* 'first' was for a complex resource (clone, group, etc),
              * create a new dependency if necessary
              */
         } else if (order_actions(first, then, other->type)) {
             /* This was the first time 'first' and 'then' were associated,
              * start again to get the new actions_before list
              */
             changed |= (pe_graph_updated_then | pe_graph_disable);
         }
 
         if (changed & pe_graph_disable) {
             crm_trace("Disabled constraint %s -> %s", other->action->uuid, then->uuid);
             clear_bit(changed, pe_graph_disable);
             other->type = pe_order_none;
         }
 
         if (changed & pe_graph_updated_first) {
             GListPtr lpc2 = NULL;
 
             crm_trace("Updated %s (first %s %s %s), processing dependants ",
                       first->uuid,
                       is_set(first->flags, pe_action_optional) ? "optional" : "required",
                       is_set(first->flags, pe_action_runnable) ? "runnable" : "unrunnable",
                       is_set(first->flags,
                              pe_action_pseudo) ? "pseudo" : first->node ? first->node->details->
                       uname : "");
             for (lpc2 = first->actions_after; lpc2 != NULL; lpc2 = lpc2->next) {
                 action_wrapper_t *other = (action_wrapper_t *) lpc2->data;
 
                 update_action(other->action);
             }
             update_action(first);
         }
     }
 
     if (is_set(then->flags, pe_action_requires_any)) {
         if (last_flags != then->flags) {
             changed |= pe_graph_updated_then;
         } else {
             clear_bit(changed, pe_graph_updated_then);
         }
     }
 
     if (changed & pe_graph_updated_then) {
         crm_trace("Updated %s (then %s %s %s), processing dependants ",
                   then->uuid,
                   is_set(then->flags, pe_action_optional) ? "optional" : "required",
                   is_set(then->flags, pe_action_runnable) ? "runnable" : "unrunnable",
                   is_set(then->flags,
                          pe_action_pseudo) ? "pseudo" : then->node ? then->node->details->
                   uname : "");
 
         if (is_set(last_flags, pe_action_runnable) && is_not_set(then->flags, pe_action_runnable)) {
             update_colo_start_chain(then);
         }
         update_action(then);
         for (lpc = then->actions_after; lpc != NULL; lpc = lpc->next) {
             action_wrapper_t *other = (action_wrapper_t *) lpc->data;
 
             update_action(other->action);
         }
     }
 
     return FALSE;
 }
 
 gboolean
 shutdown_constraints(node_t * node, action_t * shutdown_op, pe_working_set_t * data_set)
 {
     /* add the stop to the before lists so it counts as a pre-req
      * for the shutdown
      */
     GListPtr lpc = NULL;
 
     for (lpc = data_set->actions; lpc != NULL; lpc = lpc->next) {
         action_t *action = (action_t *) lpc->data;
 
         if (action->rsc == NULL || action->node == NULL) {
             continue;
         } else if (action->node->details != node->details) {
             continue;
         } else if (is_set(action->rsc->flags, pe_rsc_maintenance)) {
             pe_rsc_trace(action->rsc, "Skipping %s: maintenance mode", action->uuid);
             continue;
         } else if (node->details->maintenance) {
             pe_rsc_trace(action->rsc, "Skipping %s: node %s is in maintenance mode",
                          action->uuid, node->details->uname);
             continue;
         } else if (safe_str_neq(action->task, RSC_STOP)) {
             continue;
         } else if (is_not_set(action->rsc->flags, pe_rsc_managed)
                    && is_not_set(action->rsc->flags, pe_rsc_block)) {
             /*
              * If another action depends on this one, we may still end up blocking
              */
             pe_rsc_trace(action->rsc, "Skipping %s: unmanaged", action->uuid);
             continue;
         }
 
         pe_rsc_trace(action->rsc, "Ordering %s before shutdown on %s", action->uuid,
                      node->details->uname);
         pe_clear_action_bit(action, pe_action_optional);
         custom_action_order(action->rsc, NULL, action,
                             NULL, strdup(CRM_OP_SHUTDOWN), shutdown_op,
                             pe_order_optional | pe_order_runnable_left, data_set);
     }
 
     return TRUE;
 }
 
 gboolean
 stonith_constraints(node_t * node, action_t * stonith_op, pe_working_set_t * data_set)
 {
     CRM_CHECK(stonith_op != NULL, return FALSE);
 
     /*
      * Make sure the stonith OP occurs before we start any shared resources
      */
     if (stonith_op != NULL) {
         GListPtr lpc = NULL;
 
         for (lpc = data_set->resources; lpc != NULL; lpc = lpc->next) {
             resource_t *rsc = (resource_t *) lpc->data;
 
             rsc_stonith_ordering(rsc, stonith_op, data_set);
         }
     }
 
     /* add the stonith OP as a stop pre-req and the mark the stop
      * as a pseudo op - since its now redundant
      */
 
     return TRUE;
 }
 
 static node_t *
 get_router_node(action_t *action)
 {
     node_t *began_on = NULL;
     node_t *ended_on = NULL;
     node_t *router_node = NULL;
 
     if (safe_str_eq(action->task, CRM_OP_FENCE) || is_remote_node(action->node) == FALSE) {
         return NULL;
     }
 
     CRM_ASSERT(action->node->details->remote_rsc != NULL);
 
     if (action->node->details->remote_rsc->running_on) {
         began_on = action->node->details->remote_rsc->running_on->data;
     }
     ended_on = action->node->details->remote_rsc->allocated_to;
 
     /* if there is only one location to choose from,
      * this is easy. Check for those conditions first */
     if (!began_on || !ended_on) {
         /* remote rsc is either shutting down or starting up */
         return began_on ? began_on : ended_on;
     } else if (began_on->details == ended_on->details) {
         /* remote rsc didn't move nodes. */
         return began_on;
     }
 
     /* If we have get here, we know the remote resource
      * began on one node and is moving to another node.
      *
      * This means some actions will get routed through the cluster
      * node the connection rsc began on, and others are routed through
      * the cluster node the connection rsc ends up on.
      *
      * 1. stop, demote, migrate actions of resources living in the remote
      *    node _MUST_ occur _BEFORE_ the connection can move (these actions
      *    are all required before the remote rsc stop action can occur.) In
      *    this case, we know these actions have to be routed through the initial
      *    cluster node the connection resource lived on before the move takes place.
      *
      * 2. Everything else (start, promote, monitor, probe, refresh, clear failcount
      *    delete ....) must occur after the resource starts on the node it is
      *    moving to.
      */
 
     /* 1. before connection rsc moves. */
     if (safe_str_eq(action->task, "stop") ||
         safe_str_eq(action->task, "demote") ||
         safe_str_eq(action->task, "migrate_from") ||
         safe_str_eq(action->task, "migrate_to")) {
 
         router_node = began_on;
 
     /* 2. after connection rsc moves. */
     } else {
         router_node = ended_on;
     }
     return router_node;
 }
 
 static xmlNode *
 action2xml(action_t * action, gboolean as_input, pe_working_set_t *data_set)
 {
     gboolean needs_node_info = TRUE;
     xmlNode *action_xml = NULL;
     xmlNode *args_xml = NULL;
     char *action_id_s = NULL;
 
     if (action == NULL) {
         return NULL;
     }
 
     if (safe_str_eq(action->task, CRM_OP_FENCE)) {
         action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT);
 /* 		needs_node_info = FALSE; */
 
     } else if (safe_str_eq(action->task, CRM_OP_SHUTDOWN)) {
         action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT);
 
     } else if (safe_str_eq(action->task, CRM_OP_CLEAR_FAILCOUNT)) {
         action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT);
 
     } else if (safe_str_eq(action->task, CRM_OP_LRM_REFRESH)) {
         action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT);
 
 /* 	} else if(safe_str_eq(action->task, RSC_PROBED)) { */
 /* 		action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); */
 
     } else if (is_set(action->flags, pe_action_pseudo)) {
         action_xml = create_xml_node(NULL, XML_GRAPH_TAG_PSEUDO_EVENT);
         needs_node_info = FALSE;
 
     } else {
         action_xml = create_xml_node(NULL, XML_GRAPH_TAG_RSC_OP);
     }
 
     action_id_s = crm_itoa(action->id);
     crm_xml_add(action_xml, XML_ATTR_ID, action_id_s);
     free(action_id_s);
 
     crm_xml_add(action_xml, XML_LRM_ATTR_TASK, action->task);
     if (action->rsc != NULL && action->rsc->clone_name != NULL) {
         char *clone_key = NULL;
         const char *interval_s = g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL);
         int interval = crm_parse_int(interval_s, "0");
 
         if (safe_str_eq(action->task, RSC_NOTIFY)) {
             const char *n_type = g_hash_table_lookup(action->meta, "notify_type");
             const char *n_task = g_hash_table_lookup(action->meta, "notify_operation");
 
             CRM_CHECK(n_type != NULL, crm_err("No notify type value found for %s", action->uuid));
             CRM_CHECK(n_task != NULL,
                       crm_err("No notify operation value found for %s", action->uuid));
             clone_key = generate_notify_key(action->rsc->clone_name, n_type, n_task);
 
         } else if(action->cancel_task) {
             clone_key = generate_op_key(action->rsc->clone_name, action->cancel_task, interval);
         } else {
             clone_key = generate_op_key(action->rsc->clone_name, action->task, interval);
         }
 
         CRM_CHECK(clone_key != NULL, crm_err("Could not generate a key for %s", action->uuid));
         crm_xml_add(action_xml, XML_LRM_ATTR_TASK_KEY, clone_key);
         crm_xml_add(action_xml, "internal_" XML_LRM_ATTR_TASK_KEY, action->uuid);
         free(clone_key);
 
     } else {
         crm_xml_add(action_xml, XML_LRM_ATTR_TASK_KEY, action->uuid);
     }
 
     if (needs_node_info && action->node != NULL) {
         node_t *router_node = get_router_node(action);
 
         crm_xml_add(action_xml, XML_LRM_ATTR_TARGET, action->node->details->uname);
         crm_xml_add(action_xml, XML_LRM_ATTR_TARGET_UUID, action->node->details->id);
         if (router_node) {
             crm_xml_add(action_xml, XML_LRM_ATTR_ROUTER_NODE, router_node->details->uname);
         }
     }
 
     if (as_input) {
         return action_xml;
     }
 
     if (action->rsc) {
         if (is_set(action->flags, pe_action_pseudo) == FALSE) {
             int lpc = 0;
 
             xmlNode *rsc_xml = create_xml_node(action_xml, crm_element_name(action->rsc->xml));
 
             const char *attr_list[] = {
                 XML_AGENT_ATTR_CLASS,
                 XML_AGENT_ATTR_PROVIDER,
                 XML_ATTR_TYPE
             };
 
             if (is_set(action->rsc->flags, pe_rsc_orphan) && action->rsc->clone_name) {
                 /* Do not use the 'instance free' name here as that
                  * might interfere with the instance we plan to keep.
                  * Ie. if there are more than two named /anonymous/
                  * instances on a given node, we need to make sure the
                  * command goes to the right one.
                  *
                  * Keep this block, even when everyone is using
                  * 'instance free' anonymous clone names - it means
                  * we'll do the right thing if anyone toggles the
                  * unique flag to 'off'
                  */
                 crm_debug("Using orphan clone name %s instead of %s", action->rsc->id,
                           action->rsc->clone_name);
                 crm_xml_add(rsc_xml, XML_ATTR_ID, action->rsc->clone_name);
                 crm_xml_add(rsc_xml, XML_ATTR_ID_LONG, action->rsc->id);
 
             } else if (is_not_set(action->rsc->flags, pe_rsc_unique)) {
                 const char *xml_id = ID(action->rsc->xml);
 
                 crm_debug("Using anonymous clone name %s for %s (aka. %s)", xml_id, action->rsc->id,
                           action->rsc->clone_name);
 
                 /* ID is what we'd like client to use
                  * ID_LONG is what they might know it as instead
                  *
                  * ID_LONG is only strictly needed /here/ during the
                  * transition period until all nodes in the cluster
                  * are running the new software /and/ have rebooted
                  * once (meaning that they've only ever spoken to a DC
                  * supporting this feature).
                  *
                  * If anyone toggles the unique flag to 'on', the
                  * 'instance free' name will correspond to an orphan
                  * and fall into the claus above instead
                  */
                 crm_xml_add(rsc_xml, XML_ATTR_ID, xml_id);
                 if (action->rsc->clone_name && safe_str_neq(xml_id, action->rsc->clone_name)) {
                     crm_xml_add(rsc_xml, XML_ATTR_ID_LONG, action->rsc->clone_name);
                 } else {
                     crm_xml_add(rsc_xml, XML_ATTR_ID_LONG, action->rsc->id);
                 }
 
             } else {
                 CRM_ASSERT(action->rsc->clone_name == NULL);
                 crm_xml_add(rsc_xml, XML_ATTR_ID, action->rsc->id);
             }
 
             for (lpc = 0; lpc < DIMOF(attr_list); lpc++) {
                 crm_xml_add(rsc_xml, attr_list[lpc],
                             g_hash_table_lookup(action->rsc->meta, attr_list[lpc]));
             }
         }
     }
 
     args_xml = create_xml_node(NULL, XML_TAG_ATTRS);
     crm_xml_add(args_xml, XML_ATTR_CRM_VERSION, CRM_FEATURE_SET);
 
     g_hash_table_foreach(action->extra, hash2field, args_xml);
     if (action->rsc != NULL && action->node) {
         GHashTable *p = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
 
         get_rsc_attributes(p, action->rsc, action->node, data_set);
         g_hash_table_foreach(p, hash2smartfield, args_xml);
 
         g_hash_table_destroy(p);
     } else if(action->rsc && action->rsc->variant <= pe_native) {
         g_hash_table_foreach(action->rsc->parameters, hash2smartfield, args_xml);
     }
 
     g_hash_table_foreach(action->meta, hash2metafield, args_xml);
     if (action->rsc != NULL) {
         int isolated = 0;
         resource_t *parent = action->rsc;
 
         while (parent != NULL) {
             isolated |= parent->isolation_wrapper ? 1 : 0;
             parent->cmds->append_meta(parent, args_xml);
             parent = parent->parent;
         }
 
         if (isolated && action->node) {
             char *nodeattr = crm_meta_name(XML_RSC_ATTR_ISOLATION_HOST);
             crm_xml_add(args_xml, nodeattr, action->node->details->uname);
             free(nodeattr);
         }
 
     } else if (safe_str_eq(action->task, CRM_OP_FENCE) && action->node) {
         g_hash_table_foreach(action->node->details->attrs, hash2metafield, args_xml);
     }
 
     sorted_xml(args_xml, action_xml, FALSE);
     crm_log_xml_trace(action_xml, "dumped action");
     free_xml(args_xml);
 
     return action_xml;
 }
 
 static gboolean
 should_dump_action(action_t * action)
 {
     CRM_CHECK(action != NULL, return FALSE);
 
     if (is_set(action->flags, pe_action_dumped)) {
         crm_trace("action %d (%s) was already dumped", action->id, action->uuid);
         return FALSE;
 
     } else if (is_set(action->flags, pe_action_pseudo) && safe_str_eq(action->task, CRM_OP_PROBED)) {
         GListPtr lpc = NULL;
 
         /* This is a horrible but convenient hack
          *
          * It mimimizes the number of actions with unsatisfied inputs
          * (ie. not included in the graph)
          *
          * This in turn, means we can be more concise when printing
          * aborted/incomplete graphs.
          *
          * It also makes it obvious which node is preventing
          * probe_complete from running (presumably because it is only
          * partially up)
          *
          * For these reasons we tolerate such perversions
          */
 
         for (lpc = action->actions_after; lpc != NULL; lpc = lpc->next) {
             action_wrapper_t *wrapper = (action_wrapper_t *) lpc->data;
 
             if (is_not_set(wrapper->action->flags, pe_action_runnable)) {
                 /* Only interested in runnable operations */
             } else if (safe_str_neq(wrapper->action->task, RSC_START)) {
                 /* Only interested in start operations */
             } else if (is_set(wrapper->action->flags, pe_action_dumped)) {
                 crm_trace("action %d (%s) dependency of %s",
                           action->id, action->uuid, wrapper->action->uuid);
                 return TRUE;
 
             } else if (should_dump_action(wrapper->action)) {
                 crm_trace("action %d (%s) dependency of %s",
                           action->id, action->uuid, wrapper->action->uuid);
                 return TRUE;
             }
         }
     }
 
     if (is_set(action->flags, pe_action_runnable) == FALSE) {
         crm_trace("action %d (%s) was not runnable", action->id, action->uuid);
         return FALSE;
 
     } else if (is_set(action->flags, pe_action_optional)
                && is_set(action->flags, pe_action_print_always) == FALSE) {
         crm_trace("action %d (%s) was optional", action->id, action->uuid);
         return FALSE;
 
     } else if (action->rsc != NULL && is_not_set(action->rsc->flags, pe_rsc_managed)) {
         const char *interval = NULL;
 
         interval = g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL);
 
         /* make sure probes and recurring monitors go through */
         if (safe_str_neq(action->task, RSC_STATUS) && interval == NULL) {
             crm_trace("action %d (%s) was for an unmanaged resource (%s)",
                       action->id, action->uuid, action->rsc->id);
             return FALSE;
         }
     }
 
     if (is_set(action->flags, pe_action_pseudo)
         || safe_str_eq(action->task, CRM_OP_FENCE)
         || safe_str_eq(action->task, CRM_OP_SHUTDOWN)) {
         /* skip the next checks */
         return TRUE;
     }
 
     if (action->node == NULL) {
         pe_err("action %d (%s) was not allocated", action->id, action->uuid);
         log_action(LOG_DEBUG, "Unallocated action", action, FALSE);
         return FALSE;
 
     } else if (action->node->details->online == FALSE) {
         pe_err("action %d was (%s) scheduled for offline node", action->id, action->uuid);
         log_action(LOG_DEBUG, "Action for offline node", action, FALSE);
         return FALSE;
 #if 0
         /* but this would also affect resources that can be safely
          *  migrated before a fencing op
          */
     } else if (action->node->details->unclean == FALSE) {
         pe_err("action %d was (%s) scheduled for unclean node", action->id, action->uuid);
         log_action(LOG_DEBUG, "Action for unclean node", action, FALSE);
         return FALSE;
 #endif
     }
     return TRUE;
 }
 
 /* lowest to highest */
 static gint
 sort_action_id(gconstpointer a, gconstpointer b)
 {
     const action_wrapper_t *action_wrapper2 = (const action_wrapper_t *)a;
     const action_wrapper_t *action_wrapper1 = (const action_wrapper_t *)b;
 
     if (a == NULL) {
         return 1;
     }
     if (b == NULL) {
         return -1;
     }
 
     if (action_wrapper1->action->id > action_wrapper2->action->id) {
         return -1;
     }
 
     if (action_wrapper1->action->id < action_wrapper2->action->id) {
         return 1;
     }
     return 0;
 }
 
 static gboolean
 check_dump_input(int last_action, action_t * action, action_wrapper_t * wrapper)
 {
     int type = wrapper->type;
 
     if (wrapper->state == pe_link_dumped) {
         return TRUE;
 
     } else if (wrapper->state == pe_link_dup) {
         return FALSE;
     }
 
     type &= ~pe_order_implies_first_printed;
     type &= ~pe_order_implies_then_printed;
     type &= ~pe_order_optional;
 
     if (wrapper->action->node
         && action->rsc && action->rsc->fillers
         && is_not_set(type, pe_order_preserve)
         && wrapper->action->node->details->remote_rsc
         && uber_parent(action->rsc) != uber_parent(wrapper->action->rsc)
         ) {
         /* This prevents user-defined ordering constraints between
          * resources in remote nodes and the resources that
          * define/represent a remote node.
          *
          * There is no known valid reason to allow this sort of thing
          * but if one arises, we'd need to change the
          * action->rsc->fillers clause to be more specific, possibly
          * to check that it contained wrapper->action->rsc
          */
         crm_warn("Invalid ordering constraint between %s and %s",
                  wrapper->action->rsc->id, action->rsc->id);
         wrapper->type = pe_order_none;
         return FALSE;
     }
 
     if (last_action == wrapper->action->id) {
         crm_trace("Input (%d) %s duplicated for %s",
                   wrapper->action->id, wrapper->action->uuid, action->uuid);
         wrapper->state = pe_link_dup;
         return FALSE;
 
     } else if (wrapper->type == pe_order_none) {
         crm_trace("Input (%d) %s suppressed for %s",
                   wrapper->action->id, wrapper->action->uuid, action->uuid);
         return FALSE;
 
     } else if (is_set(wrapper->action->flags, pe_action_runnable) == FALSE
                && type == pe_order_none && safe_str_neq(wrapper->action->uuid, CRM_OP_PROBED)) {
         crm_trace("Input (%d) %s optional (ordering) for %s",
                   wrapper->action->id, wrapper->action->uuid, action->uuid);
         return FALSE;
 
     } else if (is_set(wrapper->action->flags, pe_action_runnable) == FALSE
                && is_set(type, pe_order_one_or_more)) {
         crm_trace("Input (%d) %s optional (one-or-more) for %s",
                   wrapper->action->id, wrapper->action->uuid, action->uuid);
         return FALSE;
 
     } else if (is_set(action->flags, pe_action_pseudo)
                && (wrapper->type & pe_order_stonith_stop)) {
         crm_trace("Input (%d) %s suppressed for %s",
                   wrapper->action->id, wrapper->action->uuid, action->uuid);
         return FALSE;
 
     } else if ((wrapper->type & pe_order_implies_first_migratable) && (is_set(wrapper->action->flags, pe_action_runnable) == FALSE)) {
         return FALSE;
 
     } else if ((wrapper->type & pe_order_apply_first_non_migratable)
                 && (is_set(wrapper->action->flags, pe_action_migrate_runnable))) {
         return FALSE;
 
     } else if ((wrapper->type == pe_order_optional)
                && strstr(wrapper->action->uuid, "_stop_0")
                && is_set(wrapper->action->flags, pe_action_migrate_runnable)) {
 
         /* for optional only ordering, ordering is not preserved for
          * a stop action that is actually involved with a migration. */
         return FALSE;
 
     } else if (wrapper->type == pe_order_load) {
         crm_trace("check load filter %s.%s -> %s.%s",
                   wrapper->action->uuid,
                   wrapper->action->node ? wrapper->action->node->details->uname : "", action->uuid,
                   action->node ? action->node->details->uname : "");
 
         if (action->rsc && safe_str_eq(action->task, RSC_MIGRATE)) {
             /* Remove the orders like the following if not relevant:
              *     "load_stopped_node2" -> "rscA_migrate_to node1"
              * which were created also from: pengine/native.c: MigrateRsc()
              *     order_actions(other, then, other_w->type);
              */
 
             /* For migrate_to ops, we care about where it has been
              * allocated to, not where the action will be executed
              */
             if (wrapper->action->node == NULL || action->rsc->allocated_to == NULL
                 || wrapper->action->node->details != action->rsc->allocated_to->details) {
                 /* Check if the actions are for the same node, ignore otherwise */
                 crm_trace("load filter - migrate");
                 wrapper->type = pe_order_none;
                 return FALSE;
             }
 
         } else if (wrapper->action->node == NULL || action->node == NULL
                    || wrapper->action->node->details != action->node->details) {
             /* Check if the actions are for the same node, ignore otherwise */
             crm_trace("load filter - node");
             wrapper->type = pe_order_none;
             return FALSE;
 
         } else if (is_set(wrapper->action->flags, pe_action_optional)) {
             /* Check if the pre-req is optional, ignore if so */
             crm_trace("load filter - optional");
             wrapper->type = pe_order_none;
             return FALSE;
         }
 
     } else if (wrapper->type == pe_order_anti_colocation) {
         crm_trace("check anti-colocation filter %s.%s -> %s.%s",
                   wrapper->action->uuid,
                   wrapper->action->node ? wrapper->action->node->details->uname : "",
                   action->uuid,
                   action->node ? action->node->details->uname : "");
 
         if (wrapper->action->node && action->node
             && wrapper->action->node->details != action->node->details) {
             /* Check if the actions are for the same node, ignore otherwise */
             crm_trace("anti-colocation filter - node");
             wrapper->type = pe_order_none;
             return FALSE;
 
         } else if (is_set(wrapper->action->flags, pe_action_optional)) {
             /* Check if the pre-req is optional, ignore if so */
             crm_trace("anti-colocation filter - optional");
             wrapper->type = pe_order_none;
             return FALSE;
         }
 
     } else if (wrapper->action->rsc
                && wrapper->action->rsc != action->rsc
                && is_set(wrapper->action->rsc->flags, pe_rsc_failed)
                && is_not_set(wrapper->action->rsc->flags, pe_rsc_managed)
                && strstr(wrapper->action->uuid, "_stop_0")
                && action->rsc && action->rsc->variant >= pe_clone) {
         crm_warn("Ignoring requirement that %s complete before %s:"
                  " unmanaged failed resources cannot prevent clone shutdown",
                  wrapper->action->uuid, action->uuid);
         return FALSE;
 
     } else if (is_set(wrapper->action->flags, pe_action_dumped)
                || should_dump_action(wrapper->action)) {
         crm_trace("Input (%d) %s should be dumped for %s", wrapper->action->id,
                   wrapper->action->uuid, action->uuid);
         goto dump;
 
 #if 0
     } else if (is_set(wrapper->action->flags, pe_action_runnable)
                && is_set(wrapper->action->flags, pe_action_pseudo)
                && wrapper->action->rsc->variant != pe_native) {
         crm_crit("Input (%d) %s should be dumped for %s",
                  wrapper->action->id, wrapper->action->uuid, action->uuid);
         goto dump;
 #endif
     } else if (is_set(wrapper->action->flags, pe_action_optional) == TRUE
                && is_set(wrapper->action->flags, pe_action_print_always) == FALSE) {
         crm_trace("Input (%d) %s optional for %s", wrapper->action->id,
                   wrapper->action->uuid, action->uuid);
         crm_trace("Input (%d) %s n=%p p=%d r=%d o=%d a=%d f=0x%.6x",
                   wrapper->action->id, wrapper->action->uuid, wrapper->action->node,
                   is_set(wrapper->action->flags, pe_action_pseudo),
                   is_set(wrapper->action->flags, pe_action_runnable),
                   is_set(wrapper->action->flags, pe_action_optional),
                   is_set(wrapper->action->flags, pe_action_print_always), wrapper->type);
         return FALSE;
 
     }
 
   dump:
     return TRUE;
 }
 
 static gboolean
 graph_has_loop(action_t * init_action, action_t * action, action_wrapper_t * wrapper)
 {
     GListPtr lpc = NULL;
     gboolean has_loop = FALSE;
 
     if (is_set(wrapper->action->flags, pe_action_tracking)) {
         crm_trace("Breaking tracking loop: %s.%s -> %s.%s (0x%.6x)",
                   wrapper->action->uuid,
                   wrapper->action->node ? wrapper->action->node->details->uname : "",
                   action->uuid,
                   action->node ? action->node->details->uname : "",
                   wrapper->type);
         return FALSE;
     }
 
     if (check_dump_input(-1, action, wrapper) == FALSE) {
         return FALSE;
     }
 
     /* If there's any order like:
      * "rscB_stop node2"-> "load_stopped_node2" -> "rscA_migrate_to node1"
      * rscA is being migrated from node1 to node2,
      * while rscB is being migrated from node2 to node1.
      * There will be potential graph loop.
      * Break the order "load_stopped_node2" -> "rscA_migrate_to node1".
      */
 
     crm_trace("Checking graph loop: %s.%s -> %s.%s (0x%.6x)",
               wrapper->action->uuid,
               wrapper->action->node ? wrapper->action->node->details->uname : "",
               action->uuid,
               action->node ? action->node->details->uname : "",
               wrapper->type);
 
     if (wrapper->action == init_action) {
         crm_debug("Found graph loop: %s.%s ->...-> %s.%s",
                   action->uuid,
                   action->node ? action->node->details->uname : "",
                   init_action->uuid,
                   init_action->node ? init_action->node->details->uname : "");
 
         return TRUE;
     }
 
     set_bit(wrapper->action->flags, pe_action_tracking);
 
     for (lpc = wrapper->action->actions_before; lpc != NULL; lpc = lpc->next) {
         action_wrapper_t *wrapper_before = (action_wrapper_t *) lpc->data;
 
         if (graph_has_loop(init_action, wrapper->action, wrapper_before)) {
             has_loop = TRUE;
             goto done;
         }
     }
 
 done:
     clear_bit(wrapper->action->flags, pe_action_tracking);
 
     return has_loop;
 }
 
 static gboolean
 should_dump_input(int last_action, action_t * action, action_wrapper_t * wrapper)
 {
     wrapper->state = pe_link_not_dumped;
 
     if (check_dump_input(last_action, action, wrapper) == FALSE) {
         return FALSE;
     }
 
     if (wrapper->type == pe_order_load
         && action->rsc
         && safe_str_eq(action->task, RSC_MIGRATE)) {
         crm_trace("Checking graph loop - load migrate: %s.%s -> %s.%s",
                   wrapper->action->uuid,
                   wrapper->action->node ? wrapper->action->node->details->uname : "",
                   action->uuid,
                   action->node ? action->node->details->uname : "");
 
         if (graph_has_loop(action, action, wrapper)) {
             /* Remove the orders like the following if they are introducing any graph loops:
              *     "load_stopped_node2" -> "rscA_migrate_to node1"
              * which were created also from: pengine/native.c: MigrateRsc()
              *     order_actions(other, then, other_w->type);
              */
             crm_debug("Breaking graph loop - load migrate: %s.%s -> %s.%s",
                       wrapper->action->uuid,
                       wrapper->action->node ? wrapper->action->node->details->uname : "",
                       action->uuid,
                       action->node ? action->node->details->uname : "");
 
             wrapper->type = pe_order_none;
             return FALSE;
         }
     }
 
     crm_trace("Input (%d) %s n=%p p=%d r=%d o=%d a=%d f=0x%.6x dumped for %s",
               wrapper->action->id,
               wrapper->action->uuid,
               wrapper->action->node,
               is_set(wrapper->action->flags, pe_action_pseudo),
               is_set(wrapper->action->flags, pe_action_runnable),
               is_set(wrapper->action->flags, pe_action_optional),
               is_set(wrapper->action->flags, pe_action_print_always), wrapper->type, action->uuid);
     return TRUE;
 }
 
 void
 graph_element_from_action(action_t * action, pe_working_set_t * data_set)
 {
     GListPtr lpc = NULL;
     int last_action = -1;
     int synapse_priority = 0;
     xmlNode *syn = NULL;
     xmlNode *set = NULL;
     xmlNode *in = NULL;
     xmlNode *input = NULL;
     xmlNode *xml_action = NULL;
 
     if (should_dump_action(action) == FALSE) {
         return;
     }
 
     set_bit(action->flags, pe_action_dumped);
 
     syn = create_xml_node(data_set->graph, "synapse");
     set = create_xml_node(syn, "action_set");
     in = create_xml_node(syn, "inputs");
 
     crm_xml_add_int(syn, XML_ATTR_ID, data_set->num_synapse);
     data_set->num_synapse++;
 
     if (action->rsc != NULL) {
         synapse_priority = action->rsc->priority;
     }
     if (action->priority > synapse_priority) {
         synapse_priority = action->priority;
     }
     if (synapse_priority > 0) {
         crm_xml_add_int(syn, XML_CIB_ATTR_PRIORITY, synapse_priority);
     }
 
     xml_action = action2xml(action, FALSE, data_set);
     add_node_nocopy(set, crm_element_name(xml_action), xml_action);
 
     action->actions_before = g_list_sort(action->actions_before, sort_action_id);
 
     for (lpc = action->actions_before; lpc != NULL; lpc = lpc->next) {
         action_wrapper_t *wrapper = (action_wrapper_t *) lpc->data;
 
         if (should_dump_input(last_action, action, wrapper) == FALSE) {
             continue;
         }
 
         wrapper->state = pe_link_dumped;
         CRM_CHECK(last_action < wrapper->action->id,;
             );
         last_action = wrapper->action->id;
         input = create_xml_node(in, "trigger");
 
         xml_action = action2xml(wrapper->action, TRUE, data_set);
         add_node_nocopy(input, crm_element_name(xml_action), xml_action);
     }
 }
diff --git a/pengine/regression.sh b/pengine/regression.sh
index d184798a02..7f73f92e2d 100755
--- a/pengine/regression.sh
+++ b/pengine/regression.sh
@@ -1,819 +1,833 @@
 #!/bin/bash
 
  # Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
  #
  # This program is free software; you can redistribute it and/or
  # modify it under the terms of the GNU General Public
  # License as published by the Free Software Foundation; either
  # version 2 of the License, or (at your option) any later version.
  #
  # This software is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  # General Public License for more details.
  #
  # You should have received a copy of the GNU General Public
  # License along with this library; if not, write to the Free Software
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  #
 
 core=`dirname $0`
 . $core/regression.core.sh || exit 1
 
 create_mode="true"
 info Generating test outputs for these tests...
 # do_test file description
 
 info Done.
 echo ""
 
 info Performing the following tests from $io_dir
 create_mode="false"
 
 echo ""
+do_test cloned_start_one  "order first clone then clone... first clone_min=2"
+do_test cloned_start_two  "order first clone then clone... first clone_min=2"
+do_test cloned_stop_one   "order first clone then clone... first clone_min=2"
+do_test cloned_stop_two   "order first clone then clone... first clone_min=2"
+do_test clone_min_interleave_start_one "order first clone then clone... first clone_min=2 and then has interleave=true"
+do_test clone_min_interleave_start_two "order first clone then clone... first clone_min=2 and then has interleave=true"
+do_test clone_min_interleave_stop_one  "order first clone then clone... first clone_min=2 and then has interleave=true"
+do_test clone_min_interleave_stop_two  "order first clone then clone... first clone_min=2 and then has interleave=true"
+do_test clone_min_start_one "order first clone then primitive... first clone_min=2"
+do_test clone_min_start_two "order first clone then primitive... first clone_min=2"
+do_test clone_min_stop_all  "order first clone then primitive... first clone_min=2"
+do_test clone_min_stop_one  "order first clone then primitive... first clone_min=2"
+do_test clone_min_stop_two  "order first clone then primitive... first clone_min=2"
+
 do_test simple1 "Offline     "
 do_test simple2 "Start       "
 do_test simple3 "Start 2     "
 do_test simple4 "Start Failed"
 do_test simple6 "Stop Start  "
 do_test simple7 "Shutdown    "
 #do_test simple8 "Stonith	"
 #do_test simple9 "Lower version"
 #do_test simple10 "Higher version"
 do_test simple11 "Priority (ne)"
 do_test simple12 "Priority (eq)"
 do_test simple8 "Stickiness"
 
 echo ""
 do_test group1 "Group		"
 do_test group2 "Group + Native	"
 do_test group3 "Group + Group	"
 do_test group4 "Group + Native (nothing)"
 do_test group5 "Group + Native (move)   "
 do_test group6 "Group + Group (move)    "
 do_test group7 "Group colocation"
 do_test group13 "Group colocation (cant run)"
 do_test group8 "Group anti-colocation"
 do_test group9 "Group recovery"
 do_test group10 "Group partial recovery"
 do_test group11 "Group target_role"
 do_test group14 "Group stop (graph terminated)"
 do_test group15 "-ve group colocation"
 do_test bug-1573 "Partial stop of a group with two children"
 do_test bug-1718 "Mandatory group ordering - Stop group_FUN"
 do_test bug-lf-2613 "Move group on failure"
 do_test bug-lf-2619 "Move group on clone failure"
 do_test group-fail "Ensure stop order is preserved for partially active groups"
 do_test group-unmanaged "No need to restart r115 because r114 is unmanaged"
 do_test group-unmanaged-stopped "Make sure r115 is stopped when r114 fails"
 do_test group-dependants "Account for the location preferences of things colocated with a group"
 
 echo ""
 do_test rsc_dep1 "Must not     "
 do_test rsc_dep3 "Must         "
 do_test rsc_dep5 "Must not 3   "
 do_test rsc_dep7 "Must 3       "
 do_test rsc_dep10 "Must (but cant)"
 do_test rsc_dep2  "Must (running) "
 do_test rsc_dep8  "Must (running : alt) "
 do_test rsc_dep4  "Must (running + move)"
 do_test asymmetric "Asymmetric - require explicit location constraints"
 
 echo ""
 do_test orphan-0 "Orphan ignore"
 do_test orphan-1 "Orphan stop"
 do_test orphan-2 "Orphan stop, remove failcount"
 
 echo ""
 do_test params-0 "Params: No change"
 do_test params-1 "Params: Changed"
 do_test params-2 "Params: Resource definition"
 do_test params-4 "Params: Reload"
 do_test params-5 "Params: Restart based on probe digest"
 do_test novell-251689 "Resource definition change + target_role=stopped"
 do_test bug-lf-2106 "Restart all anonymous clone instances after config change"
 do_test params-6 "Params: Detect reload in previously migrated resource"
 do_test nvpair-id-ref "Support id-ref in nvpair with optional name"
 do_test not-reschedule-unneeded-monitor "Do not reschedule unneeded monitors while resource definitions have changed"
 
 echo ""
 do_test target-0 "Target Role : baseline"
 do_test target-1 "Target Role : master"
 do_test target-2 "Target Role : invalid"
 
 echo ""
 do_test base-score "Set a node's default score for all nodes"
 
 echo ""
 do_test date-1 "Dates" -t "2005-020"
 do_test date-2 "Date Spec - Pass" -t "2005-020T12:30"
 do_test date-3 "Date Spec - Fail" -t "2005-020T11:30"
 do_test origin "Timing of recurring operations" -t "2014-05-07 00:28:00" 
 do_test probe-0 "Probe (anon clone)"
 do_test probe-1 "Pending Probe"
 do_test probe-2 "Correctly re-probe cloned groups"
 do_test probe-3 "Probe (pending node)"
 do_test probe-4 "Probe (pending node + stopped resource)" --rc 4
 do_test standby "Standby"
 do_test comments "Comments"
 
 echo ""
 do_test one-or-more-0 "Everything starts"
 do_test one-or-more-1 "Nothing starts because of A"
 do_test one-or-more-2 "D can start because of C"
 do_test one-or-more-3 "D cannot start because of B and C"
 do_test one-or-more-4 "D cannot start because of target-role"
 do_test one-or-more-5 "Start A and F even though C and D are stopped"
 do_test one-or-more-6 "Leave A running even though B is stopped"
 do_test one-or-more-7 "Leave A running even though C is stopped"
 do_test bug-5140-require-all-false "Allow basegrp:0 to stop"
 do_test clone-require-all-1 "clone B starts node 3 and 4"
 do_test clone-require-all-2 "clone B remains stopped everywhere"
 do_test clone-require-all-3 "clone B stops everywhere because A stops everywhere"
 do_test clone-require-all-4 "clone B remains on node 3 and 4 with only one instance of A remaining."
 do_test clone-require-all-5 "clone B starts on node 1 3 and 4"
 do_test clone-require-all-6 "clone B remains active after shutting down instances of A"
 do_test clone-require-all-7 "clone A and B both start at the same time. all instances of A start before B."
 do_test clone-require-all-no-interleave-1 "C starts everywhere after A and B"
 do_test clone-require-all-no-interleave-2 "C starts on nodes 1, 2, and 4 with only one active instance of B"
 do_test clone-require-all-no-interleave-3 "C remains active when instance of B is stopped on one node and started on another."
 do_test one-or-more-unrunnnable-instances "Avoid dependancies on instances that wont ever be started"
 
 echo ""
 do_test order1 "Order start 1     "
 do_test order2 "Order start 2     "
 do_test order3 "Order stop	  "
 do_test order4 "Order (multiple)  "
 do_test order5 "Order (move)  "
 do_test order6 "Order (move w/ restart)  "
 do_test order7 "Order (manditory)  "
 do_test order-optional "Order (score=0)  "
 do_test order-required "Order (score=INFINITY)  "
 do_test bug-lf-2171 "Prevent group start when clone is stopped"
 do_test order-clone "Clone ordering should be able to prevent startup of dependant clones"
 do_test order-sets "Ordering for resource sets"
 do_test order-serialize "Serialize resources without inhibiting migration"
 do_test order-serialize-set "Serialize a set of resources without inhibiting migration"
 do_test clone-order-primitive "Order clone start after a primitive"
 do_test clone-order-16instances "Verify ordering of 16 cloned resources"
 do_test order-optional-keyword "Order (optional keyword)"
 do_test order-mandatory "Order (mandatory keyword)"
 do_test bug-lf-2493 "Don't imply colocation requirements when applying ordering constraints with clones"
 do_test ordered-set-basic-startup "Constraint set with default order settings."
 do_test ordered-set-natural "Allow natural set ordering"
 do_test order-wrong-kind "Order (error)"
 
 echo ""
 do_test coloc-loop "Colocation - loop"
 do_test coloc-many-one "Colocation - many-to-one"
 do_test coloc-list "Colocation - many-to-one with list"
 do_test coloc-group "Colocation - groups"
 do_test coloc-slave-anti "Anti-colocation with slave shouldn't prevent master colocation"
 do_test coloc-attr "Colocation based on node attributes"
 do_test coloc-negative-group "Negative colocation with a group"
 do_test coloc-intra-set "Intra-set colocation"
 do_test bug-lf-2435 "Colocation sets with a negative score"
 do_test coloc-clone-stays-active "Ensure clones don't get stopped/demoted because a dependant must stop"
 do_test coloc_fp_logic "Verify floating point calculations in colocation are working"
 do_test colo_master_w_native "cl#5070 - Verify promotion order is affected when colocating master to native rsc."
 do_test colo_slave_w_native  "cl#5070 - Verify promotion order is affected when colocating slave to native rsc."
 do_test anti-colocation-order "cl#5187 - Prevent resources in an anti-colocation from even temporarily running on a same node"
 do_test enforce-colo1 "Always enforce B with A INFINITY."
 do_test complex_enforce_colo "Always enforce B with A INFINITY. (make sure heat-engine stops)"
 
 echo ""
 do_test rsc-sets-seq-true "Resource Sets - sequential=false"
 do_test rsc-sets-seq-false "Resource Sets - sequential=true"
 do_test rsc-sets-clone "Resource Sets - Clone"
 do_test rsc-sets-master "Resource Sets - Master"
 do_test rsc-sets-clone-1 "Resource Sets - Clone (lf#2404)"
 
 #echo ""
 #do_test agent1 "version: lt (empty)"
 #do_test agent2 "version: eq	"
 #do_test agent3 "version: gt	"
 
 echo ""
 do_test attrs1 "string: eq (and)     "
 do_test attrs2 "string: lt / gt (and)"
 do_test attrs3 "string: ne (or)      "
 do_test attrs4 "string: exists       "
 do_test attrs5 "string: not_exists   "
 do_test attrs6 "is_dc: true          "
 do_test attrs7 "is_dc: false         "
 do_test attrs8 "score_attribute      "
 do_test per-node-attrs "Per node resource parameters"
 
 echo ""
 do_test mon-rsc-1 "Schedule Monitor - start"
 do_test mon-rsc-2 "Schedule Monitor - move "
 do_test mon-rsc-3 "Schedule Monitor - pending start     "
 do_test mon-rsc-4 "Schedule Monitor - move/pending start"
 
 echo ""
 do_test rec-rsc-0 "Resource Recover - no start     "
 do_test rec-rsc-1 "Resource Recover - start        "
 do_test rec-rsc-2 "Resource Recover - monitor      "
 do_test rec-rsc-3 "Resource Recover - stop - ignore"
 do_test rec-rsc-4 "Resource Recover - stop - block "
 do_test rec-rsc-5 "Resource Recover - stop - fence "
 do_test rec-rsc-6 "Resource Recover - multiple - restart"
 do_test rec-rsc-7 "Resource Recover - multiple - stop   "
 do_test rec-rsc-8 "Resource Recover - multiple - block  "
 do_test rec-rsc-9 "Resource Recover - group/group"
 do_test monitor-recovery "on-fail=block + resource recovery detected by recurring monitor"
 do_test stop-failure-no-quorum "Stop failure without quorum"
 do_test stop-failure-no-fencing "Stop failure without fencing available"
 do_test stop-failure-with-fencing "Stop failure with fencing available"
 
 echo ""
 do_test quorum-1 "No quorum - ignore"
 do_test quorum-2 "No quorum - freeze"
 do_test quorum-3 "No quorum - stop  "
 do_test quorum-4 "No quorum - start anyway"
 do_test quorum-5 "No quorum - start anyway (group)"
 do_test quorum-6 "No quorum - start anyway (clone)"
 do_test bug-cl-5212 "No promotion with no-quorum-policy=freeze"
 
 echo ""
 do_test rec-node-1 "Node Recover - Startup   - no fence"
 do_test rec-node-2 "Node Recover - Startup   - fence   "
 do_test rec-node-3 "Node Recover - HA down   - no fence"
 do_test rec-node-4 "Node Recover - HA down   - fence   "
 do_test rec-node-5 "Node Recover - CRM down  - no fence"
 do_test rec-node-6 "Node Recover - CRM down  - fence   "
 do_test rec-node-7 "Node Recover - no quorum - ignore  "
 do_test rec-node-8 "Node Recover - no quorum - freeze  "
 do_test rec-node-9 "Node Recover - no quorum - stop    "
 do_test rec-node-10 "Node Recover - no quorum - stop w/fence"
 do_test rec-node-11 "Node Recover - CRM down w/ group - fence   "
 do_test rec-node-12 "Node Recover - nothing active - fence   "
 do_test rec-node-13 "Node Recover - failed resource + shutdown - fence   "
 do_test rec-node-15 "Node Recover - unknown lrm section"
 do_test rec-node-14 "Serialize all stonith's"
 
 echo ""
 do_test multi1 "Multiple Active (stop/start)"
 
 echo ""
 do_test migrate-begin     "Normal migration"
 do_test migrate-success   "Completed migration"
 do_test migrate-partial-1 "Completed migration, missing stop on source"
 do_test migrate-partial-2 "Successful migrate_to only"
 do_test migrate-partial-3 "Successful migrate_to only, target down"
 do_test migrate-partial-4 "Migrate from the correct host after migrate_to+migrate_from"
 do_test bug-5186-partial-migrate "Handle partial migration when src node loses membership"
 
 do_test migrate-fail-2 "Failed migrate_from"
 do_test migrate-fail-3 "Failed migrate_from + stop on source"
 do_test migrate-fail-4 "Failed migrate_from + stop on target - ideally we wouldn't need to re-stop on target"
 do_test migrate-fail-5 "Failed migrate_from + stop on source and target"
 
 do_test migrate-fail-6 "Failed migrate_to"
 do_test migrate-fail-7 "Failed migrate_to + stop on source"
 do_test migrate-fail-8 "Failed migrate_to + stop on target - ideally we wouldn't need to re-stop on target"
 do_test migrate-fail-9 "Failed migrate_to + stop on source and target"
 
 do_test migrate-stop "Migration in a stopping stack"
 do_test migrate-start "Migration in a starting stack"
 do_test migrate-stop_start "Migration in a restarting stack"
 do_test migrate-stop-complex "Migration in a complex stopping stack"
 do_test migrate-start-complex "Migration in a complex starting stack"
 do_test migrate-stop-start-complex "Migration in a complex moving stack"
 do_test migrate-shutdown "Order the post-migration 'stop' before node shutdown"
 
 do_test migrate-1 "Migrate (migrate)"
 do_test migrate-2 "Migrate (stable)"
 do_test migrate-3 "Migrate (failed migrate_to)"
 do_test migrate-4 "Migrate (failed migrate_from)"
 do_test novell-252693 "Migration in a stopping stack"
 do_test novell-252693-2 "Migration in a starting stack"
 do_test novell-252693-3 "Non-Migration in a starting and stopping stack"
 do_test bug-1820 "Migration in a group"
 do_test bug-1820-1 "Non-migration in a group"
 do_test migrate-5 "Primitive migration with a clone"
 do_test migrate-fencing "Migration after Fencing"
 do_test migrate-both-vms "Migrate two VMs that have no colocation"
 
 do_test 1-a-then-bm-move-b "Advanced migrate logic. A then B. migrate B."
 do_test 2-am-then-b-move-a "Advanced migrate logic, A then B, migrate A without stopping B"
 do_test 3-am-then-bm-both-migrate "Advanced migrate logic. A then B. migrate both"
 do_test 4-am-then-bm-b-not-migratable "Advanced migrate logic, A then B, B not migratable"
 do_test 5-am-then-bm-a-not-migratable "Advanced migrate logic. A then B. move both, a not migratable"
 do_test 6-migrate-group "Advanced migrate logic, migrate a group"
 do_test 7-migrate-group-one-unmigratable "Advanced migrate logic, migrate group mixed with allow-migrate true/false"
 do_test 8-am-then-bm-a-migrating-b-stopping "Advanced migrate logic, A then B, A migrating, B stopping"
 do_test 9-am-then-bm-b-migrating-a-stopping "Advanced migrate logic, A then B, B migrate, A stopping"
 do_test 10-a-then-bm-b-move-a-clone "Advanced migrate logic, A clone then B, migrate B while stopping A"
 do_test 11-a-then-bm-b-move-a-clone-starting "Advanced migrate logic, A clone then B, B moving while A is start/stopping"
 
 do_test a-promote-then-b-migrate "A promote then B start. migrate B"
 do_test a-demote-then-b-migrate "A demote then B stop. migrate B"
 
 #echo ""
 #do_test complex1 "Complex	"
 
 do_test bug-lf-2422 "Dependancy on partially active group - stop ocfs:*"
 
 echo ""
 do_test clone-anon-probe-1 "Probe the correct (anonymous) clone instance for each node"
 do_test clone-anon-probe-2 "Avoid needless re-probing of anonymous clones"
 do_test clone-anon-failcount "Merge failcounts for anonymous clones"
 do_test inc0 "Incarnation start"
 do_test inc1 "Incarnation start order"
 do_test inc2 "Incarnation silent restart, stop, move"
 do_test inc3 "Inter-incarnation ordering, silent restart, stop, move"
 do_test inc4 "Inter-incarnation ordering, silent restart, stop, move (ordered)"
 do_test inc5 "Inter-incarnation ordering, silent restart, stop, move (restart 1)"
 do_test inc6 "Inter-incarnation ordering, silent restart, stop, move (restart 2)"
 do_test inc7 "Clone colocation"
 do_test inc8 "Clone anti-colocation"
 do_test inc9 "Non-unique clone"
 do_test inc10 "Non-unique clone (stop)"
 do_test inc11 "Primitive colocation with clones"
 do_test inc12 "Clone shutdown"
 do_test cloned-group "Make sure only the correct number of cloned groups are started"
 do_test cloned-group-stop "Ensure stopping qpidd also stops glance and cinder"
 do_test clone-no-shuffle "Dont prioritize allocation of instances that must be moved"
 do_test clone-max-zero "Orphan processing with clone-max=0"
 do_test clone-anon-dup "Bug LF#2087 - Correctly parse the state of anonymous clones that are active more than once per node"
 do_test bug-lf-2160 "Dont shuffle clones due to colocation"
 do_test bug-lf-2213 "clone-node-max enforcement for cloned groups"
 do_test bug-lf-2153 "Clone ordering constraints"
 do_test bug-lf-2361 "Ensure clones observe mandatory ordering constraints if the LHS is unrunnable"
 do_test bug-lf-2317 "Avoid needless restart of primitive depending on a clone"
 do_test clone-colocate-instance-1 "Colocation with a specific clone instance (negative example)"
 do_test clone-colocate-instance-2 "Colocation with a specific clone instance"
 do_test clone-order-instance "Ordering with specific clone instances"
 do_test bug-lf-2453 "Enforce mandatory clone ordering without colocation"
 do_test bug-lf-2508 "Correctly reconstruct the status of anonymous cloned groups"
 do_test bug-lf-2544 "Balanced clone placement"
 do_test bug-lf-2445 "Redistribute clones with node-max > 1 and stickiness = 0"
 do_test bug-lf-2574 "Avoid clone shuffle"
 do_test bug-lf-2581 "Avoid group restart due to unrelated clone (re)start"
 do_test bug-cl-5168 "Don't shuffle clones"
 do_test bug-cl-5170 "Prevent clone from starting with on-fail=block"
 do_test clone-fail-block-colocation "Move colocated group when failed clone has on-fail=block"
 do_test clone-interleave-1 "Clone-3 cannot start on pcmk-1 due to interleaved ordering (no colocation)"
 do_test clone-interleave-2 "Clone-3 must stop on pcmk-1 due to interleaved ordering (no colocation)"
 do_test clone-interleave-3 "Clone-3 must be recovered on pcmk-1 due to interleaved ordering (no colocation)"
 
 echo ""
 do_test unfence-startup "Clean unfencing"
 do_test unfence-definition "Unfencing when the agent changes"
 do_test unfence-parameters "Unfencing when the agent parameters changes"
 
 echo ""
 do_test master-0 "Stopped -> Slave"
 do_test master-1 "Stopped -> Promote"
 do_test master-2 "Stopped -> Promote : notify"
 do_test master-3 "Stopped -> Promote : master location"
 do_test master-4 "Started -> Promote : master location"
 do_test master-5 "Promoted -> Promoted"
 do_test master-6 "Promoted -> Promoted (2)"
 do_test master-7 "Promoted -> Fenced"
 do_test master-8 "Promoted -> Fenced -> Moved"
 do_test master-9 "Stopped + Promotable + No quorum"
 do_test master-10 "Stopped -> Promotable : notify with monitor"
 do_test master-11 "Stopped -> Promote : colocation"
 do_test novell-239082 "Demote/Promote ordering"
 do_test novell-239087 "Stable master placement"
 do_test master-12 "Promotion based solely on rsc_location constraints"
 do_test master-13 "Include preferences of colocated resources when placing master"
 do_test master-demote "Ordering when actions depends on demoting a slave resource"
 do_test master-ordering "Prevent resources from starting that need a master"
 do_test bug-1765 "Master-Master Colocation (dont stop the slaves)"
 do_test master-group "Promotion of cloned groups"
 do_test bug-lf-1852 "Don't shuffle master/slave instances unnecessarily"
 do_test master-failed-demote "Dont retry failed demote actions"
 do_test master-failed-demote-2 "Dont retry failed demote actions (notify=false)"
 do_test master-depend "Ensure resources that depend on the master don't get allocated until the master does"
 do_test master-reattach "Re-attach to a running master"
 do_test master-allow-start "Don't include master score if it would prevent allocation"
 do_test master-colocation "Allow master instances placemaker to be influenced by colocation constraints"
 do_test master-pseudo "Make sure promote/demote pseudo actions are created correctly"
 do_test master-role "Prevent target-role from promoting more than master-max instances"
 do_test bug-lf-2358 "Master-Master anti-colocation"
 do_test master-promotion-constraint "Mandatory master colocation constraints"
 do_test unmanaged-master "Ensure role is preserved for unmanaged resources"
 do_test master-unmanaged-monitor "Start the correct monitor operation for unmanaged masters"
 do_test master-demote-2 "Demote does not clear past failure"
 do_test master-move "Move master based on failure of colocated group"
 do_test master-probed-score "Observe the promotion score of probed resources"
 do_test colocation_constraint_stops_master "cl#5054 - Ensure master is demoted when stopped by colocation constraint"
 do_test colocation_constraint_stops_slave  "cl#5054 - Ensure slave is not demoted when stopped by colocation constraint"
 do_test order_constraint_stops_master      "cl#5054 - Ensure master is demoted when stopped by order constraint"
 do_test order_constraint_stops_slave       "cl#5054 - Ensure slave is not demoted when stopped by order constraint"
 do_test master_monitor_restart "cl#5072 - Ensure master monitor operation will start after promotion."
 do_test bug-rh-880249 "Handle replacement of an m/s resource with a primitive"
 do_test bug-5143-ms-shuffle "Prevent master shuffling due to promotion score"
 do_test master-demote-block "Block promotion if demote fails with on-fail=block"
 do_test master-dependant-ban "Don't stop instances from being active because a dependant is banned from that host"
 do_test master-stop "Stop instances due to location constraint with role=Started"
 do_test master-partially-demoted-group "Allow partially demoted group to finish demoting"
 do_test bug-cl-5213 "Ensure role colocation with -INFINITY is enforced"
 do_test bug-cl-5219 "Allow unrelated resources with a common colocation target to remain promoted"
 do_test master-asymmetrical-order "Fix the behaviors of multi-state resources with asymmetrical ordering"
 do_test master-notify "Master promotion with notifies"
 
 echo ""
 do_test history-1 "Correctly parse stateful-1 resource state"
 
 echo ""
 do_test managed-0 "Managed (reference)"
 do_test managed-1 "Not managed - down "
 do_test managed-2 "Not managed - up   "
 do_test bug-5028 "Shutdown should block if anything depends on an unmanaged resource"
 do_test bug-5028-detach "Ensure detach still works"
 do_test bug-5028-bottom "Ensure shutdown still blocks if the blocked resource is at the bottom of the stack"
 do_test unmanaged-stop-1 "cl#5155 - Block the stop of resources if any depending resource is unmanaged "
 do_test unmanaged-stop-2 "cl#5155 - Block the stop of resources if the first resource in a mandatory stop order is unmanaged "
 do_test unmanaged-stop-3 "cl#5155 - Block the stop of resources if any depending resource in a group is unmanaged "
 do_test unmanaged-stop-4 "cl#5155 - Block the stop of resources if any depending resource in the middle of a group is unmanaged "
 do_test unmanaged-block-restart "Block restart of resources if any dependent resource in a group is unmanaged"
 
 echo ""
 do_test interleave-0 "Interleave (reference)"
 do_test interleave-1 "coloc - not interleaved"
 do_test interleave-2 "coloc - interleaved   "
 do_test interleave-3 "coloc - interleaved (2)"
 do_test interleave-pseudo-stop "Interleaved clone during stonith"
 do_test interleave-stop "Interleaved clone during stop"
 do_test interleave-restart "Interleaved clone during dependancy restart"
 
 echo ""
 do_test notify-0 "Notify reference"
 do_test notify-1 "Notify simple"
 do_test notify-2 "Notify simple, confirm"
 do_test notify-3 "Notify move, confirm"
 do_test novell-239079 "Notification priority"
 #do_test notify-2 "Notify - 764"
 
 echo ""
 do_test 594 "OSDL #594 - Unrunnable actions scheduled in transition"
 do_test 662 "OSDL #662 - Two resources start on one node when incarnation_node_max = 1"
 do_test 696 "OSDL #696 - CRM starts stonith RA without monitor"
 do_test 726 "OSDL #726 - Attempting to schedule rsc_posic041_monitor_5000 _after_ a stop"
 do_test 735 "OSDL #735 - Correctly detect that rsc_hadev1 is stopped on hadev3"
 do_test 764 "OSDL #764 - Missing monitor op for DoFencing:child_DoFencing:1"
 do_test 797 "OSDL #797 - Assert triggered: task_id_i > max_call_id"
 do_test 829 "OSDL #829"
 do_test 994 "OSDL #994 - Stopping the last resource in a resource group causes the entire group to be restarted"
 do_test 994-2 "OSDL #994 - with a dependant resource"
 do_test 1360 "OSDL #1360 - Clone stickiness"
 do_test 1484 "OSDL #1484 - on_fail=stop"
 do_test 1494 "OSDL #1494 - Clone stability"
 do_test unrunnable-1 "Unrunnable"
 do_test stonith-0 "Stonith loop - 1"
 do_test stonith-1 "Stonith loop - 2"
 do_test stonith-2 "Stonith loop - 3"
 do_test stonith-3 "Stonith startup"
 do_test stonith-4 "Stonith node state" --rc 4
 do_test bug-1572-1 "Recovery of groups depending on master/slave"
 do_test bug-1572-2 "Recovery of groups depending on master/slave when the master is never re-promoted"
 do_test bug-1685 "Depends-on-master ordering"
 do_test bug-1822 "Dont promote partially active groups"
 do_test bug-pm-11 "New resource added to a m/s group"
 do_test bug-pm-12 "Recover only the failed portion of a cloned group"
 do_test bug-n-387749 "Don't shuffle clone instances"
 do_test bug-n-385265 "Don't ignore the failure stickiness of group children - resource_idvscommon should stay stopped"
 do_test bug-n-385265-2 "Ensure groups are migrated instead of remaining partially active on the current node"
 do_test bug-lf-1920 "Correctly handle probes that find active resources"
 do_test bnc-515172 "Location constraint with multiple expressions"
 do_test colocate-primitive-with-clone "Optional colocation with a clone"
 do_test use-after-free-merge "Use-after-free in native_merge_weights"
 do_test bug-lf-2551 "STONITH ordering for stop"
 do_test bug-lf-2606 "Stonith implies demote"
 do_test bug-lf-2474 "Ensure resource op timeout takes precedence over op_defaults"
 do_test bug-suse-707150 "Prevent vm-01 from starting due to colocation/ordering"
 do_test bug-5014-A-start-B-start "Verify when A starts B starts using symmetrical=false"
 do_test bug-5014-A-stop-B-started "Verify when A stops B does not stop if it has already started using symmetric=false"
 do_test bug-5014-A-stopped-B-stopped "Verify when A is stopped and B has not started, B does not start before A using symmetric=false"
 do_test bug-5014-CthenAthenB-C-stopped "Verify when C then A is symmetrical=true, A then B is symmetric=false, and C is stopped that nothing starts."
 do_test bug-5014-CLONE-A-start-B-start "Verify when A starts B starts using clone resources with symmetric=false"
 do_test bug-5014-CLONE-A-stop-B-started "Verify when A stops B does not stop if it has already started using clone resources with symmetric=false."
 do_test bug-5014-GROUP-A-start-B-start "Verify when A starts B starts when using group resources with symmetric=false."
 do_test bug-5014-GROUP-A-stopped-B-started "Verify when A stops B does not stop if it has already started using group resources with symmetric=false."
 do_test bug-5014-GROUP-A-stopped-B-stopped "Verify when A is stopped and B has not started, B does not start before A using group resources with symmetric=false."
 do_test bug-5014-ordered-set-symmetrical-false "Verify ordered sets work with symmetrical=false"
 do_test bug-5014-ordered-set-symmetrical-true "Verify ordered sets work with symmetrical=true"
 do_test bug-5007-masterslave_colocation "Verify use of colocation scores other than INFINITY and -INFINITY work on multi-state resources."
 do_test bug-5038 "Prevent restart of anonymous clones when clone-max decreases"
 do_test bug-5025-1 "Automatically clean up failcount after resource config change with reload"
 do_test bug-5025-2 "Make sure clear failcount action isn't set when config does not change."
 do_test bug-5025-3 "Automatically clean up failcount after resource config change with restart"
 do_test bug-5025-4 "Clear failcount when last failure is a start op and rsc attributes changed."
 do_test failcount "Ensure failcounts are correctly expired"
 do_test failcount-block "Ensure failcounts are not expired when on-fail=block is present"
 do_test monitor-onfail-restart "bug-5058 - Monitor failure with on-fail set to restart"
 do_test monitor-onfail-stop    "bug-5058 - Monitor failure wiht on-fail set to stop"
 do_test bug-5059 "No need to restart p_stateful1:*"
 do_test bug-5069-op-enabled  "Test on-fail=ignore with failure when monitor is enabled."
 do_test bug-5069-op-disabled "Test on-fail-ignore with failure when monitor is disabled."
 do_test obsolete-lrm-resource "cl#5115 - Do not use obsolete lrm_resource sections"
 do_test expire-non-blocked-failure "Ignore failure-timeout only if the failed operation has on-fail=block"
 
 do_test ignore_stonith_rsc_order1 "cl#5056- Ignore order constraint between stonith and non-stonith rsc."
 do_test ignore_stonith_rsc_order2 "cl#5056- Ignore order constraint with group rsc containing mixed stonith and non-stonith."
 do_test ignore_stonith_rsc_order3 "cl#5056- Ignore order constraint, stonith clone and mixed group"
 do_test ignore_stonith_rsc_order4 "cl#5056- Ignore order constraint, stonith clone and clone with nested mixed group"
 do_test honor_stonith_rsc_order1 "cl#5056- Honor order constraint, stonith clone and pure stonith group(single rsc)."
 do_test honor_stonith_rsc_order2 "cl#5056- Honor order constraint, stonith clone and pure stonith group(multiple rsc)"
 do_test honor_stonith_rsc_order3 "cl#5056- Honor order constraint, stonith clones with nested pure stonith group."
 do_test honor_stonith_rsc_order4 "cl#5056- Honor order constraint, between two native stonith rscs."
 do_test probe-timeout "cl#5099 - Default probe timeout"
 
 echo ""
 do_test systemhealth1  "System Health ()               #1"
 do_test systemhealth2  "System Health ()               #2"
 do_test systemhealth3  "System Health ()               #3"
 do_test systemhealthn1 "System Health (None)           #1"
 do_test systemhealthn2 "System Health (None)           #2"
 do_test systemhealthn3 "System Health (None)           #3"
 do_test systemhealthm1 "System Health (Migrate On Red) #1"
 do_test systemhealthm2 "System Health (Migrate On Red) #2"
 do_test systemhealthm3 "System Health (Migrate On Red) #3"
 do_test systemhealtho1 "System Health (Only Green)     #1"
 do_test systemhealtho2 "System Health (Only Green)     #2"
 do_test systemhealtho3 "System Health (Only Green)     #3"
 do_test systemhealthp1 "System Health (Progessive)     #1"
 do_test systemhealthp2 "System Health (Progessive)     #2"
 do_test systemhealthp3 "System Health (Progessive)     #3"
 
 echo ""
 do_test utilization "Placement Strategy - utilization"
 do_test minimal     "Placement Strategy - minimal"
 do_test balanced    "Placement Strategy - balanced"
 
 echo ""
 do_test placement-stickiness "Optimized Placement Strategy - stickiness"
 do_test placement-priority   "Optimized Placement Strategy - priority"
 do_test placement-location   "Optimized Placement Strategy - location"
 do_test placement-capacity   "Optimized Placement Strategy - capacity"
 
 echo ""
 do_test utilization-order1 "Utilization Order - Simple"
 do_test utilization-order2 "Utilization Order - Complex"
 do_test utilization-order3 "Utilization Order - Migrate"
 do_test utilization-order4 "Utilization Order - Live Mirgration (bnc#695440)"
 do_test utilization-shuffle "Don't displace prmExPostgreSQLDB2 on act2, Start prmExPostgreSQLDB1 on act3"
 do_test load-stopped-loop "Avoid transition loop due to load_stopped (cl#5044)"
 do_test load-stopped-loop-2 "cl#5235 - Prevent graph loops that can be introduced by load_stopped -> migrate_to ordering"
 
 echo ""
 do_test colocated-utilization-primitive-1 "Colocated Utilization - Primitive"
 do_test colocated-utilization-primitive-2 "Colocated Utilization - Choose the most capable node"
 do_test colocated-utilization-group "Colocated Utilization - Group"
 do_test colocated-utilization-clone "Colocated Utilization - Clone"
 
 do_test utilization-check-allowed-nodes "Only check the capacities of the nodes that can run the resource"
 
 echo ""
 do_test reprobe-target_rc "Ensure correct target_rc for reprobe of inactive resources"
 do_test node-maintenance-1 "cl#5128 - Node maintenance"
 do_test node-maintenance-2 "cl#5128 - Node maintenance (coming out of maintenance mode)"
 
 do_test rsc-maintenance "Per-resource maintenance"
 
 echo ""
 do_test not-installed-agent "The resource agent is missing"
 do_test not-installed-tools "Something the resource agent needs is missing"
 
 echo ""
 do_test stopped-monitor-00	"Stopped Monitor - initial start"
 do_test stopped-monitor-01	"Stopped Monitor - failed started"
 do_test stopped-monitor-02	"Stopped Monitor - started multi-up"
 do_test stopped-monitor-03	"Stopped Monitor - stop started"
 do_test stopped-monitor-04	"Stopped Monitor - failed stop"
 do_test stopped-monitor-05	"Stopped Monitor - start unmanaged"
 do_test stopped-monitor-06	"Stopped Monitor - unmanaged multi-up"
 do_test stopped-monitor-07	"Stopped Monitor - start unmanaged multi-up"
 do_test stopped-monitor-08	"Stopped Monitor - migrate"
 do_test stopped-monitor-09	"Stopped Monitor - unmanage started"
 do_test stopped-monitor-10	"Stopped Monitor - unmanaged started multi-up"
 do_test stopped-monitor-11	"Stopped Monitor - stop unmanaged started"
 do_test stopped-monitor-12	"Stopped Monitor - unmanaged started multi-up (targer-role="Stopped")"
 do_test stopped-monitor-20	"Stopped Monitor - initial stop"
 do_test stopped-monitor-21	"Stopped Monitor - stopped single-up"
 do_test stopped-monitor-22	"Stopped Monitor - stopped multi-up"
 do_test stopped-monitor-23	"Stopped Monitor - start stopped"
 do_test stopped-monitor-24	"Stopped Monitor - unmanage stopped"
 do_test stopped-monitor-25	"Stopped Monitor - unmanaged stopped multi-up"
 do_test stopped-monitor-26	"Stopped Monitor - start unmanaged stopped"
 do_test stopped-monitor-27	"Stopped Monitor - unmanaged stopped multi-up (target-role="Started")"
 do_test stopped-monitor-30	"Stopped Monitor - new node started"
 do_test stopped-monitor-31	"Stopped Monitor - new node stopped"
 
 echo""
 do_test ticket-primitive-1 "Ticket - Primitive (loss-policy=stop, initial)"
 do_test ticket-primitive-2 "Ticket - Primitive (loss-policy=stop, granted)"
 do_test ticket-primitive-3 "Ticket - Primitive (loss-policy-stop, revoked)"
 do_test ticket-primitive-4 "Ticket - Primitive (loss-policy=demote, initial)"
 do_test ticket-primitive-5 "Ticket - Primitive (loss-policy=demote, granted)"
 do_test ticket-primitive-6 "Ticket - Primitive (loss-policy=demote, revoked)"
 do_test ticket-primitive-7 "Ticket - Primitive (loss-policy=fence, initial)"
 do_test ticket-primitive-8 "Ticket - Primitive (loss-policy=fence, granted)"
 do_test ticket-primitive-9 "Ticket - Primitive (loss-policy=fence, revoked)"
 do_test ticket-primitive-10 "Ticket - Primitive (loss-policy=freeze, initial)"
 do_test ticket-primitive-11 "Ticket - Primitive (loss-policy=freeze, granted)"
 do_test ticket-primitive-12 "Ticket - Primitive (loss-policy=freeze, revoked)"
 
 do_test ticket-primitive-13 "Ticket - Primitive (loss-policy=stop, standby, granted)"
 do_test ticket-primitive-14 "Ticket - Primitive (loss-policy=stop, granted, standby)"
 do_test ticket-primitive-15 "Ticket - Primitive (loss-policy=stop, standby, revoked)"
 do_test ticket-primitive-16 "Ticket - Primitive (loss-policy=demote, standby, granted)"
 do_test ticket-primitive-17 "Ticket - Primitive (loss-policy=demote, granted, standby)"
 do_test ticket-primitive-18 "Ticket - Primitive (loss-policy=demote, standby, revoked)"
 do_test ticket-primitive-19 "Ticket - Primitive (loss-policy=fence, standby, granted)"
 do_test ticket-primitive-20 "Ticket - Primitive (loss-policy=fence, granted, standby)"
 do_test ticket-primitive-21 "Ticket - Primitive (loss-policy=fence, standby, revoked)"
 do_test ticket-primitive-22 "Ticket - Primitive (loss-policy=freeze, standby, granted)"
 do_test ticket-primitive-23 "Ticket - Primitive (loss-policy=freeze, granted, standby)"
 do_test ticket-primitive-24 "Ticket - Primitive (loss-policy=freeze, standby, revoked)"
 
 echo""
 do_test ticket-group-1 "Ticket - Group (loss-policy=stop, initial)"
 do_test ticket-group-2 "Ticket - Group (loss-policy=stop, granted)"
 do_test ticket-group-3 "Ticket - Group (loss-policy-stop, revoked)"
 do_test ticket-group-4 "Ticket - Group (loss-policy=demote, initial)"
 do_test ticket-group-5 "Ticket - Group (loss-policy=demote, granted)"
 do_test ticket-group-6 "Ticket - Group (loss-policy=demote, revoked)"
 do_test ticket-group-7 "Ticket - Group (loss-policy=fence, initial)"
 do_test ticket-group-8 "Ticket - Group (loss-policy=fence, granted)"
 do_test ticket-group-9 "Ticket - Group (loss-policy=fence, revoked)"
 do_test ticket-group-10 "Ticket - Group (loss-policy=freeze, initial)"
 do_test ticket-group-11 "Ticket - Group (loss-policy=freeze, granted)"
 do_test ticket-group-12 "Ticket - Group (loss-policy=freeze, revoked)"
 
 do_test ticket-group-13 "Ticket - Group (loss-policy=stop, standby, granted)"
 do_test ticket-group-14 "Ticket - Group (loss-policy=stop, granted, standby)"
 do_test ticket-group-15 "Ticket - Group (loss-policy=stop, standby, revoked)"
 do_test ticket-group-16 "Ticket - Group (loss-policy=demote, standby, granted)"
 do_test ticket-group-17 "Ticket - Group (loss-policy=demote, granted, standby)"
 do_test ticket-group-18 "Ticket - Group (loss-policy=demote, standby, revoked)"
 do_test ticket-group-19 "Ticket - Group (loss-policy=fence, standby, granted)"
 do_test ticket-group-20 "Ticket - Group (loss-policy=fence, granted, standby)"
 do_test ticket-group-21 "Ticket - Group (loss-policy=fence, standby, revoked)"
 do_test ticket-group-22 "Ticket - Group (loss-policy=freeze, standby, granted)"
 do_test ticket-group-23 "Ticket - Group (loss-policy=freeze, granted, standby)"
 do_test ticket-group-24 "Ticket - Group (loss-policy=freeze, standby, revoked)"
 
 echo""
 do_test ticket-clone-1 "Ticket - Clone (loss-policy=stop, initial)"
 do_test ticket-clone-2 "Ticket - Clone (loss-policy=stop, granted)"
 do_test ticket-clone-3 "Ticket - Clone (loss-policy-stop, revoked)"
 do_test ticket-clone-4 "Ticket - Clone (loss-policy=demote, initial)"
 do_test ticket-clone-5 "Ticket - Clone (loss-policy=demote, granted)"
 do_test ticket-clone-6 "Ticket - Clone (loss-policy=demote, revoked)"
 do_test ticket-clone-7 "Ticket - Clone (loss-policy=fence, initial)"
 do_test ticket-clone-8 "Ticket - Clone (loss-policy=fence, granted)"
 do_test ticket-clone-9 "Ticket - Clone (loss-policy=fence, revoked)"
 do_test ticket-clone-10 "Ticket - Clone (loss-policy=freeze, initial)"
 do_test ticket-clone-11 "Ticket - Clone (loss-policy=freeze, granted)"
 do_test ticket-clone-12 "Ticket - Clone (loss-policy=freeze, revoked)"
 
 do_test ticket-clone-13 "Ticket - Clone (loss-policy=stop, standby, granted)"
 do_test ticket-clone-14 "Ticket - Clone (loss-policy=stop, granted, standby)"
 do_test ticket-clone-15 "Ticket - Clone (loss-policy=stop, standby, revoked)"
 do_test ticket-clone-16 "Ticket - Clone (loss-policy=demote, standby, granted)"
 do_test ticket-clone-17 "Ticket - Clone (loss-policy=demote, granted, standby)"
 do_test ticket-clone-18 "Ticket - Clone (loss-policy=demote, standby, revoked)"
 do_test ticket-clone-19 "Ticket - Clone (loss-policy=fence, standby, granted)"
 do_test ticket-clone-20 "Ticket - Clone (loss-policy=fence, granted, standby)"
 do_test ticket-clone-21 "Ticket - Clone (loss-policy=fence, standby, revoked)"
 do_test ticket-clone-22 "Ticket - Clone (loss-policy=freeze, standby, granted)"
 do_test ticket-clone-23 "Ticket - Clone (loss-policy=freeze, granted, standby)"
 do_test ticket-clone-24 "Ticket - Clone (loss-policy=freeze, standby, revoked)"
 
 echo""
 do_test ticket-master-1 "Ticket - Master (loss-policy=stop, initial)"
 do_test ticket-master-2 "Ticket - Master (loss-policy=stop, granted)"
 do_test ticket-master-3 "Ticket - Master (loss-policy-stop, revoked)"
 do_test ticket-master-4 "Ticket - Master (loss-policy=demote, initial)"
 do_test ticket-master-5 "Ticket - Master (loss-policy=demote, granted)"
 do_test ticket-master-6 "Ticket - Master (loss-policy=demote, revoked)"
 do_test ticket-master-7 "Ticket - Master (loss-policy=fence, initial)"
 do_test ticket-master-8 "Ticket - Master (loss-policy=fence, granted)"
 do_test ticket-master-9 "Ticket - Master (loss-policy=fence, revoked)"
 do_test ticket-master-10 "Ticket - Master (loss-policy=freeze, initial)"
 do_test ticket-master-11 "Ticket - Master (loss-policy=freeze, granted)"
 do_test ticket-master-12 "Ticket - Master (loss-policy=freeze, revoked)"
 
 do_test ticket-master-13 "Ticket - Master (loss-policy=stop, standby, granted)"
 do_test ticket-master-14 "Ticket - Master (loss-policy=stop, granted, standby)"
 do_test ticket-master-15 "Ticket - Master (loss-policy=stop, standby, revoked)"
 do_test ticket-master-16 "Ticket - Master (loss-policy=demote, standby, granted)"
 do_test ticket-master-17 "Ticket - Master (loss-policy=demote, granted, standby)"
 do_test ticket-master-18 "Ticket - Master (loss-policy=demote, standby, revoked)"
 do_test ticket-master-19 "Ticket - Master (loss-policy=fence, standby, granted)"
 do_test ticket-master-20 "Ticket - Master (loss-policy=fence, granted, standby)"
 do_test ticket-master-21 "Ticket - Master (loss-policy=fence, standby, revoked)"
 do_test ticket-master-22 "Ticket - Master (loss-policy=freeze, standby, granted)"
 do_test ticket-master-23 "Ticket - Master (loss-policy=freeze, granted, standby)"
 do_test ticket-master-24 "Ticket - Master (loss-policy=freeze, standby, revoked)"
 
 echo ""
 do_test ticket-rsc-sets-1 "Ticket - Resource sets (1 ticket, initial)"
 do_test ticket-rsc-sets-2 "Ticket - Resource sets (1 ticket, granted)"
 do_test ticket-rsc-sets-3 "Ticket - Resource sets (1 ticket, revoked)"
 do_test ticket-rsc-sets-4 "Ticket - Resource sets (2 tickets, initial)"
 do_test ticket-rsc-sets-5 "Ticket - Resource sets (2 tickets, granted)"
 do_test ticket-rsc-sets-6 "Ticket - Resource sets (2 tickets, granted)"
 do_test ticket-rsc-sets-7 "Ticket - Resource sets (2 tickets, revoked)"
 
 do_test ticket-rsc-sets-8 "Ticket - Resource sets (1 ticket, standby, granted)"
 do_test ticket-rsc-sets-9 "Ticket - Resource sets (1 ticket, granted, standby)"
 do_test ticket-rsc-sets-10 "Ticket - Resource sets (1 ticket, standby, revoked)"
 do_test ticket-rsc-sets-11 "Ticket - Resource sets (2 tickets, standby, granted)"
 do_test ticket-rsc-sets-12 "Ticket - Resource sets (2 tickets, standby, granted)"
 do_test ticket-rsc-sets-13 "Ticket - Resource sets (2 tickets, granted, standby)"
 do_test ticket-rsc-sets-14 "Ticket - Resource sets (2 tickets, standby, revoked)"
 
 do_test cluster-specific-params "Cluster-specific instance attributes based on rules"
 do_test site-specific-params "Site-specific instance attributes based on rules"
 
 echo ""
 do_test template-1 "Template - 1"
 do_test template-2 "Template - 2"
 do_test template-3 "Template - 3 (merge operations)"
 
 do_test template-coloc-1 "Template - Colocation 1"
 do_test template-coloc-2 "Template - Colocation 2"
 do_test template-coloc-3 "Template - Colocation 3"
 do_test template-order-1 "Template - Order 1"
 do_test template-order-2 "Template - Order 2"
 do_test template-order-3 "Template - Order 3"
 do_test template-ticket  "Template - Ticket"
 
 do_test template-rsc-sets-1  "Template - Resource Sets 1"
 do_test template-rsc-sets-2  "Template - Resource Sets 2"
 do_test template-rsc-sets-3  "Template - Resource Sets 3"
 do_test template-rsc-sets-4  "Template - Resource Sets 4"
 
 do_test template-clone-primitive "Cloned primitive from template"
 do_test template-clone-group     "Cloned group from template"
 
 do_test location-sets-templates "Resource sets and templates - Location"
 
 do_test tags-coloc-order-1 "Tags - Colocation and Order (Simple)"
 do_test tags-coloc-order-2 "Tags - Colocation and Order (Resource Sets with Templates)"
 do_test tags-location      "Tags - Location"
 do_test tags-ticket        "Tags - Ticket"
 
 echo ""
 do_test container-1 "Container - initial"
 do_test container-2 "Container - monitor failed"
 do_test container-3 "Container - stop failed"
 do_test container-4 "Container - reached migration-threshold"
 do_test container-group-1 "Container in group - initial"
 do_test container-group-2 "Container in group - monitor failed"
 do_test container-group-3 "Container in group - stop failed"
 do_test container-group-4 "Container in group - reached migration-threshold"
 do_test container-is-remote-node "Place resource within container when container is remote-node"
 do_test bug-rh-1097457 "Kill user defined container/contents ordering"
 
 echo ""
 do_test whitebox-fail1 "Fail whitebox container rsc."
 do_test whitebox-fail2 "Fail whitebox container rsc lrmd connection."
 do_test whitebox-fail3 "Failed containers should not run nested on remote nodes."
 do_test whitebox-start "Start whitebox container with resources assigned to it"
 do_test whitebox-stop "Stop whitebox container with resources assigned to it"
 do_test whitebox-move "Move whitebox container with resources assigned to it"
 do_test whitebox-asymmetric "Verify connection rsc opts-in based on container resource"
 do_test whitebox-ms-ordering "Verify promote/demote can not occur before connection is established"
 do_test whitebox-orphaned    "Properly shutdown orphaned whitebox container"
 do_test whitebox-orphan-ms   "Properly tear down orphan ms resources on remote-nodes"
 do_test whitebox-unexpectedly-running "Recover container nodes the cluster did not start."
 do_test whitebox-migrate1 "Migrate both container and connection resource"
 do_test whitebox-imply-stop-on-fence "imply stop action on container node rsc when host node is fenced"
 do_test whitebox-nested-group "Verify guest remote-node works nested in a group"
 
 echo ""
 do_test remote-startup-probes  "Baremetal remote-node startup probes"
 do_test remote-startup         "Startup a newly discovered remote-nodes with no status."
 do_test remote-fence-unclean   "Fence unclean baremetal remote-node"
 do_test remote-fence-unclean2  "Fence baremetal remote-node after cluster node fails and connection can not be recovered"
 do_test remote-move            "Move remote-node connection resource"
 do_test remote-disable         "Disable a baremetal remote-node"
 do_test remote-orphaned        "Properly shutdown orphaned connection resource"
 do_test remote-orphaned2       "verify we can handle orphaned remote connections with active resources on the remote"
 do_test remote-recover         "Recover connection resource after cluster-node fails."
 do_test remote-stale-node-entry "Make sure we properly handle leftover remote-node entries in the node section"
 do_test remote-partial-migrate  "Make sure partial migrations are handled before ops on the remote node."
 do_test remote-partial-migrate2 "Make sure partial migration target is prefered for remote connection."
 do_test remote-recover-fail     "Make sure start failure causes fencing if rsc are active on remote."
 do_test remote-start-fail       "Make sure a start failure does not result in fencing if no active resources are on remote."
 do_test remote-unclean2         "Make monitor failure always results in fencing, even if no rsc are active on remote."
 do_test remote-fence-before-reconnect "Fence before clearing recurring monitor failure"
 
 echo ""
 do_test resource-discovery      "Exercises resource-discovery location constraint option."
 do_test rsc-discovery-per-node  "Disable resource discovery per node"
 
 echo ""
 do_test isolation-start-all   "Start docker isolated resources."
 do_test isolation-restart-all "Restart docker isolated resources."
 do_test isolation-clone       "Cloned isolated primitive."
 
 echo ""
 test_results
diff --git a/pengine/test10/clone_min_interleave_start_one.dot b/pengine/test10/clone_min_interleave_start_one.dot
new file mode 100644
index 0000000000..15ac9be2be
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_one.dot
@@ -0,0 +1,50 @@
+ digraph "g" {
+"FAKE1-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1-clone_start_0" -> "FAKE1-clone_running_0" [ style = bold]
+"FAKE1-clone_start_0" -> "FAKE1_start_0 c7auto1" [ style = bold]
+"FAKE1-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1_monitor_10000 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE1_start_0 c7auto1" -> "FAKE1-clone_running_0" [ style = bold]
+"FAKE1_start_0 c7auto1" -> "FAKE1_monitor_10000 c7auto1" [ style = bold]
+"FAKE1_start_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE2-clone_running_0" -> "FAKE3-clone_start_0" [ style = dashed]
+"FAKE2-clone_running_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKE2-clone_start_0" -> "FAKE2-clone_running_0" [ style = dashed]
+"FAKE2-clone_start_0" -> "FAKE2:1_start_0 c7auto3" [ style = dashed]
+"FAKE2-clone_start_0" -> "FAKE2:2_start_0 c7auto1" [ style = dashed]
+"FAKE2-clone_start_0" -> "FAKE2_start_0 c7auto2" [ style = dashed]
+"FAKE2-clone_start_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKE2:1_monitor_10000 c7auto3" [ style=dashed color="red" fontcolor="black"]
+"FAKE2:1_start_0 c7auto3" -> "FAKE2-clone_running_0" [ style = dashed]
+"FAKE2:1_start_0 c7auto3" -> "FAKE2:1_monitor_10000 c7auto3" [ style = dashed]
+"FAKE2:1_start_0 c7auto3" -> "FAKE3:1_start_0 c7auto3" [ style = dashed]
+"FAKE2:1_start_0 c7auto3" [ style=dashed color="red" fontcolor="black"]
+"FAKE2:2_monitor_10000 c7auto1" [ style=dashed color="red" fontcolor="black"]
+"FAKE2:2_start_0 c7auto1" -> "FAKE2-clone_running_0" [ style = dashed]
+"FAKE2:2_start_0 c7auto1" -> "FAKE2:2_monitor_10000 c7auto1" [ style = dashed]
+"FAKE2:2_start_0 c7auto1" -> "FAKE3:2_start_0 c7auto1" [ style = dashed]
+"FAKE2:2_start_0 c7auto1" [ style=dashed color="red" fontcolor="black"]
+"FAKE2_monitor_10000 c7auto2" [ style=dashed color="red" fontcolor="black"]
+"FAKE2_start_0 c7auto2" -> "FAKE2-clone_running_0" [ style = dashed]
+"FAKE2_start_0 c7auto2" -> "FAKE2_monitor_10000 c7auto2" [ style = dashed]
+"FAKE2_start_0 c7auto2" -> "FAKE3_start_0 c7auto2" [ style = dashed]
+"FAKE2_start_0 c7auto2" [ style=dashed color="red" fontcolor="black"]
+"FAKE3-clone_running_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKE3-clone_start_0" -> "FAKE3-clone_running_0" [ style = dashed]
+"FAKE3-clone_start_0" -> "FAKE3:1_start_0 c7auto3" [ style = dashed]
+"FAKE3-clone_start_0" -> "FAKE3:2_start_0 c7auto1" [ style = dashed]
+"FAKE3-clone_start_0" -> "FAKE3_start_0 c7auto2" [ style = dashed]
+"FAKE3-clone_start_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKE3:1_monitor_10000 c7auto3" [ style=dashed color="red" fontcolor="black"]
+"FAKE3:1_start_0 c7auto3" -> "FAKE3-clone_running_0" [ style = dashed]
+"FAKE3:1_start_0 c7auto3" -> "FAKE3:1_monitor_10000 c7auto3" [ style = dashed]
+"FAKE3:1_start_0 c7auto3" [ style=dashed color="red" fontcolor="black"]
+"FAKE3:2_monitor_10000 c7auto1" [ style=dashed color="red" fontcolor="black"]
+"FAKE3:2_start_0 c7auto1" -> "FAKE3-clone_running_0" [ style = dashed]
+"FAKE3:2_start_0 c7auto1" -> "FAKE3:2_monitor_10000 c7auto1" [ style = dashed]
+"FAKE3:2_start_0 c7auto1" [ style=dashed color="red" fontcolor="black"]
+"FAKE3_monitor_10000 c7auto2" [ style=dashed color="red" fontcolor="black"]
+"FAKE3_start_0 c7auto2" -> "FAKE3-clone_running_0" [ style = dashed]
+"FAKE3_start_0 c7auto2" -> "FAKE3_monitor_10000 c7auto2" [ style = dashed]
+"FAKE3_start_0 c7auto2" [ style=dashed color="red" fontcolor="black"]
+}
diff --git a/pengine/test10/clone_min_interleave_start_one.exp b/pengine/test10/clone_min_interleave_start_one.exp
new file mode 100644
index 0000000000..b6e0c5da81
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_one.exp
@@ -0,0 +1,51 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="11" operation="monitor" operation_key="FAKE1_monitor_10000" internal_operation_key="FAKE1:0_monitor_10000" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE1" long-id="FAKE1:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="10" operation="start" operation_key="FAKE1_start_0" internal_operation_key="FAKE1:0_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="10" operation="start" operation_key="FAKE1_start_0" internal_operation_key="FAKE1:0_start_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE1" long-id="FAKE1:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="12" operation="start" operation_key="FAKE1-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2" priority="1000000">
+    <action_set>
+      <pseudo_event id="13" operation="running" operation_key="FAKE1-clone_running_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="10" operation="start" operation_key="FAKE1_start_0" internal_operation_key="FAKE1:0_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="12" operation="start" operation_key="FAKE1-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <pseudo_event id="12" operation="start" operation_key="FAKE1-clone_start_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_interleave_start_one.scores b/pengine/test10/clone_min_interleave_start_one.scores
new file mode 100644
index 0000000000..03de0189cf
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_one.scores
@@ -0,0 +1,67 @@
+Allocation scores:
+clone_color: FAKE1-clone allocation score on c7auto1: 0
+clone_color: FAKE1-clone allocation score on c7auto2: -INFINITY
+clone_color: FAKE1-clone allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:0 allocation score on c7auto1: 0
+clone_color: FAKE1:0 allocation score on c7auto2: -INFINITY
+clone_color: FAKE1:0 allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:1 allocation score on c7auto1: 0
+clone_color: FAKE1:1 allocation score on c7auto2: -INFINITY
+clone_color: FAKE1:1 allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:2 allocation score on c7auto1: 0
+clone_color: FAKE1:2 allocation score on c7auto2: -INFINITY
+clone_color: FAKE1:2 allocation score on c7auto3: -INFINITY
+clone_color: FAKE2-clone allocation score on c7auto1: 0
+clone_color: FAKE2-clone allocation score on c7auto2: 0
+clone_color: FAKE2-clone allocation score on c7auto3: 0
+clone_color: FAKE2:0 allocation score on c7auto1: 0
+clone_color: FAKE2:0 allocation score on c7auto2: 0
+clone_color: FAKE2:0 allocation score on c7auto3: 0
+clone_color: FAKE2:1 allocation score on c7auto1: 0
+clone_color: FAKE2:1 allocation score on c7auto2: 0
+clone_color: FAKE2:1 allocation score on c7auto3: 0
+clone_color: FAKE2:2 allocation score on c7auto1: 0
+clone_color: FAKE2:2 allocation score on c7auto2: 0
+clone_color: FAKE2:2 allocation score on c7auto3: 0
+clone_color: FAKE3-clone allocation score on c7auto1: 0
+clone_color: FAKE3-clone allocation score on c7auto2: 0
+clone_color: FAKE3-clone allocation score on c7auto3: 0
+clone_color: FAKE3:0 allocation score on c7auto1: 0
+clone_color: FAKE3:0 allocation score on c7auto2: 0
+clone_color: FAKE3:0 allocation score on c7auto3: 0
+clone_color: FAKE3:1 allocation score on c7auto1: 0
+clone_color: FAKE3:1 allocation score on c7auto2: 0
+clone_color: FAKE3:1 allocation score on c7auto3: 0
+clone_color: FAKE3:2 allocation score on c7auto1: 0
+clone_color: FAKE3:2 allocation score on c7auto2: 0
+clone_color: FAKE3:2 allocation score on c7auto3: 0
+native_color: FAKE1:0 allocation score on c7auto1: 0
+native_color: FAKE1:0 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:0 allocation score on c7auto3: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto1: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto1: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto3: -INFINITY
+native_color: FAKE2:0 allocation score on c7auto1: 0
+native_color: FAKE2:0 allocation score on c7auto2: 0
+native_color: FAKE2:0 allocation score on c7auto3: 0
+native_color: FAKE2:1 allocation score on c7auto1: 0
+native_color: FAKE2:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE2:1 allocation score on c7auto3: 0
+native_color: FAKE2:2 allocation score on c7auto1: 0
+native_color: FAKE2:2 allocation score on c7auto2: -INFINITY
+native_color: FAKE2:2 allocation score on c7auto3: -INFINITY
+native_color: FAKE3:0 allocation score on c7auto1: 0
+native_color: FAKE3:0 allocation score on c7auto2: 0
+native_color: FAKE3:0 allocation score on c7auto3: 0
+native_color: FAKE3:1 allocation score on c7auto1: 0
+native_color: FAKE3:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE3:1 allocation score on c7auto3: 0
+native_color: FAKE3:2 allocation score on c7auto1: 0
+native_color: FAKE3:2 allocation score on c7auto2: -INFINITY
+native_color: FAKE3:2 allocation score on c7auto3: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
diff --git a/pengine/test10/clone_min_interleave_start_one.summary b/pengine/test10/clone_min_interleave_start_one.summary
new file mode 100644
index 0000000000..b15f68a884
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_one.summary
@@ -0,0 +1,39 @@
+
+Current cluster status:
+Online: [ c7auto1 c7auto2 c7auto3 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKE1-clone [FAKE1]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE2-clone [FAKE2]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE3-clone [FAKE3]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+
+Transition Summary:
+ * Start   FAKE1:0	(c7auto1)
+ * Start   FAKE2:0	(c7auto2 - blocked)
+ * Start   FAKE2:1	(c7auto3 - blocked)
+ * Start   FAKE2:2	(c7auto1 - blocked)
+ * Start   FAKE3:0	(c7auto2 - blocked)
+ * Start   FAKE3:1	(c7auto3 - blocked)
+ * Start   FAKE3:2	(c7auto1 - blocked)
+
+Executing cluster transition:
+ * Pseudo action:   FAKE1-clone_start_0
+ * Resource action: FAKE1           start on c7auto1
+ * Pseudo action:   FAKE1-clone_running_0
+ * Resource action: FAKE1           monitor=10000 on c7auto1
+
+Revised cluster status:
+Online: [ c7auto1 c7auto2 c7auto3 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKE1-clone [FAKE1]
+     Started: [ c7auto1 ]
+     Stopped: [ c7auto2 c7auto3 ]
+ Clone Set: FAKE2-clone [FAKE2]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE3-clone [FAKE3]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+
diff --git a/pengine/test10/clone_min_interleave_start_one.xml b/pengine/test10/clone_min_interleave_start_one.xml
new file mode 100644
index 0000000000..fbe99deaa2
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_one.xml
@@ -0,0 +1,155 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="15" num_updates="0" admin_epoch="0" cib-last-written="Fri Jul 17 11:44:12 2015" update-origin="c7auto1" update-client="crm_resource" update-user="root" have-quorum="1" dc-uuid="3">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1"/>
+      <node id="2" uname="c7auto2"/>
+      <node id="3" uname="c7auto3"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKE1-clone">
+        <primitive class="ocf" id="FAKE1" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE1-instance_attributes"/>
+          <operations>
+            <op id="FAKE1-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE1-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE1-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE1-clone-meta">
+          <nvpair id="FAKE1-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+        <meta_attributes id="FAKE1-clone-meta_attributes"/>
+      </clone>
+      <clone id="FAKE2-clone">
+        <primitive class="ocf" id="FAKE2" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE2-instance_attributes"/>
+          <operations>
+            <op id="FAKE2-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE2-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE2-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE2-clone-meta">
+          <nvpair id="FAKE2-interleave" name="interleave" value="true"/>
+        </meta_attributes>
+      </clone>
+      <clone id="FAKE3-clone">
+        <primitive class="ocf" id="FAKE3" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE3-instance_attributes"/>
+          <operations>
+            <op id="FAKE3-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE3-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE3-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE3-clone-meta">
+          <nvpair id="FAKE3-interleave" name="interleave" value="true"/>
+        </meta_attributes>
+      </clone>
+    </resources>
+    <constraints>
+      <rsc_order first="FAKE1-clone" first-action="start" id="order-FAKE1-clone-FAKE2-clone-mandatory" then="FAKE2-clone" then-action="start"/>
+      <rsc_order first="FAKE2-clone" first-action="start" id="order-FAKE2-clone-FAKE3-clone-mandatory" then="FAKE3-clone" then-action="start"/>
+      <rsc_location id="cli-ban-FAKE1-clone-on-c7auto3" rsc="FAKE1-clone" role="Started" node="c7auto3" score="-INFINITY"/>
+      <rsc_location id="cli-ban-FAKE1-clone-on-c7auto2" rsc="FAKE1-clone" role="Started" node="c7auto2" score="-INFINITY"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:7;8:4:7:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437146780" last-rc-change="1437146780" exec-time="998" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="18:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;18:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;15:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147006" exec-time="9" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="25:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;25:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;28:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="19" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="35:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;35:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="28" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="41:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;41:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="26" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:4:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;9:4:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437146782" last-rc-change="1437146782" exec-time="5" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;10:4:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437146783" exec-time="5" queue-time="1" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="19:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;19:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="34" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;17:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147007" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="27:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;27:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="30:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;30:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="21" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="37:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;37:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="43:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;43:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="28" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="6" queue-time="1" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:4:7:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:7;6:4:7:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437146780" last-rc-change="1437146780" exec-time="994" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;20:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="13:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;13:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147007" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="29:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;29:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="26:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;26:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="19" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="39:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;39:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="28" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="39:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;39:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="26" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/clone_min_interleave_start_two.dot b/pengine/test10/clone_min_interleave_start_two.dot
new file mode 100644
index 0000000000..f99ce320e2
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_two.dot
@@ -0,0 +1,59 @@
+ digraph "g" {
+"FAKE1-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1-clone_start_0" -> "FAKE1-clone_running_0" [ style = bold]
+"FAKE1-clone_start_0" -> "FAKE1:1_start_0 c7auto1" [ style = bold]
+"FAKE1-clone_start_0" -> "FAKE1_start_0 c7auto2" [ style = bold]
+"FAKE1-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1:1_monitor_10000 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE1:1_start_0 c7auto1" -> "FAKE1-clone_running_0" [ style = bold]
+"FAKE1:1_start_0 c7auto1" -> "FAKE1:1_monitor_10000 c7auto1" [ style = bold]
+"FAKE1:1_start_0 c7auto1" -> "clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory" [ style = bold]
+"FAKE1:1_start_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE1_monitor_10000 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE1_start_0 c7auto2" -> "FAKE1-clone_running_0" [ style = bold]
+"FAKE1_start_0 c7auto2" -> "FAKE1_monitor_10000 c7auto2" [ style = bold]
+"FAKE1_start_0 c7auto2" -> "clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory" [ style = bold]
+"FAKE1_start_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE2-clone_running_0" -> "FAKE3-clone_start_0" [ style = bold]
+"FAKE2-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE2-clone_start_0" -> "FAKE2-clone_running_0" [ style = bold]
+"FAKE2-clone_start_0" -> "FAKE2:1_start_0 c7auto2" [ style = bold]
+"FAKE2-clone_start_0" -> "FAKE2:2_start_0 c7auto1" [ style = bold]
+"FAKE2-clone_start_0" -> "FAKE2_start_0 c7auto3" [ style = bold]
+"FAKE2-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE2:1_monitor_10000 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE2:1_start_0 c7auto2" -> "FAKE2-clone_running_0" [ style = bold]
+"FAKE2:1_start_0 c7auto2" -> "FAKE2:1_monitor_10000 c7auto2" [ style = bold]
+"FAKE2:1_start_0 c7auto2" -> "FAKE3:1_start_0 c7auto2" [ style = bold]
+"FAKE2:1_start_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE2:2_monitor_10000 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE2:2_start_0 c7auto1" -> "FAKE2-clone_running_0" [ style = bold]
+"FAKE2:2_start_0 c7auto1" -> "FAKE2:2_monitor_10000 c7auto1" [ style = bold]
+"FAKE2:2_start_0 c7auto1" -> "FAKE3:2_start_0 c7auto1" [ style = bold]
+"FAKE2:2_start_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE2_monitor_10000 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKE2_start_0 c7auto3" -> "FAKE2-clone_running_0" [ style = bold]
+"FAKE2_start_0 c7auto3" -> "FAKE2_monitor_10000 c7auto3" [ style = bold]
+"FAKE2_start_0 c7auto3" -> "FAKE3_start_0 c7auto3" [ style = bold]
+"FAKE2_start_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKE3-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE3-clone_start_0" -> "FAKE3-clone_running_0" [ style = bold]
+"FAKE3-clone_start_0" -> "FAKE3:1_start_0 c7auto2" [ style = bold]
+"FAKE3-clone_start_0" -> "FAKE3:2_start_0 c7auto1" [ style = bold]
+"FAKE3-clone_start_0" -> "FAKE3_start_0 c7auto3" [ style = bold]
+"FAKE3-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE3:1_monitor_10000 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE3:1_start_0 c7auto2" -> "FAKE3-clone_running_0" [ style = bold]
+"FAKE3:1_start_0 c7auto2" -> "FAKE3:1_monitor_10000 c7auto2" [ style = bold]
+"FAKE3:1_start_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE3:2_monitor_10000 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE3:2_start_0 c7auto1" -> "FAKE3-clone_running_0" [ style = bold]
+"FAKE3:2_start_0 c7auto1" -> "FAKE3:2_monitor_10000 c7auto1" [ style = bold]
+"FAKE3:2_start_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE3_monitor_10000 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKE3_start_0 c7auto3" -> "FAKE3-clone_running_0" [ style = bold]
+"FAKE3_start_0 c7auto3" -> "FAKE3_monitor_10000 c7auto3" [ style = bold]
+"FAKE3_start_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory" -> "FAKE2-clone_start_0" [ style = bold]
+"clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/clone_min_interleave_start_two.exp b/pengine/test10/clone_min_interleave_start_two.exp
new file mode 100644
index 0000000000..98460722f4
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_two.exp
@@ -0,0 +1,326 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="11" operation="monitor" operation_key="FAKE1_monitor_10000" internal_operation_key="FAKE1:0_monitor_10000" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE1" long-id="FAKE1:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="10" operation="start" operation_key="FAKE1_start_0" internal_operation_key="FAKE1:0_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="10" operation="start" operation_key="FAKE1_start_0" internal_operation_key="FAKE1:0_start_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE1" long-id="FAKE1:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="14" operation="start" operation_key="FAKE1-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="13" operation="monitor" operation_key="FAKE1:1_monitor_10000" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE1" long-id="FAKE1:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="12" operation="start" operation_key="FAKE1:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <rsc_op id="12" operation="start" operation_key="FAKE1:1_start_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE1" long-id="FAKE1:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="14" operation="start" operation_key="FAKE1-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4" priority="1000000">
+    <action_set>
+      <pseudo_event id="15" operation="running" operation_key="FAKE1-clone_running_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="10" operation="start" operation_key="FAKE1_start_0" internal_operation_key="FAKE1:0_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="12" operation="start" operation_key="FAKE1:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="14" operation="start" operation_key="FAKE1-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <pseudo_event id="14" operation="start" operation_key="FAKE1-clone_start_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="6">
+    <action_set>
+      <rsc_op id="19" operation="monitor" operation_key="FAKE2_monitor_10000" internal_operation_key="FAKE2:0_monitor_10000" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKE2" long-id="FAKE2:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="18" operation="start" operation_key="FAKE2_start_0" internal_operation_key="FAKE2:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <rsc_op id="18" operation="start" operation_key="FAKE2_start_0" internal_operation_key="FAKE2:0_start_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKE2" long-id="FAKE2:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="24" operation="start" operation_key="FAKE2-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <rsc_op id="21" operation="monitor" operation_key="FAKE2:1_monitor_10000" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE2" long-id="FAKE2:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="20" operation="start" operation_key="FAKE2:1_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="9">
+    <action_set>
+      <rsc_op id="20" operation="start" operation_key="FAKE2:1_start_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE2" long-id="FAKE2:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="24" operation="start" operation_key="FAKE2-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="10">
+    <action_set>
+      <rsc_op id="23" operation="monitor" operation_key="FAKE2:2_monitor_10000" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE2" long-id="FAKE2:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="22" operation="start" operation_key="FAKE2:2_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="11">
+    <action_set>
+      <rsc_op id="22" operation="start" operation_key="FAKE2:2_start_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE2" long-id="FAKE2:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="24" operation="start" operation_key="FAKE2-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="12" priority="1000000">
+    <action_set>
+      <pseudo_event id="25" operation="running" operation_key="FAKE2-clone_running_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="18" operation="start" operation_key="FAKE2_start_0" internal_operation_key="FAKE2:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="20" operation="start" operation_key="FAKE2:1_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="22" operation="start" operation_key="FAKE2:2_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="24" operation="start" operation_key="FAKE2-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="13">
+    <action_set>
+      <pseudo_event id="24" operation="start" operation_key="FAKE2-clone_start_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="2" operation="clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory" operation_key="clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="14">
+    <action_set>
+      <rsc_op id="29" operation="monitor" operation_key="FAKE3_monitor_10000" internal_operation_key="FAKE3:0_monitor_10000" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKE3" long-id="FAKE3:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="28" operation="start" operation_key="FAKE3_start_0" internal_operation_key="FAKE3:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="15">
+    <action_set>
+      <rsc_op id="28" operation="start" operation_key="FAKE3_start_0" internal_operation_key="FAKE3:0_start_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKE3" long-id="FAKE3:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="18" operation="start" operation_key="FAKE2_start_0" internal_operation_key="FAKE2:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="34" operation="start" operation_key="FAKE3-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="16">
+    <action_set>
+      <rsc_op id="31" operation="monitor" operation_key="FAKE3:1_monitor_10000" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE3" long-id="FAKE3:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="30" operation="start" operation_key="FAKE3:1_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="17">
+    <action_set>
+      <rsc_op id="30" operation="start" operation_key="FAKE3:1_start_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE3" long-id="FAKE3:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="20" operation="start" operation_key="FAKE2:1_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="34" operation="start" operation_key="FAKE3-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="18">
+    <action_set>
+      <rsc_op id="33" operation="monitor" operation_key="FAKE3:2_monitor_10000" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE3" long-id="FAKE3:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="32" operation="start" operation_key="FAKE3:2_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="19">
+    <action_set>
+      <rsc_op id="32" operation="start" operation_key="FAKE3:2_start_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE3" long-id="FAKE3:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="22" operation="start" operation_key="FAKE2:2_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="34" operation="start" operation_key="FAKE3-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="20" priority="1000000">
+    <action_set>
+      <pseudo_event id="35" operation="running" operation_key="FAKE3-clone_running_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="28" operation="start" operation_key="FAKE3_start_0" internal_operation_key="FAKE3:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="30" operation="start" operation_key="FAKE3:1_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="32" operation="start" operation_key="FAKE3:2_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="34" operation="start" operation_key="FAKE3-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="21">
+    <action_set>
+      <pseudo_event id="34" operation="start" operation_key="FAKE3-clone_start_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="25" operation="running" operation_key="FAKE2-clone_running_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="22">
+    <action_set>
+      <pseudo_event id="2" operation="clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory" operation_key="clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="10" operation="start" operation_key="FAKE1_start_0" internal_operation_key="FAKE1:0_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="12" operation="start" operation_key="FAKE1:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_interleave_start_two.scores b/pengine/test10/clone_min_interleave_start_two.scores
new file mode 100644
index 0000000000..d443c58984
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_two.scores
@@ -0,0 +1,67 @@
+Allocation scores:
+clone_color: FAKE1-clone allocation score on c7auto1: 0
+clone_color: FAKE1-clone allocation score on c7auto2: 0
+clone_color: FAKE1-clone allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:0 allocation score on c7auto1: 0
+clone_color: FAKE1:0 allocation score on c7auto2: 0
+clone_color: FAKE1:0 allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:1 allocation score on c7auto1: 0
+clone_color: FAKE1:1 allocation score on c7auto2: 0
+clone_color: FAKE1:1 allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:2 allocation score on c7auto1: 0
+clone_color: FAKE1:2 allocation score on c7auto2: 0
+clone_color: FAKE1:2 allocation score on c7auto3: -INFINITY
+clone_color: FAKE2-clone allocation score on c7auto1: 0
+clone_color: FAKE2-clone allocation score on c7auto2: 0
+clone_color: FAKE2-clone allocation score on c7auto3: 0
+clone_color: FAKE2:0 allocation score on c7auto1: 0
+clone_color: FAKE2:0 allocation score on c7auto2: 0
+clone_color: FAKE2:0 allocation score on c7auto3: 0
+clone_color: FAKE2:1 allocation score on c7auto1: 0
+clone_color: FAKE2:1 allocation score on c7auto2: 0
+clone_color: FAKE2:1 allocation score on c7auto3: 0
+clone_color: FAKE2:2 allocation score on c7auto1: 0
+clone_color: FAKE2:2 allocation score on c7auto2: 0
+clone_color: FAKE2:2 allocation score on c7auto3: 0
+clone_color: FAKE3-clone allocation score on c7auto1: 0
+clone_color: FAKE3-clone allocation score on c7auto2: 0
+clone_color: FAKE3-clone allocation score on c7auto3: 0
+clone_color: FAKE3:0 allocation score on c7auto1: 0
+clone_color: FAKE3:0 allocation score on c7auto2: 0
+clone_color: FAKE3:0 allocation score on c7auto3: 0
+clone_color: FAKE3:1 allocation score on c7auto1: 0
+clone_color: FAKE3:1 allocation score on c7auto2: 0
+clone_color: FAKE3:1 allocation score on c7auto3: 0
+clone_color: FAKE3:2 allocation score on c7auto1: 0
+clone_color: FAKE3:2 allocation score on c7auto2: 0
+clone_color: FAKE3:2 allocation score on c7auto3: 0
+native_color: FAKE1:0 allocation score on c7auto1: 0
+native_color: FAKE1:0 allocation score on c7auto2: 0
+native_color: FAKE1:0 allocation score on c7auto3: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto1: 0
+native_color: FAKE1:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto1: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto3: -INFINITY
+native_color: FAKE2:0 allocation score on c7auto1: 0
+native_color: FAKE2:0 allocation score on c7auto2: 0
+native_color: FAKE2:0 allocation score on c7auto3: 0
+native_color: FAKE2:1 allocation score on c7auto1: 0
+native_color: FAKE2:1 allocation score on c7auto2: 0
+native_color: FAKE2:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE2:2 allocation score on c7auto1: 0
+native_color: FAKE2:2 allocation score on c7auto2: -INFINITY
+native_color: FAKE2:2 allocation score on c7auto3: -INFINITY
+native_color: FAKE3:0 allocation score on c7auto1: 0
+native_color: FAKE3:0 allocation score on c7auto2: 0
+native_color: FAKE3:0 allocation score on c7auto3: 0
+native_color: FAKE3:1 allocation score on c7auto1: 0
+native_color: FAKE3:1 allocation score on c7auto2: 0
+native_color: FAKE3:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE3:2 allocation score on c7auto1: 0
+native_color: FAKE3:2 allocation score on c7auto2: -INFINITY
+native_color: FAKE3:2 allocation score on c7auto3: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
diff --git a/pengine/test10/clone_min_interleave_start_two.summary b/pengine/test10/clone_min_interleave_start_two.summary
new file mode 100644
index 0000000000..9f928f2b35
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_two.summary
@@ -0,0 +1,59 @@
+
+Current cluster status:
+Online: [ c7auto1 c7auto2 c7auto3 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKE1-clone [FAKE1]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE2-clone [FAKE2]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE3-clone [FAKE3]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+
+Transition Summary:
+ * Start   FAKE1:0	(c7auto2)
+ * Start   FAKE1:1	(c7auto1)
+ * Start   FAKE2:0	(c7auto3)
+ * Start   FAKE2:1	(c7auto2)
+ * Start   FAKE2:2	(c7auto1)
+ * Start   FAKE3:0	(c7auto3)
+ * Start   FAKE3:1	(c7auto2)
+ * Start   FAKE3:2	(c7auto1)
+
+Executing cluster transition:
+ * Pseudo action:   FAKE1-clone_start_0
+ * Resource action: FAKE1           start on c7auto2
+ * Resource action: FAKE1           start on c7auto1
+ * Pseudo action:   FAKE1-clone_running_0
+ * Pseudo action:   clone-one-or-more:order-FAKE1-clone-FAKE2-clone-mandatory
+ * Resource action: FAKE1           monitor=10000 on c7auto2
+ * Resource action: FAKE1           monitor=10000 on c7auto1
+ * Pseudo action:   FAKE2-clone_start_0
+ * Resource action: FAKE2           start on c7auto3
+ * Resource action: FAKE2           start on c7auto2
+ * Resource action: FAKE2           start on c7auto1
+ * Pseudo action:   FAKE2-clone_running_0
+ * Pseudo action:   FAKE3-clone_start_0
+ * Resource action: FAKE2           monitor=10000 on c7auto3
+ * Resource action: FAKE2           monitor=10000 on c7auto2
+ * Resource action: FAKE2           monitor=10000 on c7auto1
+ * Resource action: FAKE3           start on c7auto3
+ * Resource action: FAKE3           start on c7auto2
+ * Resource action: FAKE3           start on c7auto1
+ * Pseudo action:   FAKE3-clone_running_0
+ * Resource action: FAKE3           monitor=10000 on c7auto3
+ * Resource action: FAKE3           monitor=10000 on c7auto2
+ * Resource action: FAKE3           monitor=10000 on c7auto1
+
+Revised cluster status:
+Online: [ c7auto1 c7auto2 c7auto3 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKE1-clone [FAKE1]
+     Started: [ c7auto1 c7auto2 ]
+     Stopped: [ c7auto3 ]
+ Clone Set: FAKE2-clone [FAKE2]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE3-clone [FAKE3]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+
diff --git a/pengine/test10/clone_min_interleave_start_two.xml b/pengine/test10/clone_min_interleave_start_two.xml
new file mode 100644
index 0000000000..2507018b28
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_start_two.xml
@@ -0,0 +1,154 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="15" num_updates="0" admin_epoch="0" cib-last-written="Fri Jul 17 11:44:12 2015" update-origin="c7auto1" update-client="crm_resource" update-user="root" have-quorum="1" dc-uuid="3">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1"/>
+      <node id="2" uname="c7auto2"/>
+      <node id="3" uname="c7auto3"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKE1-clone">
+        <primitive class="ocf" id="FAKE1" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE1-instance_attributes"/>
+          <operations>
+            <op id="FAKE1-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE1-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE1-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE1-clone-meta">
+          <nvpair id="FAKE1-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+        <meta_attributes id="FAKE1-clone-meta_attributes"/>
+      </clone>
+      <clone id="FAKE2-clone">
+        <primitive class="ocf" id="FAKE2" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE2-instance_attributes"/>
+          <operations>
+            <op id="FAKE2-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE2-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE2-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE2-clone-meta">
+          <nvpair id="FAKE2-interleave" name="interleave" value="true"/>
+        </meta_attributes>
+      </clone>
+      <clone id="FAKE3-clone">
+        <primitive class="ocf" id="FAKE3" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE3-instance_attributes"/>
+          <operations>
+            <op id="FAKE3-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE3-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE3-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE3-clone-meta">
+          <nvpair id="FAKE3-interleave" name="interleave" value="true"/>
+        </meta_attributes>
+      </clone>
+    </resources>
+    <constraints>
+      <rsc_order first="FAKE1-clone" first-action="start" id="order-FAKE1-clone-FAKE2-clone-mandatory" then="FAKE2-clone" then-action="start"/>
+      <rsc_order first="FAKE2-clone" first-action="start" id="order-FAKE2-clone-FAKE3-clone-mandatory" then="FAKE3-clone" then-action="start"/>
+      <rsc_location id="cli-ban-FAKE1-clone-on-c7auto3" rsc="FAKE1-clone" role="Started" node="c7auto3" score="-INFINITY"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:7;8:4:7:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437146780" last-rc-change="1437146780" exec-time="998" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="18:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;18:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;15:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147006" exec-time="9" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="25:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;25:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;28:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="19" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="35:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;35:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="28" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="41:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;41:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="26" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:4:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;9:4:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437146782" last-rc-change="1437146782" exec-time="5" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;10:4:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437146783" exec-time="5" queue-time="1" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="19:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;19:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="34" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;17:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147007" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="27:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;27:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="30:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;30:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="21" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="37:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;37:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="43:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;43:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="28" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="6" queue-time="1" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:4:7:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:7;6:4:7:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437146780" last-rc-change="1437146780" exec-time="994" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;20:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="13:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;13:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147007" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="29:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;29:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="26:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;26:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="19" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="39:10:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;39:10:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="28" rc-code="0" op-status="0" interval="0" last-run="1437147852" last-rc-change="1437147852" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="39:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;39:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="26" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/clone_min_interleave_stop_one.dot b/pengine/test10/clone_min_interleave_stop_one.dot
new file mode 100644
index 0000000000..a66ceb67b1
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_one.dot
@@ -0,0 +1,18 @@
+ digraph "g" {
+"FAKE1-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1-clone_start_0" -> "FAKE1-clone_running_0" [ style = bold]
+"FAKE1-clone_start_0" -> "FAKE1_start_0 <none>" [ style = dashed]
+"FAKE1-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1-clone_stop_0" -> "FAKE1-clone_stopped_0" [ style = bold]
+"FAKE1-clone_stop_0" -> "FAKE1_stop_0 c7auto3" [ style = bold]
+"FAKE1-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1-clone_stopped_0" -> "FAKE1-clone_start_0" [ style = bold]
+"FAKE1-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1_start_0 <none>" -> "FAKE1-clone_running_0" [ style = dashed]
+"FAKE1_start_0 <none>" [ style=dashed color="red" fontcolor="black"]
+"FAKE1_stop_0 c7auto3" -> "FAKE1-clone_stopped_0" [ style = bold]
+"FAKE1_stop_0 c7auto3" -> "FAKE1_start_0 <none>" [ style = dashed]
+"FAKE1_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKE1_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/clone_min_interleave_stop_one.exp b/pengine/test10/clone_min_interleave_stop_one.exp
new file mode 100644
index 0000000000..31a15dacd7
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_one.exp
@@ -0,0 +1,74 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="19" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:0_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKE1" long-id="FAKE1:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="26" operation="stop" operation_key="FAKE1-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1" priority="1000000">
+    <action_set>
+      <pseudo_event id="27" operation="stopped" operation_key="FAKE1-clone_stopped_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="19" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="26" operation="stop" operation_key="FAKE1-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <pseudo_event id="26" operation="stop" operation_key="FAKE1-clone_stop_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="3" priority="1000000">
+    <action_set>
+      <pseudo_event id="25" operation="running" operation_key="FAKE1-clone_running_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="24" operation="start" operation_key="FAKE1-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4">
+    <action_set>
+      <pseudo_event id="24" operation="start" operation_key="FAKE1-clone_start_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="27" operation="stopped" operation_key="FAKE1-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <pseudo_event id="12" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="19" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_interleave_stop_one.scores b/pengine/test10/clone_min_interleave_stop_one.scores
new file mode 100644
index 0000000000..1a982304a0
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_one.scores
@@ -0,0 +1,67 @@
+Allocation scores:
+clone_color: FAKE1-clone allocation score on c7auto1: 0
+clone_color: FAKE1-clone allocation score on c7auto2: 0
+clone_color: FAKE1-clone allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:0 allocation score on c7auto1: 0
+clone_color: FAKE1:0 allocation score on c7auto2: 0
+clone_color: FAKE1:0 allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:1 allocation score on c7auto1: 1
+clone_color: FAKE1:1 allocation score on c7auto2: 0
+clone_color: FAKE1:1 allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:2 allocation score on c7auto1: 0
+clone_color: FAKE1:2 allocation score on c7auto2: 1
+clone_color: FAKE1:2 allocation score on c7auto3: -INFINITY
+clone_color: FAKE2-clone allocation score on c7auto1: 0
+clone_color: FAKE2-clone allocation score on c7auto2: 0
+clone_color: FAKE2-clone allocation score on c7auto3: 0
+clone_color: FAKE2:0 allocation score on c7auto1: 0
+clone_color: FAKE2:0 allocation score on c7auto2: 0
+clone_color: FAKE2:0 allocation score on c7auto3: 1
+clone_color: FAKE2:1 allocation score on c7auto1: 1
+clone_color: FAKE2:1 allocation score on c7auto2: 0
+clone_color: FAKE2:1 allocation score on c7auto3: 0
+clone_color: FAKE2:2 allocation score on c7auto1: 0
+clone_color: FAKE2:2 allocation score on c7auto2: 1
+clone_color: FAKE2:2 allocation score on c7auto3: 0
+clone_color: FAKE3-clone allocation score on c7auto1: 0
+clone_color: FAKE3-clone allocation score on c7auto2: 0
+clone_color: FAKE3-clone allocation score on c7auto3: 0
+clone_color: FAKE3:0 allocation score on c7auto1: 0
+clone_color: FAKE3:0 allocation score on c7auto2: 0
+clone_color: FAKE3:0 allocation score on c7auto3: 1
+clone_color: FAKE3:1 allocation score on c7auto1: 1
+clone_color: FAKE3:1 allocation score on c7auto2: 0
+clone_color: FAKE3:1 allocation score on c7auto3: 0
+clone_color: FAKE3:2 allocation score on c7auto1: 0
+clone_color: FAKE3:2 allocation score on c7auto2: 1
+clone_color: FAKE3:2 allocation score on c7auto3: 0
+native_color: FAKE1:0 allocation score on c7auto1: -INFINITY
+native_color: FAKE1:0 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:0 allocation score on c7auto3: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto1: 1
+native_color: FAKE1:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto1: 0
+native_color: FAKE1:2 allocation score on c7auto2: 1
+native_color: FAKE1:2 allocation score on c7auto3: -INFINITY
+native_color: FAKE2:0 allocation score on c7auto1: 0
+native_color: FAKE2:0 allocation score on c7auto2: 0
+native_color: FAKE2:0 allocation score on c7auto3: 1
+native_color: FAKE2:1 allocation score on c7auto1: 1
+native_color: FAKE2:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE2:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE2:2 allocation score on c7auto1: 0
+native_color: FAKE2:2 allocation score on c7auto2: 1
+native_color: FAKE2:2 allocation score on c7auto3: -INFINITY
+native_color: FAKE3:0 allocation score on c7auto1: 0
+native_color: FAKE3:0 allocation score on c7auto2: 0
+native_color: FAKE3:0 allocation score on c7auto3: 1
+native_color: FAKE3:1 allocation score on c7auto1: 1
+native_color: FAKE3:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE3:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE3:2 allocation score on c7auto1: 0
+native_color: FAKE3:2 allocation score on c7auto2: 1
+native_color: FAKE3:2 allocation score on c7auto3: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
diff --git a/pengine/test10/clone_min_interleave_stop_one.summary b/pengine/test10/clone_min_interleave_stop_one.summary
new file mode 100644
index 0000000000..9280b7e8b9
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_one.summary
@@ -0,0 +1,35 @@
+
+Current cluster status:
+Online: [ c7auto1 c7auto2 c7auto3 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKE1-clone [FAKE1]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE2-clone [FAKE2]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE3-clone [FAKE3]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+
+Transition Summary:
+ * Stop    FAKE1:0	(c7auto3)
+
+Executing cluster transition:
+ * Pseudo action:   FAKE1-clone_stop_0
+ * Resource action: FAKE1           stop on c7auto3
+ * Pseudo action:   FAKE1-clone_stopped_0
+ * Pseudo action:   FAKE1-clone_start_0
+ * Pseudo action:   all_stopped
+ * Pseudo action:   FAKE1-clone_running_0
+
+Revised cluster status:
+Online: [ c7auto1 c7auto2 c7auto3 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKE1-clone [FAKE1]
+     Started: [ c7auto1 c7auto2 ]
+     Stopped: [ c7auto3 ]
+ Clone Set: FAKE2-clone [FAKE2]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE3-clone [FAKE3]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+
diff --git a/pengine/test10/clone_min_interleave_stop_one.xml b/pengine/test10/clone_min_interleave_stop_one.xml
new file mode 100644
index 0000000000..31db5f3206
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_one.xml
@@ -0,0 +1,153 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="12" num_updates="0" admin_epoch="0" cib-last-written="Fri Jul 17 11:30:45 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="3">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1"/>
+      <node id="2" uname="c7auto2"/>
+      <node id="3" uname="c7auto3"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKE1-clone">
+        <primitive class="ocf" id="FAKE1" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE1-instance_attributes"/>
+          <operations>
+            <op id="FAKE1-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE1-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE1-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE1-clone-meta">
+          <nvpair id="FAKE1-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+      </clone>
+      <clone id="FAKE2-clone">
+        <primitive class="ocf" id="FAKE2" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE2-instance_attributes"/>
+          <operations>
+            <op id="FAKE2-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE2-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE2-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE2-clone-meta">
+          <nvpair id="FAKE2-interleave" name="interleave" value="true"/>
+        </meta_attributes>
+      </clone>
+      <clone id="FAKE3-clone">
+        <primitive class="ocf" id="FAKE3" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE3-instance_attributes"/>
+          <operations>
+            <op id="FAKE3-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE3-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE3-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE3-clone-meta">
+          <nvpair id="FAKE3-interleave" name="interleave" value="true"/>
+        </meta_attributes>
+      </clone>
+    </resources>
+    <constraints>
+      <rsc_order first="FAKE1-clone" first-action="start" id="order-FAKE1-clone-FAKE2-clone-mandatory" then="FAKE2-clone" then-action="start"/>
+      <rsc_order first="FAKE2-clone" first-action="start" id="order-FAKE2-clone-FAKE3-clone-mandatory" then="FAKE3-clone" then-action="start"/>
+      <rsc_location id="cli-ban-FAKE1-clone-on-c7auto3" rsc="FAKE1-clone" role="Started" node="c7auto3" score="-INFINITY"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:7;8:4:7:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437146780" last-rc-change="1437146780" exec-time="998" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;14:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437147006" last-rc-change="1437147006" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;15:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147006" exec-time="9" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="27:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;27:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437147019" last-rc-change="1437147019" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;28:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="19" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="40:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;40:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="25" rc-code="0" op-status="0" interval="0" last-run="1437147024" last-rc-change="1437147024" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="41:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;41:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="26" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:4:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;9:4:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437146782" last-rc-change="1437146782" exec-time="5" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;10:4:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437146783" exec-time="5" queue-time="1" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;16:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="13" rc-code="0" op-status="0" interval="0" last-run="1437147007" last-rc-change="1437147007" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;17:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147007" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="29:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;29:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="20" rc-code="0" op-status="0" interval="0" last-run="1437147019" last-rc-change="1437147019" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="30:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;30:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="21" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="42:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;42:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="27" rc-code="0" op-status="0" interval="0" last-run="1437147024" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="43:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;43:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="28" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="6" queue-time="1" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:4:7:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:7;6:4:7:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437146780" last-rc-change="1437146780" exec-time="994" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;12:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437147007" last-rc-change="1437147007" exec-time="6" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="13:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;13:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147007" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="25:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;25:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437147019" last-rc-change="1437147019" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="26:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;26:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="19" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="38:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;38:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="25" rc-code="0" op-status="0" interval="0" last-run="1437147024" last-rc-change="1437147024" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="39:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;39:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="26" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/clone_min_interleave_stop_two.dot b/pengine/test10/clone_min_interleave_stop_two.dot
new file mode 100644
index 0000000000..73f60ddc61
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_two.dot
@@ -0,0 +1,108 @@
+ digraph "g" {
+"FAKE1-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1-clone_start_0" -> "FAKE1-clone_running_0" [ style = bold]
+"FAKE1-clone_start_0" -> "FAKE1_start_0 <none>" [ style = dashed]
+"FAKE1-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1-clone_stop_0" -> "FAKE1-clone_stopped_0" [ style = bold]
+"FAKE1-clone_stop_0" -> "FAKE1_stop_0 c7auto2" [ style = bold]
+"FAKE1-clone_stop_0" -> "FAKE1_stop_0 c7auto3" [ style = bold]
+"FAKE1-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1-clone_stopped_0" -> "FAKE1-clone_start_0" [ style = bold]
+"FAKE1-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE1_start_0 <none>" -> "FAKE1-clone_running_0" [ style = dashed]
+"FAKE1_start_0 <none>" [ style=dashed color="red" fontcolor="black"]
+"FAKE1_stop_0 c7auto2" -> "FAKE1-clone_stopped_0" [ style = bold]
+"FAKE1_stop_0 c7auto2" -> "FAKE1_start_0 <none>" [ style = dashed]
+"FAKE1_stop_0 c7auto2" -> "all_stopped" [ style = bold]
+"FAKE1_stop_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE1_stop_0 c7auto3" -> "FAKE1-clone_stopped_0" [ style = bold]
+"FAKE1_stop_0 c7auto3" -> "FAKE1_start_0 <none>" [ style = dashed]
+"FAKE1_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKE1_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKE2-clone_running_0" -> "FAKE3-clone_start_0" [ style = dashed]
+"FAKE2-clone_running_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKE2-clone_start_0" -> "FAKE2-clone_running_0" [ style = dashed]
+"FAKE2-clone_start_0" -> "FAKE2_start_0 c7auto1" [ style = dashed]
+"FAKE2-clone_start_0" -> "FAKE2_start_0 c7auto2" [ style = dashed]
+"FAKE2-clone_start_0" -> "FAKE2_start_0 c7auto3" [ style = dashed]
+"FAKE2-clone_start_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKE2-clone_stop_0" -> "FAKE2-clone_stopped_0" [ style = bold]
+"FAKE2-clone_stop_0" -> "FAKE2_stop_0 c7auto1" [ style = bold]
+"FAKE2-clone_stop_0" -> "FAKE2_stop_0 c7auto2" [ style = bold]
+"FAKE2-clone_stop_0" -> "FAKE2_stop_0 c7auto3" [ style = bold]
+"FAKE2-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE2-clone_stopped_0" -> "FAKE1-clone_stop_0" [ style = bold]
+"FAKE2-clone_stopped_0" -> "FAKE2-clone_start_0" [ style = dashed]
+"FAKE2-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE2_monitor_10000 c7auto1" [ style=dashed color="red" fontcolor="black"]
+"FAKE2_monitor_10000 c7auto2" [ style=dashed color="red" fontcolor="black"]
+"FAKE2_monitor_10000 c7auto3" [ style=dashed color="red" fontcolor="black"]
+"FAKE2_start_0 c7auto1" -> "FAKE2-clone_running_0" [ style = dashed]
+"FAKE2_start_0 c7auto1" -> "FAKE2_monitor_10000 c7auto1" [ style = dashed]
+"FAKE2_start_0 c7auto1" -> "FAKE3_start_0 c7auto1" [ style = dashed]
+"FAKE2_start_0 c7auto1" [ style=dashed color="red" fontcolor="black"]
+"FAKE2_start_0 c7auto2" -> "FAKE2-clone_running_0" [ style = dashed]
+"FAKE2_start_0 c7auto2" -> "FAKE2_monitor_10000 c7auto2" [ style = dashed]
+"FAKE2_start_0 c7auto2" -> "FAKE3_start_0 c7auto2" [ style = dashed]
+"FAKE2_start_0 c7auto2" [ style=dashed color="red" fontcolor="black"]
+"FAKE2_start_0 c7auto3" -> "FAKE2-clone_running_0" [ style = dashed]
+"FAKE2_start_0 c7auto3" -> "FAKE2_monitor_10000 c7auto3" [ style = dashed]
+"FAKE2_start_0 c7auto3" -> "FAKE3_start_0 c7auto3" [ style = dashed]
+"FAKE2_start_0 c7auto3" [ style=dashed color="red" fontcolor="black"]
+"FAKE2_stop_0 c7auto1" -> "FAKE2-clone_stopped_0" [ style = bold]
+"FAKE2_stop_0 c7auto1" -> "FAKE2_start_0 c7auto1" [ style = dashed]
+"FAKE2_stop_0 c7auto1" -> "all_stopped" [ style = bold]
+"FAKE2_stop_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE2_stop_0 c7auto2" -> "FAKE1_stop_0 c7auto2" [ style = bold]
+"FAKE2_stop_0 c7auto2" -> "FAKE2-clone_stopped_0" [ style = bold]
+"FAKE2_stop_0 c7auto2" -> "FAKE2_start_0 c7auto2" [ style = dashed]
+"FAKE2_stop_0 c7auto2" -> "all_stopped" [ style = bold]
+"FAKE2_stop_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE2_stop_0 c7auto3" -> "FAKE1_stop_0 c7auto3" [ style = bold]
+"FAKE2_stop_0 c7auto3" -> "FAKE2-clone_stopped_0" [ style = bold]
+"FAKE2_stop_0 c7auto3" -> "FAKE2_start_0 c7auto3" [ style = dashed]
+"FAKE2_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKE2_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKE3-clone_running_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKE3-clone_start_0" -> "FAKE3-clone_running_0" [ style = dashed]
+"FAKE3-clone_start_0" -> "FAKE3_start_0 c7auto1" [ style = dashed]
+"FAKE3-clone_start_0" -> "FAKE3_start_0 c7auto2" [ style = dashed]
+"FAKE3-clone_start_0" -> "FAKE3_start_0 c7auto3" [ style = dashed]
+"FAKE3-clone_start_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKE3-clone_stop_0" -> "FAKE3-clone_stopped_0" [ style = bold]
+"FAKE3-clone_stop_0" -> "FAKE3_stop_0 c7auto1" [ style = bold]
+"FAKE3-clone_stop_0" -> "FAKE3_stop_0 c7auto2" [ style = bold]
+"FAKE3-clone_stop_0" -> "FAKE3_stop_0 c7auto3" [ style = bold]
+"FAKE3-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE3-clone_stopped_0" -> "FAKE2-clone_stop_0" [ style = bold]
+"FAKE3-clone_stopped_0" -> "FAKE3-clone_start_0" [ style = dashed]
+"FAKE3-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKE3_monitor_10000 c7auto1" [ style=dashed color="red" fontcolor="black"]
+"FAKE3_monitor_10000 c7auto2" [ style=dashed color="red" fontcolor="black"]
+"FAKE3_monitor_10000 c7auto3" [ style=dashed color="red" fontcolor="black"]
+"FAKE3_start_0 c7auto1" -> "FAKE3-clone_running_0" [ style = dashed]
+"FAKE3_start_0 c7auto1" -> "FAKE3_monitor_10000 c7auto1" [ style = dashed]
+"FAKE3_start_0 c7auto1" [ style=dashed color="red" fontcolor="black"]
+"FAKE3_start_0 c7auto2" -> "FAKE3-clone_running_0" [ style = dashed]
+"FAKE3_start_0 c7auto2" -> "FAKE3_monitor_10000 c7auto2" [ style = dashed]
+"FAKE3_start_0 c7auto2" [ style=dashed color="red" fontcolor="black"]
+"FAKE3_start_0 c7auto3" -> "FAKE3-clone_running_0" [ style = dashed]
+"FAKE3_start_0 c7auto3" -> "FAKE3_monitor_10000 c7auto3" [ style = dashed]
+"FAKE3_start_0 c7auto3" [ style=dashed color="red" fontcolor="black"]
+"FAKE3_stop_0 c7auto1" -> "FAKE2_stop_0 c7auto1" [ style = bold]
+"FAKE3_stop_0 c7auto1" -> "FAKE3-clone_stopped_0" [ style = bold]
+"FAKE3_stop_0 c7auto1" -> "FAKE3_start_0 c7auto1" [ style = dashed]
+"FAKE3_stop_0 c7auto1" -> "all_stopped" [ style = bold]
+"FAKE3_stop_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKE3_stop_0 c7auto2" -> "FAKE2_stop_0 c7auto2" [ style = bold]
+"FAKE3_stop_0 c7auto2" -> "FAKE3-clone_stopped_0" [ style = bold]
+"FAKE3_stop_0 c7auto2" -> "FAKE3_start_0 c7auto2" [ style = dashed]
+"FAKE3_stop_0 c7auto2" -> "all_stopped" [ style = bold]
+"FAKE3_stop_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE3_stop_0 c7auto3" -> "FAKE2_stop_0 c7auto3" [ style = bold]
+"FAKE3_stop_0 c7auto3" -> "FAKE3-clone_stopped_0" [ style = bold]
+"FAKE3_stop_0 c7auto3" -> "FAKE3_start_0 c7auto3" [ style = dashed]
+"FAKE3_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKE3_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/clone_min_interleave_stop_two.exp b/pengine/test10/clone_min_interleave_stop_two.exp
new file mode 100644
index 0000000000..62fe1e61f7
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_two.exp
@@ -0,0 +1,270 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="19" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:0_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKE1" long-id="FAKE1:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="25" operation="stop" operation_key="FAKE1-clone_stop_0"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="27" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="22" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:2_stop_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE1" long-id="FAKE1:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="25" operation="stop" operation_key="FAKE1-clone_stop_0"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="31" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:2_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2" priority="1000000">
+    <action_set>
+      <pseudo_event id="26" operation="stopped" operation_key="FAKE1-clone_stopped_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="19" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="22" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:2_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="25" operation="stop" operation_key="FAKE1-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <pseudo_event id="25" operation="stop" operation_key="FAKE1-clone_stop_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="36" operation="stopped" operation_key="FAKE2-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4" priority="1000000">
+    <action_set>
+      <pseudo_event id="24" operation="running" operation_key="FAKE1-clone_running_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="23" operation="start" operation_key="FAKE1-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <pseudo_event id="23" operation="start" operation_key="FAKE1-clone_start_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="26" operation="stopped" operation_key="FAKE1-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="6">
+    <action_set>
+      <rsc_op id="27" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:0_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKE2" long-id="FAKE2:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="35" operation="stop" operation_key="FAKE2-clone_stop_0"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="37" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <rsc_op id="29" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:1_stop_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE2" long-id="FAKE2:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="35" operation="stop" operation_key="FAKE2-clone_stop_0"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="39" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:1_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <rsc_op id="31" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:2_stop_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE2" long-id="FAKE2:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="35" operation="stop" operation_key="FAKE2-clone_stop_0"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="41" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:2_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="9" priority="1000000">
+    <action_set>
+      <pseudo_event id="36" operation="stopped" operation_key="FAKE2-clone_stopped_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="27" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="29" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:1_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="31" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:2_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="35" operation="stop" operation_key="FAKE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="10">
+    <action_set>
+      <pseudo_event id="35" operation="stop" operation_key="FAKE2-clone_stop_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="46" operation="stopped" operation_key="FAKE3-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="11">
+    <action_set>
+      <rsc_op id="37" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:0_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKE3" long-id="FAKE3:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="45" operation="stop" operation_key="FAKE3-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="12">
+    <action_set>
+      <rsc_op id="39" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:1_stop_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKE3" long-id="FAKE3:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="45" operation="stop" operation_key="FAKE3-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="13">
+    <action_set>
+      <rsc_op id="41" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:2_stop_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKE3" long-id="FAKE3:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="45" operation="stop" operation_key="FAKE3-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="14" priority="1000000">
+    <action_set>
+      <pseudo_event id="46" operation="stopped" operation_key="FAKE3-clone_stopped_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="37" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="39" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:1_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="41" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:2_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="45" operation="stop" operation_key="FAKE3-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="15">
+    <action_set>
+      <pseudo_event id="45" operation="stop" operation_key="FAKE3-clone_stop_0">
+        <attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="16">
+    <action_set>
+      <pseudo_event id="12" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="19" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="22" operation="stop" operation_key="FAKE1_stop_0" internal_operation_key="FAKE1:2_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="27" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="29" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:1_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="31" operation="stop" operation_key="FAKE2_stop_0" internal_operation_key="FAKE2:2_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="37" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="39" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:1_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="41" operation="stop" operation_key="FAKE3_stop_0" internal_operation_key="FAKE3:2_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_interleave_stop_two.scores b/pengine/test10/clone_min_interleave_stop_two.scores
new file mode 100644
index 0000000000..ee7df92449
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_two.scores
@@ -0,0 +1,67 @@
+Allocation scores:
+clone_color: FAKE1-clone allocation score on c7auto1: 0
+clone_color: FAKE1-clone allocation score on c7auto2: -INFINITY
+clone_color: FAKE1-clone allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:0 allocation score on c7auto1: 0
+clone_color: FAKE1:0 allocation score on c7auto2: -INFINITY
+clone_color: FAKE1:0 allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:1 allocation score on c7auto1: 1
+clone_color: FAKE1:1 allocation score on c7auto2: -INFINITY
+clone_color: FAKE1:1 allocation score on c7auto3: -INFINITY
+clone_color: FAKE1:2 allocation score on c7auto1: 0
+clone_color: FAKE1:2 allocation score on c7auto2: -INFINITY
+clone_color: FAKE1:2 allocation score on c7auto3: -INFINITY
+clone_color: FAKE2-clone allocation score on c7auto1: 0
+clone_color: FAKE2-clone allocation score on c7auto2: 0
+clone_color: FAKE2-clone allocation score on c7auto3: 0
+clone_color: FAKE2:0 allocation score on c7auto1: 0
+clone_color: FAKE2:0 allocation score on c7auto2: 0
+clone_color: FAKE2:0 allocation score on c7auto3: 1
+clone_color: FAKE2:1 allocation score on c7auto1: 1
+clone_color: FAKE2:1 allocation score on c7auto2: 0
+clone_color: FAKE2:1 allocation score on c7auto3: 0
+clone_color: FAKE2:2 allocation score on c7auto1: 0
+clone_color: FAKE2:2 allocation score on c7auto2: 1
+clone_color: FAKE2:2 allocation score on c7auto3: 0
+clone_color: FAKE3-clone allocation score on c7auto1: 0
+clone_color: FAKE3-clone allocation score on c7auto2: 0
+clone_color: FAKE3-clone allocation score on c7auto3: 0
+clone_color: FAKE3:0 allocation score on c7auto1: 0
+clone_color: FAKE3:0 allocation score on c7auto2: 0
+clone_color: FAKE3:0 allocation score on c7auto3: 1
+clone_color: FAKE3:1 allocation score on c7auto1: 1
+clone_color: FAKE3:1 allocation score on c7auto2: 0
+clone_color: FAKE3:1 allocation score on c7auto3: 0
+clone_color: FAKE3:2 allocation score on c7auto1: 0
+clone_color: FAKE3:2 allocation score on c7auto2: 1
+clone_color: FAKE3:2 allocation score on c7auto3: 0
+native_color: FAKE1:0 allocation score on c7auto1: -INFINITY
+native_color: FAKE1:0 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:0 allocation score on c7auto3: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto1: 1
+native_color: FAKE1:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto1: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto2: -INFINITY
+native_color: FAKE1:2 allocation score on c7auto3: -INFINITY
+native_color: FAKE2:0 allocation score on c7auto1: 0
+native_color: FAKE2:0 allocation score on c7auto2: -INFINITY
+native_color: FAKE2:0 allocation score on c7auto3: 1
+native_color: FAKE2:1 allocation score on c7auto1: 1
+native_color: FAKE2:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE2:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE2:2 allocation score on c7auto1: 0
+native_color: FAKE2:2 allocation score on c7auto2: 1
+native_color: FAKE2:2 allocation score on c7auto3: 0
+native_color: FAKE3:0 allocation score on c7auto1: 0
+native_color: FAKE3:0 allocation score on c7auto2: -INFINITY
+native_color: FAKE3:0 allocation score on c7auto3: 1
+native_color: FAKE3:1 allocation score on c7auto1: 1
+native_color: FAKE3:1 allocation score on c7auto2: -INFINITY
+native_color: FAKE3:1 allocation score on c7auto3: -INFINITY
+native_color: FAKE3:2 allocation score on c7auto1: 0
+native_color: FAKE3:2 allocation score on c7auto2: 1
+native_color: FAKE3:2 allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
diff --git a/pengine/test10/clone_min_interleave_stop_two.summary b/pengine/test10/clone_min_interleave_stop_two.summary
new file mode 100644
index 0000000000..fb28e0d3aa
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_two.summary
@@ -0,0 +1,53 @@
+
+Current cluster status:
+Online: [ c7auto1 c7auto2 c7auto3 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKE1-clone [FAKE1]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE2-clone [FAKE2]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE3-clone [FAKE3]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+
+Transition Summary:
+ * Stop    FAKE1:0	(c7auto3)
+ * Stop    FAKE1:2	(c7auto2)
+ * Stop    FAKE2:0	(Started c7auto3)
+ * Stop    FAKE2:1	(Started c7auto1)
+ * Stop    FAKE2:2	(Started c7auto2)
+ * Stop    FAKE3:0	(Started c7auto3)
+ * Stop    FAKE3:1	(Started c7auto1)
+ * Stop    FAKE3:2	(Started c7auto2)
+
+Executing cluster transition:
+ * Pseudo action:   FAKE3-clone_stop_0
+ * Resource action: FAKE3           stop on c7auto3
+ * Resource action: FAKE3           stop on c7auto1
+ * Resource action: FAKE3           stop on c7auto2
+ * Pseudo action:   FAKE3-clone_stopped_0
+ * Pseudo action:   FAKE2-clone_stop_0
+ * Resource action: FAKE2           stop on c7auto3
+ * Resource action: FAKE2           stop on c7auto1
+ * Resource action: FAKE2           stop on c7auto2
+ * Pseudo action:   FAKE2-clone_stopped_0
+ * Pseudo action:   FAKE1-clone_stop_0
+ * Resource action: FAKE1           stop on c7auto3
+ * Resource action: FAKE1           stop on c7auto2
+ * Pseudo action:   FAKE1-clone_stopped_0
+ * Pseudo action:   FAKE1-clone_start_0
+ * Pseudo action:   all_stopped
+ * Pseudo action:   FAKE1-clone_running_0
+
+Revised cluster status:
+Online: [ c7auto1 c7auto2 c7auto3 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKE1-clone [FAKE1]
+     Started: [ c7auto1 ]
+     Stopped: [ c7auto2 c7auto3 ]
+ Clone Set: FAKE2-clone [FAKE2]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+ Clone Set: FAKE3-clone [FAKE3]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+
diff --git a/pengine/test10/clone_min_interleave_stop_two.xml b/pengine/test10/clone_min_interleave_stop_two.xml
new file mode 100644
index 0000000000..32c2b3be43
--- /dev/null
+++ b/pengine/test10/clone_min_interleave_stop_two.xml
@@ -0,0 +1,154 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="13" num_updates="0" admin_epoch="0" cib-last-written="Fri Jul 17 11:30:45 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="3">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1"/>
+      <node id="2" uname="c7auto2"/>
+      <node id="3" uname="c7auto3"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKE1-clone">
+        <primitive class="ocf" id="FAKE1" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE1-instance_attributes"/>
+          <operations>
+            <op id="FAKE1-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE1-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE1-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE1-clone-meta">
+          <nvpair id="FAKE1-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+      </clone>
+      <clone id="FAKE2-clone">
+        <primitive class="ocf" id="FAKE2" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE2-instance_attributes"/>
+          <operations>
+            <op id="FAKE2-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE2-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE2-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE2-clone-meta">
+          <nvpair id="FAKE2-interleave" name="interleave" value="true"/>
+        </meta_attributes>
+      </clone>
+      <clone id="FAKE3-clone">
+        <primitive class="ocf" id="FAKE3" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKE3-instance_attributes"/>
+          <operations>
+            <op id="FAKE3-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKE3-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKE3-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKE3-clone-meta">
+          <nvpair id="FAKE3-interleave" name="interleave" value="true"/>
+        </meta_attributes>
+      </clone>
+    </resources>
+    <constraints>
+      <rsc_order first="FAKE1-clone" first-action="start" id="order-FAKE1-clone-FAKE2-clone-mandatory" then="FAKE2-clone" then-action="start"/>
+      <rsc_order first="FAKE2-clone" first-action="start" id="order-FAKE2-clone-FAKE3-clone-mandatory" then="FAKE3-clone" then-action="start"/>
+      <rsc_location id="cli-ban-FAKE1-clone-on-c7auto3" rsc="FAKE1-clone" role="Started" node="c7auto3" score="-INFINITY"/>
+      <rsc_location id="cli-ban-FAKE1-clone-on-c7auto2" rsc="FAKE1-clone" role="Started" node="c7auto2" score="-INFINITY"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:7;8:4:7:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437146780" last-rc-change="1437146780" exec-time="998" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;14:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437147006" last-rc-change="1437147006" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;15:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147006" exec-time="9" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="27:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;27:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437147019" last-rc-change="1437147019" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;28:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="19" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="40:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;40:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="25" rc-code="0" op-status="0" interval="0" last-run="1437147024" last-rc-change="1437147024" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="41:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;41:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto3" call-id="26" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:4:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;9:4:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437146782" last-rc-change="1437146782" exec-time="5" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;10:4:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437146783" exec-time="5" queue-time="1" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;16:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="13" rc-code="0" op-status="0" interval="0" last-run="1437147007" last-rc-change="1437147007" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;17:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147007" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="29:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;29:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="20" rc-code="0" op-status="0" interval="0" last-run="1437147019" last-rc-change="1437147019" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="30:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;30:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="21" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="42:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;42:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="27" rc-code="0" op-status="0" interval="0" last-run="1437147024" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="43:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;43:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto1" call-id="28" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="6" queue-time="1" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:4:7:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:7;6:4:7:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437146780" last-rc-change="1437146780" exec-time="994" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE1" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE1_last_0" operation_key="FAKE1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;12:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437147007" last-rc-change="1437147007" exec-time="6" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE1_monitor_10000" operation_key="FAKE1_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="13:5:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;13:5:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147007" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE2_last_0" operation_key="FAKE2_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="25:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;25:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437147019" last-rc-change="1437147019" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE2_monitor_10000" operation_key="FAKE2_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="26:6:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;26:6:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="19" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147019" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE3" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE3_last_0" operation_key="FAKE3_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="38:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;38:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="25" rc-code="0" op-status="0" interval="0" last-run="1437147024" last-rc-change="1437147024" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE3_monitor_10000" operation_key="FAKE3_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="39:7:0:9d56c099-7067-4908-9f99-89a103eff57b" transition-magic="0:0;39:7:0:9d56c099-7067-4908-9f99-89a103eff57b" on_node="c7auto2" call-id="26" rc-code="0" op-status="0" interval="10000" last-rc-change="1437147024" exec-time="8" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/clone_min_start_one.dot b/pengine/test10/clone_min_start_one.dot
new file mode 100644
index 0000000000..3940361555
--- /dev/null
+++ b/pengine/test10/clone_min_start_one.dot
@@ -0,0 +1,20 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 c7auto3" [ style = bold]
+"FAKECLONE-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE_monitor_10000 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_start_0 c7auto3" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE_start_0 c7auto3" -> "FAKECLONE_monitor_10000 c7auto3" [ style = bold]
+"FAKECLONE_start_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKE_monitor_10000 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKE_start_0 c7auto4" -> "FAKE_monitor_10000 c7auto4" [ style = dashed]
+"FAKE_start_0 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+"shooter_monitor_60000 c7auto3" [ style=bold color="green" fontcolor="black"]
+"shooter_start_0 c7auto3" -> "shooter_monitor_60000 c7auto3" [ style = bold]
+"shooter_start_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"shooter_stop_0 c7auto1" -> "all_stopped" [ style = bold]
+"shooter_stop_0 c7auto1" -> "shooter_start_0 c7auto3" [ style = bold]
+"shooter_stop_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+}
diff --git a/pengine/test10/clone_min_start_one.exp b/pengine/test10/clone_min_start_one.exp
new file mode 100644
index 0000000000..a6868f658b
--- /dev/null
+++ b/pengine/test10/clone_min_start_one.exp
@@ -0,0 +1,98 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="11" operation="monitor" operation_key="shooter_monitor_60000" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_interval="60000" CRM_meta_name="monitor" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="10" operation="start" operation_key="shooter_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="10" operation="start" operation_key="shooter_start_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="9" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="9" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <rsc_op id="13" operation="monitor" operation_key="FAKECLONE_monitor_10000" internal_operation_key="FAKECLONE:0_monitor_10000" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="12" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4">
+    <action_set>
+      <rsc_op id="12" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="14" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5" priority="1000000">
+    <action_set>
+      <pseudo_event id="15" operation="running" operation_key="FAKECLONE-clone_running_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="12" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="14" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="6">
+    <action_set>
+      <pseudo_event id="14" operation="start" operation_key="FAKECLONE-clone_start_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <pseudo_event id="3" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="9" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_start_one.scores b/pengine/test10/clone_min_start_one.scores
new file mode 100644
index 0000000000..668689e4bf
--- /dev/null
+++ b/pengine/test10/clone_min_start_one.scores
@@ -0,0 +1,45 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:0 allocation score on c7auto1: 0
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 0
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 0
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKE allocation score on c7auto1: -INFINITY
+native_color: FAKE allocation score on c7auto2: -INFINITY
+native_color: FAKE allocation score on c7auto3: -INFINITY
+native_color: FAKE allocation score on c7auto4: 0
+native_color: FAKECLONE:0 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto3: 0
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/clone_min_start_one.summary b/pengine/test10/clone_min_start_one.summary
new file mode 100644
index 0000000000..ee33e01916
--- /dev/null
+++ b/pengine/test10/clone_min_start_one.summary
@@ -0,0 +1,37 @@
+
+Current cluster status:
+Node c7auto1 (1): standby
+Node c7auto2 (2): standby
+Online: [ c7auto3 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Stopped: [ c7auto1 c7auto2 c7auto3 c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Stopped
+
+Transition Summary:
+ * Move    shooter	(Started c7auto1 -> c7auto3)
+ * Start   FAKECLONE:0	(c7auto3)
+ * Start   FAKE	(c7auto4 - blocked)
+
+Executing cluster transition:
+ * Resource action: shooter         stop on c7auto1
+ * Pseudo action:   FAKECLONE-clone_start_0
+ * Pseudo action:   all_stopped
+ * Resource action: shooter         start on c7auto3
+ * Resource action: FAKECLONE       start on c7auto3
+ * Pseudo action:   FAKECLONE-clone_running_0
+ * Resource action: shooter         monitor=60000 on c7auto3
+ * Resource action: FAKECLONE       monitor=10000 on c7auto3
+
+Revised cluster status:
+Node c7auto1 (1): standby
+Node c7auto2 (2): standby
+Online: [ c7auto3 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto3
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto3 ]
+     Stopped: [ c7auto1 c7auto2 c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Stopped
+
diff --git a/pengine/test10/clone_min_start_one.xml b/pengine/test10/clone_min_start_one.xml
new file mode 100644
index 0000000000..dfb9379f3c
--- /dev/null
+++ b/pengine/test10/clone_min_start_one.xml
@@ -0,0 +1,155 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="17" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 15:37:54 2015" update-origin="c7auto1" update-client="crm_resource" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1">
+        <instance_attributes id="nodes-1">
+          <nvpair id="nodes-1-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="2" uname="c7auto2">
+        <instance_attributes id="nodes-2">
+          <nvpair id="nodes-2-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="3" uname="c7auto3"/>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+        <meta_attributes id="FAKECLONE-clone-meta_attributes"/>
+      </clone>
+      <primitive class="ocf" id="FAKE" provider="heartbeat" type="Dummy">
+        <instance_attributes id="FAKE-instance_attributes"/>
+        <operations>
+          <op id="FAKE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+          <op id="FAKE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+          <op id="FAKE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+        </operations>
+      </primitive>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto1--INFINITY" node="c7auto1" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto2--INFINITY" node="c7auto2" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto3--INFINITY" node="c7auto3" rsc="FAKE" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKE-mandatory" then="FAKE" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="20" rc-code="0" op-status="0" interval="0" last-run="1437075474" last-rc-change="1437075474" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="18" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="13" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="12" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074828" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074870" last-rc-change="1437074870" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="21:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;21:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="22" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="6" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE_monitor_10000" operation_key="FAKE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="20" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/clone_min_start_two.dot b/pengine/test10/clone_min_start_two.dot
new file mode 100644
index 0000000000..3fe00627be
--- /dev/null
+++ b/pengine/test10/clone_min_start_two.dot
@@ -0,0 +1,22 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE:1_start_0 c7auto1" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 c7auto3" [ style = bold]
+"FAKECLONE-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE:1_monitor_10000 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE:1_start_0 c7auto1" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE:1_start_0 c7auto1" -> "FAKECLONE:1_monitor_10000 c7auto1" [ style = bold]
+"FAKECLONE:1_start_0 c7auto1" -> "clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory" [ style = bold]
+"FAKECLONE:1_start_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_monitor_10000 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_start_0 c7auto3" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE_start_0 c7auto3" -> "FAKECLONE_monitor_10000 c7auto3" [ style = bold]
+"FAKECLONE_start_0 c7auto3" -> "clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory" [ style = bold]
+"FAKECLONE_start_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKE_monitor_10000 c7auto4" [ style=bold color="green" fontcolor="black"]
+"FAKE_start_0 c7auto4" -> "FAKE_monitor_10000 c7auto4" [ style = bold]
+"FAKE_start_0 c7auto4" [ style=bold color="green" fontcolor="black"]
+"clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory" -> "FAKE_start_0 c7auto4" [ style = bold]
+"clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/clone_min_start_two.exp b/pengine/test10/clone_min_start_two.exp
new file mode 100644
index 0000000000..f7a053c660
--- /dev/null
+++ b/pengine/test10/clone_min_start_two.exp
@@ -0,0 +1,121 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="12" operation="monitor" operation_key="FAKECLONE_monitor_10000" internal_operation_key="FAKECLONE:0_monitor_10000" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="11" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="11" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="15" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="14" operation="monitor" operation_key="FAKECLONE:1_monitor_10000" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="start" operation_key="FAKECLONE:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <rsc_op id="13" operation="start" operation_key="FAKECLONE:1_start_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="15" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4" priority="1000000">
+    <action_set>
+      <pseudo_event id="16" operation="running" operation_key="FAKECLONE-clone_running_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="11" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="13" operation="start" operation_key="FAKECLONE:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="15" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <pseudo_event id="15" operation="start" operation_key="FAKECLONE-clone_start_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="6">
+    <action_set>
+      <rsc_op id="20" operation="monitor" operation_key="FAKE_monitor_10000" on_node="c7auto4" on_node_uuid="4">
+        <primitive id="FAKE" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="19" operation="start" operation_key="FAKE_start_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <rsc_op id="19" operation="start" operation_key="FAKE_start_0" on_node="c7auto4" on_node_uuid="4">
+        <primitive id="FAKE" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_name="start" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="2" operation="clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory" operation_key="clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <pseudo_event id="2" operation="clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory" operation_key="clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="11" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="13" operation="start" operation_key="FAKECLONE:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_start_two.scores b/pengine/test10/clone_min_start_two.scores
new file mode 100644
index 0000000000..b3bcac051a
--- /dev/null
+++ b/pengine/test10/clone_min_start_two.scores
@@ -0,0 +1,45 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:0 allocation score on c7auto1: 0
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 0
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 0
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKE allocation score on c7auto1: -INFINITY
+native_color: FAKE allocation score on c7auto2: -INFINITY
+native_color: FAKE allocation score on c7auto3: -INFINITY
+native_color: FAKE allocation score on c7auto4: 0
+native_color: FAKECLONE:0 allocation score on c7auto1: 0
+native_color: FAKECLONE:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto3: 0
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: 0
+native_color: FAKECLONE:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/clone_min_start_two.summary b/pengine/test10/clone_min_start_two.summary
new file mode 100644
index 0000000000..f0c649c93d
--- /dev/null
+++ b/pengine/test10/clone_min_start_two.summary
@@ -0,0 +1,36 @@
+
+Current cluster status:
+Node c7auto2 (2): standby
+Online: [ c7auto1 c7auto3 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Stopped: [ c7auto1 c7auto2 c7auto3 c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Stopped
+
+Transition Summary:
+ * Start   FAKECLONE:0	(c7auto3)
+ * Start   FAKECLONE:1	(c7auto1)
+ * Start   FAKE	(c7auto4)
+
+Executing cluster transition:
+ * Pseudo action:   FAKECLONE-clone_start_0
+ * Resource action: FAKECLONE       start on c7auto3
+ * Resource action: FAKECLONE       start on c7auto1
+ * Pseudo action:   FAKECLONE-clone_running_0
+ * Pseudo action:   clone-one-or-more:order-FAKECLONE-clone-FAKE-mandatory
+ * Resource action: FAKECLONE       monitor=10000 on c7auto3
+ * Resource action: FAKECLONE       monitor=10000 on c7auto1
+ * Resource action: FAKE            start on c7auto4
+ * Resource action: FAKE            monitor=10000 on c7auto4
+
+Revised cluster status:
+Node c7auto2 (2): standby
+Online: [ c7auto1 c7auto3 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto3 ]
+     Stopped: [ c7auto2 c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Started c7auto4
+
diff --git a/pengine/test10/clone_min_start_two.xml b/pengine/test10/clone_min_start_two.xml
new file mode 100644
index 0000000000..ae84425bdf
--- /dev/null
+++ b/pengine/test10/clone_min_start_two.xml
@@ -0,0 +1,153 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="18" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 15:37:54 2015" update-origin="c7auto1" update-client="crm_resource" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1">
+        <instance_attributes id="nodes-1"/>
+      </node>
+      <node id="2" uname="c7auto2">
+        <instance_attributes id="nodes-2">
+          <nvpair id="nodes-2-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="3" uname="c7auto3"/>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+        <meta_attributes id="FAKECLONE-clone-meta_attributes"/>
+      </clone>
+      <primitive class="ocf" id="FAKE" provider="heartbeat" type="Dummy">
+        <instance_attributes id="FAKE-instance_attributes"/>
+        <operations>
+          <op id="FAKE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+          <op id="FAKE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+          <op id="FAKE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+        </operations>
+      </primitive>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto1--INFINITY" node="c7auto1" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto2--INFINITY" node="c7auto2" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto3--INFINITY" node="c7auto3" rsc="FAKE" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKE-mandatory" then="FAKE" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="20" rc-code="0" op-status="0" interval="0" last-run="1437075474" last-rc-change="1437075474" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="18" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="13" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="12" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074828" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074870" last-rc-change="1437074870" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="21:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;21:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="22" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="6" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE_monitor_10000" operation_key="FAKE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="20" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/clone_min_stop_all.dot b/pengine/test10/clone_min_stop_all.dot
new file mode 100644
index 0000000000..254e889e8f
--- /dev/null
+++ b/pengine/test10/clone_min_stop_all.dot
@@ -0,0 +1,41 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = dashed]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE-clone_start_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto1" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto2" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto3" [ style = bold]
+"FAKECLONE-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stopped_0" -> "FAKECLONE-clone_start_0" [ style = dashed]
+"FAKECLONE-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE_start_0 <none>" -> "FAKECLONE-clone_running_0" [ style = dashed]
+"FAKECLONE_start_0 <none>" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto1" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto1" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto1" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto2" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto2" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto2" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto3" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto3" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKE_monitor_10000 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKE_start_0 c7auto4" -> "FAKE_monitor_10000 c7auto4" [ style = dashed]
+"FAKE_start_0 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKE_stop_0 c7auto4" -> "FAKECLONE-clone_stop_0" [ style = bold]
+"FAKE_stop_0 c7auto4" -> "FAKE_start_0 c7auto4" [ style = dashed]
+"FAKE_stop_0 c7auto4" -> "all_stopped" [ style = bold]
+"FAKE_stop_0 c7auto4" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+"shooter_monitor_60000 c7auto4" [ style=bold color="green" fontcolor="black"]
+"shooter_start_0 c7auto4" -> "shooter_monitor_60000 c7auto4" [ style = bold]
+"shooter_start_0 c7auto4" [ style=bold color="green" fontcolor="black"]
+"shooter_stop_0 c7auto1" -> "all_stopped" [ style = bold]
+"shooter_stop_0 c7auto1" -> "shooter_start_0 c7auto4" [ style = bold]
+"shooter_stop_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+}
diff --git a/pengine/test10/clone_min_stop_all.exp b/pengine/test10/clone_min_stop_all.exp
new file mode 100644
index 0000000000..1b8c9ce67e
--- /dev/null
+++ b/pengine/test10/clone_min_stop_all.exp
@@ -0,0 +1,142 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="15" operation="monitor" operation_key="shooter_monitor_60000" on_node="c7auto4" on_node_uuid="4">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_interval="60000" CRM_meta_name="monitor" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="14" operation="start" operation_key="shooter_start_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="14" operation="start" operation_key="shooter_start_0" on_node="c7auto4" on_node_uuid="4">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="13" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <rsc_op id="16" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:0_stop_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="21" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4">
+    <action_set>
+      <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="21" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <rsc_op id="18" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="21" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="6" priority="1000000">
+    <action_set>
+      <pseudo_event id="22" operation="stopped" operation_key="FAKECLONE-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="16" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:0_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="18" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="21" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <pseudo_event id="21" operation="stop" operation_key="FAKECLONE-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="23" operation="stop" operation_key="FAKE_stop_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <rsc_op id="23" operation="stop" operation_key="FAKE_stop_0" on_node="c7auto4" on_node_uuid="4">
+        <primitive id="FAKE" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_name="stop" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="9">
+    <action_set>
+      <pseudo_event id="7" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="16" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:0_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="18" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="23" operation="stop" operation_key="FAKE_stop_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_stop_all.scores b/pengine/test10/clone_min_stop_all.scores
new file mode 100644
index 0000000000..0bcbb1f58e
--- /dev/null
+++ b/pengine/test10/clone_min_stop_all.scores
@@ -0,0 +1,45 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:0 allocation score on c7auto1: 1
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 1
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 1
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKE allocation score on c7auto1: -INFINITY
+native_color: FAKE allocation score on c7auto2: -INFINITY
+native_color: FAKE allocation score on c7auto3: -INFINITY
+native_color: FAKE allocation score on c7auto4: 0
+native_color: FAKECLONE:0 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/clone_min_stop_all.summary b/pengine/test10/clone_min_stop_all.summary
new file mode 100644
index 0000000000..eb2944f930
--- /dev/null
+++ b/pengine/test10/clone_min_stop_all.summary
@@ -0,0 +1,43 @@
+
+Current cluster status:
+Node c7auto1 (1): standby
+Node c7auto2 (2): standby
+Node c7auto3 (3): standby
+Online: [ c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+     Stopped: [ c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Started c7auto4
+
+Transition Summary:
+ * Move    shooter	(Started c7auto1 -> c7auto4)
+ * Stop    FAKECLONE:0	(c7auto1)
+ * Stop    FAKECLONE:1	(c7auto2)
+ * Stop    FAKECLONE:2	(c7auto3)
+ * Stop    FAKE	(Started c7auto4)
+
+Executing cluster transition:
+ * Resource action: shooter         stop on c7auto1
+ * Resource action: FAKE            stop on c7auto4
+ * Resource action: shooter         start on c7auto4
+ * Pseudo action:   FAKECLONE-clone_stop_0
+ * Resource action: shooter         monitor=60000 on c7auto4
+ * Resource action: FAKECLONE       stop on c7auto1
+ * Resource action: FAKECLONE       stop on c7auto2
+ * Resource action: FAKECLONE       stop on c7auto3
+ * Pseudo action:   FAKECLONE-clone_stopped_0
+ * Pseudo action:   all_stopped
+
+Revised cluster status:
+Node c7auto1 (1): standby
+Node c7auto2 (2): standby
+Node c7auto3 (3): standby
+Online: [ c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto4
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Stopped: [ c7auto1 c7auto2 c7auto3 c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Stopped
+
diff --git a/pengine/test10/clone_min_stop_all.xml b/pengine/test10/clone_min_stop_all.xml
new file mode 100644
index 0000000000..70e8a9612b
--- /dev/null
+++ b/pengine/test10/clone_min_stop_all.xml
@@ -0,0 +1,158 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="18" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 15:28:22 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1">
+        <instance_attributes id="nodes-1">
+          <nvpair id="nodes-1-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="2" uname="c7auto2">
+        <instance_attributes id="nodes-2">
+          <nvpair id="nodes-2-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="3" uname="c7auto3">
+        <instance_attributes id="nodes-3">
+          <nvpair id="nodes-3-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+      </clone>
+      <primitive class="ocf" id="FAKE" provider="heartbeat" type="Dummy">
+        <instance_attributes id="FAKE-instance_attributes"/>
+        <operations>
+          <op id="FAKE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+          <op id="FAKE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+          <op id="FAKE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+        </operations>
+      </primitive>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto1--INFINITY" node="c7auto1" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto2--INFINITY" node="c7auto2" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto3--INFINITY" node="c7auto3" rsc="FAKE" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKE-mandatory" then="FAKE" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="13" rc-code="0" op-status="0" interval="0" last-run="1437074829" last-rc-change="1437074829" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="18" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437074829" last-rc-change="1437074829" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437074828" last-rc-change="1437074828" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074828" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074870" last-rc-change="1437074870" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="27:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;27:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="19" rc-code="0" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE_monitor_10000" operation_key="FAKE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="20" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/clone_min_stop_one.dot b/pengine/test10/clone_min_stop_one.dot
new file mode 100644
index 0000000000..19f84ccd66
--- /dev/null
+++ b/pengine/test10/clone_min_stop_one.dot
@@ -0,0 +1,18 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto2" [ style = bold]
+"FAKECLONE-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stopped_0" -> "FAKECLONE-clone_start_0" [ style = bold]
+"FAKECLONE-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE_start_0 <none>" -> "FAKECLONE-clone_running_0" [ style = dashed]
+"FAKECLONE_start_0 <none>" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto2" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto2" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto2" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/clone_min_stop_one.exp b/pengine/test10/clone_min_stop_one.exp
new file mode 100644
index 0000000000..4e6edb8725
--- /dev/null
+++ b/pengine/test10/clone_min_stop_one.exp
@@ -0,0 +1,74 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1" priority="1000000">
+    <action_set>
+      <pseudo_event id="23" operation="stopped" operation_key="FAKECLONE-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="3" priority="1000000">
+    <action_set>
+      <pseudo_event id="21" operation="running" operation_key="FAKECLONE-clone_running_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="20" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4">
+    <action_set>
+      <pseudo_event id="20" operation="start" operation_key="FAKECLONE-clone_start_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="23" operation="stopped" operation_key="FAKECLONE-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <pseudo_event id="7" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_stop_one.scores b/pengine/test10/clone_min_stop_one.scores
new file mode 100644
index 0000000000..1f289329bc
--- /dev/null
+++ b/pengine/test10/clone_min_stop_one.scores
@@ -0,0 +1,45 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:0 allocation score on c7auto1: 1
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 1
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 1
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKE allocation score on c7auto1: -INFINITY
+native_color: FAKE allocation score on c7auto2: -INFINITY
+native_color: FAKE allocation score on c7auto3: -INFINITY
+native_color: FAKE allocation score on c7auto4: 0
+native_color: FAKECLONE:0 allocation score on c7auto1: 1
+native_color: FAKECLONE:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: 0
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: 1
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/clone_min_stop_one.summary b/pengine/test10/clone_min_stop_one.summary
new file mode 100644
index 0000000000..9206a0d7be
--- /dev/null
+++ b/pengine/test10/clone_min_stop_one.summary
@@ -0,0 +1,32 @@
+
+Current cluster status:
+Node c7auto2 (2): standby
+Online: [ c7auto1 c7auto3 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+     Stopped: [ c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Started c7auto4
+
+Transition Summary:
+ * Stop    FAKECLONE:1	(c7auto2)
+
+Executing cluster transition:
+ * Pseudo action:   FAKECLONE-clone_stop_0
+ * Resource action: FAKECLONE       stop on c7auto2
+ * Pseudo action:   FAKECLONE-clone_stopped_0
+ * Pseudo action:   FAKECLONE-clone_start_0
+ * Pseudo action:   all_stopped
+ * Pseudo action:   FAKECLONE-clone_running_0
+
+Revised cluster status:
+Node c7auto2 (2): standby
+Online: [ c7auto1 c7auto3 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto3 ]
+     Stopped: [ c7auto2 c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Started c7auto4
+
diff --git a/pengine/test10/clone_min_stop_one.xml b/pengine/test10/clone_min_stop_one.xml
new file mode 100644
index 0000000000..eb05803819
--- /dev/null
+++ b/pengine/test10/clone_min_stop_one.xml
@@ -0,0 +1,152 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="16" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 15:28:22 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1">
+        <instance_attributes id="nodes-1"/>
+      </node>
+      <node id="2" uname="c7auto2">
+        <instance_attributes id="nodes-2">
+          <nvpair id="nodes-2-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="3" uname="c7auto3"/>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+      </clone>
+      <primitive class="ocf" id="FAKE" provider="heartbeat" type="Dummy">
+        <instance_attributes id="FAKE-instance_attributes"/>
+        <operations>
+          <op id="FAKE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+          <op id="FAKE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+          <op id="FAKE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+        </operations>
+      </primitive>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto1--INFINITY" node="c7auto1" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto2--INFINITY" node="c7auto2" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto3--INFINITY" node="c7auto3" rsc="FAKE" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKE-mandatory" then="FAKE" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="13" rc-code="0" op-status="0" interval="0" last-run="1437074829" last-rc-change="1437074829" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="18" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437074829" last-rc-change="1437074829" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437074828" last-rc-change="1437074828" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074828" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074870" last-rc-change="1437074870" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="27:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;27:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="19" rc-code="0" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE_monitor_10000" operation_key="FAKE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="20" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/clone_min_stop_two.dot b/pengine/test10/clone_min_stop_two.dot
new file mode 100644
index 0000000000..11640f4874
--- /dev/null
+++ b/pengine/test10/clone_min_stop_two.dot
@@ -0,0 +1,36 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto1" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto2" [ style = bold]
+"FAKECLONE-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stopped_0" -> "FAKECLONE-clone_start_0" [ style = bold]
+"FAKECLONE-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE_start_0 <none>" -> "FAKECLONE-clone_running_0" [ style = dashed]
+"FAKECLONE_start_0 <none>" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto1" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto1" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto1" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto2" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto2" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto2" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKE_monitor_10000 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKE_start_0 c7auto4" -> "FAKE_monitor_10000 c7auto4" [ style = dashed]
+"FAKE_start_0 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKE_stop_0 c7auto4" -> "FAKECLONE-clone_stop_0" [ style = bold]
+"FAKE_stop_0 c7auto4" -> "FAKE_start_0 c7auto4" [ style = dashed]
+"FAKE_stop_0 c7auto4" -> "all_stopped" [ style = bold]
+"FAKE_stop_0 c7auto4" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+"shooter_monitor_60000 c7auto3" [ style=bold color="green" fontcolor="black"]
+"shooter_start_0 c7auto3" -> "shooter_monitor_60000 c7auto3" [ style = bold]
+"shooter_start_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"shooter_stop_0 c7auto1" -> "all_stopped" [ style = bold]
+"shooter_stop_0 c7auto1" -> "shooter_start_0 c7auto3" [ style = bold]
+"shooter_stop_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+}
diff --git a/pengine/test10/clone_min_stop_two.exp b/pengine/test10/clone_min_stop_two.exp
new file mode 100644
index 0000000000..5697611497
--- /dev/null
+++ b/pengine/test10/clone_min_stop_two.exp
@@ -0,0 +1,147 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="15" operation="monitor" operation_key="shooter_monitor_60000" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_interval="60000" CRM_meta_name="monitor" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="14" operation="start" operation_key="shooter_start_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="14" operation="start" operation_key="shooter_start_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="13" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="shooter" class="stonith" type="fence_phd_kvm"/>
+        <attributes CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <rsc_op id="16" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:0_stop_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4">
+    <action_set>
+      <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5" priority="1000000">
+    <action_set>
+      <pseudo_event id="23" operation="stopped" operation_key="FAKECLONE-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="16" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:0_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="6">
+    <action_set>
+      <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="24" operation="stop" operation_key="FAKE_stop_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7" priority="1000000">
+    <action_set>
+      <pseudo_event id="21" operation="running" operation_key="FAKECLONE-clone_running_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="20" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <pseudo_event id="20" operation="start" operation_key="FAKECLONE-clone_start_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="23" operation="stopped" operation_key="FAKECLONE-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="9">
+    <action_set>
+      <rsc_op id="24" operation="stop" operation_key="FAKE_stop_0" on_node="c7auto4" on_node_uuid="4">
+        <primitive id="FAKE" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_name="stop" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="10">
+    <action_set>
+      <pseudo_event id="7" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="stop" operation_key="shooter_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="16" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:0_stop_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="17" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="24" operation="stop" operation_key="FAKE_stop_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/clone_min_stop_two.scores b/pengine/test10/clone_min_stop_two.scores
new file mode 100644
index 0000000000..ce43eb9b57
--- /dev/null
+++ b/pengine/test10/clone_min_stop_two.scores
@@ -0,0 +1,45 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:0 allocation score on c7auto1: 1
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 1
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 1
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKE allocation score on c7auto1: -INFINITY
+native_color: FAKE allocation score on c7auto2: -INFINITY
+native_color: FAKE allocation score on c7auto3: -INFINITY
+native_color: FAKE allocation score on c7auto4: 0
+native_color: FAKECLONE:0 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: 1
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/clone_min_stop_two.summary b/pengine/test10/clone_min_stop_two.summary
new file mode 100644
index 0000000000..c009d7d13f
--- /dev/null
+++ b/pengine/test10/clone_min_stop_two.summary
@@ -0,0 +1,42 @@
+
+Current cluster status:
+Node c7auto1 (1): standby
+Node c7auto2 (2): standby
+Online: [ c7auto3 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+     Stopped: [ c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Started c7auto4
+
+Transition Summary:
+ * Move    shooter	(Started c7auto1 -> c7auto3)
+ * Stop    FAKECLONE:0	(c7auto1)
+ * Stop    FAKECLONE:1	(c7auto2)
+ * Stop    FAKE	(Started c7auto4)
+
+Executing cluster transition:
+ * Resource action: shooter         stop on c7auto1
+ * Resource action: FAKE            stop on c7auto4
+ * Resource action: shooter         start on c7auto3
+ * Pseudo action:   FAKECLONE-clone_stop_0
+ * Resource action: shooter         monitor=60000 on c7auto3
+ * Resource action: FAKECLONE       stop on c7auto1
+ * Resource action: FAKECLONE       stop on c7auto2
+ * Pseudo action:   FAKECLONE-clone_stopped_0
+ * Pseudo action:   FAKECLONE-clone_start_0
+ * Pseudo action:   all_stopped
+ * Pseudo action:   FAKECLONE-clone_running_0
+
+Revised cluster status:
+Node c7auto1 (1): standby
+Node c7auto2 (2): standby
+Online: [ c7auto3 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto3
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto3 ]
+     Stopped: [ c7auto1 c7auto2 c7auto4 ]
+ FAKE	(ocf::heartbeat:Dummy):	Stopped
+
diff --git a/pengine/test10/clone_min_stop_two.xml b/pengine/test10/clone_min_stop_two.xml
new file mode 100644
index 0000000000..8d085ada95
--- /dev/null
+++ b/pengine/test10/clone_min_stop_two.xml
@@ -0,0 +1,154 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="15" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 15:28:22 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1">
+        <instance_attributes id="nodes-1">
+          <nvpair id="nodes-1-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="2" uname="c7auto2">
+        <instance_attributes id="nodes-2">
+          <nvpair id="nodes-2-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="3" uname="c7auto3"/>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+      </clone>
+      <primitive class="ocf" id="FAKE" provider="heartbeat" type="Dummy">
+        <instance_attributes id="FAKE-instance_attributes"/>
+        <operations>
+          <op id="FAKE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+          <op id="FAKE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+          <op id="FAKE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+        </operations>
+      </primitive>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto1--INFINITY" node="c7auto1" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto2--INFINITY" node="c7auto2" rsc="FAKE" score="-INFINITY"/>
+      <rsc_location id="location-FAKE-c7auto3--INFINITY" node="c7auto3" rsc="FAKE" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKE-mandatory" then="FAKE" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="13" rc-code="0" op-status="0" interval="0" last-run="1437074829" last-rc-change="1437074829" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;21:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="14" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="18" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437074829" last-rc-change="1437074829" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="11" rc-code="0" op-status="0" interval="0" last-run="1437074828" last-rc-change="1437074828" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074828" exec-time="10" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;12:4:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="16" rc-code="7" op-status="0" interval="0" last-run="1437074870" last-rc-change="1437074870" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;19:2:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="12" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074829" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKE_last_0" operation_key="FAKE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="27:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;27:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="19" rc-code="0" op-status="0" interval="0" last-run="1437074871" last-rc-change="1437074871" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKE_monitor_10000" operation_key="FAKE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;28:4:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="20" rc-code="0" op-status="0" interval="10000" last-rc-change="1437074871" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/cloned_start_one.dot b/pengine/test10/cloned_start_one.dot
new file mode 100644
index 0000000000..b3c254c5dc
--- /dev/null
+++ b/pengine/test10/cloned_start_one.dot
@@ -0,0 +1,32 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 c7auto1" [ style = bold]
+"FAKECLONE-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2-clone_running_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKECLONE2-clone_start_0" -> "FAKECLONE2-clone_running_0" [ style = dashed]
+"FAKECLONE2-clone_start_0" -> "FAKECLONE2_start_0 c7auto4" [ style = dashed]
+"FAKECLONE2-clone_start_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2_stop_0 c7auto3" [ style = bold]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2_stop_0 c7auto4" [ style = bold]
+"FAKECLONE2-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2-clone_stopped_0" -> "FAKECLONE2-clone_start_0" [ style = dashed]
+"FAKECLONE2-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2_monitor_10000 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE2_start_0 c7auto4" -> "FAKECLONE2-clone_running_0" [ style = dashed]
+"FAKECLONE2_start_0 c7auto4" -> "FAKECLONE2_monitor_10000 c7auto4" [ style = dashed]
+"FAKECLONE2_start_0 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE2_stop_0 c7auto3" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKECLONE2_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE2_stop_0 c7auto4" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2_stop_0 c7auto4" -> "FAKECLONE2_start_0 c7auto4" [ style = dashed]
+"FAKECLONE2_stop_0 c7auto4" -> "all_stopped" [ style = bold]
+"FAKECLONE2_stop_0 c7auto4" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_monitor_10000 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_start_0 c7auto1" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE_start_0 c7auto1" -> "FAKECLONE_monitor_10000 c7auto1" [ style = bold]
+"FAKECLONE_start_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/cloned_start_one.exp b/pengine/test10/cloned_start_one.exp
new file mode 100644
index 0000000000..636ccd8e0b
--- /dev/null
+++ b/pengine/test10/cloned_start_one.exp
@@ -0,0 +1,118 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="14" operation="monitor" operation_key="FAKECLONE_monitor_10000" internal_operation_key="FAKECLONE:0_monitor_10000" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="13" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="15" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2" priority="1000000">
+    <action_set>
+      <pseudo_event id="16" operation="running" operation_key="FAKECLONE-clone_running_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="15" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <pseudo_event id="15" operation="start" operation_key="FAKECLONE-clone_start_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="4">
+    <action_set>
+      <rsc_op id="19" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE2" long-id="FAKECLONE2:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="24" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <rsc_op id="20" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:1_stop_0" on_node="c7auto4" on_node_uuid="4">
+        <primitive id="FAKECLONE2" long-id="FAKECLONE2:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="24" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="6" priority="1000000">
+    <action_set>
+      <pseudo_event id="25" operation="stopped" operation_key="FAKECLONE2-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="19" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="20" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:1_stop_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="24" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <pseudo_event id="24" operation="stop" operation_key="FAKECLONE2-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <pseudo_event id="5" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="19" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="20" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:1_stop_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/cloned_start_one.scores b/pengine/test10/cloned_start_one.scores
new file mode 100644
index 0000000000..3dc6ab8cc5
--- /dev/null
+++ b/pengine/test10/cloned_start_one.scores
@@ -0,0 +1,77 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE2-clone allocation score on c7auto4: 0
+clone_color: FAKECLONE2:0 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:0 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:0 allocation score on c7auto3: 1
+clone_color: FAKECLONE2:0 allocation score on c7auto4: 0
+clone_color: FAKECLONE2:1 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:1 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:1 allocation score on c7auto4: 1
+clone_color: FAKECLONE2:2 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:2 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:2 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:2 allocation score on c7auto4: 0
+clone_color: FAKECLONE2:3 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:3 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:3 allocation score on c7auto4: 0
+clone_color: FAKECLONE:0 allocation score on c7auto1: 0
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 0
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 0
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto4: 1
+native_color: FAKECLONE2:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto1: 0
+native_color: FAKECLONE:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/cloned_start_one.summary b/pengine/test10/cloned_start_one.summary
new file mode 100644
index 0000000000..20ac58f85d
--- /dev/null
+++ b/pengine/test10/cloned_start_one.summary
@@ -0,0 +1,41 @@
+
+Current cluster status:
+Node c7auto2 (2): standby
+Node c7auto3 (3): standby
+Online: [ c7auto1 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Stopped: [ c7auto1 c7auto2 c7auto3 c7auto4 ]
+ Clone Set: FAKECLONE2-clone [FAKECLONE2]
+     Started: [ c7auto3 c7auto4 ]
+     Stopped: [ c7auto1 c7auto2 ]
+
+Transition Summary:
+ * Start   FAKECLONE:0	(c7auto1)
+ * Stop    FAKECLONE2:0	(c7auto3)
+ * Stop    FAKECLONE2:1	(Started c7auto4)
+
+Executing cluster transition:
+ * Pseudo action:   FAKECLONE-clone_start_0
+ * Pseudo action:   FAKECLONE2-clone_stop_0
+ * Resource action: FAKECLONE       start on c7auto1
+ * Pseudo action:   FAKECLONE-clone_running_0
+ * Resource action: FAKECLONE2      stop on c7auto3
+ * Resource action: FAKECLONE2      stop on c7auto4
+ * Pseudo action:   FAKECLONE2-clone_stopped_0
+ * Pseudo action:   all_stopped
+ * Resource action: FAKECLONE       monitor=10000 on c7auto1
+
+Revised cluster status:
+Node c7auto2 (2): standby
+Node c7auto3 (3): standby
+Online: [ c7auto1 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 ]
+     Stopped: [ c7auto2 c7auto3 c7auto4 ]
+ Clone Set: FAKECLONE2-clone [FAKECLONE2]
+     Stopped: [ c7auto1 c7auto2 c7auto3 c7auto4 ]
+
diff --git a/pengine/test10/cloned_start_one.xml b/pengine/test10/cloned_start_one.xml
new file mode 100644
index 0000000000..6c2bfe1b06
--- /dev/null
+++ b/pengine/test10/cloned_start_one.xml
@@ -0,0 +1,154 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="30" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 17:55:58 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1"/>
+      <node id="2" uname="c7auto2">
+        <instance_attributes id="nodes-2">
+          <nvpair id="nodes-2-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="3" uname="c7auto3">
+        <instance_attributes id="nodes-3">
+          <nvpair id="nodes-3-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+        <meta_attributes id="FAKECLONE-clone-meta_attributes"/>
+      </clone>
+      <clone id="FAKECLONE2-clone">
+        <primitive class="ocf" id="FAKECLONE2" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE2-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE2-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE2-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE2-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE2-clone-meta"/>
+      </clone>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKECLONE2-clone-c7auto1--INFINITY" node="c7auto1" rsc="FAKECLONE2-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKECLONE2-clone-c7auto2--INFINITY" node="c7auto2" rsc="FAKECLONE2-clone" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKECLONE2-clone-mandatory" then="FAKECLONE2-clone" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="17:28:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:28:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437083676" last-rc-change="1437083676" exec-time="12" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="14:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="20" rc-code="0" op-status="0" interval="0" last-run="1437075474" last-rc-change="1437075474" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="16:29:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:29:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437083678" last-rc-change="1437083678" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="15:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="13" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="17:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="29" rc-code="0" op-status="0" interval="0" last-run="1437083710" last-rc-change="1437083710" exec-time="6" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE2_monitor_10000" operation_key="FAKECLONE2_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="18:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;18:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="30" rc-code="0" op-status="0" interval="10000" last-rc-change="1437083710" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="16:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="12" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="22:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;22:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="29" rc-code="0" op-status="0" interval="0" last-run="1437083649" last-rc-change="1437083649" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE2_monitor_10000" operation_key="FAKECLONE2_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="23:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;23:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="30" rc-code="0" op-status="0" interval="10000" last-rc-change="1437083649" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/cloned_start_two.dot b/pengine/test10/cloned_start_two.dot
new file mode 100644
index 0000000000..348d435ddf
--- /dev/null
+++ b/pengine/test10/cloned_start_two.dot
@@ -0,0 +1,26 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE:1_start_0 c7auto1" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 c7auto2" [ style = bold]
+"FAKECLONE-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2_stop_0 c7auto3" [ style = bold]
+"FAKECLONE2-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2_stop_0 c7auto3" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKECLONE2_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE:1_monitor_10000 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE:1_start_0 c7auto1" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE:1_start_0 c7auto1" -> "FAKECLONE:1_monitor_10000 c7auto1" [ style = bold]
+"FAKECLONE:1_start_0 c7auto1" -> "clone-one-or-more:order-FAKECLONE-clone-FAKECLONE2-clone-mandatory" [ style = bold]
+"FAKECLONE:1_start_0 c7auto1" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_monitor_10000 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_start_0 c7auto2" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE_start_0 c7auto2" -> "FAKECLONE_monitor_10000 c7auto2" [ style = bold]
+"FAKECLONE_start_0 c7auto2" -> "clone-one-or-more:order-FAKECLONE-clone-FAKECLONE2-clone-mandatory" [ style = bold]
+"FAKECLONE_start_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+"clone-one-or-more:order-FAKECLONE-clone-FAKECLONE2-clone-mandatory" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/cloned_start_two.exp b/pengine/test10/cloned_start_two.exp
new file mode 100644
index 0000000000..ee82324bbd
--- /dev/null
+++ b/pengine/test10/cloned_start_two.exp
@@ -0,0 +1,143 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="14" operation="monitor" operation_key="FAKECLONE_monitor_10000" internal_operation_key="FAKECLONE:0_monitor_10000" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="13" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="17" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <rsc_op id="16" operation="monitor" operation_key="FAKECLONE:1_monitor_10000" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_interval="10000" CRM_meta_name="monitor" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="15" operation="start" operation_key="FAKECLONE:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <rsc_op id="15" operation="start" operation_key="FAKECLONE:1_start_0" on_node="c7auto1" on_node_uuid="1">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="start" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="17" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4" priority="1000000">
+    <action_set>
+      <pseudo_event id="18" operation="running" operation_key="FAKECLONE-clone_running_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="15" operation="start" operation_key="FAKECLONE:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="17" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <pseudo_event id="17" operation="start" operation_key="FAKECLONE-clone_start_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="6">
+    <action_set>
+      <rsc_op id="21" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE2" long-id="FAKECLONE2:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="26" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7" priority="1000000">
+    <action_set>
+      <pseudo_event id="27" operation="stopped" operation_key="FAKECLONE2-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="21" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="26" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <pseudo_event id="26" operation="stop" operation_key="FAKECLONE2-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="9">
+    <action_set>
+      <pseudo_event id="5" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="21" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="10">
+    <action_set>
+      <pseudo_event id="4" operation="clone-one-or-more:order-FAKECLONE-clone-FAKECLONE2-clone-mandatory" operation_key="clone-one-or-more:order-FAKECLONE-clone-FAKECLONE2-clone-mandatory">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="13" operation="start" operation_key="FAKECLONE_start_0" internal_operation_key="FAKECLONE:0_start_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="15" operation="start" operation_key="FAKECLONE:1_start_0" on_node="c7auto1" on_node_uuid="1"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/cloned_start_two.scores b/pengine/test10/cloned_start_two.scores
new file mode 100644
index 0000000000..dae3b5dafe
--- /dev/null
+++ b/pengine/test10/cloned_start_two.scores
@@ -0,0 +1,77 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE2-clone allocation score on c7auto4: 0
+clone_color: FAKECLONE2:0 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:0 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:0 allocation score on c7auto3: 1
+clone_color: FAKECLONE2:0 allocation score on c7auto4: 0
+clone_color: FAKECLONE2:1 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:1 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:1 allocation score on c7auto4: 1
+clone_color: FAKECLONE2:2 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:2 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:2 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:2 allocation score on c7auto4: 0
+clone_color: FAKECLONE2:3 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:3 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:3 allocation score on c7auto4: 0
+clone_color: FAKECLONE:0 allocation score on c7auto1: 0
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 0
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 0
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto4: 1
+native_color: FAKECLONE2:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto1: 0
+native_color: FAKECLONE:0 allocation score on c7auto2: 0
+native_color: FAKECLONE:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: 0
+native_color: FAKECLONE:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/cloned_start_two.summary b/pengine/test10/cloned_start_two.summary
new file mode 100644
index 0000000000..bea4609013
--- /dev/null
+++ b/pengine/test10/cloned_start_two.summary
@@ -0,0 +1,42 @@
+
+Current cluster status:
+Node c7auto3 (3): standby
+Online: [ c7auto1 c7auto2 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Stopped: [ c7auto1 c7auto2 c7auto3 c7auto4 ]
+ Clone Set: FAKECLONE2-clone [FAKECLONE2]
+     Started: [ c7auto3 c7auto4 ]
+     Stopped: [ c7auto1 c7auto2 ]
+
+Transition Summary:
+ * Start   FAKECLONE:0	(c7auto2)
+ * Start   FAKECLONE:1	(c7auto1)
+ * Stop    FAKECLONE2:0	(c7auto3)
+
+Executing cluster transition:
+ * Pseudo action:   FAKECLONE-clone_start_0
+ * Pseudo action:   FAKECLONE2-clone_stop_0
+ * Resource action: FAKECLONE       start on c7auto2
+ * Resource action: FAKECLONE       start on c7auto1
+ * Pseudo action:   FAKECLONE-clone_running_0
+ * Resource action: FAKECLONE2      stop on c7auto3
+ * Pseudo action:   FAKECLONE2-clone_stopped_0
+ * Pseudo action:   all_stopped
+ * Pseudo action:   clone-one-or-more:order-FAKECLONE-clone-FAKECLONE2-clone-mandatory
+ * Resource action: FAKECLONE       monitor=10000 on c7auto2
+ * Resource action: FAKECLONE       monitor=10000 on c7auto1
+
+Revised cluster status:
+Node c7auto3 (3): standby
+Online: [ c7auto1 c7auto2 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto2 ]
+     Stopped: [ c7auto3 c7auto4 ]
+ Clone Set: FAKECLONE2-clone [FAKECLONE2]
+     Started: [ c7auto4 ]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+
diff --git a/pengine/test10/cloned_start_two.xml b/pengine/test10/cloned_start_two.xml
new file mode 100644
index 0000000000..be7831766f
--- /dev/null
+++ b/pengine/test10/cloned_start_two.xml
@@ -0,0 +1,152 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="31" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 17:55:58 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1"/>
+      <node id="2" uname="c7auto2">
+        <instance_attributes id="nodes-2"/>
+      </node>
+      <node id="3" uname="c7auto3">
+        <instance_attributes id="nodes-3">
+          <nvpair id="nodes-3-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+        <meta_attributes id="FAKECLONE-clone-meta_attributes"/>
+      </clone>
+      <clone id="FAKECLONE2-clone">
+        <primitive class="ocf" id="FAKECLONE2" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE2-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE2-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE2-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE2-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE2-clone-meta"/>
+      </clone>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKECLONE2-clone-c7auto1--INFINITY" node="c7auto1" rsc="FAKECLONE2-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKECLONE2-clone-c7auto2--INFINITY" node="c7auto2" rsc="FAKECLONE2-clone" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKECLONE2-clone-mandatory" then="FAKECLONE2-clone" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="17:28:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:28:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437083676" last-rc-change="1437083676" exec-time="12" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="14:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="20" rc-code="0" op-status="0" interval="0" last-run="1437075474" last-rc-change="1437075474" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="16:29:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:29:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437083678" last-rc-change="1437083678" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="15:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="13" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="17:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="29" rc-code="0" op-status="0" interval="0" last-run="1437083710" last-rc-change="1437083710" exec-time="6" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE2_monitor_10000" operation_key="FAKECLONE2_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="18:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;18:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="30" rc-code="0" op-status="0" interval="10000" last-rc-change="1437083710" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="16:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:9:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="18" rc-code="0" op-status="0" interval="0" last-run="1437075473" last-rc-change="1437075473" exec-time="12" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="22:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;22:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="29" rc-code="0" op-status="0" interval="0" last-run="1437083649" last-rc-change="1437083649" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE2_monitor_10000" operation_key="FAKECLONE2_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="23:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;23:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="30" rc-code="0" op-status="0" interval="10000" last-rc-change="1437083649" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/cloned_stop_one.dot b/pengine/test10/cloned_stop_one.dot
new file mode 100644
index 0000000000..d1811353f5
--- /dev/null
+++ b/pengine/test10/cloned_stop_one.dot
@@ -0,0 +1,26 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto3" [ style = bold]
+"FAKECLONE-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stopped_0" -> "FAKECLONE-clone_start_0" [ style = bold]
+"FAKECLONE-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2_stop_0 c7auto3" [ style = bold]
+"FAKECLONE2-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2-clone_stopped_0" -> "FAKECLONE-clone_stop_0" [ style = bold]
+"FAKECLONE2-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2_stop_0 c7auto3" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKECLONE2_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_start_0 <none>" -> "FAKECLONE-clone_running_0" [ style = dashed]
+"FAKECLONE_start_0 <none>" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto3" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto3" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/cloned_stop_one.exp b/pengine/test10/cloned_stop_one.exp
new file mode 100644
index 0000000000..9613d6f327
--- /dev/null
+++ b/pengine/test10/cloned_stop_one.exp
@@ -0,0 +1,117 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="20" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="23" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1" priority="1000000">
+    <action_set>
+      <pseudo_event id="24" operation="stopped" operation_key="FAKECLONE-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="20" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="23" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2">
+    <action_set>
+      <pseudo_event id="23" operation="stop" operation_key="FAKECLONE-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="31" operation="stopped" operation_key="FAKECLONE2-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3" priority="1000000">
+    <action_set>
+      <pseudo_event id="22" operation="running" operation_key="FAKECLONE-clone_running_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="21" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4">
+    <action_set>
+      <pseudo_event id="21" operation="start" operation_key="FAKECLONE-clone_start_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="24" operation="stopped" operation_key="FAKECLONE-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <rsc_op id="25" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE2" long-id="FAKECLONE2:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="30" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="6" priority="1000000">
+    <action_set>
+      <pseudo_event id="31" operation="stopped" operation_key="FAKECLONE2-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="25" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="30" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <pseudo_event id="30" operation="stop" operation_key="FAKECLONE2-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="8">
+    <action_set>
+      <pseudo_event id="8" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="20" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="25" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/cloned_stop_one.scores b/pengine/test10/cloned_stop_one.scores
new file mode 100644
index 0000000000..6d66638371
--- /dev/null
+++ b/pengine/test10/cloned_stop_one.scores
@@ -0,0 +1,77 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE2-clone allocation score on c7auto4: 0
+clone_color: FAKECLONE2:0 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:0 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:0 allocation score on c7auto3: 1
+clone_color: FAKECLONE2:0 allocation score on c7auto4: 0
+clone_color: FAKECLONE2:1 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:1 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:1 allocation score on c7auto4: 1
+clone_color: FAKECLONE2:2 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:2 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:2 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:2 allocation score on c7auto4: 0
+clone_color: FAKECLONE2:3 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:3 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:3 allocation score on c7auto4: 0
+clone_color: FAKECLONE:0 allocation score on c7auto1: 1
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 1
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 1
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto4: 1
+native_color: FAKECLONE2:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto1: 1
+native_color: FAKECLONE:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: 0
+native_color: FAKECLONE:1 allocation score on c7auto2: 1
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/cloned_stop_one.summary b/pengine/test10/cloned_stop_one.summary
new file mode 100644
index 0000000000..1a952a2303
--- /dev/null
+++ b/pengine/test10/cloned_stop_one.summary
@@ -0,0 +1,40 @@
+
+Current cluster status:
+Node c7auto3 (3): standby
+Online: [ c7auto1 c7auto2 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+     Stopped: [ c7auto4 ]
+ Clone Set: FAKECLONE2-clone [FAKECLONE2]
+     Started: [ c7auto3 c7auto4 ]
+     Stopped: [ c7auto1 c7auto2 ]
+
+Transition Summary:
+ * Stop    FAKECLONE:2	(c7auto3)
+ * Stop    FAKECLONE2:0	(c7auto3)
+
+Executing cluster transition:
+ * Pseudo action:   FAKECLONE2-clone_stop_0
+ * Resource action: FAKECLONE2      stop on c7auto3
+ * Pseudo action:   FAKECLONE2-clone_stopped_0
+ * Pseudo action:   FAKECLONE-clone_stop_0
+ * Resource action: FAKECLONE       stop on c7auto3
+ * Pseudo action:   FAKECLONE-clone_stopped_0
+ * Pseudo action:   FAKECLONE-clone_start_0
+ * Pseudo action:   all_stopped
+ * Pseudo action:   FAKECLONE-clone_running_0
+
+Revised cluster status:
+Node c7auto3 (3): standby
+Online: [ c7auto1 c7auto2 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto2 ]
+     Stopped: [ c7auto3 c7auto4 ]
+ Clone Set: FAKECLONE2-clone [FAKECLONE2]
+     Started: [ c7auto4 ]
+     Stopped: [ c7auto1 c7auto2 c7auto3 ]
+
diff --git a/pengine/test10/cloned_stop_one.xml b/pengine/test10/cloned_stop_one.xml
new file mode 100644
index 0000000000..2e2fdfd263
--- /dev/null
+++ b/pengine/test10/cloned_stop_one.xml
@@ -0,0 +1,153 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="29" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 18:03:09 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1"/>
+      <node id="2" uname="c7auto2"/>
+      <node id="3" uname="c7auto3">
+        <instance_attributes id="nodes-3">
+          <nvpair id="nodes-3-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+        <meta_attributes id="FAKECLONE-clone-meta_attributes"/>
+      </clone>
+      <clone id="FAKECLONE2-clone">
+        <primitive class="ocf" id="FAKECLONE2" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE2-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE2-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE2-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE2-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE2-clone-meta"/>
+      </clone>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKECLONE2-clone-c7auto1--INFINITY" node="c7auto1" rsc="FAKECLONE2-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKECLONE2-clone-c7auto2--INFINITY" node="c7auto2" rsc="FAKECLONE2-clone" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKECLONE2-clone-mandatory" then="FAKECLONE2-clone" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="17:28:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:28:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437083676" last-rc-change="1437083676" exec-time="12" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="31" rc-code="0" op-status="0" interval="0" last-run="1437084158" last-rc-change="1437084158" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="32" rc-code="0" op-status="0" interval="10000" last-rc-change="1437084158" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="16:29:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:29:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437083678" last-rc-change="1437083678" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;12:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="33" rc-code="0" op-status="0" interval="0" last-run="1437084158" last-rc-change="1437084158" exec-time="11" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="13:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;13:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="34" rc-code="0" op-status="0" interval="10000" last-rc-change="1437084158" exec-time="12" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="17:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="29" rc-code="0" op-status="0" interval="0" last-run="1437083710" last-rc-change="1437083710" exec-time="6" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE2_monitor_10000" operation_key="FAKECLONE2_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="18:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;18:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="30" rc-code="0" op-status="0" interval="10000" last-rc-change="1437083710" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="31" rc-code="0" op-status="0" interval="0" last-run="1437084157" last-rc-change="1437084157" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="32" rc-code="0" op-status="0" interval="10000" last-rc-change="1437084157" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="22:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;22:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="29" rc-code="0" op-status="0" interval="0" last-run="1437083649" last-rc-change="1437083649" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE2_monitor_10000" operation_key="FAKECLONE2_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="23:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;23:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="30" rc-code="0" op-status="0" interval="10000" last-rc-change="1437083649" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+  </status>
+</cib>
diff --git a/pengine/test10/cloned_stop_two.dot b/pengine/test10/cloned_stop_two.dot
new file mode 100644
index 0000000000..2c7fd3d363
--- /dev/null
+++ b/pengine/test10/cloned_stop_two.dot
@@ -0,0 +1,45 @@
+ digraph "g" {
+"FAKECLONE-clone_running_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_start_0" -> "FAKECLONE-clone_running_0" [ style = bold]
+"FAKECLONE-clone_start_0" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE-clone_start_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto2" [ style = bold]
+"FAKECLONE-clone_stop_0" -> "FAKECLONE_stop_0 c7auto3" [ style = bold]
+"FAKECLONE-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE-clone_stopped_0" -> "FAKECLONE-clone_start_0" [ style = bold]
+"FAKECLONE-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2-clone_running_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKECLONE2-clone_start_0" -> "FAKECLONE2-clone_running_0" [ style = dashed]
+"FAKECLONE2-clone_start_0" -> "FAKECLONE2_start_0 c7auto4" [ style = dashed]
+"FAKECLONE2-clone_start_0" [ style=dashed color="red" fontcolor="orange"]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2_stop_0 c7auto3" [ style = bold]
+"FAKECLONE2-clone_stop_0" -> "FAKECLONE2_stop_0 c7auto4" [ style = bold]
+"FAKECLONE2-clone_stop_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2-clone_stopped_0" -> "FAKECLONE-clone_stop_0" [ style = bold]
+"FAKECLONE2-clone_stopped_0" -> "FAKECLONE2-clone_start_0" [ style = dashed]
+"FAKECLONE2-clone_stopped_0" [ style=bold color="green" fontcolor="orange"]
+"FAKECLONE2_monitor_10000 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE2_start_0 c7auto4" -> "FAKECLONE2-clone_running_0" [ style = dashed]
+"FAKECLONE2_start_0 c7auto4" -> "FAKECLONE2_monitor_10000 c7auto4" [ style = dashed]
+"FAKECLONE2_start_0 c7auto4" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE2_stop_0 c7auto3" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKECLONE2_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE2_stop_0 c7auto4" -> "FAKECLONE2-clone_stopped_0" [ style = bold]
+"FAKECLONE2_stop_0 c7auto4" -> "FAKECLONE2_start_0 c7auto4" [ style = dashed]
+"FAKECLONE2_stop_0 c7auto4" -> "all_stopped" [ style = bold]
+"FAKECLONE2_stop_0 c7auto4" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_start_0 <none>" -> "FAKECLONE-clone_running_0" [ style = dashed]
+"FAKECLONE_start_0 <none>" [ style=dashed color="red" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto2" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto2" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto2" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto2" [ style=bold color="green" fontcolor="black"]
+"FAKECLONE_stop_0 c7auto3" -> "FAKECLONE-clone_stopped_0" [ style = bold]
+"FAKECLONE_stop_0 c7auto3" -> "FAKECLONE_start_0 <none>" [ style = dashed]
+"FAKECLONE_stop_0 c7auto3" -> "all_stopped" [ style = bold]
+"FAKECLONE_stop_0 c7auto3" [ style=bold color="green" fontcolor="black"]
+"all_stopped" [ style=bold color="green" fontcolor="orange"]
+}
diff --git a/pengine/test10/cloned_stop_two.exp b/pengine/test10/cloned_stop_two.exp
new file mode 100644
index 0000000000..4aa0e58cb0
--- /dev/null
+++ b/pengine/test10/cloned_stop_two.exp
@@ -0,0 +1,155 @@
+<transition_graph cluster-delay="60s" stonith-timeout="60s" failed-stop-offset="INFINITY" failed-start-offset="INFINITY"  transition_id="0">
+  <synapse id="0">
+    <action_set>
+      <rsc_op id="18" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="1">
+    <action_set>
+      <rsc_op id="19" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE" long-id="FAKECLONE:2" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="2" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="2" priority="1000000">
+    <action_set>
+      <pseudo_event id="23" operation="stopped" operation_key="FAKECLONE-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="18" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="19" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="3">
+    <action_set>
+      <pseudo_event id="22" operation="stop" operation_key="FAKECLONE-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="30" operation="stopped" operation_key="FAKECLONE2-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="4" priority="1000000">
+    <action_set>
+      <pseudo_event id="21" operation="running" operation_key="FAKECLONE-clone_running_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="20" operation="start" operation_key="FAKECLONE-clone_start_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="5">
+    <action_set>
+      <pseudo_event id="20" operation="start" operation_key="FAKECLONE-clone_start_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="23" operation="stopped" operation_key="FAKECLONE-clone_stopped_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="6">
+    <action_set>
+      <rsc_op id="24" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3">
+        <primitive id="FAKECLONE2" long-id="FAKECLONE2:0" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="0" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="29" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="7">
+    <action_set>
+      <rsc_op id="25" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:1_stop_0" on_node="c7auto4" on_node_uuid="4">
+        <primitive id="FAKECLONE2" long-id="FAKECLONE2:1" class="ocf" provider="heartbeat" type="Dummy"/>
+        <attributes CRM_meta_clone="1" CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_name="stop" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </rsc_op>
+    </action_set>
+    <inputs>
+      <trigger>
+        <pseudo_event id="29" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="8" priority="1000000">
+    <action_set>
+      <pseudo_event id="30" operation="stopped" operation_key="FAKECLONE2-clone_stopped_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="24" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="25" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:1_stop_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+      <trigger>
+        <pseudo_event id="29" operation="stop" operation_key="FAKECLONE2-clone_stop_0"/>
+      </trigger>
+    </inputs>
+  </synapse>
+  <synapse id="9">
+    <action_set>
+      <pseudo_event id="29" operation="stop" operation_key="FAKECLONE2-clone_stop_0">
+        <attributes CRM_meta_clone_max="4" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
+      </pseudo_event>
+    </action_set>
+    <inputs/>
+  </synapse>
+  <synapse id="10">
+    <action_set>
+      <pseudo_event id="8" operation="all_stopped" operation_key="all_stopped">
+        <attributes />
+      </pseudo_event>
+    </action_set>
+    <inputs>
+      <trigger>
+        <rsc_op id="18" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:1_stop_0" on_node="c7auto2" on_node_uuid="2"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="19" operation="stop" operation_key="FAKECLONE_stop_0" internal_operation_key="FAKECLONE:2_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="24" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:0_stop_0" on_node="c7auto3" on_node_uuid="3"/>
+      </trigger>
+      <trigger>
+        <rsc_op id="25" operation="stop" operation_key="FAKECLONE2_stop_0" internal_operation_key="FAKECLONE2:1_stop_0" on_node="c7auto4" on_node_uuid="4"/>
+      </trigger>
+    </inputs>
+  </synapse>
+</transition_graph>
diff --git a/pengine/test10/cloned_stop_two.scores b/pengine/test10/cloned_stop_two.scores
new file mode 100644
index 0000000000..f6e9779d3d
--- /dev/null
+++ b/pengine/test10/cloned_stop_two.scores
@@ -0,0 +1,77 @@
+Allocation scores:
+clone_color: FAKECLONE-clone allocation score on c7auto1: 0
+clone_color: FAKECLONE-clone allocation score on c7auto2: 0
+clone_color: FAKECLONE-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE-clone allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2-clone allocation score on c7auto3: 0
+clone_color: FAKECLONE2-clone allocation score on c7auto4: 0
+clone_color: FAKECLONE2:0 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:0 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:0 allocation score on c7auto3: 1
+clone_color: FAKECLONE2:0 allocation score on c7auto4: 0
+clone_color: FAKECLONE2:1 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:1 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:1 allocation score on c7auto4: 1
+clone_color: FAKECLONE2:2 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:2 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:2 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:2 allocation score on c7auto4: 0
+clone_color: FAKECLONE2:3 allocation score on c7auto1: -INFINITY
+clone_color: FAKECLONE2:3 allocation score on c7auto2: -INFINITY
+clone_color: FAKECLONE2:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE2:3 allocation score on c7auto4: 0
+clone_color: FAKECLONE:0 allocation score on c7auto1: 1
+clone_color: FAKECLONE:0 allocation score on c7auto2: 0
+clone_color: FAKECLONE:0 allocation score on c7auto3: 0
+clone_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:1 allocation score on c7auto1: 0
+clone_color: FAKECLONE:1 allocation score on c7auto2: 1
+clone_color: FAKECLONE:1 allocation score on c7auto3: 0
+clone_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:2 allocation score on c7auto1: 0
+clone_color: FAKECLONE:2 allocation score on c7auto2: 0
+clone_color: FAKECLONE:2 allocation score on c7auto3: 1
+clone_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+clone_color: FAKECLONE:3 allocation score on c7auto1: 0
+clone_color: FAKECLONE:3 allocation score on c7auto2: 0
+clone_color: FAKECLONE:3 allocation score on c7auto3: 0
+clone_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:1 allocation score on c7auto4: 1
+native_color: FAKECLONE2:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE2:3 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto1: 1
+native_color: FAKECLONE:0 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:0 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:1 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:2 allocation score on c7auto4: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto1: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto2: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto3: -INFINITY
+native_color: FAKECLONE:3 allocation score on c7auto4: -INFINITY
+native_color: shooter allocation score on c7auto1: 0
+native_color: shooter allocation score on c7auto2: 0
+native_color: shooter allocation score on c7auto3: 0
+native_color: shooter allocation score on c7auto4: 0
diff --git a/pengine/test10/cloned_stop_two.summary b/pengine/test10/cloned_stop_two.summary
new file mode 100644
index 0000000000..531295f47b
--- /dev/null
+++ b/pengine/test10/cloned_stop_two.summary
@@ -0,0 +1,45 @@
+
+Current cluster status:
+Node c7auto2 (2): standby
+Node c7auto3 (3): standby
+Online: [ c7auto1 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 c7auto2 c7auto3 ]
+     Stopped: [ c7auto4 ]
+ Clone Set: FAKECLONE2-clone [FAKECLONE2]
+     Started: [ c7auto3 c7auto4 ]
+     Stopped: [ c7auto1 c7auto2 ]
+
+Transition Summary:
+ * Stop    FAKECLONE:1	(c7auto2)
+ * Stop    FAKECLONE:2	(c7auto3)
+ * Stop    FAKECLONE2:0	(c7auto3)
+ * Stop    FAKECLONE2:1	(Started c7auto4)
+
+Executing cluster transition:
+ * Pseudo action:   FAKECLONE2-clone_stop_0
+ * Resource action: FAKECLONE2      stop on c7auto3
+ * Resource action: FAKECLONE2      stop on c7auto4
+ * Pseudo action:   FAKECLONE2-clone_stopped_0
+ * Pseudo action:   FAKECLONE-clone_stop_0
+ * Resource action: FAKECLONE       stop on c7auto2
+ * Resource action: FAKECLONE       stop on c7auto3
+ * Pseudo action:   FAKECLONE-clone_stopped_0
+ * Pseudo action:   FAKECLONE-clone_start_0
+ * Pseudo action:   all_stopped
+ * Pseudo action:   FAKECLONE-clone_running_0
+
+Revised cluster status:
+Node c7auto2 (2): standby
+Node c7auto3 (3): standby
+Online: [ c7auto1 c7auto4 ]
+
+ shooter	(stonith:fence_phd_kvm):	Started c7auto1
+ Clone Set: FAKECLONE-clone [FAKECLONE]
+     Started: [ c7auto1 ]
+     Stopped: [ c7auto2 c7auto3 c7auto4 ]
+ Clone Set: FAKECLONE2-clone [FAKECLONE2]
+     Stopped: [ c7auto1 c7auto2 c7auto3 c7auto4 ]
+
diff --git a/pengine/test10/cloned_stop_two.xml b/pengine/test10/cloned_stop_two.xml
new file mode 100644
index 0000000000..220dfc2f9a
--- /dev/null
+++ b/pengine/test10/cloned_stop_two.xml
@@ -0,0 +1,157 @@
+<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="30" num_updates="0" admin_epoch="0" cib-last-written="Thu Jul 16 18:03:09 2015" update-origin="c7auto1" update-client="cibadmin" update-user="root" have-quorum="1" dc-uuid="2">
+  <configuration>
+    <crm_config>
+      <cluster_property_set id="cib-bootstrap-options">
+        <nvpair id="cib-bootstrap-options-have-watchdog" name="have-watchdog" value="false"/>
+        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.12-ef86b49"/>
+        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
+        <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="phd"/>
+      </cluster_property_set>
+    </crm_config>
+    <nodes>
+      <node id="1" uname="c7auto1"/>
+      <node id="2" uname="c7auto2">
+        <instance_attributes id="nodes-2">
+          <nvpair id="nodes-2-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="3" uname="c7auto3">
+        <instance_attributes id="nodes-3">
+          <nvpair id="nodes-3-standby" name="standby" value="on"/>
+        </instance_attributes>
+      </node>
+      <node id="4" uname="c7auto4"/>
+    </nodes>
+    <resources>
+      <primitive class="stonith" id="shooter" type="fence_phd_kvm">
+        <instance_attributes id="shooter-instance_attributes"/>
+        <operations>
+          <op id="shooter-monitor-interval-60s" interval="60s" name="monitor"/>
+        </operations>
+      </primitive>
+      <clone id="FAKECLONE-clone">
+        <primitive class="ocf" id="FAKECLONE" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE-clone-meta">
+          <nvpair id="FAKECLONE-clone-min" name="clone-min" value="2"/>
+        </meta_attributes>
+        <meta_attributes id="FAKECLONE-clone-meta_attributes"/>
+      </clone>
+      <clone id="FAKECLONE2-clone">
+        <primitive class="ocf" id="FAKECLONE2" provider="heartbeat" type="Dummy">
+          <instance_attributes id="FAKECLONE2-instance_attributes"/>
+          <operations>
+            <op id="FAKECLONE2-start-timeout-20" interval="0s" name="start" timeout="20"/>
+            <op id="FAKECLONE2-stop-timeout-20" interval="0s" name="stop" timeout="20"/>
+            <op id="FAKECLONE2-monitor-interval-10" interval="10" name="monitor" timeout="20"/>
+          </operations>
+        </primitive>
+        <meta_attributes id="FAKECLONE2-clone-meta"/>
+      </clone>
+    </resources>
+    <constraints>
+      <rsc_location id="location-FAKECLONE-clone-c7auto4--INFINITY" node="c7auto4" rsc="FAKECLONE-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKECLONE2-clone-c7auto1--INFINITY" node="c7auto1" rsc="FAKECLONE2-clone" score="-INFINITY"/>
+      <rsc_location id="location-FAKECLONE2-clone-c7auto2--INFINITY" node="c7auto2" rsc="FAKECLONE2-clone" score="-INFINITY"/>
+      <rsc_order first="FAKECLONE-clone" first-action="start" id="order-FAKECLONE-clone-FAKECLONE2-clone-mandatory" then="FAKECLONE2-clone" then-action="start"/>
+    </constraints>
+  </configuration>
+  <status>
+    <node_state id="1" uname="c7auto1" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <transient_attributes id="1">
+        <instance_attributes id="status-1">
+          <nvpair id="status-1-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="1">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="17:28:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:28:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="30" rc-code="0" op-status="0" interval="0" last-run="1437083676" last-rc-change="1437083676" exec-time="12" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;11:0:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1437073991" last-rc-change="1437073991" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="shooter_monitor_60000" operation_key="shooter_monitor_60000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;9:1:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="7" rc-code="0" op-status="0" interval="60000" last-rc-change="1437073992" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="16:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="31" rc-code="0" op-status="0" interval="0" last-run="1437084158" last-rc-change="1437084158" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="17:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto1" call-id="32" rc-code="0" op-status="0" interval="10000" last-rc-change="1437084158" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="2" uname="c7auto2" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <transient_attributes id="2">
+        <instance_attributes id="status-2">
+          <nvpair id="status-2-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="2">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="16:29:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;16:29:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="32" rc-code="0" op-status="0" interval="0" last-run="1437083678" last-rc-change="1437083678" exec-time="10" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;6:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="964" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="12:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;12:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="33" rc-code="0" op-status="0" interval="0" last-run="1437084158" last-rc-change="1437084158" exec-time="11" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="13:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;13:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto2" call-id="34" rc-code="0" op-status="0" interval="10000" last-rc-change="1437084158" exec-time="12" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="3" uname="c7auto3" in_ccm="true" crmd="online" crm-debug-origin="do_update_resource" join="member" expected="member">
+      <transient_attributes id="3">
+        <instance_attributes id="status-3">
+          <nvpair id="status-3-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="3">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="17:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;17:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="29" rc-code="0" op-status="0" interval="0" last-run="1437083710" last-rc-change="1437083710" exec-time="6" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE2_monitor_10000" operation_key="FAKECLONE2_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="18:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;18:30:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="30" rc-code="0" op-status="0" interval="10000" last-rc-change="1437083710" exec-time="6" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;8:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="14:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;14:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="31" rc-code="0" op-status="0" interval="0" last-run="1437084157" last-rc-change="1437084157" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE_monitor_10000" operation_key="FAKECLONE_monitor_10000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.10" transition-key="15:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;15:33:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto3" call-id="32" rc-code="0" op-status="0" interval="10000" last-rc-change="1437084157" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+    <node_state id="4" uname="c7auto4" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
+      <transient_attributes id="4">
+        <instance_attributes id="status-4">
+          <nvpair id="status-4-shutdown" name="shutdown" value="0"/>
+          <nvpair id="status-4-probe_complete" name="probe_complete" value="true"/>
+        </instance_attributes>
+      </transient_attributes>
+      <lrm id="4">
+        <lrm_resources>
+          <lrm_resource id="FAKECLONE2" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE2_last_0" operation_key="FAKECLONE2_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="22:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;22:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="29" rc-code="0" op-status="0" interval="0" last-run="1437083649" last-rc-change="1437083649" exec-time="7" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" fake " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+            <lrm_rsc_op id="FAKECLONE2_monitor_10000" operation_key="FAKECLONE2_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="23:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;23:26:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="30" rc-code="0" op-status="0" interval="10000" last-rc-change="1437083649" exec-time="7" queue-time="0" op-digest="4811cef7f7f94e3a35a70be7916cb2fd"/>
+          </lrm_resource>
+          <lrm_resource id="shooter" type="fence_phd_kvm" class="stonith">
+            <lrm_rsc_op id="shooter_last_0" operation_key="shooter_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:7;10:0:7:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1437073988" last-rc-change="1437073988" exec-time="963" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+          <lrm_resource id="FAKECLONE" type="Dummy" class="ocf" provider="heartbeat">
+            <lrm_rsc_op id="FAKECLONE_last_0" operation_key="FAKECLONE_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.10" transition-key="20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" transition-magic="0:0;20:3:0:b489d50c-a7db-4605-8519-a2d5e1452e29" on_node="c7auto4" call-id="14" rc-code="0" op-status="0" interval="0" last-run="1437074856" last-rc-change="1437074856" exec-time="8" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
+          </lrm_resource>
+        </lrm_resources>
+      </lrm>
+    </node_state>
+  </status>
+</cib>