1 /* Copyright (c) 2003-2005 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #include <signaldata/TestOrd.hpp>
17 #include <OutputStream.hpp>
19 #include "MgmtSrvr.hpp"
20 #include "SignalQueue.hpp"
21 #include <InitConfigFileParser.hpp>
22 #include <ConfigRetriever.hpp>
23 #include <ndb_version.h>
26 * Save a configuration to the running configuration file
29 MgmtSrvr::saveConfig(const Config
*conf
) {
31 newfile
.appfmt("%s.new", m_configFilename
.c_str());
33 /* Open and write to the new config file */
34 FILE *f
= fopen(newfile
.c_str(), "w");
36 /** @todo Send something apropriate to the log */
39 FileOutputStream
stream(f
);
40 conf
->printConfigFile(stream
);
44 /* Rename file to real name */
45 rename(newfile
.c_str(), m_configFilename
.c_str());
51 MgmtSrvr::readConfig() {
53 InitConfigFileParser parser
;
54 if (m_configFilename
.length())
56 conf
= parser
.parseConfig(m_configFilename
.c_str());
60 ndbout_c("Reading cluster configuration using my.cnf");
61 conf
= parser
.parse_mycnf();
67 MgmtSrvr::fetchConfig() {
68 struct ndb_mgm_configuration
* tmp
= m_config_retriever
->getConfig();
70 Config
* conf
= new Config();
71 conf
->m_configValues
= tmp
;