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
Xiaowu Zhang
slapos.core
Commits
7adf49d4
Commit
7adf49d4
authored
Aug 26, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: migrate Computer to Compute Node
Also migrate Computer Partition to Compute Partition
parent
92cfd1b9
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
823 additions
and
9 deletions
+823
-9
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
...plateItem/portal_components/extension.erp5.SlapOSCloud.py
+96
-3
master/bt5/slapos_cloud/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
...rtalTypePropertySheetTemplateItem/property_sheet_list.xml
+11
-3
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/ComputerPartitionUpgradeConstraint.xml
...al_property_sheets/ComputerPartitionUpgradeConstraint.xml
+66
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/ComputerPartitionUpgradeConstraint/computer_partition_migration_constraint.xml
...adeConstraint/computer_partition_migration_constraint.xml
+80
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/ComputerUpgradeConstraint.xml
...Item/portal_property_sheets/ComputerUpgradeConstraint.xml
+66
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/ComputerUpgradeConstraint/computer_migration_constraint.xml
...mputerUpgradeConstraint/computer_migration_constraint.xml
+80
-0
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SlapOSMasterUpgradeConstraint/compute_node_migration_constraint.xml
...erUpgradeConstraint/compute_node_migration_constraint.xml
+80
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/AlarmTool_checkComputeNodeMigrationConsistency.py
...s_cloud/AlarmTool_checkComputeNodeMigrationConsistency.py
+23
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/AlarmTool_checkComputeNodeMigrationConsistency.xml
..._cloud/AlarmTool_checkComputeNodeMigrationConsistency.xml
+62
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_checkComputePartitionMigrationConsistency.xml
...erPartition_checkComputePartitionMigrationConsistency.xml
+28
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_checkComputeNodeMigrationConsistency.xml
...s_cloud/Computer_checkComputeNodeMigrationConsistency.xml
+28
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgrader.py
...em/portal_components/test.erp5.testSlapOSCloudUpgrader.py
+194
-0
master/bt5/slapos_cloud/bt/template_portal_type_property_sheet_list
.../slapos_cloud/bt/template_portal_type_property_sheet_list
+7
-3
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
+2
-0
No files found.
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
View file @
7adf49d4
...
@@ -32,10 +32,25 @@ from Products.ERP5Security import SUPER_USER
...
@@ -32,10 +32,25 @@ from Products.ERP5Security import SUPER_USER
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
,
aq_inner
# from erp5.portal_type import InstanceTree
def
cloneDocumentWithANewPortalType
(
obj
,
portal_type
):
import
erp5.portal_type
klass
=
getattr
(
erp5
.
portal_type
,
portal_type
)
obj
=
aq_base
(
obj
)
new_obj
=
klass
(
obj
.
id
)
# raise NotImplementedError(str(obj.__dict__.keys()))
for
key
in
obj
.
__dict__
.
keys
():
if
key
not
in
(
'meta_type'
,
'portal_type'
,
'__class__'
):
setattr
(
new_obj
,
key
,
obj
.
__dict__
[
key
])
new_obj
.
portal_type
=
portal_type
return
new_obj
def
SoftwareInstance_bangAsSelf
(
self
,
relative_url
=
None
,
reference
=
None
,
def
SoftwareInstance_bangAsSelf
(
self
,
relative_url
=
None
,
reference
=
None
,
comment
=
None
):
comment
=
None
):
...
@@ -142,6 +157,84 @@ def HostingSubscription_checkInstanceTreeMigrationConsistency(self, fixit=False)
...
@@ -142,6 +157,84 @@ def HostingSubscription_checkInstanceTreeMigrationConsistency(self, fixit=False)
return
error_list
return
error_list
def
ComputerPartition_checkComputePartitionMigrationConsistency
(
self
,
fixit
=
False
):
error_list
=
[]
import
erp5.portal_type
klass
=
getattr
(
erp5
.
portal_type
,
'Compute Partition'
)
if
((
getattr
(
self
,
'workflow_history'
,
None
)
is
not
None
)
and
(
'computer_partition_slap_interface_workflow'
in
self
.
workflow_history
))
or
\
((
self
.
__class__
==
klass
)
and
(
self
.
getPortalType
()
==
'Computer Partition'
))
or
\
((
self
.
getParentValue
().
getPortalType
()
==
'Compute Node'
)
and
(
self
.
getPortalType
()
==
'Computer Partition'
)):
if
fixit
:
assert
self
.
getPortalType
()
==
'Computer Partition'
container
=
aq_inner
(
self
.
getParentValue
())
partition_id
=
self
.
getId
()
self
=
cloneDocumentWithANewPortalType
(
self
,
'Compute Partition'
)
container
.
_delObject
(
partition_id
)
container
.
_setOb
(
partition_id
,
self
)
compute_partition
=
container
.
restrictedTraverse
(
partition_id
)
assert
compute_partition
.
getPortalType
()
==
'Compute Partition'
if
(
getattr
(
compute_partition
,
'workflow_history'
,
None
)
is
not
None
)
and
\
(
'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
.
activate
().
reindexObject
()
else
:
error_list
.
append
(
'Computer Partition must be migrated to a Compute Partition'
)
return
error_list
def
Computer_checkComputeNodeMigrationConsistency
(
self
,
fixit
=
False
):
error_list
=
[]
portal
=
self
.
getPortalObject
()
if
self
.
getParentValue
().
getId
()
!=
"computer_module"
:
# Skip if the document isn't on the computer_module
return
error_list
import
erp5.portal_type
klass
=
getattr
(
erp5
.
portal_type
,
'Compute Node'
)
if
((
getattr
(
self
,
'workflow_history'
,
None
)
is
not
None
)
and
(
'computer_slap_interface_workflow'
in
self
.
workflow_history
))
or
\
(
self
.
__class__
==
klass
):
if
fixit
:
assert
self
.
getPortalType
()
==
'Computer'
computer_id
=
self
.
getId
()
computer_relative_url
=
self
.
getRelativeUrl
()
container
=
aq_inner
(
self
.
getParentValue
())
self
=
cloneDocumentWithANewPortalType
(
self
,
'Compute Node'
)
container
.
_delObject
(
computer_id
)
assert
self
.
getPortalType
()
==
'Compute Node'
if
(
getattr
(
self
,
'workflow_history'
,
None
)
is
not
None
)
and
\
(
'computer_slap_interface_workflow'
in
self
.
workflow_history
):
self
.
workflow_history
[
'compute_node_slap_interface_workflow'
]
=
self
.
workflow_history
.
pop
(
'computer_slap_interface_workflow'
)
portal
.
compute_node_module
.
_setOb
(
computer_id
,
self
)
compute_node
=
portal
.
compute_node_module
.
restrictedTraverse
(
computer_id
)
for
sub_obj
in
compute_node
.
contentValues
():
sub_obj
.
activate
().
fixConsistency
()
compute_node
.
activate
().
recursiveReindexObject
()
UnrestrictedMethod
(
compute_node
.
Base_updateRelatedContentWithoutReindextion
)(
computer_relative_url
,
compute_node
.
getRelativeUrl
())
else
:
error_list
.
append
(
'Computer must be migrated to a Compute Node'
)
return
error_list
def
Base_updateRelatedContentWithoutReindextion
(
self
,
previous_category_url
,
new_category_url
,
REQUEST
=
None
):
def
Base_updateRelatedContentWithoutReindextion
(
self
,
previous_category_url
,
new_category_url
,
REQUEST
=
None
):
""" This method indeed reimplements the updateRelatedContent but it uses
""" This method indeed reimplements the updateRelatedContent but it uses
...
@@ -149,7 +242,7 @@ def Base_updateRelatedContentWithoutReindextion(self, previous_category_url, new
...
@@ -149,7 +242,7 @@ def Base_updateRelatedContentWithoutReindextion(self, previous_category_url, new
"""
"""
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
raise
Unauthorized
(
"You cannot call this script"
)
raise
Unauthorized
(
"You cannot call this script"
)
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
activate_kw
=
{
'tag'
:
'%s_updateRelatedContent'
%
self
.
getPath
()}
activate_kw
=
{
'tag'
:
'%s_updateRelatedContent'
%
self
.
getPath
()}
...
...
master/bt5/slapos_cloud/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
View file @
7adf49d4
...
@@ -7,18 +7,26 @@
...
@@ -7,18 +7,26 @@
</portal_type>
</portal_type>
<portal_type
id=
"Compute Node"
>
<portal_type
id=
"Compute Node"
>
<item>
ComputeNodeSlapOSMetadata
</item>
<item>
ComputeNodeSlapOSMetadata
</item>
<item>
ComputerUpgradeConstraint
</item>
<item>
ERP5User
</item>
<item>
ERP5User
</item>
<item>
SlaposCapacity
</item>
<item>
SlaposCapacity
</item>
<item>
SlaposComputeNodeConstraint
</item>
<item>
SlaposComputeNodeConstraint
</item>
<item>
Url
</item>
<item>
Url
</item>
</portal_type>
</portal_type>
<portal_type
id=
"Computer Model"
>
<item>
SlaposCapacity
</item>
</portal_type>
<portal_type
id=
"Compute Partition"
>
<portal_type
id=
"Compute Partition"
>
<item>
ComputePartition
</item>
<item>
ComputePartition
</item>
<item>
ComputerPartitionUpgradeConstraint
</item>
<item>
SlaposComputePartitionConstraint
</item>
<item>
SlaposComputePartitionConstraint
</item>
</portal_type>
</portal_type>
<portal_type
id=
"Computer"
>
<item>
ComputerUpgradeConstraint
</item>
</portal_type>
<portal_type
id=
"Computer Model"
>
<item>
SlaposCapacity
</item>
</portal_type>
<portal_type
id=
"Computer Partition"
>
<item>
ComputerPartitionUpgradeConstraint
</item>
</portal_type>
<portal_type
id=
"Email"
>
<portal_type
id=
"Email"
>
<item>
SlaposEmailConstraint
</item>
<item>
SlaposEmailConstraint
</item>
</portal_type>
</portal_type>
...
...
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/ComputerPartitionUpgradeConstraint.xml
0 → 100644
View file @
7adf49d4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Sheet"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComputerPartitionUpgradeConstraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Sheet
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/ComputerPartitionUpgradeConstraint/computer_partition_migration_constraint.xml
0 → 100644
View file @
7adf49d4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Script Constraint"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
constraint_type/default
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
computer_partition_migration_constraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Script Constraint
</string>
</value>
</item>
<item>
<key>
<string>
script_id
</string>
</key>
<value>
<string>
ComputerPartition_checkComputePartitionMigrationConsistency
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/ComputerUpgradeConstraint.xml
0 → 100644
View file @
7adf49d4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Sheet"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComputerUpgradeConstraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Sheet
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/ComputerUpgradeConstraint/computer_migration_constraint.xml
0 → 100644
View file @
7adf49d4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Script Constraint"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
constraint_type/default
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
computer_migration_constraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Script Constraint
</string>
</value>
</item>
<item>
<key>
<string>
script_id
</string>
</key>
<value>
<string>
Computer_checkComputeNodeMigrationConsistency
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/PropertySheetTemplateItem/portal_property_sheets/SlapOSMasterUpgradeConstraint/compute_node_migration_constraint.xml
0 → 100644
View file @
7adf49d4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Script Constraint"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
constraint_type/post_upgrade
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
compute_node_migration_constraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Script Constraint
</string>
</value>
</item>
<item>
<key>
<string>
script_id
</string>
</key>
<value>
<string>
AlarmTool_checkComputeNodeMigrationConsistency
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/AlarmTool_checkComputeNodeMigrationConsistency.py
0 → 100644
View file @
7adf49d4
portal
=
context
.
getPortalObject
()
result_list
=
[]
migration_kw
=
{
'portal_type'
:
'Computer'
,
'slap_state'
:
'%'
}
non_migrated_instance
=
portal
.
portal_catalog
(
limit
=
1
,
**
migration_kw
)
if
len
(
non_migrated_instance
)
==
1
:
if
fixit
:
portal
.
portal_catalog
.
searchAndActivate
(
activate_kw
=
dict
(
priority
=
5
,
tag
=
script
.
getId
(),
after_method_id
=
(
'immediateReindexObject'
,
'recursiveImmediateReindexObject'
)),
method_id
=
'fixConsistency'
,
**
migration_kw
)
else
:
result_list
.
append
(
"all X needs updates %s"
%
non_migrated_instance
[
0
].
getRelativeUrl
())
return
result_list
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/AlarmTool_checkComputeNodeMigrationConsistency.xml
0 → 100644
View file @
7adf49d4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
fixit=False
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AlarmTool_checkComputeNodeMigrationConsistency
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_checkComputePartitionMigrationConsistency.xml
0 → 100644
View file @
7adf49d4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
ComputerPartition_checkComputePartitionMigrationConsistency
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
SlapOSCloud
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComputerPartition_checkComputePartitionMigrationConsistency
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_checkComputeNodeMigrationConsistency.xml
0 → 100644
View file @
7adf49d4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
Computer_checkComputeNodeMigrationConsistency
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
SlapOSCloud
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_checkComputeNodeMigrationConsistency
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudUpgrader.py
View file @
7adf49d4
...
@@ -149,3 +149,197 @@ class TestSlapOSCloudUpgrader(SlapOSTestCaseMixin):
...
@@ -149,3 +149,197 @@ 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
())
def
test_upgrade_computer_to_compute_node
(
self
):
migration_message
=
'Computer must be migrated to a Compute Node'
computer_module
=
self
.
portal
.
getDefaultModule
(
'Computer'
)
computer_nothing_to_migrate
=
computer_module
.
newContent
(
portal_type
=
'Computer'
)
computer_to_migrate
=
computer_module
.
newContent
(
portal_type
=
'Computer'
,
quantity
=
99
,
bar
=
'foo3'
)
# Create fake workflow history
creation_date
=
DateTime
(
'2011/11/15 11:11'
)
modification_date
=
DateTime
(
'2012/11/15 11:11'
)
computer_to_migrate
.
workflow_history
[
'edit_workflow'
]
=
[{
'comment'
:
'Fake history'
,
'error_message'
:
''
,
'actor'
:
'ERP5TypeTestCase'
,
'state'
:
'current'
,
'time'
:
creation_date
,
'action'
:
'foo_action'
}]
computer_to_migrate
.
workflow_history
[
'validation_workflow'
]
=
[{
'comment'
:
'Fake history'
,
'error_message'
:
''
,
'actor'
:
'ERP5TypeTestCase'
,
'validation_state'
:
'validated'
,
'time'
:
modification_date
,
'action'
:
'validate'
}]
computer_to_migrate
.
workflow_history
[
'computer_slap_interface_workflow'
]
=
[{
'comment'
:
'Fake history'
,
'error_message'
:
''
,
'actor'
:
'ERP5TypeTestCase'
,
'slap_state'
:
'draft'
,
'time'
:
modification_date
,
'action'
:
'barfoo'
}]
computer_partition
=
computer_to_migrate
.
newContent
(
portal_type
=
'Computer Partition'
)
# Check that related object are updated
software_installation
=
self
.
portal
.
software_installation_module
.
newContent
(
portal_type
=
'Software Installation'
,
aggregate_value
=
computer_to_migrate
)
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
,
aggregate_value
=
computer_partition
)
computer_to_migrate_id
=
computer_to_migrate
.
getId
()
computer_to_migrate_uid
=
computer_to_migrate
.
getUid
()
self
.
tic
()
# Nothing to migrate
self
.
assertFalse
(
migration_message
in
getMessageList
(
computer_nothing_to_migrate
))
# To migrate
self
.
assertTrue
(
migration_message
in
getMessageList
(
computer_to_migrate
))
computer_to_migrate
.
fixConsistency
()
self
.
commit
()
self
.
assertFalse
(
computer_to_migrate
.
hasActivity
())
compute_node_module
=
self
.
portal
.
getDefaultModule
(
'Compute Node'
)
migrated_compute_node
=
compute_node_module
.
restrictedTraverse
(
computer_to_migrate_id
)
migrated_computer_partition
=
migrated_compute_node
.
restrictedTraverse
(
computer_partition
.
getId
())
self
.
assertTrue
(
migrated_compute_node
.
hasActivity
())
self
.
assertFalse
(
computer_partition
.
hasActivity
())
self
.
assertTrue
(
migrated_computer_partition
.
hasActivity
())
self
.
assertEqual
(
'Computer Partition'
,
migrated_computer_partition
.
getPortalType
())
self
.
assertFalse
(
software_installation
.
hasActivity
())
self
.
assertFalse
(
software_instance
.
hasActivity
())
self
.
tic
()
migrated_computer_partition
=
migrated_compute_node
.
restrictedTraverse
(
computer_partition
.
getId
())
self
.
assertEqual
(
'Compute Node'
,
migrated_compute_node
.
getPortalType
())
self
.
assertEqual
(
self
.
portal
.
compute_node_module
,
migrated_compute_node
.
getParentValue
())
self
.
assertEqual
(
computer_to_migrate_id
,
migrated_compute_node
.
getId
())
self
.
assertEqual
(
computer_to_migrate_uid
,
migrated_compute_node
.
getUid
())
self
.
assertEqual
(
99
,
migrated_compute_node
.
getQuantity
())
self
.
assertEqual
(
'foo3'
,
migrated_compute_node
.
getProperty
(
'bar'
))
self
.
assertEqual
(
'validated'
,
migrated_compute_node
.
getValidationState
())
self
.
assertEqual
(
'draft'
,
migrated_compute_node
.
getSlapState
())
self
.
assertEqual
(
creation_date
,
migrated_compute_node
.
getCreationDate
())
# self.assertEqual(modification_date,
# migrated_compute_node.getModificationDate())
self
.
assertFalse
(
'computer_slap_interface_workflow'
in
migrated_compute_node
.
workflow_history
)
self
.
assertFalse
(
migration_message
in
getMessageList
(
migrated_compute_node
))
self
.
assertEqual
(
migrated_compute_node
.
getRelativeUrl
(),
software_installation
.
getAggregate
())
self
.
assertEqual
(
migrated_computer_partition
.
getRelativeUrl
(),
software_instance
.
getAggregate
())
self
.
assertEqual
(
'Compute Partition'
,
migrated_computer_partition
.
getPortalType
())
def
test_upgrade_computer_partition_to_compute_partition
(
self
):
migration_message
=
'Computer Partition must be migrated to a Compute Partition'
computer_module
=
self
.
portal
.
getDefaultModule
(
'Computer'
)
computer
=
computer_module
.
newContent
(
portal_type
=
'Computer'
)
computer_partition_to_migrate
=
computer
.
newContent
(
portal_type
=
'Computer Partition'
,
quantity
=
99
,
bar
=
'foo3'
)
computer_nothing_to_migrate
=
computer
.
newContent
(
portal_type
=
'Computer Partition'
)
# Create fake workflow history
creation_date
=
DateTime
(
'2011/11/15 11:11'
)
modification_date
=
DateTime
(
'2012/11/15 11:11'
)
computer_partition_to_migrate
.
workflow_history
[
'edit_workflow'
]
=
[{
'comment'
:
'Fake history'
,
'error_message'
:
''
,
'actor'
:
'ERP5TypeTestCase'
,
'state'
:
'current'
,
'time'
:
creation_date
,
'action'
:
'foo_action'
}]
computer_partition_to_migrate
.
workflow_history
[
'validation_workflow'
]
=
[{
'comment'
:
'Fake history'
,
'error_message'
:
''
,
'actor'
:
'ERP5TypeTestCase'
,
'validation_state'
:
'validated'
,
'time'
:
modification_date
,
'action'
:
'validate'
}]
computer_partition_to_migrate
.
workflow_history
[
'computer_partition_slap_interface_workflow'
]
=
[{
'comment'
:
'Fake history'
,
'error_message'
:
''
,
'actor'
:
'ERP5TypeTestCase'
,
'slap_state'
:
'draft'
,
'time'
:
modification_date
,
'action'
:
'barfoo'
}]
self
.
tic
()
# Nothing to migrate
self
.
assertFalse
(
migration_message
in
getMessageList
(
computer_nothing_to_migrate
))
# To migrate
self
.
assertTrue
(
migration_message
in
getMessageList
(
computer_partition_to_migrate
))
computer_partition_to_migrate
.
fixConsistency
()
self
.
commit
()
migrated_computer_partition
=
computer
.
restrictedTraverse
(
computer_partition_to_migrate
.
getId
())
self
.
assertTrue
(
migrated_computer_partition
.
hasActivity
())
self
.
tic
()
self
.
assertEqual
(
'Compute Partition'
,
migrated_computer_partition
.
getPortalType
())
self
.
assertEqual
(
99
,
migrated_computer_partition
.
getQuantity
())
self
.
assertEqual
(
'foo3'
,
migrated_computer_partition
.
getProperty
(
'bar'
))
self
.
assertEqual
(
'validated'
,
migrated_computer_partition
.
getValidationState
())
self
.
assertEqual
(
'draft'
,
migrated_computer_partition
.
getSlapState
())
self
.
assertEqual
(
creation_date
,
migrated_computer_partition
.
getCreationDate
())
# self.assertEqual(modification_date,
# migrated_compute_node.getModificationDate())
self
.
assertFalse
(
'computer_partition_slap_interface_workflow'
in
migrated_computer_partition
.
workflow_history
)
self
.
assertFalse
(
migration_message
in
getMessageList
(
computer_partition_to_migrate
))
master/bt5/slapos_cloud/bt/template_portal_type_property_sheet_list
View file @
7adf49d4
Alarm Tool | SlapOSMasterUpgradeConstraint
Alarm Tool | SlapOSMasterUpgradeConstraint
Assignment | SlaposAssignmentConstraint
Assignment | SlaposAssignmentConstraint
Computer Model | SlaposCapacity
Compute Partition | ComputePartition
Compute Partition | SlaposComputePartitionConstraint
Compute Node | ComputeNodeSlapOSMetadata
Compute Node | ComputeNodeSlapOSMetadata
Compute Node | ComputerUpgradeConstraint
Compute Node | ERP5User
Compute Node | ERP5User
Compute Node | SlaposCapacity
Compute Node | SlaposCapacity
Compute Node | SlaposComputeNodeConstraint
Compute Node | SlaposComputeNodeConstraint
Compute Node | Url
Compute Node | Url
Compute Partition | ComputePartition
Compute Partition | ComputerPartitionUpgradeConstraint
Compute Partition | SlaposComputePartitionConstraint
Computer Model | SlaposCapacity
Computer Partition | ComputerPartitionUpgradeConstraint
Computer | ComputerUpgradeConstraint
Email | SlaposEmailConstraint
Email | SlaposEmailConstraint
Hosting Subscription | HostingSubscriptionUpgradeConstraint
Hosting Subscription | HostingSubscriptionUpgradeConstraint
Instance Tree | HostingSubscriptionUpgradeConstraint
Instance Tree | HostingSubscriptionUpgradeConstraint
...
...
master/bt5/slapos_cloud/bt/template_property_sheet_id_list
View file @
7adf49d4
...
@@ -5,6 +5,8 @@ SlaposInstanceTreeConstraint
...
@@ -5,6 +5,8 @@ SlaposInstanceTreeConstraint
SlaveInstanceConstraint
SlaveInstanceConstraint
InternetProtocolAddress
InternetProtocolAddress
HostingSubscriptionUpgradeConstraint
HostingSubscriptionUpgradeConstraint
ComputerUpgradeConstraint
ComputerPartitionUpgradeConstraint
ComputePartition
ComputePartition
SoftwareInstance
SoftwareInstance
SoftwareInstanceUpgradeConstraint
SoftwareInstanceUpgradeConstraint
...
...
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