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

Function attrd_perform_update

tools/attrd.c:706–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

704}
705
706void
707attrd_perform_update(attr_hash_entry_t * hash_entry)
708{
709 int rc = pcmk_ok;
710 struct attrd_callback_s *data = NULL;
711 const char *user_name = NULL;
712
713 if (hash_entry == NULL) {
714 return;
715
716 } else if (cib_conn == NULL) {
717 crm_info("Delaying operation %s=%s: cib not connected", hash_entry->id,
718 crm_str(hash_entry->value));
719 return;
720
721 }
722#if ENABLE_ACL
723 if (hash_entry->user) {
724 user_name = hash_entry->user;
725 crm_trace("Performing request from user '%s'", hash_entry->user);
726 }
727#endif
728
729 if (hash_entry->value == NULL) {
730 /* delete the attr */
731 rc = delete_attr_delegate(cib_conn, cib_none, hash_entry->section, attrd_uuid, NULL,
732 hash_entry->set, hash_entry->uuid, hash_entry->id, NULL, FALSE,
733 user_name);
734
735 if (rc >= 0 && hash_entry->stored_value) {
736 crm_notice("Sent delete %d: node=%s, attr=%s, id=%s, set=%s, section=%s",
737 rc, attrd_uuid, hash_entry->id,
738 hash_entry->uuid ? hash_entry->uuid : "<n/a>", hash_entry->set,
739 hash_entry->section);
740
741 } else if (rc < 0 && rc != -ENXIO) {
742 crm_notice
743 ("Delete operation failed: node=%s, attr=%s, id=%s, set=%s, section=%s: %s (%d)",
744 attrd_uuid, hash_entry->id, hash_entry->uuid ? hash_entry->uuid : "<n/a>",
745 hash_entry->set, hash_entry->section, pcmk_strerror(rc), rc);
746
747 } else {
748 crm_trace("Sent delete %d: node=%s, attr=%s, id=%s, set=%s, section=%s",
749 rc, attrd_uuid, hash_entry->id,
750 hash_entry->uuid ? hash_entry->uuid : "<n/a>", hash_entry->set,
751 hash_entry->section);
752 }
753
754 } else {
755 /* send update */
756 rc = update_attr_delegate(cib_conn, cib_none, hash_entry->section,
757 attrd_uuid, NULL, hash_entry->set, hash_entry->uuid,
758 hash_entry->id, hash_entry->value, FALSE, user_name);
759 if (rc < 0) {
760 crm_notice("Sent update %s=%s failed: %s", hash_entry->id, hash_entry->value, pcmk_strerror(rc));
761 } if (safe_str_neq(hash_entry->value, hash_entry->stored_value) || rc < 0) {
762 crm_notice("Sent update %d: %s=%s", rc, hash_entry->id, hash_entry->value);
763 } else {

Callers 4

attrd_ha_callbackFunction · 0.85
attrd_ais_dispatchFunction · 0.85
attrd_trigger_updateFunction · 0.85

Calls 4

delete_attr_delegateFunction · 0.85
pcmk_strerrorFunction · 0.85
update_attr_delegateFunction · 0.85
safe_str_neqFunction · 0.85

Tested by

no test coverage detected