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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
0a539290
Commit
0a539290
authored
Nov 28, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_upgrader: move an instance to the same virtual master than his main compute node
parent
10901d12
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_checkSiteMigrationToVirtualMaster.py
...pgrader/InstanceTree_checkSiteMigrationToVirtualMaster.py
+39
-0
No files found.
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/InstanceTree_checkSiteMigrationToVirtualMaster.py
View file @
0a539290
...
...
@@ -8,6 +8,7 @@ not_migrated_instance_tree_dict = {}
portal
=
context
.
getPortalObject
()
instance_tree
=
context
.
getObject
()
instance_tree_relative_url
=
instance_tree
.
getRelativeUrl
()
software_instance
=
([
x
for
x
in
instance_tree
.
getSuccessorValueList
()
if
x
.
getTitle
()
==
instance_tree
.
getTitle
()]
+
[
None
])[
0
]
last_affectation_list
=
instance_tree
.
Item_getAffectationList
()
project_relative_url
=
None
...
...
@@ -41,3 +42,41 @@ elif (not_migrated_instance_tree_dict[instance_tree_relative_url]['slap_state']
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
)
project
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Project'
,
reference
=
project_reference
)
if
project
is
not
None
:
instance_tree
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
project
.
getRelativeUrl
())
not_migrated_instance_tree_dict
.
pop
(
instance_tree_relative_url
)
# Node requested to be allocated on a specific node
elif
(
software_instance
is
not
None
)
and
(
software_instance
.
getSlaXmlAsDict
().
get
(
'computer_guid'
,
None
)
is
not
None
):
project_instance_reference
=
software_instance
.
getSlaXmlAsDict
().
get
(
'computer_guid'
,
None
)
project_instance
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
project_instance_reference
)
if
project_instance
is
not
None
:
project
=
project_instance
.
getFollowUpValue
(
None
)
if
project
is
not
None
:
instance_tree
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
project
.
getRelativeUrl
())
not_migrated_instance_tree_dict
.
pop
(
instance_tree_relative_url
)
# Slave Node requested to be allocated on a specific project instance
elif
(
software_instance
is
not
None
)
and
(
software_instance
.
getSlaXmlAsDict
().
get
(
'instance_guid'
,
None
)
is
not
None
):
project_instance_reference
=
software_instance
.
getSlaXmlAsDict
().
get
(
'instance_guid'
,
None
)
project_instance
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Instance'
,
reference
=
project_instance_reference
)
if
project_instance
is
not
None
:
project
=
project_instance
.
getFollowUpValue
(
None
)
if
project
is
not
None
:
instance_tree
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
project
.
getRelativeUrl
())
not_migrated_instance_tree_dict
.
pop
(
instance_tree_relative_url
)
# Finally, use the same project than the allocation
elif
(
software_instance
is
not
None
)
and
(
software_instance
.
getAggregateValue
(
None
)
is
not
None
):
project
=
software_instance
.
getAggregateValue
().
getParentValue
().
getFollowUpValue
(
None
)
if
project
is
not
None
:
instance_tree
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
project
.
getRelativeUrl
())
not_migrated_instance_tree_dict
.
pop
(
instance_tree_relative_url
)
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