Make the python world aware of IAllocator requests to find a suitable
secondary node for an instance. This will allow disk-template conversion
to ask the allocator for a suitable node.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 lib/masterd/iallocator.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/masterd/iallocator.py b/lib/masterd/iallocator.py
index 62fadde..547c939 100644
--- a/lib/masterd/iallocator.py
+++ b/lib/masterd/iallocator.py
@@ -232,6 +232,23 @@ class IAReqInstanceAlloc(IARequestBase):
                                          (len(result), self.RequiredNodes()))
 
 
+class IAReqInstanceAllocateSecondary(IARequestBase):
+  """Request to find a secondary node for plain to DRBD conversion.
+
+  """
+  # pylint: disable=E1101
+  MODE = constants.IALLOCATOR_MODE_ALLOCATE_SECONDARY
+  REQ_PARAMS = [
+    _INST_NAME,
+    ]
+  REQ_RESULT = ht.TString
+
+  def GetRequest(self, cfg):
+    return {
+      "name": self.name
+    }
+
+
 class IAReqMultiInstanceAlloc(IARequestBase):
   """An multi instance allocation request.
 
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to