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
Cédric Le Ninivin
slapos.core
Commits
af23c67d
Commit
af23c67d
authored
Jul 20, 2022
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: slapgrid-cp move out of slap
parent
41cdc016
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
176 additions
and
91 deletions
+176
-91
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+8
-8
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+168
-83
No files found.
slapos/grid/SlapObject.py
View file @
af23c67d
...
@@ -581,7 +581,7 @@ class Partition(object):
...
@@ -581,7 +581,7 @@ class Partition(object):
installs the software partition with the help of buildout
installs the software partition with the help of buildout
"""
"""
self
.
logger
.
info
(
"Installing Computer Partition %s..."
self
.
logger
.
info
(
"Installing Computer Partition %s..."
%
self
.
computer_partition
.
get
Id
(
))
%
self
.
computer_partition
.
get
(
"compute_partition_id"
))
self
.
check_free_space
()
self
.
check_free_space
()
...
@@ -731,7 +731,7 @@ class Partition(object):
...
@@ -731,7 +731,7 @@ class Partition(object):
if
os
.
path
.
exists
(
self
.
supervisord_partition_configuration_path
):
if
os
.
path
.
exists
(
self
.
supervisord_partition_configuration_path
):
os
.
unlink
(
self
.
supervisord_partition_configuration_path
)
os
.
unlink
(
self
.
supervisord_partition_configuration_path
)
else
:
else
:
partition_id
=
self
.
computer_partition
.
get
Id
(
)
partition_id
=
self
.
computer_partition
.
get
(
"compute_partition_id"
)
group_partition_template
=
bytes2str
(
pkg_resources
.
resource_string
(
__name__
,
group_partition_template
=
bytes2str
(
pkg_resources
.
resource_string
(
__name__
,
'templates/group_partition_supervisord.conf.in'
))
'templates/group_partition_supervisord.conf.in'
))
self
.
supervisor_configuration_group
=
group_partition_template
%
{
self
.
supervisor_configuration_group
=
group_partition_template
%
{
...
@@ -766,22 +766,22 @@ class Partition(object):
...
@@ -766,22 +766,22 @@ class Partition(object):
"""Asks supervisord to start the instance. If this instance is not
"""Asks supervisord to start the instance. If this instance is not
installed, we install it.
installed, we install it.
"""
"""
partition_id
=
self
.
computer_partition
.
get
Id
(
)
partition_id
=
self
.
computer_partition
.
get
(
"compute_partition_id"
)
try
:
try
:
with
self
.
getSupervisorRPC
()
as
supervisor
:
with
self
.
getSupervisorRPC
()
as
supervisor
:
supervisor
.
startProcessGroup
(
partition_id
,
False
)
supervisor
.
startProcessGroup
(
partition_id
,
False
)
except
xmlrpclib
.
Fault
as
exc
:
except
xmlrpclib
.
Fault
as
exc
:
if
exc
.
faultString
.
startswith
(
'BAD_NAME:'
):
if
exc
.
faultString
.
startswith
(
'BAD_NAME:'
):
self
.
logger
.
info
(
"Nothing to start on %s..."
%
self
.
logger
.
info
(
"Nothing to start on %s..."
%
self
.
computer_partition
.
get
Id
(
))
self
.
computer_partition
.
get
(
"compute_partition_id"
))
else
:
else
:
raise
raise
else
:
else
:
self
.
logger
.
info
(
"Requested start of %s..."
%
self
.
computer_partition
.
get
Id
(
))
self
.
logger
.
info
(
"Requested start of %s..."
%
self
.
computer_partition
.
get
(
"compute_partition_id"
))
def
stop
(
self
):
def
stop
(
self
):
"""Asks supervisord to stop the instance."""
"""Asks supervisord to stop the instance."""
partition_id
=
self
.
computer_partition
.
get
Id
(
)
partition_id
=
self
.
computer_partition
.
get
(
"compute_partition_id"
)
try
:
try
:
with
self
.
getSupervisorRPC
()
as
supervisor
:
with
self
.
getSupervisorRPC
()
as
supervisor
:
supervisor
.
stopProcessGroup
(
partition_id
,
False
)
supervisor
.
stopProcessGroup
(
partition_id
,
False
)
...
@@ -791,13 +791,13 @@ class Partition(object):
...
@@ -791,13 +791,13 @@ class Partition(object):
else
:
else
:
raise
raise
else
:
else
:
self
.
logger
.
info
(
"Requested stop of %s..."
%
self
.
computer_partition
.
get
Id
(
))
self
.
logger
.
info
(
"Requested stop of %s..."
%
self
.
computer_partition
.
get
(
"compute_partition_id"
))
def
destroy
(
self
):
def
destroy
(
self
):
"""Destroys the partition and makes it available for subsequent use."
"""Destroys the partition and makes it available for subsequent use."
"""
"""
self
.
logger
.
info
(
"Destroying Computer Partition %s..."
self
.
logger
.
info
(
"Destroying Computer Partition %s..."
%
self
.
computer_partition
.
get
Id
(
))
%
self
.
computer_partition
.
get
(
"compute_partition_id"
))
self
.
createRetentionLockDate
()
self
.
createRetentionLockDate
()
if
not
self
.
checkRetentionIsAuthorized
():
if
not
self
.
checkRetentionIsAuthorized
():
...
...
slapos/grid/slapgrid.py
View file @
af23c67d
This diff is collapsed.
Click to expand it.
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