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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
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
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
...
@@ -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,28 +61,30 @@ class SlapOSControler(object):
...
@@ -59,28 +61,30 @@ 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'
])
# create partition and configure computer
for
i
in
range
(
0
,
MAX_PARTIONS
):
partition_reference
=
config
[
'partition_reference'
]
# create partition and configure computer
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_reference
)
# XXX: at the moment all partitions do share same virtual interface address
if
not
os
.
path
.
exists
(
partition_path
):
# this is not a problem as usually all services are on different ports
os
.
mkdir
(
partition_path
)
partition_reference
=
'%s-%s'
%
(
config
[
'partition_reference'
],
i
)
os
.
chmod
(
partition_path
,
0750
)
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_reference
)
computer
.
updateConfiguration
(
xml_marshaller
.
xml_marshaller
.
dumps
({
if
not
os
.
path
.
exists
(
partition_path
):
'address'
:
config
[
'ipv4_address'
],
os
.
mkdir
(
partition_path
)
'instance_root'
:
config
[
'instance_root'
],
os
.
chmod
(
partition_path
,
0750
)
'netmask'
:
'255.255.255.255'
,
computer
.
updateConfiguration
(
xml_marshaller
.
xml_marshaller
.
dumps
({
'partition_list'
:
[{
'address_list'
:
[{
'addr'
:
config
[
'ipv4_address'
],
'address'
:
config
[
'ipv4_address'
],
'netmask'
:
'255.255.255.255'
},
'instance_root'
:
config
[
'instance_root'
],
{
'addr'
:
config
[
'ipv6_address'
],
'netmask'
:
'255.255.255.255'
,
'netmask'
:
'ffff:ffff:ffff::'
},
'partition_list'
:
[{
'address_list'
:
[{
'addr'
:
config
[
'ipv4_address'
],
],
'netmask'
:
'255.255.255.255'
},
'path'
:
partition_path
,
{
'addr'
:
config
[
'ipv6_address'
],
'reference'
:
partition_reference
,
'netmask'
:
'ffff:ffff:ffff::'
},],
'tap'
:
{
'name'
:
partition_reference
},
'path'
:
partition_path
,
}
'reference'
:
partition_reference
,
],
'tap'
:
{
'name'
:
partition_reference
},
'reference'
:
config
[
'computer_id'
],
}
'software_root'
:
config
[
'software_root'
]}))
],
'reference'
:
config
[
'computer_id'
],
'software_root'
:
config
[
'software_root'
]}))
def
runSoftwareRelease
(
self
,
config
,
environment
,
process_group_pid_set
=
None
,
def
runSoftwareRelease
(
self
,
config
,
environment
,
process_group_pid_set
=
None
,
stdout
=
None
,
stderr
=
None
):
stdout
=
None
,
stderr
=
None
):
...
@@ -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'
]
slapgrid
=
subprocess
.
Popen
(
command
,
stdout
=
stdout
,
stderr
=
stderr
,
# try to run for all partitions as one partition may in theory request another one
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
# this not always is required but curently no way to know how "tree" of partitions
process_group_pid_set
.
add
(
slapgrid
.
pid
)
# may "expand"
slapgrid
.
wait
()
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
)
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