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
Carlos Ramos Carreño
slapos.core
Commits
690080dc
Commit
690080dc
authored
Sep 08, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: migration: reindex after unindexing
parent
cbd2ab8e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
...plateItem/portal_components/extension.erp5.SlapOSCloud.py
+3
-3
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgrader.py
...em/portal_components/test.erp5.testSlapOSCloudUpgrader.py
+6
-0
No files found.
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
View file @
690080dc
...
@@ -148,7 +148,7 @@ def HostingSubscription_checkInstanceTreeMigrationConsistency(self, fixit=False)
...
@@ -148,7 +148,7 @@ def HostingSubscription_checkInstanceTreeMigrationConsistency(self, fixit=False)
(
'hosting_subscription_workflow'
in
instance_tree
.
workflow_history
):
(
'hosting_subscription_workflow'
in
instance_tree
.
workflow_history
):
instance_tree
.
workflow_history
[
'instance_tree_workflow'
]
=
instance_tree
.
workflow_history
.
pop
(
'hosting_subscription_workflow'
)
instance_tree
.
workflow_history
[
'instance_tree_workflow'
]
=
instance_tree
.
workflow_history
.
pop
(
'hosting_subscription_workflow'
)
instance_tree
.
reindexObject
()
instance_tree
.
activate
(
after_method_id
=
"unindexObject"
).
reindexObject
()
# Migrate Predecessor/Successor if the instance wasn't migrated before.
# Migrate Predecessor/Successor if the instance wasn't migrated before.
instance_tree
.
SoftwareInstance_checkPredecessorToSuccessorMigrationConsistency
(
fixit
=
True
)
instance_tree
.
SoftwareInstance_checkPredecessorToSuccessorMigrationConsistency
(
fixit
=
True
)
UnrestrictedMethod
(
instance_tree
.
Base_updateRelatedContentWithoutReindextion
)(
hosting_subscription_relative_url
,
instance_tree
.
getRelativeUrl
())
UnrestrictedMethod
(
instance_tree
.
Base_updateRelatedContentWithoutReindextion
)(
hosting_subscription_relative_url
,
instance_tree
.
getRelativeUrl
())
...
@@ -181,7 +181,7 @@ def ComputerPartition_checkComputePartitionMigrationConsistency(self, fixit=Fals
...
@@ -181,7 +181,7 @@ def ComputerPartition_checkComputePartitionMigrationConsistency(self, fixit=Fals
(
'computer_partition_slap_interface_workflow'
in
compute_partition
.
workflow_history
):
(
'computer_partition_slap_interface_workflow'
in
compute_partition
.
workflow_history
):
compute_partition
.
workflow_history
[
'compute_partition_slap_interface_workflow'
]
=
compute_partition
.
workflow_history
.
pop
(
'computer_partition_slap_interface_workflow'
)
compute_partition
.
workflow_history
[
'compute_partition_slap_interface_workflow'
]
=
compute_partition
.
workflow_history
.
pop
(
'computer_partition_slap_interface_workflow'
)
compute_partition
.
activate
().
reindexObject
()
compute_partition
.
activate
(
after_method_id
=
"unindexObject"
).
reindexObject
()
else
:
else
:
error_list
.
append
(
'Computer Partition must be migrated to a Compute Partition'
)
error_list
.
append
(
'Computer Partition must be migrated to a Compute Partition'
)
...
@@ -225,7 +225,7 @@ def Computer_checkComputeNodeMigrationConsistency(self, fixit=False):
...
@@ -225,7 +225,7 @@ def Computer_checkComputeNodeMigrationConsistency(self, fixit=False):
for
sub_obj
in
compute_node
.
contentValues
():
for
sub_obj
in
compute_node
.
contentValues
():
sub_obj
.
activate
().
fixConsistency
()
sub_obj
.
activate
().
fixConsistency
()
compute_node
.
activate
().
recursiveReindexObject
()
compute_node
.
activate
(
after_method_id
=
"unindexObject"
).
recursiveReindexObject
()
UnrestrictedMethod
(
compute_node
.
Base_updateRelatedContentWithoutReindextion
)(
computer_relative_url
,
compute_node
.
getRelativeUrl
())
UnrestrictedMethod
(
compute_node
.
Base_updateRelatedContentWithoutReindextion
)(
computer_relative_url
,
compute_node
.
getRelativeUrl
())
else
:
else
:
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgrader.py
View file @
690080dc
...
@@ -149,6 +149,7 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
...
@@ -149,6 +149,7 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self
.
assertFalse
(
migration_message
in
getMessageList
(
migrated_instance_tree
))
self
.
assertFalse
(
migration_message
in
getMessageList
(
migrated_instance_tree
))
self
.
assertEqual
(
migrated_instance_tree
.
getRelativeUrl
(),
self
.
assertEqual
(
migrated_instance_tree
.
getRelativeUrl
(),
software_instance
.
getAggregate
())
software_instance
.
getAggregate
())
self
.
assertEqual
(
1
,
len
(
self
.
portal
.
portal_catalog
(
uid
=
migrated_instance_tree
.
getUid
())))
def
test_upgrade_computer_to_compute_node
(
self
):
def
test_upgrade_computer_to_compute_node
(
self
):
migration_message
=
'Computer must be migrated to a Compute Node'
migration_message
=
'Computer must be migrated to a Compute Node'
...
@@ -266,6 +267,9 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
...
@@ -266,6 +267,9 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
software_instance
.
getAggregate
())
software_instance
.
getAggregate
())
self
.
assertEqual
(
'Compute Partition'
,
self
.
assertEqual
(
'Compute Partition'
,
migrated_computer_partition
.
getPortalType
())
migrated_computer_partition
.
getPortalType
())
self
.
assertEqual
(
1
,
len
(
self
.
portal
.
portal_catalog
(
uid
=
migrated_compute_node
.
getUid
())))
self
.
assertEqual
(
1
,
len
(
self
.
portal
.
portal_catalog
(
uid
=
migrated_computer_partition
.
getUid
())))
def
test_upgrade_computer_partition_to_compute_partition
(
self
):
def
test_upgrade_computer_partition_to_compute_partition
(
self
):
migration_message
=
'Computer Partition must be migrated to a Compute Partition'
migration_message
=
'Computer Partition must be migrated to a Compute Partition'
...
@@ -343,3 +347,5 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
...
@@ -343,3 +347,5 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
self
.
assertFalse
(
'computer_partition_slap_interface_workflow'
in
migrated_computer_partition
.
workflow_history
)
self
.
assertFalse
(
'computer_partition_slap_interface_workflow'
in
migrated_computer_partition
.
workflow_history
)
self
.
assertFalse
(
migration_message
in
getMessageList
(
computer_partition_to_migrate
))
self
.
assertFalse
(
migration_message
in
getMessageList
(
computer_partition_to_migrate
))
self
.
assertEqual
(
1
,
len
(
self
.
portal
.
portal_catalog
(
uid
=
migrated_computer_partition
.
getUid
())))
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