diff --git a/IM/ConfManager.py b/IM/ConfManager.py index dc7db25fd..f0253e34e 100644 --- a/IM/ConfManager.py +++ b/IM/ConfManager.py @@ -147,6 +147,9 @@ def run(self): while not self._stop: if self.init_time + self.max_ctxt_time < time.time(): ConfManager.logger.debug("Inf ID: " + str(self.inf.id) + ": Max contextualization time passed. Exit thread.") + # Kill the ansible processes + for vm in self.inf.get_vm_list(): + vm.kill_check_ctxt_process() return vms_configuring = self.check_running_pids(vms_configuring) diff --git a/IM/VirtualMachine.py b/IM/VirtualMachine.py index 1ad5e8f7e..255342fbb 100644 --- a/IM/VirtualMachine.py +++ b/IM/VirtualMachine.py @@ -525,6 +525,22 @@ def launch_check_ctxt_process(self): t = threading.Thread(target=eval("self.check_ctxt_process")) t.daemon = True t.start() + + def kill_check_ctxt_process(self): + """ + Kill the check_ctxt_process thread + """ + if self.ctxt_pid: + if self.ctxt_pid != self.WAIT_TO_PID: + ssh = self.inf.vm_master.get_ssh(retry = True) + try: + ssh.execute("kill -9 " + str(self.ctxt_pid)) + except: + VirtualMachine.logger.exception("Error killing ctxt process with pid: " + str(self.ctxt_pid)) + pass + + self.ctxt_pid = None + self.configured = False def check_ctxt_process(self): """ @@ -543,7 +559,7 @@ def check_ctxt_process(self): wait = 0 while self.ctxt_pid: if self.ctxt_pid != self.WAIT_TO_PID: - ssh = self.inf.vm_master.get_ssh() + ssh = self.inf.vm_master.get_ssh(retry = True) if self.state in VirtualMachine.NOT_RUNNING_STATES: try: diff --git a/README b/README index 16ed92b82..af797df30 100644 --- a/README +++ b/README @@ -39,6 +39,8 @@ However, if you install IM from sources you should install: * The YAML library for Python, typically available as the 'python-yaml' or 'PyYAML' package. * The SOAPpy library for Python, typically available as the 'python-soappy' or 'SOAPpy' package. + + * The Netaddr library for Python, typically available as the 'python-netaddr' package. * Ansible (http://www.ansibleworks.com/) to configure nodes in the infrastructures. In particular, Ansible 1.4.2+ must be installed. diff --git a/README.md b/README.md index 2b5074207..e7f0719ff 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ However, if you install IM from sources you should install: + The YAML library for Python, typically available as the 'python-yaml' or 'PyYAML' package. + The SOAPpy library for Python, typically available as the 'python-soappy' or 'SOAPpy' package. + + + The Netaddr library for Python, typically available as the 'python-netaddr' package. + Ansible (http://www.ansibleworks.com/) to configure nodes in the infrastructures. In particular, Ansible 1.4.2+ must be installed. diff --git a/doc/source/manual.rst b/doc/source/manual.rst index f657c6827..8d43d1785 100644 --- a/doc/source/manual.rst +++ b/doc/source/manual.rst @@ -13,6 +13,8 @@ IM needs at least Python 2.6 to run, as well as the next libraries: * `PyYAML `_, a YAML parser. * `SOAPpy `_, a full-featured SOAP library (we know it is not actively supported by upstream anymore). +* `Netaddr `_, A Python library for representing + and manipulating network addresses. Also, IM uses `Ansible `_ (1.4.2 or later) to configure the infrastructure nodes. @@ -20,12 +22,15 @@ infrastructure nodes. These components are usually available from the distribution repositories. To install them in Debian and Ubuntu based distributions, do:: - $ apt-get install python-ply python-paramiko python-yaml python-soappy ansible + $ apt-get install python-ply python-paramiko python-yaml python-soappy python-netaddr ansible In Red Hat based distributions (RHEL, CentOS, Amazon Linux, Oracle Linux, Fedora, etc.), do:: - $ yum install python-ply python-paramiko PyYAML SOAPpy ansible + $ yum install python-ply python-paramiko python-netaddr PyYAML SOAPpy ansible + +**WARNING: In some GNU/Linux distributions (RHEL 6 or equivalents) you must NOT install +the packages 'python-paramiko' and 'python-crypto' with yum. You MUST use pip to install them** Finally, check the next values in the Ansible configuration file :file:`ansible.cfg`, (usually found in :file:`/etc/ansible`):: diff --git a/setup.py b/setup.py index 95ccecff3..f2e50f959 100644 --- a/setup.py +++ b/setup.py @@ -42,5 +42,5 @@ long_description="IM is a tool that ease the access and the usability of IaaS clouds by automating the VMI selection, deployment, configuration, software installation, monitoring and update of Virtual Appliances. It supports APIs from a large number of virtual platforms, making user applications cloud-agnostic. In addition it integrates a contextualization system to enable the installation and configuration of all the user required applications providing the user with a fully functional infrastructure.", description="IM is a tool to manage virtual infrastructures on Cloud deployments", platforms=["any"], - install_requires=["ansible >= 1.4","paramiko >= 1.14","PyYAML","SOAPpy","boto >= 2.29","apache-libcloud >= 0.17","ply", "bottle"] + install_requires=["ansible >= 1.4","paramiko >= 1.14","PyYAML","SOAPpy","boto >= 2.29","apache-libcloud >= 0.17","ply", "bottle", "netaddr"] )