Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Ophélie Gagnard
slapos
Commits
5c76fa33
Commit
5c76fa33
authored
Aug 26, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated acording to master
parent
2272651b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
42 deletions
+56
-42
slapos/recipe/cloudoootestnode/SlapOSControler.py
slapos/recipe/cloudoootestnode/SlapOSControler.py
+35
-34
slapos/recipe/cloudoootestnode/testnode.py
slapos/recipe/cloudoootestnode/testnode.py
+21
-8
No files found.
slapos/recipe/cloudoootestnode/SlapOSControler.py
View file @
5c76fa33
...
...
@@ -46,48 +46,49 @@ class SlapOSControler(object):
'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
):
print
"SlapOSControler.runSoftwareRelease"
while
True
:
cpu_count
=
os
.
sysconf
(
"SC_NPROCESSORS_ONLN"
)
os
.
putenv
(
'MAKEFLAGS'
,
'-j%s'
%
cpu_count
)
os
.
environ
[
'PATH'
]
=
environment
[
'PATH'
]
stdout
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.runSoftwareRelease_out'
),
'w+'
)
stderr
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.runSoftwareRelease_err'
),
'w+'
)
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
#'--buildout-parameter',"'-U -N' -o",
config
[
'slapos_config'
]],
stdout
=
stdout
,
stderr
=
stderr
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
stdout
.
seek
(
0
)
stderr
.
seek
(
0
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
'stdout'
:
stdout
.
read
(),
'stderr'
:
stderr
.
read
()}
stdout
.
close
()
stderr
.
close
()
return
status_dict
cpu_count
=
os
.
sysconf
(
"SC_NPROCESSORS_ONLN"
)
os
.
putenv
(
'MAKEFLAGS'
,
'-j%s'
%
cpu_count
)
os
.
environ
[
'PATH'
]
=
environment
[
'PATH'
]
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
#'--buildout-parameter',"'-U -N' -o",
config
[
'slapos_config'
]],
stdout
=
stdout
,
stderr
=
stderr
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
stdout
.
seek
(
0
)
stderr
.
seek
(
0
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
'stdout'
:
stdout
.
read
(),
'stderr'
:
stderr
.
read
()}
stdout
.
close
()
stderr
.
close
()
return
status_dict
def
runComputerPartition
(
self
,
config
,
process_group_pid_set
=
None
):
def
runComputerPartition
(
self
,
config
,
environment
,
process_group_pid_set
=
None
,
stdout
=
None
,
stderr
=
None
):
print
"SlapOSControler.runInstanceRelease"
slap
=
slapos
.
slap
.
slap
()
slap
.
registerOpenOrder
().
request
(
self
.
software_profile
,
partition_reference
=
'testing partition'
,
partition_parameter_kw
=
config
[
'instance_dict'
])
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_partition_binary'
],
config
[
'slapos_config'
],
'-c'
,
'-v'
],
close_fds
=
True
,
preexec_fn
=
os
.
setsid
,
stdout
=-
1
,
stderr
=-
1
)
ss
,
se
=
slapgrid
.
communicate
()
print
"
\
n
%s
\
n
\
n
%s
\
n
"
%
(
ss
,
se
)
config
[
'slapos_config'
],
'-c'
,
'-v'
],
stdout
=
stdout
,
stderr
=
stderr
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
stdout
.
seek
(
0
)
stderr
.
seek
(
0
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
if
slapgrid
.
returncode
!=
0
:
raise
ValueError
(
'Slapgrid instance failed'
)
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
'stdout'
:
stdout
.
read
(),
'stderr'
:
stderr
.
read
()}
stdout
.
close
()
stderr
.
close
()
return
status_dict
slapos/recipe/cloudoootestnode/testnode.py
View file @
5c76fa33
...
...
@@ -55,6 +55,16 @@ def safeRpcCall(function, *args):
time
.
sleep
(
retry
)
retry
+=
retry
>>
1
def
getInputOutputFileList
(
config
,
command_name
):
stdout
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.%s_out'
%
command_name
),
'w+'
)
stdout
.
write
(
"%s
\
n
"
%
command_name
)
stderr
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.%s_err'
%
command_name
),
'w+'
)
return
(
stdout
,
stderr
)
slapos_controler
=
None
def
run
(
args
):
...
...
@@ -168,22 +178,25 @@ branch = %(branch)s
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
revision
=
repository_revision
.
split
(
'-'
)[
1
])
updater
.
checkout
()
# Now prepare the installation of SlapOS
slapos_controler
=
SlapOSControler
(
config
,
process_group_pid_set
=
process_group_pid_set
)
# this should be always true later, but it is too slow for now
status_dict
=
slapos_controler
.
runSoftwareRelease
(
config
,
config
[
'environment'
],
process_group_pid_set
,
)
for
method_name
in
(
"runSoftwareRelease"
,
"runComputerPartition"
):
stdout
,
stderr
=
getInputOutputFileList
(
config
,
method_name
)
slapos_method
=
getattr
(
slapos_controler
,
method_name
)
status_dict
=
slapos_method
(
config
,
environment
=
config
[
'environment'
],
process_group_pid_set
=
process_group_pid_set
,
stdout
=
stdout
,
stderr
=
stderr
)
if
status_dict
[
'status_code'
]
!=
0
:
break
if
status_dict
[
'status_code'
]
!=
0
:
safeRpcCall
(
master
.
reportTaskFailure
,
test_result_path
,
status_dict
,
config
[
'test_node_title'
])
retry_software
=
True
continue
# create instances, it should take some seconds only
slapos_controler
.
runComputerPartition
(
config
,
process_group_pid_set
=
process_group_pid_set
)
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
config
[
'partition_reference'
])
...
...
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