diff --git a/lib/pacemaker/pcmk_sched_promotable.c b/lib/pacemaker/pcmk_sched_promotable.c index b4480ba..ab69694 100644 --- a/lib/pacemaker/pcmk_sched_promotable.c +++ b/lib/pacemaker/pcmk_sched_promotable.c @@ -151,6 +151,14 @@ static void apply_master_location(pe_resource_t *child, GListPtr location_constr } static pe_node_t * +guest_location(pe_node_t *guest_node) +{ + pe_resource_t *guest = guest_node->details->remote_rsc->container; + + return guest->fns->location(guest, NULL, FALSE); +} + +static pe_node_t * can_be_master(pe_resource_t * rsc) { pe_node_t *node = NULL; @@ -199,6 +207,15 @@ can_be_master(pe_resource_t * rsc) } else if (can_run_resources(node) == FALSE) { crm_trace("Node can't run any resources: %s", node->details->uname); return NULL; + + /* @TODO It's possible this check should be done in can_run_resources() + * instead. We should investigate all its callers to figure out whether that + * would be a good idea. + */ + } else if (pe__is_guest_node(node) && (guest_location(node) == NULL)) { + pe_rsc_trace(rsc, "%s cannot be promoted: guest %s not allocated", + rsc->id, node->details->remote_rsc->container->id); + return NULL; } get_clone_variant_data(clone_data, parent);