Commit c78fce70 authored by Romain Courteaud's avatar Romain Courteaud

slapos_pdm: upgrade not allocated or allocated on remote slave instances

parent c864efa7
......@@ -42,14 +42,15 @@ root_instance_list = [
if q.getSlapState() != 'destroy_requested']
if len(root_instance_list) != 0:
root_instance = root_instance_list[0]
if root_instance.getPortalType() == 'Slave Instance':
# XXX do not upgrade Slave Instance for now
# should check Instance Node or allocation on same tree
return
partition = root_instance.getAggregateValue()
if partition is not None:
compute_node = partition.getParentValue()
if (root_instance.getPortalType() == 'Slave Instance') and \
(compute_node.getPortalType() != 'Remote Node'):
return
person = context.getDestinationSectionValue()
if person is None:
return
......@@ -65,6 +66,10 @@ allocation_cell_list = software_product.getFollowUpValue().Project_getSoftwarePr
predicate_portal_type='Allocation Supply Cell'
)
if (root_instance.getPortalType() == 'Slave Instance') and \
(compute_node is None):
allocation_cell_list = [x for x in allocation_cell_list if ("Remote Node" in [y.getPortalType() for y in x.getParentValue().getParentValue().getAggregateValueList()])]
# Only upgrade if there is no doubt (ie, only 1 url is allowed)
if len(allocation_cell_list) == 1:
if (allocation_cell_list[0].getSoftwareReleaseValue().getUrlString() != instance_tree.getUrlString()):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment