Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
82f3de6e
Commit
82f3de6e
authored
Nov 08, 2011
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make test node run slapgrid-cp in order to suppert the case when one partition can request another.
parent
31c502de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
38 deletions
+45
-38
erp5/util/testnode/SlapOSControler.py
erp5/util/testnode/SlapOSControler.py
+40
-28
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+5
-10
No files found.
erp5/util/testnode/SlapOSControler.py
View file @
82f3de6e
...
...
@@ -30,6 +30,8 @@ import subprocess
import
time
import
xml_marshaller
MAX_PARTIONS
=
10
class
SlapOSControler
(
object
):
def
__init__
(
self
,
config
,
log
,
process_group_pid_set
=
None
,
...
...
@@ -59,28 +61,30 @@ class SlapOSControler(object):
self
.
software_profile
,
computer_guid
=
config
[
'computer_id'
])
computer
=
slap
.
registerComputer
(
config
[
'computer_id'
])
# create partition and configure computer
partition_reference
=
config
[
'partition_reference'
]
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_reference
)
if
not
os
.
path
.
exists
(
partition_path
):
os
.
mkdir
(
partition_path
)
os
.
chmod
(
partition_path
,
0750
)
computer
.
updateConfiguration
(
xml_marshaller
.
xml_marshaller
.
dumps
({
'address'
:
config
[
'ipv4_address'
],
'instance_root'
:
config
[
'instance_root'
],
'netmask'
:
'255.255.255.255'
,
'partition_list'
:
[{
'address_list'
:
[{
'addr'
:
config
[
'ipv4_address'
],
'netmask'
:
'255.255.255.255'
},
{
'addr'
:
config
[
'ipv6_address'
],
'netmask'
:
'ffff:ffff:ffff::'
},
],
'path'
:
partition_path
,
'reference'
:
partition_reference
,
'tap'
:
{
'name'
:
partition_reference
},
}
],
'reference'
:
config
[
'computer_id'
],
'software_root'
:
config
[
'software_root'
]}))
for
i
in
range
(
0
,
MAX_PARTIONS
):
# create partition and configure computer
# XXX: at the moment all partitions do share same virtual interface address
# this is not a problem as usually all services are on different ports
partition_reference
=
'%s-%s'
%
(
config
[
'partition_reference'
],
i
)
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_reference
)
if
not
os
.
path
.
exists
(
partition_path
):
os
.
mkdir
(
partition_path
)
os
.
chmod
(
partition_path
,
0750
)
computer
.
updateConfiguration
(
xml_marshaller
.
xml_marshaller
.
dumps
({
'address'
:
config
[
'ipv4_address'
],
'instance_root'
:
config
[
'instance_root'
],
'netmask'
:
'255.255.255.255'
,
'partition_list'
:
[{
'address_list'
:
[{
'addr'
:
config
[
'ipv4_address'
],
'netmask'
:
'255.255.255.255'
},
{
'addr'
:
config
[
'ipv6_address'
],
'netmask'
:
'ffff:ffff:ffff::'
},],
'path'
:
partition_path
,
'reference'
:
partition_reference
,
'tap'
:
{
'name'
:
partition_reference
},
}
],
'reference'
:
config
[
'computer_id'
],
'software_root'
:
config
[
'software_root'
]}))
def
runSoftwareRelease
(
self
,
config
,
environment
,
process_group_pid_set
=
None
,
stdout
=
None
,
stderr
=
None
):
...
...
@@ -112,19 +116,27 @@ class SlapOSControler(object):
stdout
=
None
,
stderr
=
None
):
self
.
log
(
"SlapOSControler.runComputerPartition"
)
slap
=
slapos
.
slap
.
slap
()
# cloudooo-json is required but this is a hack which should be removed
config
[
'instance_dict'
][
'cloudooo-json'
]
=
"{}"
slap
.
registerOpenOrder
().
request
(
self
.
software_profile
,
partition_reference
=
'testing partition'
,
partition_parameter_kw
=
config
[
'instance_dict'
])
command
=
[
config
[
'slapgrid_partition_binary'
],
config
[
'slapos_config'
],
'-c'
,
'-v'
]
slapgrid
=
subprocess
.
Popen
(
command
,
stdout
=
stdout
,
stderr
=
stderr
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
# try to run for all partitions as one partition may in theory request another one
# this not always is required but curently no way to know how "tree" of partitions
# may "expand"
for
runs
in
range
(
0
,
MAX_PARTIONS
):
slapgrid
=
subprocess
.
Popen
(
command
,
stdout
=
stdout
,
stderr
=
stderr
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
stdout
.
seek
(
0
)
stderr
.
seek
(
0
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
'command'
:
repr
(
command
),
'stdout'
:
stdout
.
read
(),
...
...
erp5/util/testnode/testnode.py
View file @
82f3de6e
...
...
@@ -32,7 +32,7 @@ import subprocess
import
sys
import
time
import
xmlrpclib
import
glob
import
SlapOSControler
class
SubprocessError
(
EnvironmentError
):
...
...
@@ -247,15 +247,10 @@ branch = %(branch)s
retry_software
=
True
raise
SubprocessError
(
status_dict
)
run_test_suite_path
=
config
[
'runTestSuite'
]
if
not
os
.
path
.
exists
(
run_test_suite_path
):
raise
SubprocessError
({
'command'
:
'os.path.exists(run_test_suite_path)'
,
'status_code'
:
1
,
'stdout'
:
''
,
'stderr'
:
'File does not exist: %r'
%
(
run_test_suite_path
,
),
})
run_test_suite_path_list
=
glob
.
glob
(
"%s/*/bin/runTestSuite"
%
config
[
'instance_root'
])
if
not
len
(
run_test_suite_path_list
):
raise
ValueError
(
'No runTestSuite provided in installed partitions.'
)
run_test_suite_path
=
run_test_suite_path_list
[
0
]
run_test_suite_revision
=
revision
if
isinstance
(
revision
,
tuple
):
revision
=
','
.
join
(
revision
)
...
...
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