summaryrefslogtreecommitdiff
path: root/res/res_corosync.c
AgeCommit message (Collapse)Author
2017-12-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-06-16res_corosync: Change thread stack sizeJan Friesse
In Corosync 2.x libraries were changed to use LibQB IPC. Sadly LibQB IPC doesn't support copy-free access to received buffer, so Corosync libraries were rewritten to use stack as buffer. Mostly the needed stack size is quite small, but for all *_dispatch functions, 1MiB is needed. Asterisk function ast_pthread_create_background set stack size for new thread to much smaller AST_BACKGROUND_STACKSIZE (~500KiB). This results in Asterisk crash when running with Corosync 2.x. Patch solves this issue by creating it's own version of ast_pthread_create_background which sets stack size to much higher value (actually it's AST_BACKGROUND_STACKSIZE + 3MiB). Another problem may appear when "corosync show members" netconsole command is executed. It is also executed in thread and also has only 500KiB stack size. Sadly it calls corosync_cfg_get_node_addrs which again needs at least 1MiB stack. Solution is to use HAVE_COROSYNC_CFG_STATE_TRACK as a discriminator between Corosync 1.x and 2.x. If 1.x is found, nothing changes. If 2.x is found, NodeID is displayed instead of IP address. ASTERISK-25370 #close Reported by: mdu113 Change-Id: Id95b0d21ab6e708e7d74ad8786c587211676fa08
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-08-15core: Entity ID is not set or invalidAlexei Gradinari
The Exchanging Device and Mailbox States could not working if the Entity ID (EID) is not set manually and can't be obtained from ethernet interface. This patch replaces debug message to warning and addes missing description about option 'entityid' to asterisk.conf.sample. With this patch the asterisk also: (1) decline loading the modules which won't work without EID: res_corosync and res_pjsip_publish_asterisk. (2) warn if EID is empty on loading next modules: pbx_dundi, res_xmpp Starting with v197 systemd/udev will automatically assign "predictable" names for all local Ethernet interfaces. This patch also addes some new ethernet prefixes "eno" and "ens". ASTERISK-26164 #close Change-Id: I72d712f1ad5b6f64571bb179c5cb12461e7c58c6
2016-07-13res/res_corosync: Raise a Stasis message on node join/leave eventsMatt Jordan
When res_corosync detects that a node leaves or joins, it currently is informed of this via Corosync callbacks. However, there are a few limitations with the information presented: (1) While we have information that Corosync is aware of - such as the Corosync nodeid - that information is really only useful inside of Corosync or res_corosync. There's no way to translate a Corosync nodeid to some other internally useful unique identifier for the Asterisk instance that just joined or left the cluster. (2) While res_corosync is notified of the instance joining or leaving the cluster, it has no mechanism to inform the Asterisk core or other modules of this event. This limits the usefulness of res_corosync as a heartbeat mechanism for other modules. This patch addresses both issues. First, it adds the notion of a cluster discovery message both within the Stasis message bus, as well as the binary event messages that res_corosync uses to transmit data back and forth within the cluster. When Asterisk joins the cluster, it sends a discovery message to the other nodes in the cluster, which correlates the Corosync nodeid along with the Asterisk EID. res_corosync now maintains a hash of Corosync nodeids to Asterisk EIDs, such that it can map changes in cluster state with the Asterisk instance that has that nodeid. Likewise, when an Asterisk instance receives a discovery message from a node in the cluster, it now sends its own discovery message back to the originating node with the local Asterisk EID. This lets Asterisk instances within the cluster build a complete picture of the other Asterisk instances within the cluster. Second, it publishes the discovery messages onto the Stasis message bus. Said messages are published whenever a node joins or leaves the cluster. Interested modules can subscribe for the ast_cluster_discovery_type() message under the ast_system_topic() and be notified when changes in cluster state occur. Change-Id: I9015f418d6ae7f47e4994e04e18948df4d49b465
2015-06-26res/res_corosync: Always decline module load, instead of failingMatt Jordan
Returns a 'failure' from the module load routine indicates to Asterisk that it should abort loading completely. This is rarely - in fact, really, never - a good option. Aborting load of Asterisk from a dynamic module implies that the core, and the rest of the dynamic modules, don't matter: we should abandon all processing. res_corosync is really not that important. This patch updates the module such that, if it fails to load, it politely declines (emitting ERROR messages along the way), and allows Asterisk to continue to function. Note that this issue was keeping Asterisk unit tests from running on certain build agents. Change-Id: I252249e81fb9b1a68e0da873f54f47e21d648f0f
2015-04-23res_corosync: Add check for config file before calling corosync apisGeorge Joseph
On some systems, res_corosync isn't compatible with the installed version of corosync so corosync_cfg_initialize fails, load_module returns LOAD_FAILURE, and Asterisk terminates. The work around has been to remember to add res_corosync as a noload in modules.conf. A better solution though is to have res_corosync check for its config file before attempting to call corosync apis and return LOAD_DECLINE if there's no config file. This lets Asterisk loading continue. If you have a res_corosync.conf file and res_corosync fails, you get the same behavior as today and the fatal error tells you something is wrong with the install. ASTERISK-24998 Change-Id: Iaf94a9431a4922ec4ec994003f02135acfdd3889
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2014-08-06Stasis: Allow message types to be blockedKinsey Moore
This introduces stasis.conf and a mechanism to prevent certain message types from being published. Internally, this works by preventing the chosen message types from being created which ensures that those message types can never be published. This patch also adjusts message publishers such that message payloads are not created if the related message type is not available. ASTERISK-23943 #close Review: https://reviewboard.asterisk.org/r/3823/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-22Fix more dev-mode build issuesKinsey Moore
........ Merged revisions 419129 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 419162 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 419163 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-22res_corosync: Update module to work with Stasis (and compile)Matthew Jordan
This patch fixes res_corosync such that it works with Asterisk 12. This restores the functionality that was present in previous versions of Asterisk, and ensures compatibility with those versions by restoring the binary message format needed to pass information from/to them. The following changes were made in the core to support this: * The event system has been partially restored. All event definition and event types in this patch were pulled from Asterisk 11. Previously, we had hoped that this information would live in res_corosync; however, the approach in this patch seems to be better for a few reasons: (1) Theoretically, ast_events can be used by any module as a binary representation of a Stasis message. Given the structure of an ast_event object, that information has to live in the core to be used universally. For example, defining the payload of a device state ast_event in res_corosync could result in an incompatible device state representation in another module. (2) Much of this representation already lived in the core, and was not easily extensible. (3) The code already existed. :-) * Stasis message types now have a message formatter that converts their payload to an ast_event object. * Stasis message forwarders now handle forwarding to themselves. Previously this would result in an infinite recursive call. Now, this simply creates a new forwarding object with no forwards set up (as it is the thing it is forwarding to). This is advantageous for res_corosync, as returning NULL would also imply an unrecoverable error. Returning a subscription in this case allows for easier handling of message types that are published directly to an aggregate topic that has forwarders. Review: https://reviewboard.asterisk.org/r/3486/ ASTERISK-22912 #close ASTERISK-22372 #close ........ Merged revisions 414330 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-18Disable build of res_corosync until it is back in a compiling stateKinsey Moore
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396908 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-16Allow res_corosync to buildKinsey Moore
ast_enable_distributed_devstate is no longer applicable to how the distributed device state system works and is no longer necessary. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385886 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-30Add a "corosync ping" CLI command.Russell Bryant
This patch adds a new CLI command to the res_corosync module. It is primarily used as a debugging tool. It lets you fire off an event which will cause res_corosync on other nodes in the cluster to place messages into the logger if everything is working ok. It verifies that the corosync communication is working as expected. I didn't put anything in the CHANGES file for this, because this module is new in Asterisk 11. There is already a generic "res_corosync new module" entry in there so I figure that covers it just fine. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370535 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-28res_corosync: Fix build against corosync 2.0.Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364444 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-21res_corosync: Recover if corosync gets restarted.Russell Bryant
If corosync gets restarted while Asterisk is running, automatically recover. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363046 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-21res_corosync: reimplement "corosync show members" command.Russell Bryant
Reimplement the "corosync show members" CLI command using a CPG iterator instead of the cpg_membership_get API call. This will also show all CPG members, including those in groups other than 'asterisk', which may be useful at some point for debugging purposes. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@363045 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-17Avoid cppcheck warnings; removing unused vars and a bit of cleanup.Walter Doekes
Patch by: junky Review: https://reviewboard.asterisk.org/r/1743/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-05Replace res_ais with a new module, res_corosync.Russell Bryant
This patch removes res_ais and introduces a new module, res_corosync. The OpenAIS project is deprecated and is now just a wrapper around Corosync. This module provides the same functionality using the same core infrastructure, but without the use of the deprecated components. Technically res_ais could have been used with an AIS implementation other than OpenAIS, but that is the only one I know of that was ever used. Review: https://reviewboard.asterisk.org/r/1700/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354046 65c4cc65-6c06-0410-ace0-fbb531ad65f3