diff --git a/Makefile.am b/Makefile.am index 85a114bedabd97721e7e71298cb353bf6e3cada6..ac2fdc6d098bad75b3cb8208a5a39f56fd427f79 100644 --- a/Makefile.am +++ b/Makefile.am @@ -294,6 +294,7 @@ lib/_autoconf.py: Makefile stamp-directories echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \ echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \ echo "KVM_PATH = '$(KVM_PATH)'"; \ + echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \ } > $@ $(REPLACE_VARS_SED): Makefile stamp-directories diff --git a/configure.ac b/configure.ac index 9c0a2846c1062c67ec409923b6e979a65e1585ad..28c1940686d5710e05bd36f6376345e417de5fbc 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,16 @@ AC_ARG_WITH([kvm-path], [kvm_path="/usr/bin/kvm"]) AC_SUBST(KVM_PATH, $kvm_path) +# --with-socat-path=... +AC_ARG_WITH([socat-path], + [AS_HELP_STRING([--with-socat-path=PATH], + [absolute path to the socat binary] + [ (default is /usr/bin/socat)] + )], + [socat_path="$withval"], + [socat_path="/usr/bin/socat"]) +AC_SUBST(SOCAT_PATH, $socat_path) + # Check common programs AC_PROG_INSTALL AC_PROG_LN_S diff --git a/lib/constants.py b/lib/constants.py index ca0c38f10ee8f6ae7fd8c81861a24182e3896752..a5748c900a26d9bcd32a3a77b203021a28b7cd2b 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -131,6 +131,7 @@ XEN_KERNEL = _autoconf.XEN_KERNEL XEN_INITRD = _autoconf.XEN_INITRD KVM_PATH = _autoconf.KVM_PATH +SOCAT_PATH = _autoconf.SOCAT_PATH VALUE_DEFAULT = "default" VALUE_AUTO = "auto" diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 86890d8704d5670e9dbb42b07fe665614c945307..f3f5b4ecac1ed5ebf08c4824db1447495610703f 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -256,6 +256,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): """Stop an instance. """ + socat_bin = constants.SOCAT_PATH pid_file = self._PIDS_DIR + "/%s" % instance.name pid = utils.ReadPidFile(pid_file) if pid > 0 and utils.IsProcessAlive(pid): @@ -264,7 +265,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): else: # This only works if the instance os has acpi support monitor_socket = '%s/%s.monitor' % (self._CTRL_DIR, instance.name) - socat = 'socat -u STDIN UNIX-CONNECT:%s' % monitor_socket + socat = '%s -u STDIN UNIX-CONNECT:%s' % (socat_bin, monitor_socket) command = "echo 'system_powerdown' | %s" % socat result = utils.RunCmd(command) if result.failed: @@ -352,6 +353,9 @@ class KVMHypervisor(hv_base.BaseHypervisor): """ if not os.path.exists(constants.KVM_PATH): return "The kvm binary ('%s') does not exist." % constants.KVM_PATH + if not os.path.exists(constants.SOCAT_PATH): + return "The socat binary ('%s') does not exist." % constants.SOCAT_PATH + @classmethod def CheckParameterSyntax(cls, hvparams):