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

Function cli_config_update

lib/common/xml.c:2771–2838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2769}
2770
2771gboolean
2772cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs)
2773{
2774 gboolean rc = TRUE;
2775 static int min_version = -1;
2776 static int max_version = -1;
2777
2778 const char *value = crm_element_value(*xml, XML_ATTR_VALIDATION);
2779 int version = get_schema_version(value);
2780
2781 if(min_version < 0) {
2782 min_version = get_schema_version(MINIMUM_SCHEMA_VERSION);
2783 }
2784 if(max_version < 0) {
2785 max_version = get_schema_version(LATEST_SCHEMA_VERSION);
2786 }
2787
2788 if(version < min_version) {
2789 xmlNode *converted = NULL;
2790
2791 converted = copy_xml(*xml);
2792 update_validation(&converted, &version, TRUE, to_logs);
2793
2794 value = crm_element_value(converted, XML_ATTR_VALIDATION);
2795 if(version < min_version) {
2796 if(to_logs) {
2797 crm_config_err("Your current configuration could only be upgraded to %s... "
2798 "the minimum requirement is %s.\n", crm_str(value), MINIMUM_SCHEMA_VERSION);
2799 } else {
2800 fprintf(stderr, "Your current configuration could only be upgraded to %s... "
2801 "the minimum requirement is %s.\n", crm_str(value), MINIMUM_SCHEMA_VERSION);
2802 }
2803
2804 free_xml(converted);
2805 converted = NULL;
2806 rc = FALSE;
2807
2808 } else {
2809 free_xml(*xml);
2810 *xml = converted;
2811
2812 if(version < max_version) {
2813 crm_config_warn("Your configuration was internally updated to %s... "
2814 "which is acceptable but not the most recent",
2815 get_schema_name(version));
2816
2817 } else if(to_logs){
2818 crm_info("Your configuration was internally updated to the latest version (%s)",
2819 get_schema_name(version));
2820 }
2821 }
2822 } else if(version > max_version) {
2823 if(to_logs){
2824 crm_config_warn("Configuration validation is currently disabled."
2825 " It is highly encouraged and prevents many common cluster issues.");
2826
2827 } else {
2828 fprintf(stderr, "Configuration validation is currently disabled."

Callers 9

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mon_refresh_displayFunction · 0.85
setup_inputFunction · 0.85
profile_oneFunction · 0.85
generate_paramsFunction · 0.85
mainFunction · 0.85
process_pe_messageFunction · 0.85

Calls 6

crm_element_valueFunction · 0.85
get_schema_versionFunction · 0.85
copy_xmlFunction · 0.85
update_validationFunction · 0.85
free_xmlFunction · 0.85
get_schema_nameFunction · 0.85

Tested by 2

generate_paramsFunction · 0.68
mainFunction · 0.68