~ubuntu-branches/ubuntu/utopic/pacemaker/utopic-proposed

« back to all changes in this revision

Viewing changes to pengine/graph.c

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2013-08-15 11:27:07 UTC
  • mfrom: (1.1.12) (2.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20130815112707-5r864ink7jme3zl5
Tags: 1.1.10+git20130802-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - debian/control: Build-Depends on libqb-dev; Depends on libheartbeat2.
* Corosync's pacemaker plugin is disabled, hence not built:
  - debian/licrmcluster4-dev.install: Do not install plugin.h.
  - debian/pacemaker.install: Do not install pacemaker.lcrso.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
 
1
/*
2
2
 * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
3
 
 * 
 
3
 *
4
4
 * This program is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU General Public
6
6
 * License as published by the Free Software Foundation; either
7
7
 * version 2 of the License, or (at your option) any later version.
8
 
 * 
 
8
 *
9
9
 * This software is distributed in the hope that it will be useful,
10
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
12
 * General Public License for more details.
13
 
 * 
 
13
 *
14
14
 * You should have received a copy of the GNU General Public
15
15
 * License along with this library; if not, write to the Free Software
16
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
333
333
        update_action_flags(first, pe_action_print_always);     /* dont care about changed */
334
334
    }
335
335
 
 
336
    if ((type & pe_order_implies_then
 
337
         || type & pe_order_implies_first
 
338
         || type & pe_order_restart)
 
339
        && first->rsc
 
340
        && safe_str_eq(first->task, RSC_STOP)
 
341
        && is_not_set(first->rsc->flags, pe_rsc_managed)
 
342
        && is_set(first->rsc->flags, pe_rsc_block)
 
343
        && is_not_set(first->flags, pe_action_runnable)) {
 
344
 
 
345
        if (update_action_flags(then, pe_action_runnable | pe_action_clear)) {
 
346
            changed |= pe_graph_updated_then;
 
347
        }
 
348
 
 
349
        if (changed) {
 
350
            pe_rsc_trace(then->rsc, "unmanaged left: %s then %s: changed", first->uuid, then->uuid);
 
351
        } else {
 
352
            crm_trace("unmanaged left: %s then %s", first->uuid, then->uuid);
 
353
        }
 
354
    }
 
355
 
336
356
    if (processed == FALSE) {
337
357
        crm_trace("Constraint 0x%.6x not applicable", type);
338
358
    }
489
509
        } else if (is_set(data_set->flags, pe_flag_maintenance_mode)) {
490
510
            pe_rsc_trace(action->rsc, "Skipping %s: maintainence mode", action->uuid);
491
511
            continue;
 
512
        } else if (node->details->maintenance) {
 
513
            pe_rsc_trace(action->rsc, "Skipping %s: node %s is in maintenance mode",
 
514
                         action->uuid, node->details->uname);
 
515
            continue;
492
516
        } else if (safe_str_neq(action->task, RSC_STOP)) {
493
517
            continue;
494
518
        } else if (is_not_set(action->rsc->flags, pe_rsc_managed)
568
592
     * This means some actions will get routed through the cluster
569
593
     * node the connection rsc began on, and others are routed through
570
594
     * the cluster node the connection rsc ends up on.
571
 
     * 
 
595
     *
572
596
     * 1. stop, demote, migrate actions of resources living in the remote
573
597
     *    node _MUST_ occur _BEFORE_ the connection can move (these actions
574
598
     *    are all required before the remote rsc stop action can occur.) In
595
619
    return router_node;
596
620
}
597
621
 
598
 
xmlNode *
599
 
action2xml(action_t * action, gboolean as_input)
 
622
static xmlNode *
 
623
action2xml(action_t * action, gboolean as_input, pe_working_set_t *data_set)
600
624
{
601
625
    gboolean needs_node_info = TRUE;
602
626
    xmlNode *action_xml = NULL;
752
776
    crm_xml_add(args_xml, XML_ATTR_CRM_VERSION, CRM_FEATURE_SET);
753
777
 
754
778
    g_hash_table_foreach(action->extra, hash2field, args_xml);
755
 
    if (action->rsc != NULL) {
 
779
    if (action->rsc != NULL && action->node) {
 
780
        GHashTable *p = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
 
781
 
 
782
        get_rsc_attributes(p, action->rsc, action->node, data_set);
 
783
        g_hash_table_foreach(p, hash2smartfield, args_xml);
 
784
 
 
785
        g_hash_table_destroy(p);
 
786
    } else if(action->rsc) {
756
787
        g_hash_table_foreach(action->rsc->parameters, hash2smartfield, args_xml);
757
788
    }
758
789
 
800
831
         * probe_complete from running (presumably because it is only
801
832
         * partially up)
802
833
         *
803
 
         * For these reasons we tolerate such perversions 
 
834
         * For these reasons we tolerate such perversions
804
835
         */
805
836
 
806
837
        for (lpc = action->actions_after; lpc != NULL; lpc = lpc->next) {
940
971
        if (action->rsc && safe_str_eq(action->task, RSC_MIGRATE)) {
941
972
            /* Remove the orders like :
942
973
             *     "load_stopped_node2" -> "rscA_migrate_to node1"
943
 
             * which were created from: pengine/native.c: MigrateRsc() 
 
974
             * which were created from: pengine/native.c: MigrateRsc()
944
975
             *     order_actions(other, then, other_w->type);
945
976
             */
946
977
            wrapper->type = pe_order_none;
1045
1076
        crm_xml_add_int(syn, XML_CIB_ATTR_PRIORITY, synapse_priority);
1046
1077
    }
1047
1078
 
1048
 
    xml_action = action2xml(action, FALSE);
 
1079
    xml_action = action2xml(action, FALSE, data_set);
1049
1080
    add_node_nocopy(set, crm_element_name(xml_action), xml_action);
1050
1081
 
1051
1082
    action->actions_before = g_list_sort(action->actions_before, sort_action_id);
1063
1094
        last_action = wrapper->action->id;
1064
1095
        input = create_xml_node(in, "trigger");
1065
1096
 
1066
 
        xml_action = action2xml(wrapper->action, TRUE);
 
1097
        xml_action = action2xml(wrapper->action, TRUE, data_set);
1067
1098
        add_node_nocopy(input, crm_element_name(xml_action), xml_action);
1068
1099
    }
1069
1100
}