1 /* 2 * Copyright (C) 2012 3 * David Vossel <davidvossel@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU Lesser General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef STANDALONE_CONFIG__H 21 # define STANDALONE_CONFIG__H 22 23 /*! Picking a large number in effort to avoid a dynamic list. */ 24 # define STANDALONE_CFG_MAX_KEYVALS 100 25 26 # define STONITH_NG_CONF_FILE "/etc/pacemaker/stonith-ng.conf" 27 28 /*! 29 * \brief Attempts to open a stonith standalone config file 30 * and load the config internally. 31 * 32 * \note standalone_cfg_commit() must be executed after 33 * reading in the file before the config will be activated. 34 * 35 * \retval 0, success 36 * \retval -1, failure 37 */ 38 int standalone_cfg_read_file(const char *file_path); 39 40 /*! 41 * \brief Add a fencing device to the standalone config 42 * 43 * \param device, Name of the fencing device to be created. 44 * \param agent, The underlying fencing agent this device will use. 45 * 46 * \retval 0, Success 47 * \retval -1, Failure 48 */ 49 int standalone_cfg_add_device(const char *device, const char *agent); 50 51 /*! 52 * \brief Add an option (key value pair) to an existing fencing device. 53 * 54 * \param device, Name of the fencing device 55 * \param key, the Key portion of the key value pair. 56 * \param value, the value portion of the key value pair. 57 * 58 * \retval 0, Success 59 * \retval -1, Failure 60 */ 61 int standalone_cfg_add_device_options(const char *device, const char *key, const char *value); 62 63 /*! 64 * \brief Add a node to a fencing device. 65 * 66 * \param node, Name of the node to add to the fencing device 67 * \param device, Name of the fencing device to add the node to 68 * \param ports, The port mappings of this specific node for the device, NULL if no 69 * port mapping is present. 70 * 71 * \retval 0, Success 72 * \retval -1, failure 73 */ 74 int standalone_cfg_add_node(const char *node, const char *device, const char *ports); 75 76 /*! 77 * \brief Add a fencing level rule to a node for a specific fencing device. 78 */ 79 int standalone_cfg_add_node_priority(const char *node, const char *device, unsigned int level); 80 81 /*! 82 * \brief Commits all the changes added to the standalone config into the stonithd core. 83 */ 84 int standalone_cfg_commit(void); 85 86 #endif