Skip to content

Commit

Permalink
Code and documentation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jul 29, 2015
1 parent 7f66922 commit b337ae1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
3 changes: 3 additions & 0 deletions IM/ConfManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 17 additions & 1 deletion IM/VirtualMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 7 additions & 2 deletions doc/source/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@ IM needs at least Python 2.6 to run, as well as the next libraries:
* `PyYAML <http://pyyaml.org/>`_, a YAML parser.
* `SOAPpy <http://pywebsvcs.sourceforge.net/>`_, a full-featured SOAP library
(we know it is not actively supported by upstream anymore).
* `Netaddr <http://pythonhosted.org/netaddr//>`_, A Python library for representing
and manipulating network addresses.

Also, IM uses `Ansible <http://www.ansible.com>`_ (1.4.2 or later) to configure the
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`)::
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)

0 comments on commit b337ae1

Please sign in to comment.