Add --enable-rapi parameter to configure
[ganeti-local] / daemons / ganeti-master
index 5d882fc..b13ed98 100755 (executable)
@@ -128,11 +128,12 @@ def StartMaster(master_netdev, master_ip, debug):
                          "-s", master_ip, master_ip])
   # we'll ignore the exit code of arping
 
-  # Start remote API
-  result = utils.RunCmd(["ganeti-rapi", "--port=%s" % constants.RAPI_PORT])
-  if debug and result.failed:
-    sys.stderr.write("Failed to start ganeti-rapi, error: %s\n" %
-                     result.output)
+  if constants.RAPI_ENABLE:
+    # Start remote API
+    result = utils.RunCmd(["ganeti-rapi", "--port=%s" % constants.RAPI_PORT])
+    if debug and result.failed:
+      sys.stderr.write("Failed to start ganeti-rapi, error: %s\n" %
+                       result.output)
 
   return EXIT_OK
 
@@ -141,10 +142,13 @@ def StopMaster(master_netdev, master_ip, debug):
   """Stops the master.
 
   """
-  # Stop remote API
-  result = utils.RunCmd(["fuser", "-k", "-n", "tcp", str(constants.RAPI_PORT)])
-  if debug and result.failed:
-    sys.stderr.write("Failed to stop ganeti-rapi, error: %s\n" % result.output)
+  if constants.RAPI_ENABLE:
+    # Stop remote API
+    result = utils.RunCmd(["fuser", "-k", "-n", "tcp",
+                          str(constants.RAPI_PORT)])
+    if debug and result.failed:
+      sys.stderr.write("Failed to stop ganeti-rapi, error: %s\n" %
+                       result.output)
 
   result = utils.RunCmd(["ip", "address", "del", "%s/32" % master_ip,
                          "dev", master_netdev])