MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / unpack_simple_colocation

Function unpack_simple_colocation

pengine/constraints.c:1783–1854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1781}
1782
1783static gboolean
1784unpack_simple_colocation(xmlNode * xml_obj, pe_working_set_t * data_set)
1785{
1786 int score_i = 0;
1787
1788 const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
1789 const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE);
1790
1791 const char *id_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE);
1792 const char *id_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET);
1793 const char *state_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_ROLE);
1794 const char *state_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET_ROLE);
1795 const char *instance_lh = crm_element_value(xml_obj, XML_COLOC_ATTR_SOURCE_INSTANCE);
1796 const char *instance_rh = crm_element_value(xml_obj, XML_COLOC_ATTR_TARGET_INSTANCE);
1797 const char *attr = crm_element_value(xml_obj, XML_COLOC_ATTR_NODE_ATTR);
1798
1799 const char *symmetrical = crm_element_value(xml_obj, XML_CONS_ATTR_SYMMETRICAL);
1800
1801 resource_t *rsc_lh = pe_find_resource(data_set->resources, id_lh);
1802 resource_t *rsc_rh = pe_find_resource(data_set->resources, id_rh);
1803
1804 if (rsc_lh == NULL) {
1805 crm_config_err("Invalid constraint '%s': No resource named '%s'", id, id_lh);
1806 return FALSE;
1807
1808 } else if (rsc_rh == NULL) {
1809 crm_config_err("Invalid constraint '%s': No resource named '%s'", id, id_rh);
1810 return FALSE;
1811
1812 } else if (instance_lh && rsc_lh->variant < pe_clone) {
1813 crm_config_err
1814 ("Invalid constraint '%s': Resource '%s' is not a clone but instance %s was requested",
1815 id, id_lh, instance_lh);
1816 return FALSE;
1817
1818 } else if (instance_rh && rsc_rh->variant < pe_clone) {
1819 crm_config_err
1820 ("Invalid constraint '%s': Resource '%s' is not a clone but instance %s was requested",
1821 id, id_rh, instance_rh);
1822 return FALSE;
1823 }
1824
1825 if (instance_lh) {
1826 rsc_lh = find_clone_instance(rsc_lh, instance_lh, data_set);
1827 if (rsc_lh == NULL) {
1828 crm_config_warn("Invalid constraint '%s': No instance '%s' of '%s'", id, instance_lh,
1829 id_lh);
1830 return FALSE;
1831 }
1832 }
1833
1834 if (instance_rh) {
1835 rsc_rh = find_clone_instance(rsc_rh, instance_rh, data_set);
1836 if (rsc_rh == NULL) {
1837 crm_config_warn("Invalid constraint '%s': No instance '%s' of '%s'", id, instance_rh,
1838 id_rh);
1839 return FALSE;
1840 }

Callers 1

unpack_rsc_colocationFunction · 0.85

Calls 6

crm_element_valueFunction · 0.85
pe_find_resourceFunction · 0.85
find_clone_instanceFunction · 0.85
crm_is_trueFunction · 0.85
char2scoreFunction · 0.85
rsc_colocation_newFunction · 0.85

Tested by

no test coverage detected