Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
Commits
1f359d43
Commit
1f359d43
authored
Apr 15, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_upgrader: reduce number of Remote Node creation
parent
7b5d49a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/InstanceTree_fixupSiteMigrationToVirtualMaster.py
...pgrader/InstanceTree_fixupSiteMigrationToVirtualMaster.py
+39
-0
No files found.
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/InstanceTree_fixupSiteMigrationToVirtualMaster.py
View file @
1f359d43
...
...
@@ -9,6 +9,45 @@ instance_tree = context.getObject()
instance_tree_virtual_master
=
instance_tree
.
getFollowUpValue
()
instance_tree_virtual_master_relative_url
=
instance_tree_virtual_master
.
getRelativeUrl
()
#######################################################################
# If root instance is not allocated on the same virtual master than instance tree
# remove the instance tree virtual master
# and rerun the migration
#######################################################################
root_software_instance
=
([
x
for
x
in
instance_tree
.
getSuccessorValueList
()
if
x
.
getTitle
()
==
instance_tree
.
getTitle
()]
+
[
None
])[
0
]
sla_xml_dict
=
{}
if
root_software_instance
is
not
None
:
try
:
sla_xml_dict
=
root_software_instance
.
getSlaXmlAsDict
()
except
:
# pylint: disable=bare-except
# XMLSyntaxError
pass
root_partition
=
root_software_instance
.
getAggregateValue
()
if
root_partition
is
not
None
:
root_instance_virtual_master_relative_url
=
root_partition
.
getParentValue
().
getFollowUp
(
None
)
if
((
root_instance_virtual_master_relative_url
is
not
None
)
and
(
root_instance_virtual_master_relative_url
!=
instance_tree_virtual_master_relative_url
)
and
(
not
sla_xml_dict
)):
edit_kw
=
{
'follow_up_value'
:
None
}
activate_kw
=
{
'tag'
:
tag
}
instance_tree
.
edit
(
**
edit_kw
)
instance_tree
.
reindexObject
(
activate_kw
=
activate_kw
)
for
sql_result
in
portal
.
portal_catalog
(
specialise__uid
=
instance_tree
.
getUid
(),
portal_type
=
[
'Software Instance'
,
'Slave Instance'
]
):
instance
=
sql_result
.
getObject
()
instance
.
edit
(
**
edit_kw
)
instance
.
reindexObject
(
activate_kw
=
activate_kw
)
return
#######################################################################
# If instance is not allocated on the same virtual master than instance tree
# create remote node
#######################################################################
# Check recursively the instance tree
# and detect orphaned nodes
is_orphaned_instance_dict
=
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment