Also, corrected a few places where the ip command was hardcoded.

Signed-off-by: Andrea Spadaccini <[email protected]>
---
 Makefile.am      |    1 +
 configure.ac     |    8 ++++++++
 lib/backend.py   |    4 ++--
 lib/constants.py |    1 +
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 719c14f..351090c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -886,6 +886,7 @@ lib/_autoconf.py: Makefile | lib/.dir
          echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
          echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
          echo "KVM_PATH = '$(KVM_PATH)'"; \
+         echo "IP_PATH = '$(IP_PATH)'"; \
          echo "SOCAT_PATH = '$(SOCAT)'"; \
          echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
          echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
diff --git a/configure.ac b/configure.ac
index 4f80c0f..601adfc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,6 +275,14 @@ AC_SUBST(DISK_SEPARATOR, $disk_separator)
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
+# Check for the ip command
+AC_ARG_VAR(IP_PATH, [ip path])
+AC_PATH_PROG(IP_PATH, [ip], [])
+if test -z "$IP_PATH"
+then
+  AC_MSG_ERROR([ip command not found])
+fi
+
 # Check for pandoc
 AC_ARG_VAR(PANDOC, [pandoc path])
 AC_PATH_PROG(PANDOC, [pandoc], [])
diff --git a/lib/backend.py b/lib/backend.py
index a779939..953b516 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -296,7 +296,7 @@ def StartMaster(start_daemons, no_voting):
       if family == netutils.IP6Address.family:
         ipcls = netutils.IP6Address
 
-      result = utils.RunCmd(["ip", "address", "add",
+      result = utils.RunCmd([constants.IP_COMMAND_PATH, "address", "add",
                              "%s/%d" % (master_ip, ipcls.iplen),
                              "dev", master_netdev, "label",
                              "%s:0" % master_netdev])
@@ -343,7 +343,7 @@ def StopMaster(stop_daemons):
   if family == netutils.IP6Address.family:
     ipcls = netutils.IP6Address
 
-  result = utils.RunCmd(["ip", "address", "del",
+  result = utils.RunCmd([constants.IP_COMMAND_PATH, "address", "del",
                          "%s/%d" % (master_ip, ipcls.iplen),
                          "dev", master_netdev])
   if result.failed:
diff --git a/lib/constants.py b/lib/constants.py
index 53d9047..c0b8c3b 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -568,6 +568,7 @@ NODE_MAX_CLOCK_SKEW = 150
 DISK_TRANSFER_CONNECT_TIMEOUT = 60
 # Disk index separator
 DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
+IP_COMMAND_PATH = _autoconf.IP_PATH
 
 #: Key for job IDs in opcode result
 JOB_IDS_KEY = "jobs"
-- 
1.7.3.1

Reply via email to