| 780 | } |
| 781 | |
| 782 | void |
| 783 | RecurringOp_Stopped(resource_t * rsc, action_t * start, node_t * node, |
| 784 | xmlNode * operation, pe_working_set_t * data_set) |
| 785 | { |
| 786 | char *key = NULL; |
| 787 | const char *name = NULL; |
| 788 | const char *role = NULL; |
| 789 | const char *interval = NULL; |
| 790 | const char *node_uname = NULL; |
| 791 | |
| 792 | unsigned long long interval_ms = 0; |
| 793 | GListPtr possible_matches = NULL; |
| 794 | GListPtr gIter = NULL; |
| 795 | |
| 796 | /* TODO: Support of non-unique clone */ |
| 797 | if (is_set(rsc->flags, pe_rsc_unique) == FALSE) { |
| 798 | return; |
| 799 | } |
| 800 | |
| 801 | /* Only process for the operations with role="Stopped" */ |
| 802 | role = crm_element_value(operation, "role"); |
| 803 | if (role == NULL || text2role(role) != RSC_ROLE_STOPPED) { |
| 804 | return; |
| 805 | } |
| 806 | |
| 807 | pe_rsc_trace(rsc, "Creating recurring actions %s for %s in role %s on nodes where it'll not be running", |
| 808 | ID(operation), rsc->id, role2text(rsc->next_role)); |
| 809 | |
| 810 | if (node != NULL) { |
| 811 | node_uname = node->details->uname; |
| 812 | } |
| 813 | |
| 814 | interval = crm_element_value(operation, XML_LRM_ATTR_INTERVAL); |
| 815 | interval_ms = crm_get_interval(interval); |
| 816 | |
| 817 | if (interval_ms == 0) { |
| 818 | return; |
| 819 | } |
| 820 | |
| 821 | name = crm_element_value(operation, "name"); |
| 822 | if (is_op_dup(rsc, name, interval)) { |
| 823 | return; |
| 824 | } |
| 825 | |
| 826 | if (safe_str_eq(name, RSC_STOP) |
| 827 | || safe_str_eq(name, RSC_START) |
| 828 | || safe_str_eq(name, RSC_DEMOTE) |
| 829 | || safe_str_eq(name, RSC_PROMOTE) |
| 830 | ) { |
| 831 | crm_config_err("Invalid recurring action %s wth name: '%s'", ID(operation), name); |
| 832 | return; |
| 833 | } |
| 834 | |
| 835 | key = generate_op_key(rsc->id, name, interval_ms); |
| 836 | if (find_rsc_op_entry(rsc, key) == NULL) { |
| 837 | /* disabled */ |
| 838 | free(key); |
| 839 | return; |
no test coverage detected