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
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
Titouan Soulard
slapos.core
Commits
806f1777
Commit
806f1777
authored
Jan 31, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_upgrader: move compute node on personal project if there is a single user only on it
parent
085c87f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
19 deletions
+25
-19
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ComputeNode_checkSiteMigrationToVirtualMaster.py
...upgrader/ComputeNode_checkSiteMigrationToVirtualMaster.py
+25
-19
No files found.
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/ComputeNode_checkSiteMigrationToVirtualMaster.py
View file @
806f1777
...
...
@@ -63,35 +63,24 @@ elif (computer_network is not None) and (computer_network.getFollowUp(None) is n
compute_node
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
computer_network
.
getFollowUp
())
not_migrated_compute_node_dict
.
pop
(
compute_node_relative_url
)
elif
force_migration
and
(
not_migrated_compute_node
[
'source_administration'
]
is
not
None
):
# Create a single project for every single remaining compute node
project
=
source_administration_value
.
Person_addVirtualMaster
(
title
=
'Migrated shared for %s'
%
compute_node
.
getReference
(),
is_compute_node_payable
=
False
,
is_instance_tree_payable
=
False
,
# Hardcoded
price_currency
=
'currency_module/EUR'
,
batch
=
1
)
compute_node
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
project
.
getRelativeUrl
())
not_migrated_compute_node_dict
.
pop
(
compute_node_relative_url
)
else
:
# If the related instance are all grouped on this machine, and from the same user
from_same_user_only
=
True
on_this_node_only
=
True
instance_project_list
=
[]
for
instance_tree
in
instance_tree_list
:
instance_project_list
.
append
(
instance_tree
.
getFollowUp
(
None
))
if
instance_tree
.
getDestinationSection
()
!=
not_migrated_compute_node
[
'source_administration'
]:
from_same_user_only
=
False
else
:
for
software_instance
in
instance_tree
.
getSpecialiseRelatedValueList
():
partition
=
software_instance
.
getAggregate
(
None
)
if
(
partition
is
not
None
)
and
(
partition
.
startswith
(
compute_node_relative_url
)):
from_same_user_only
=
False
for
software_instance
in
instance_tree
.
getSpecialiseRelatedValueList
():
partition
=
software_instance
.
getAggregate
(
None
)
if
(
partition
is
not
None
)
and
(
partition
.
startswith
(
compute_node_relative_url
)):
on_this_node_only
=
False
instance_project_list
=
list
(
set
(
instance_project_list
))
if
from_same_user_only
:
if
from_same_user_only
and
on_this_node_only
:
not_migrated_compute_node_dict
.
pop
(
compute_node_relative_url
)
source_administration_value
.
Person_checkSiteMigrationCreatePersonalVirtualMaster
([
compute_node_relative_url
]
+
[
x
.
getRelativeUrl
()
for
x
in
instance_tree_list
])
...
...
@@ -100,6 +89,23 @@ else:
not_migrated_compute_node_dict
.
pop
(
compute_node_relative_url
)
compute_node
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
instance_project_list
[
0
])
elif
force_migration
and
(
not_migrated_compute_node
[
'source_administration'
]
is
not
None
):
if
from_same_user_only
:
not_migrated_compute_node_dict
.
pop
(
compute_node_relative_url
)
source_administration_value
.
Person_checkSiteMigrationCreatePersonalVirtualMaster
([
compute_node_relative_url
])
else
:
# Create a single project for every single remaining compute node
project
=
source_administration_value
.
Person_addVirtualMaster
(
title
=
'Migrated shared for %s'
%
compute_node
.
getReference
(),
is_compute_node_payable
=
False
,
is_instance_tree_payable
=
False
,
# Hardcoded
price_currency
=
'currency_module/EUR'
,
batch
=
1
)
compute_node
.
activate
().
Base_activateObjectMigrationToVirtualMaster
(
project
.
getRelativeUrl
())
not_migrated_compute_node_dict
.
pop
(
compute_node_relative_url
)
# Log
if
not_migrated_compute_node_dict
:
context
.
log
(
not_migrated_compute_node_dict
.
keys
())
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