| 119 | } |
| 120 | |
| 121 | resource_t * |
| 122 | native_find_rsc(resource_t * rsc, const char *id, node_t * on_node, int flags) |
| 123 | { |
| 124 | gboolean match = FALSE; |
| 125 | resource_t *result = NULL; |
| 126 | GListPtr gIter = rsc->children; |
| 127 | |
| 128 | CRM_ASSERT(id != NULL); |
| 129 | |
| 130 | if (flags & pe_find_clone) { |
| 131 | const char *rid = ID(rsc->xml); |
| 132 | if(rsc->parent == NULL) { |
| 133 | match = FALSE; |
| 134 | |
| 135 | } else if (safe_str_eq(rsc->id, id)) { |
| 136 | match = TRUE; |
| 137 | |
| 138 | } else if(safe_str_eq(rid, id)) { |
| 139 | match = TRUE; |
| 140 | } |
| 141 | |
| 142 | } else { |
| 143 | if (strcmp(rsc->id, id) == 0) { |
| 144 | match = TRUE; |
| 145 | |
| 146 | } else if (is_set(flags, pe_find_renamed) |
| 147 | && rsc->clone_name |
| 148 | && strcmp(rsc->clone_name, id) == 0) { |
| 149 | match = TRUE; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | if (match && on_node) { |
| 154 | pe_rsc_trace(rsc, "Now checking %s is on %s", rsc->id, on_node->details->uname); |
| 155 | if (is_set(flags, pe_find_current) && rsc->running_on) { |
| 156 | |
| 157 | GListPtr gIter = rsc->running_on; |
| 158 | |
| 159 | for (; gIter != NULL; gIter = gIter->next) { |
| 160 | node_t *loc = (node_t *) gIter->data; |
| 161 | |
| 162 | if (loc->details == on_node->details) { |
| 163 | return rsc; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | } else if (is_set(flags, pe_find_inactive) && rsc->running_on == NULL) { |
| 168 | return rsc; |
| 169 | |
| 170 | } else if (is_not_set(flags, pe_find_current) && rsc->allocated_to |
| 171 | && rsc->allocated_to->details == on_node->details) { |
| 172 | return rsc; |
| 173 | } |
| 174 | |
| 175 | } else if (match) { |
| 176 | return rsc; |
| 177 | } |
| 178 |
nothing calls this directly
no test coverage detected