Skip to content

Commit

Permalink
Merge pull request #620 from grycap/devel
Browse files Browse the repository at this point in the history
Fix some update problems
  • Loading branch information
micafer authored May 23, 2018
2 parents 703f137 + 669e926 commit a203038
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
20 changes: 12 additions & 8 deletions IM/InfrastructureInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,17 +306,16 @@ def update_radl(self, radl, deployed_vms):
"""

with self._lock:
# Add new networks only
for s in radl.systems + radl.networks + radl.ansible_hosts:
original_radl = self.radl.clone()
# Add new networks ad ansible_hosts only
for s in radl.networks + radl.ansible_hosts:
if not self.radl.add(s.clone(), "ignore"):
InfrastructureInfo.logger.warn(
"Ignoring the redefinition of %s %s" % (type(s), s.getId()))
InfrastructureInfo.logger.warn("Ignoring the redefinition of %s %s" % (type(s), s.getId()))

# Add or update configures
# Add or update configures and systems
for s in radl.configures + radl.systems:
self.radl.add(s.clone(), "replace")
InfrastructureInfo.logger.warn(
"(Re)definition of %s %s" % (type(s), s.getId()))
InfrastructureInfo.logger.warn("(Re)definition of %s %s" % (type(s), s.getId()))

# Append contextualize
self.radl.add(radl.contextualize)
Expand All @@ -335,7 +334,12 @@ def update_radl(self, radl, deployed_vms):
self.private_networks[private_net] = d.cloud_id

# Check the RADL
self.radl.check()
try:
self.radl.check()
except Exception as ex:
# If something is not correct restore the original one and raise the error
self.radl = original_radl
raise(ex)

def complete_radl(self, radl):
"""
Expand Down
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.graphviz'
]

# Math
Expand Down
11 changes: 11 additions & 0 deletions doc/source/xmlrpc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ This is the list of method names:
Return the aggregated state associated to the
infrastructure with ID ``infId``.

The ``state`` can be

* ``pending``, At least one VM is still in initialization stage;
* ``running``, All the VMs are created successfully and running, but at least one of them are still in the configuration stage;
* ``configured``, All the VMs are running and contextualized;
* ``unconfigured``, All the VMs are running but at least one of them are not correctly contextualized;
* ``stopped``, All the VMs are stopped or suspended;
* ``off``, All the VMs are shutdown or removed from the infrastructure;
* ``failed``, There are at least one VM in status ``failed``.
* ``unknown``, There are at least one VM in status ``unknown``.

``GetInfrastructureRADL``
:parameter 0: ``infId``: integer
:parameter 1: ``auth``: array of structs
Expand Down

0 comments on commit a203038

Please sign in to comment.