Commit 6bb9be02 authored by Romain Courteaud's avatar Romain Courteaud

slapos_upgrader: partially destroyed instanc ewill move to personal

Unallocated instance will use remote note
parent be1d90ed
......@@ -21,12 +21,9 @@ not_migrated_instance_tree_dict[instance_tree_relative_url] = {
'slap_state': instance_tree.getSlapState(),
'destination_section': instance_tree.getDestinationSection(None),
'project_relative_url': project_relative_url,
'alive_instance_list': [],
'allocated_instance_list': []
}
for sql_instance in portal.portal_catalog(specialise__uid=instance_tree.getUid()):
if not ((sql_instance.getAggregate(None) is None) and (sql_instance.getValidationState() == 'invalidated')):
not_migrated_instance_tree_dict[instance_tree_relative_url]['alive_instance_list'].append(sql_instance.getRelativeUrl())
if sql_instance.getAggregate(None) is not None:
not_migrated_instance_tree_dict[instance_tree_relative_url]['allocated_instance_list'].append(sql_instance.getRelativeUrl())
......@@ -36,16 +33,6 @@ if not_migrated_instance_tree_dict[instance_tree_relative_url]['project_relative
instance_tree.activate().Base_activateObjectMigrationToVirtualMaster(not_migrated_instance_tree_dict[instance_tree_relative_url]['project_relative_url'])
not_migrated_instance_tree_dict.pop(instance_tree_relative_url)
# Outdated instance tree will move to the personal project
# as, there is no way to know where it has been allocated previously
elif (not_migrated_instance_tree_dict[instance_tree_relative_url]['slap_state'] == 'destroy_requested') and \
(len(not_migrated_instance_tree_dict[instance_tree_relative_url]['alive_instance_list']) == 0) and \
(not_migrated_instance_tree_dict[instance_tree_relative_url]['project_relative_url'] is None) and \
(not_migrated_instance_tree_dict[instance_tree_relative_url]['destination_section'] is not None):
instance_tree.getDestinationSectionValue().Person_checkSiteMigrationCreatePersonalVirtualMaster([instance_tree_relative_url])
not_migrated_instance_tree_dict.pop(instance_tree_relative_url)
# Node requested to be allocated on a specific project
elif (software_instance is not None) and (software_instance.getSlaXmlAsDict().get('project_guid', None) is not None):
project_reference = software_instance.getSlaXmlAsDict().get('project_guid', None)
......@@ -90,3 +77,12 @@ elif ((len(not_migrated_instance_tree_dict[instance_tree_relative_url]['allocate
instance_tree.getDestinationSectionValue().Person_checkSiteMigrationCreatePersonalVirtualMaster([instance_tree_relative_url])
not_migrated_instance_tree_dict.pop(instance_tree_relative_url)
# Outdated instance tree will move to the personal project
# as, there is no way to know where it has been allocated previously
elif (not_migrated_instance_tree_dict[instance_tree_relative_url]['slap_state'] == 'destroy_requested') and \
(not_migrated_instance_tree_dict[instance_tree_relative_url]['project_relative_url'] is None) and \
(not_migrated_instance_tree_dict[instance_tree_relative_url]['destination_section'] is not None):
instance_tree.getDestinationSectionValue().Person_checkSiteMigrationCreatePersonalVirtualMaster([instance_tree_relative_url])
not_migrated_instance_tree_dict.pop(instance_tree_relative_url)
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