30 XmlClusterLoader::XmlClusterLoader(
string szFileName) : confFile(std::move(szFileName))
39 cluster.
nodes.clear();
41 TiXmlDocument doc(confFile);
45 err<<
"XmlClusterLoader: unable to load "<<confFile;
51 TiXmlElement *root = doc.RootElement();
54 logger->
addError(
"XmlClusterLoader: unable to find root element");
58 if (root->ValueStr() !=
"cluster")
61 err<<
"XmlClusterLoader:No tag cluster found in"<<confFile;
66 if (root->Attribute(
"name"))
68 cluster.
name = root->Attribute(
"name");
71 if (root->Attribute(
"user"))
73 cluster.
user = root->Attribute(
"user");
76 TiXmlElement *nameserver = root->FirstChildElement(
"nameserver");
80 err<<
"XmlClusterLoader:No tag nameserver found in"<<confFile;
85 if (nameserver->Attribute(
"namespace"))
87 cluster.
nameSpace = nameserver->Attribute(
"namespace");
91 if (nameserver->Attribute(
"node"))
93 cluster.
nsNode = nameserver->Attribute(
"node");
97 if (nameserver->Attribute(
"ssh-options"))
99 cluster.
ssh_options = nameserver->Attribute(
"ssh-options");
105 for (TiXmlElement* node = root->FirstChildElement(
"node");
106 node !=
nullptr; node = node->NextSiblingElement(
"node"))
111 c_node.
name = node->GetText();
114 if (node->Attribute(
"display"))
120 if (node->Attribute(
"user"))
122 c_node.
user = node->Attribute(
"user");
129 if (node->Attribute(
"ssh-options"))
131 c_node.
ssh_options = node->Attribute(
"ssh-options");
134 if (node->Attribute(
"address"))
136 c_node.
address = node->Attribute(
"address");
142 cluster.
nodes.push_back(c_node);