Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Alexander Emmerich
erp5
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
Show 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
...
@@ -30,6 +30,8 @@ import subprocess
import
time
import
time
import
xml_marshaller
import
xml_marshaller
MAX_PARTIONS
=
10
class
SlapOSControler
(
object
):
class
SlapOSControler
(
object
):
def
__init__
(
self
,
config
,
log
,
process_group_pid_set
=
None
,
def
__init__
(
self
,
config
,
log
,
process_group_pid_set
=
None
,
...
@@ -59,8 +61,11 @@ class SlapOSControler(object):
...
@@ -59,8 +61,11 @@ class SlapOSControler(object):
self
.
software_profile
,
self
.
software_profile
,
computer_guid
=
config
[
'computer_id'
])
computer_guid
=
config
[
'computer_id'
])
computer
=
slap
.
registerComputer
(
config
[
'computer_id'
])
computer
=
slap
.
registerComputer
(
config
[
'computer_id'
])
for
i
in
range
(
0
,
MAX_PARTIONS
):
# create partition and configure computer
# create partition and configure computer
partition_reference
=
config
[
'partition_reference'
]
# 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
)
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_reference
)
if
not
os
.
path
.
exists
(
partition_path
):
if
not
os
.
path
.
exists
(
partition_path
):
os
.
mkdir
(
partition_path
)
os
.
mkdir
(
partition_path
)
...
@@ -72,8 +77,7 @@ class SlapOSControler(object):
...
@@ -72,8 +77,7 @@ class SlapOSControler(object):
'partition_list'
:
[{
'address_list'
:
[{
'addr'
:
config
[
'ipv4_address'
],
'partition_list'
:
[{
'address_list'
:
[{
'addr'
:
config
[
'ipv4_address'
],
'netmask'
:
'255.255.255.255'
},
'netmask'
:
'255.255.255.255'
},
{
'addr'
:
config
[
'ipv6_address'
],
{
'addr'
:
config
[
'ipv6_address'
],
'netmask'
:
'ffff:ffff:ffff::'
},
'netmask'
:
'ffff:ffff:ffff::'
},],
],
'path'
:
partition_path
,
'path'
:
partition_path
,
'reference'
:
partition_reference
,
'reference'
:
partition_reference
,
'tap'
:
{
'name'
:
partition_reference
},
'tap'
:
{
'name'
:
partition_reference
},
...
@@ -112,19 +116,27 @@ class SlapOSControler(object):
...
@@ -112,19 +116,27 @@ class SlapOSControler(object):
stdout
=
None
,
stderr
=
None
):
stdout
=
None
,
stderr
=
None
):
self
.
log
(
"SlapOSControler.runComputerPartition"
)
self
.
log
(
"SlapOSControler.runComputerPartition"
)
slap
=
slapos
.
slap
.
slap
()
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
,
slap
.
registerOpenOrder
().
request
(
self
.
software_profile
,
partition_reference
=
'testing partition'
,
partition_reference
=
'testing partition'
,
partition_parameter_kw
=
config
[
'instance_dict'
])
partition_parameter_kw
=
config
[
'instance_dict'
])
command
=
[
config
[
'slapgrid_partition_binary'
],
command
=
[
config
[
'slapgrid_partition_binary'
],
config
[
'slapos_config'
],
'-c'
,
'-v'
]
config
[
'slapos_config'
],
'-c'
,
'-v'
]
# 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
,
slapgrid
=
subprocess
.
Popen
(
command
,
stdout
=
stdout
,
stderr
=
stderr
,
stdout
=
stdout
,
stderr
=
stderr
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
slapgrid
.
wait
()
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
stdout
.
seek
(
0
)
stdout
.
seek
(
0
)
stderr
.
seek
(
0
)
stderr
.
seek
(
0
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
'command'
:
repr
(
command
),
'command'
:
repr
(
command
),
'stdout'
:
stdout
.
read
(),
'stdout'
:
stdout
.
read
(),
...
...
erp5/util/testnode/testnode.py
View file @
82f3de6e
...
@@ -32,7 +32,7 @@ import subprocess
...
@@ -32,7 +32,7 @@ import subprocess
import
sys
import
sys
import
time
import
time
import
xmlrpclib
import
xmlrpclib
import
glob
import
SlapOSControler
import
SlapOSControler
class
SubprocessError
(
EnvironmentError
):
class
SubprocessError
(
EnvironmentError
):
...
@@ -247,15 +247,10 @@ branch = %(branch)s
...
@@ -247,15 +247,10 @@ branch = %(branch)s
retry_software
=
True
retry_software
=
True
raise
SubprocessError
(
status_dict
)
raise
SubprocessError
(
status_dict
)
run_test_suite_path
=
config
[
'runTestSuite'
]
run_test_suite_path_list
=
glob
.
glob
(
"%s/*/bin/runTestSuite"
%
config
[
'instance_root'
])
if
not
os
.
path
.
exists
(
run_test_suite_path
):
if
not
len
(
run_test_suite_path_list
):
raise
SubprocessError
({
raise
ValueError
(
'No runTestSuite provided in installed partitions.'
)
'command'
:
'os.path.exists(run_test_suite_path)'
,
run_test_suite_path
=
run_test_suite_path_list
[
0
]
'status_code'
:
1
,
'stdout'
:
''
,
'stderr'
:
'File does not exist: %r'
%
(
run_test_suite_path
,
),
})
run_test_suite_revision
=
revision
run_test_suite_revision
=
revision
if
isinstance
(
revision
,
tuple
):
if
isinstance
(
revision
,
tuple
):
revision
=
','
.
join
(
revision
)
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