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
cb36a56e
Commit
cb36a56e
authored
Aug 05, 2022
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip only 14 tests remaining till new API
parent
4ed72fcc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
20 deletions
+71
-20
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+11
-10
slapos/tests/test_slapgrid.py
slapos/tests/test_slapgrid.py
+60
-10
No files found.
slapos/grid/slapgrid.py
View file @
cb36a56e
...
...
@@ -582,6 +582,7 @@ stderr_logfile_backups=1
"slap_partition"
:
partition
,
"access_status_message"
:
partition
.
getAccessStatus
(),
"software_release_uri"
:
software_release_uri
,
"sla_parameters"
:
getattr
(
partition
,
'_filter_dict'
,
{}),
})
return
self
.
computer_partition_list
...
...
@@ -1041,11 +1042,12 @@ stderr_logfile_backups=1
"root_instance_title"
:
computer_partition
[
"root_instance_title"
],
}).
get
(
"result_list"
,
[])
for
instance_result
in
related_instance_list
:
instance
=
self
.
slap
.
jio_api_connector
.
get
({
"portal_type"
:
"Software Instance"
,
"reference"
:
instance_result
[
"reference"
],
})
hosting_ip_list
=
hosting_ip_list
+
instance
[
"ip_list"
]
if
instance_result
[
"reference"
]
!=
computer_partition
[
"reference"
]:
instance
=
self
.
slap
.
jio_api_connector
.
get
({
"portal_type"
:
"Software Instance"
,
"reference"
:
instance_result
[
"reference"
],
})
hosting_ip_list
=
hosting_ip_list
+
instance
[
"ip_list"
]
else
:
hosting_ip_list
=
computer_partition
[
"slap_partition"
].
getFullHostingIpAddressList
()
...
...
@@ -1057,7 +1059,7 @@ stderr_logfile_backups=1
if
not
ip
in
ipv6_list
:
hosting_ipv6_list
.
append
(
ip
)
filter_dict
=
getattr
(
computer_partition
,
'_filter_dict
'
,
None
)
filter_dict
=
computer_partition
.
get
(
'sla_parameters
'
,
None
)
extra_list
=
[]
accept_ip_list
=
[]
if
filter_dict
is
not
None
:
...
...
@@ -1152,7 +1154,7 @@ stderr_logfile_backups=1
buildout
=
self
.
buildout
,
buildout_debug
=
self
.
buildout_debug
,
logger
=
self
.
logger
,
retention_delay
=
getattr
(
computer_partition
,
'_filter_dict
'
,
{}).
get
(
'retention_delay'
,
'0'
),
retention_delay
=
computer_partition
.
get
(
'sla_parameters
'
,
{}).
get
(
'retention_delay'
,
'0'
),
instance_min_free_space
=
self
.
instance_min_free_space
,
instance_storage_home
=
self
.
instance_storage_home
,
ipv4_global_network
=
self
.
ipv4_global_network
,
...
...
@@ -1202,7 +1204,6 @@ stderr_logfile_backups=1
instance_path
,
COMPUTER_PARTITION_TIMESTAMP_FILENAME
)
parameter_dict
=
computer_partition
.
get
(
"parameters"
,
{})
timestamp
=
computer_partition
.
get
(
"processing_timestamp"
)
error_output_file
=
os
.
path
.
join
(
...
...
@@ -1246,7 +1247,7 @@ stderr_logfile_backups=1
buildout
=
self
.
buildout
,
buildout_debug
=
self
.
buildout_debug
,
logger
=
self
.
logger
,
retention_delay
=
getattr
(
computer_partition
,
'_filter_dict
'
,
{}).
get
(
'retention_delay'
,
'0'
),
retention_delay
=
computer_partition
.
get
(
'sla_parameters
'
,
{}).
get
(
'retention_delay'
,
'0'
),
instance_min_free_space
=
self
.
instance_min_free_space
,
instance_storage_home
=
self
.
instance_storage_home
,
ipv4_global_network
=
self
.
ipv4_global_network
,
...
...
@@ -1334,7 +1335,7 @@ stderr_logfile_backups=1
partition_ip_list
=
full_hosting_ip_list
=
[]
if
self
.
firewall_conf
:
partition_ip_list
=
parameter_dict
[
'ip_list'
]
+
parameter_dict
.
get
(
partition_ip_list
=
computer_partition
[
'ip_list'
]
+
computer_partition
.
get
(
'full_ip_list'
,
[])
if
computer_partition_state
==
COMPUTER_PARTITION_STARTED_STATE
:
...
...
slapos/tests/test_slapgrid.py
View file @
cb36a56e
...
...
@@ -439,16 +439,37 @@ class ComputerForTest(object):
}
for
x
in
self
.
software_list
]
})
if
content
[
"portal_type"
]
==
"Software Instance"
:
return
json
.
dumps
({
"result_list"
:
[{
"software_release_uri"
:
x
.
software
.
name
if
x
.
software
else
None
,
"reference"
:
x
.
name
,
"title"
:
x
.
name
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
x
.
name
,
"state"
:
x
.
requested_state
}
for
x
in
self
.
instance_list
]
})
if
"compute_node_id"
in
content
:
return
json
.
dumps
({
"result_list"
:
[{
"software_release_uri"
:
x
.
software
.
name
if
x
.
software
else
None
,
"reference"
:
x
.
name
,
"title"
:
x
.
name
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
x
.
name
,
"state"
:
x
.
requested_state
}
for
x
in
self
.
instance_list
]
})
elif
"root_instance_title"
in
content
:
return
json
.
dumps
({
"result_list"
:
[{
"software_release_uri"
:
x
.
software
.
name
if
x
.
software
else
None
,
"reference"
:
x
.
name
,
"title"
:
x
.
name
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
x
.
name
,
"state"
:
x
.
requested_state
}
for
x
in
self
.
instance_list
]
+
[
{
"software_release_uri"
:
"foo.cfg"
,
"reference"
:
"related_instance"
,
"title"
:
"related_instance"
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
"related_instance"
,
"state"
:
"stopped"
}
]
})
elif
(
url
.
path
==
'/api/put/'
):
if
content
[
"portal_type"
]
==
"Software Installation"
:
...
...
@@ -470,6 +491,7 @@ class ComputerForTest(object):
requested_instance
.
sequence
.
append
((
url
.
path
,
content
))
if
"reported_state"
in
content
:
if
content
[
"reported_state"
]
==
"error"
:
instance
.
error
=
True
instance
.
error_log
=
content
[
"status_message"
]
else
:
requested_instance
.
state
=
content
[
"reported_state"
]
...
...
@@ -494,6 +516,31 @@ class ComputerForTest(object):
elif
(
url
.
path
==
'/api/get/'
):
if
content
[
"portal_type"
]
==
"Software Instance"
:
reference
=
content
[
"reference"
]
# Treat the case of firewall
if
reference
==
"related_instance"
:
return
json
.
dumps
({
"title"
:
"related_instance"
,
"reference"
:
"related_instance"
,
"software_release_uri"
:
"foo.cfg"
,
"software_type"
:
None
,
"state"
:
"stopped"
,
"connection_parameters"
:
{
},
"parameters"
:
{},
"shared"
:
False
,
"root_instance_title"
:
"0"
,
"ip_list"
:
self
.
ip_address_list
,
"X509"
:
{
"certificate"
:
""
,
"key"
:
""
},
"sla_parameters"
:
{},
"compute_node_id"
:
None
,
"compute_partition_id"
:
"requested_instance"
,
"processing_timestamp"
:
0
,
"access_status_message"
:
""
,
"portal_type"
:
"Software Instance"
})
requested_instance
=
None
for
instance
in
self
.
instance_list
:
if
instance
.
name
==
reference
:
...
...
@@ -513,6 +560,7 @@ class ComputerForTest(object):
"shared"
:
False
,
"root_instance_title"
:
requested_instance
.
name
,
"ip_list"
:
requested_instance
.
ip_list
,
"full_ip_list"
:
requested_instance
.
full_ip_list
,
"X509"
:
{
"certificate"
:
requested_instance
.
certificate
,
"key"
:
requested_instance
.
key
...
...
@@ -2574,6 +2622,8 @@ class TestSlapgridDestructionLock(MasterMixin, unittest.TestCase):
)))
instance
.
requested_state
=
'destroyed'
# Reset Cache
self
.
grid
.
computer_partition_list
=
None
self
.
grid
.
agregateAndSendUsage
()
self
.
assertTrue
(
os
.
path
.
exists
(
dummy_instance_file_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
...
...
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