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
80957db3
Commit
80957db3
authored
Dec 07, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: allow remote allocation on an uniq hardcoded partition
parent
8d9b8214
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
22 deletions
+50
-22
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_getAvailableSoftwareReleaseUrlStringList.py
...putePartition_getAvailableSoftwareReleaseUrlStringList.py
+6
-2
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_propagateRemoteNode.py
...kins/slapos_cloud/ComputePartition_propagateRemoteNode.py
+28
-19
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
...ateItem/portal_skins/slapos_cloud/Person_findPartition.py
+6
-1
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/RemoteNode_init.py
...TemplateItem/portal_skins/slapos_cloud/RemoteNode_init.py
+10
-0
No files found.
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_getAvailableSoftwareReleaseUrlStringList.py
View file @
80957db3
slap_state
=
context
.
getSlapState
()
slap_state
=
context
.
getSlapState
()
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
compute_node
=
context
.
getParentValue
()
if
slap_state
==
'free'
:
if
slap_state
==
'free'
:
compute_node
=
context
.
getParentValue
()
return
compute_node
.
ComputeNode_getSoftwareReleaseUrlStringList
()
return
compute_node
.
ComputeNode_getSoftwareReleaseUrlStringList
()
elif
slap_state
==
'busy'
:
elif
slap_state
==
'busy'
:
...
@@ -10,9 +11,12 @@ elif slap_state == 'busy':
...
@@ -10,9 +11,12 @@ elif slap_state == 'busy':
instance
=
portal
.
portal_catalog
.
getResultValue
(
instance
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Software Instance"
,
portal_type
=
"Software Instance"
,
validation_state
=
"validated"
,
validation_state
=
"validated"
,
default_aggregate
_uid
=
context
.
getUid
(),
aggregate_
_uid
=
context
.
getUid
(),
)
)
if
(
instance
is
None
)
or
(
instance
.
getSlapState
()
not
in
[
"start_requested"
,
"stop_requested"
]):
if
(
instance
is
None
)
or
(
instance
.
getSlapState
()
not
in
[
"start_requested"
,
"stop_requested"
]):
# XXX Not very elegant
if
(
compute_node
.
getPortalType
()
==
'Remote Node'
)
and
(
context
.
getId
()
==
'SHARED_REMOTE'
):
return
[
'ANY_URL'
]
return
[]
return
[]
else
:
else
:
return
[
instance
.
getUrlString
()]
return
[
instance
.
getUrlString
()]
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputePartition_propagateRemoteNode.py
View file @
80957db3
...
@@ -7,23 +7,32 @@ assert remote_node.getPortalType() == 'Remote Node'
...
@@ -7,23 +7,32 @@ assert remote_node.getPortalType() == 'Remote Node'
remote_project
=
remote_node
.
getDestinationProjectValue
(
portal_type
=
'Project'
)
remote_project
=
remote_node
.
getDestinationProjectValue
(
portal_type
=
'Project'
)
remote_person
=
remote_node
.
getDestinationSectionValue
(
portal_type
=
'Person'
)
remote_person
=
remote_node
.
getDestinationSectionValue
(
portal_type
=
'Person'
)
local_instance
=
portal
.
portal_catalog
.
getResultValue
(
if
compute_partition
.
getId
()
==
'SHARED_REMOTE'
:
# Hardcoded ID behaviour
local_instance_list
=
portal
.
portal_catalog
(
portal_type
=
'Slave Instance'
,
aggregate__uid
=
compute_partition
.
getUid
()
)
else
:
local_instance_list
=
[
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Instance'
,
portal_type
=
'Software Instance'
,
aggregate__uid
=
compute_partition
.
getUid
()
aggregate__uid
=
compute_partition
.
getUid
()
)
)]
# XXX TODO this will increase the workflow history
for
local_instance
in
local_instance_list
:
# Use the 'cached' API instead
# XXX TODO this will increase the workflow history
remote_person
.
requestSoftwareInstance
(
# Use the 'cached' API instead
remote_person
.
requestSoftwareInstance
(
project_reference
=
remote_project
.
getReference
(),
project_reference
=
remote_project
.
getReference
(),
software_release
=
local_instance
.
getUrlString
(),
software_release
=
local_instance
.
getUrlString
(),
software_title
=
'_remote_%s_%s'
%
(
remote_node
.
getFollowUpReference
(),
local_instance
.
getReference
()),
software_title
=
'_remote_%s_%s'
%
(
remote_node
.
getFollowUpReference
(),
local_instance
.
getReference
()),
software_type
=
local_instance
.
getSourceReference
(),
software_type
=
local_instance
.
getSourceReference
(),
instance_xml
=
local_instance
.
getTextContent
(),
instance_xml
=
local_instance
.
getTextContent
(),
sla_xml
=
None
,
sla_xml
=
None
,
shared
=
False
,
shared
=
(
local_instance
.
getPortalType
()
==
'Slave Instance'
)
,
state
=
{
'start_requested'
:
'started'
,
'stop_requested'
:
'stopped'
}[
local_instance
.
getSlapState
()]
state
=
{
'start_requested'
:
'started'
,
'stop_requested'
:
'stopped'
}[
local_instance
.
getSlapState
()]
)
)
requested_software_instance
=
context
.
REQUEST
.
get
(
'request_instance'
)
requested_software_instance
=
context
.
REQUEST
.
get
(
'request_instance'
)
if
requested_software_instance
is
not
None
:
if
requested_software_instance
is
not
None
:
local_instance
.
setConnectionXml
(
requested_software_instance
.
getConnectionXml
())
local_instance
.
setConnectionXml
(
requested_software_instance
.
getConnectionXml
())
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
View file @
80957db3
...
@@ -36,6 +36,8 @@ software_product, release_variation, type_variation = tmp_instance.InstanceTree_
...
@@ -36,6 +36,8 @@ software_product, release_variation, type_variation = tmp_instance.InstanceTree_
if
software_product
is
None
:
if
software_product
is
None
:
raise
ValueError
(
'No Software Product matching'
)
raise
ValueError
(
'No Software Product matching'
)
assert
software_product
.
getFollowUpUid
()
==
project_uid
allocation_cell_list
=
software_product
.
getFollowUpValue
().
Project_getSoftwareProductPredicateList
(
allocation_cell_list
=
software_product
.
getFollowUpValue
().
Project_getSoftwareProductPredicateList
(
software_product
=
software_product
,
software_product
=
software_product
,
software_product_type
=
type_variation
,
software_product_type
=
type_variation
,
...
@@ -44,7 +46,6 @@ allocation_cell_list = software_product.getFollowUpValue().Project_getSoftwarePr
...
@@ -44,7 +46,6 @@ allocation_cell_list = software_product.getFollowUpValue().Project_getSoftwarePr
predicate_portal_type
=
'Allocation Supply Cell'
predicate_portal_type
=
'Allocation Supply Cell'
)
)
#context.log('allocation_cell_list %s' % str(allocation_cell_list))
if
not
allocation_cell_list
:
if
not
allocation_cell_list
:
raise
ValueError
(
'No Allocation Supply allowing this operation'
)
raise
ValueError
(
'No Allocation Supply allowing this operation'
)
...
@@ -79,6 +80,10 @@ for compute_node_list, is_slave_on_same_instance_tree_allocable in compute_node_
...
@@ -79,6 +80,10 @@ for compute_node_list, is_slave_on_same_instance_tree_allocable in compute_node_
elif
compute_node
.
getPortalType
()
==
'Remote Node'
:
elif
compute_node
.
getPortalType
()
==
'Remote Node'
:
parent_uid_list
.
append
(
compute_node
.
getUid
())
parent_uid_list
.
append
(
compute_node
.
getUid
())
# This is the only hardcoded partition accepting any slave instance allocation
shared_partition
=
compute_node
.
restrictedTraverse
(
'SHARED_REMOTE'
,
None
)
if
shared_partition
is
not
None
:
partition_uid_list
.
append
(
shared_partition
.
getUid
())
else
:
else
:
raise
NotImplementedError
(
'Unsupported Node type: %s'
%
compute_node
.
getPortalType
())
raise
NotImplementedError
(
'Unsupported Node type: %s'
%
compute_node
.
getPortalType
())
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/RemoteNode_init.py
View file @
80957db3
...
@@ -4,4 +4,14 @@ reference = "REMOTE-%s" % portal.portal_ids.generateNewId(
...
@@ -4,4 +4,14 @@ reference = "REMOTE-%s" % portal.portal_ids.generateNewId(
id_group
=
'slap_instance_node_reference'
,
id_group
=
'slap_instance_node_reference'
,
id_generator
=
'uid'
,
default
=
1
)
id_generator
=
'uid'
,
default
=
1
)
# XXX format
partition
=
context
.
newContent
(
portal_type
=
'Compute Partition'
,
reference
=
'shared_partition'
,
id
=
'SHARED_REMOTE'
)
partition
.
markFree
()
partition
.
markBusy
()
partition
.
validate
()
context
.
edit
(
reference
=
reference
)
context
.
edit
(
reference
=
reference
)
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