Confd client: make confd port configurable
[ganeti-local] / lib / confd / querylib.py
index 0aaf04c..5ede415 100644 (file)
@@ -167,3 +167,64 @@ class InstanceIpToNodePrimaryIpQuery(ConfdQuery):
       return QUERY_INTERNAL_ERROR
 
     return constants.CONFD_REPL_STATUS_OK, pnode_primary_ip
+
+
+class NodesPipsQuery(ConfdQuery):
+  """A query for nodes primary IPs.
+
+  It returns the list of nodes primary IPs.
+
+  """
+  def Exec(self, query):
+    """NodesPipsQuery main execution.
+
+    """
+    if query is None:
+      status = constants.CONFD_REPL_STATUS_OK
+      answer = self.reader.GetNodesPrimaryIps()
+    else:
+      status = constants.CONFD_REPL_STATUS_ERROR
+      answer = "non-empty node primary IPs query"
+
+    return status, answer
+
+
+class MasterCandidatesPipsQuery(ConfdQuery):
+  """A query for master candidates primary IPs.
+
+  It returns the list of master candidates primary IPs.
+
+  """
+  def Exec(self, query):
+    """MasterCandidatesPipsQuery main execution.
+
+    """
+    if query is None:
+      status = constants.CONFD_REPL_STATUS_OK
+      answer = self.reader.GetMasterCandidatesPrimaryIps()
+    else:
+      status = constants.CONFD_REPL_STATUS_ERROR
+      answer = "non-empty master candidates primary IPs query"
+
+    return status, answer
+
+
+class InstancesIpsQuery(ConfdQuery):
+  """A query for instances IPs.
+
+  It returns the list of instances IPs.
+
+  """
+  def Exec(self, query):
+    """InstancesIpsQuery main execution.
+
+    """
+    if query is None:
+      status = constants.CONFD_REPL_STATUS_OK
+      answer = self.reader.GetInstancesIps()
+    else:
+      status = constants.CONFD_REPL_STATUS_ERROR
+      answer = "non-empty instances IPs query"
+
+    return status, answer
+