Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
snf-ganeti
Commits
9f13fc7a
Commit
9f13fc7a
authored
17 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Fix burnin - when removed from cmdlib, it lost locking functionality.
Also improve the burnin by doing an optional replace-disks.
parent
bd785ecd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/burnin
+47
-11
47 additions, 11 deletions
tools/burnin
with
47 additions
and
11 deletions
tools/burnin
+
47
−
11
View file @
9f13fc7a
...
@@ -10,8 +10,10 @@ from ganeti import objects
...
@@ -10,8 +10,10 @@ from ganeti import objects
from
ganeti
import
constants
from
ganeti
import
constants
from
ganeti
import
cli
from
ganeti
import
cli
from
ganeti
import
logger
from
ganeti
import
logger
from
ganeti
import
errors
from
ganeti
import
utils
USAGE
=
(
"
\t
burnin [options] instance_name ...
"
)
USAGE
=
(
"
\t
burnin
-o OS_NAME
[options
...
] instance_name ...
"
)
def
Usage
():
def
Usage
():
"""
Shows program usage information and exits the program.
"""
"""
Shows program usage information and exits the program.
"""
...
@@ -50,9 +52,18 @@ def ParseOptions():
...
@@ -50,9 +52,18 @@ def ParseOptions():
parser
.
add_option
(
"
-v
"
,
"
--verbose
"
,
parser
.
add_option
(
"
-v
"
,
"
--verbose
"
,
action
=
"
store_true
"
,
dest
=
"
verbose
"
,
default
=
False
,
action
=
"
store_true
"
,
dest
=
"
verbose
"
,
default
=
False
,
help
=
"
print command execution messages to stdout
"
)
help
=
"
print command execution messages to stdout
"
)
parser
.
add_option
(
"
--do-replace1
"
,
dest
=
"
do_replace1
"
,
help
=
"
Do disk replacement with the same secondary
"
,
action
=
"
store_false
"
,
default
=
True
)
parser
.
add_option
(
"
--do-replace2
"
,
dest
=
"
do_replace2
"
,
help
=
"
Do disk replacement with a different secondary
"
,
action
=
"
store_false
"
,
default
=
True
)
parser
.
add_option
(
"
--do-failover
"
,
dest
=
"
do_failover
"
,
help
=
"
Do instance failovers
"
,
action
=
"
store_false
"
,
default
=
True
)
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
()
if
len
(
args
)
<
1
:
if
len
(
args
)
<
1
or
options
.
os
is
None
:
Usage
()
Usage
()
return
options
,
args
return
options
,
args
...
@@ -93,7 +104,7 @@ def BurninCluster(opts, args):
...
@@ -93,7 +104,7 @@ def BurninCluster(opts, args):
os_set
&=
set
([
os_inst
.
name
for
os_inst
in
oses
[
node
]])
os_set
&=
set
([
os_inst
.
name
for
os_inst
in
oses
[
node
]])
if
opts
.
os
not
in
os_set
:
if
opts
.
os
not
in
os_set
:
Feedback
(
"
OS not found
"
)
Feedback
(
"
OS
'
%s
'
not found
"
%
opts
.
os
)
return
1
return
1
to_remove
=
[]
to_remove
=
[]
...
@@ -125,14 +136,29 @@ def BurninCluster(opts, args):
...
@@ -125,14 +136,29 @@ def BurninCluster(opts, args):
idx
=
next_idx
idx
=
next_idx
if
len
(
nodelist
)
>
1
:
if
opts
.
do_replace1
:
# failover
if
len
(
nodelist
)
>
1
:
for
instance_name
in
args
:
# failover
op
=
opcodes
.
OpFailoverInstance
(
instance_name
=
instance_name
,
for
instance_name
in
args
:
ignore_consistency
=
True
)
op
=
opcodes
.
OpReplaceDisks
(
instance_name
=
instance_name
,
remote_node
=
None
)
Feedback
(
"
- Replace disks for instance %s
"
%
(
instance_name
))
result
=
proc
.
ExecOpCode
(
op
,
Feedback
)
else
:
Feedback
(
"
- Can
'
t run replace1, not enough nodes
"
)
Feedback
(
"
- Failover instance %s
"
%
(
instance_name
))
if
opts
.
do_failover
:
result
=
proc
.
ExecOpCode
(
op
,
Feedback
)
if
len
(
nodelist
)
>
1
:
# failover
for
instance_name
in
args
:
op
=
opcodes
.
OpFailoverInstance
(
instance_name
=
instance_name
,
ignore_consistency
=
True
)
Feedback
(
"
- Failover instance %s
"
%
(
instance_name
))
result
=
proc
.
ExecOpCode
(
op
,
Feedback
)
else
:
Feedback
(
"
- Can
'
t run failovers, not enough nodes
"
)
# stop / start
# stop / start
for
instance_name
in
args
:
for
instance_name
in
args
:
...
@@ -156,7 +182,17 @@ def main():
...
@@ -156,7 +182,17 @@ def main():
"""
Main function
"""
"""
Main function
"""
opts
,
args
=
ParseOptions
()
opts
,
args
=
ParseOptions
()
return
BurninCluster
(
opts
,
args
)
try
:
utils
.
Lock
(
'
cmd
'
,
max_retries
=
15
,
debug
=
True
)
except
errors
.
LockError
,
err
:
logger
.
ToStderr
(
str
(
err
))
return
1
try
:
retval
=
BurninCluster
(
opts
,
args
)
finally
:
utils
.
Unlock
(
'
cmd
'
)
utils
.
LockCleanup
()
return
retval
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
main
()
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment