Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
7f77b6c7
Commit
7f77b6c7
authored
Aug 01, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3722 from bcoca/lvg_gets_bin_path
now uses get_bin_path for lvg executables
parents
bdef7f17
0ae7bcf3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
library/system/lvg
+18
-8
No files found.
library/system/lvg
View file @
7f77b6c7
...
...
@@ -116,6 +116,8 @@ def main():
elif
state
==
'present'
:
module
.
fail_json
(
msg
=
"No physical volumes given."
)
if
state
==
'present'
:
### check given devices
for
test_dev
in
dev_list
:
...
...
@@ -123,7 +125,8 @@ def main():
module
.
fail_json
(
msg
=
"Device
%
s not found."
%
test_dev
)
### get pv list
rc
,
current_pvs
,
err
=
module
.
run_command
(
"pvs --noheadings -o pv_name,vg_name --separator ';'"
)
pvs_cmd
=
module
.
get_bin_path
(
'pvs'
,
True
)
rc
,
current_pvs
,
err
=
module
.
run_command
(
"
%
s --noheadings -o pv_name,vg_name --separator ';'"
%
pvs_cmd
)
if
rc
!=
0
:
module
.
fail_json
(
msg
=
"Failed executing pvs command."
,
rc
=
rc
,
err
=
err
)
...
...
@@ -133,7 +136,8 @@ def main():
if
used_pvs
:
module
.
fail_json
(
msg
=
"Device
%
s is already in
%
s volume group."
%
(
used_pvs
[
0
][
'name'
],
used_pvs
[
0
][
'vg_name'
]))
rc
,
current_vgs
,
err
=
module
.
run_command
(
"vgs --noheadings -o vg_name,pv_count,lv_count --separator ';'"
)
vgs_cmd
=
module
.
get_bin_path
(
'vgs'
,
True
)
rc
,
current_vgs
,
err
=
module
.
run_command
(
"
%
s --noheadings -o vg_name,pv_count,lv_count --separator ';'"
%
vgs_cmd
)
if
rc
!=
0
:
module
.
fail_json
(
msg
=
"Failed executing vgs command."
,
rc
=
rc
,
err
=
err
)
...
...
@@ -156,13 +160,15 @@ def main():
changed
=
True
else
:
### create PV
pvcreate_cmd
=
module
.
get_bin_path
(
'pvcreate'
,
True
)
for
current_dev
in
dev_list
:
rc
,
_
,
err
=
module
.
run_command
(
"
pvcreate
%
s"
%
current_dev
)
rc
,
_
,
err
=
module
.
run_command
(
"
%
s
%
s"
%
(
pvcreate_cmd
,
current_dev
)
)
if
rc
==
0
:
changed
=
True
else
:
module
.
fail_json
(
msg
=
"Creating physical volume '
%
s' failed"
%
current_dev
,
rc
=
rc
,
err
=
err
)
rc
,
_
,
err
=
module
.
run_command
(
"vgcreate -s
%
s
%
s
%
s"
%
(
pesize
,
vg
,
dev_string
))
vgcreate_cmd
=
module
.
get_bin_path
(
'vgcreate'
)
rc
,
_
,
err
=
module
.
run_command
(
"
%
s -s
%
s
%
s
%
s"
%
(
vgcreate_cmd
,
pesize
,
vg
,
dev_string
))
if
rc
==
0
:
changed
=
True
else
:
...
...
@@ -174,7 +180,8 @@ def main():
else
:
if
this_vg
[
'lv_count'
]
==
0
or
force
:
### remove VG
rc
,
_
,
err
=
module
.
run_command
(
"vgremove --force
%
s"
%
(
vg
))
vgremove_cmd
=
module
.
get_bin_path
(
'vgremove'
,
True
)
rc
,
_
,
err
=
module
.
run_command
(
"
%
s --force
%
s"
%
(
vgremove_cmd
,
vg
))
if
rc
==
0
:
module
.
exit_json
(
changed
=
True
)
else
:
...
...
@@ -194,14 +201,16 @@ def main():
if
devs_to_add
:
devs_to_add_string
=
' '
.
join
(
devs_to_add
)
### create PV
pvcreate_cmd
=
module
.
get_bin_path
(
'pvcreate'
,
True
)
for
current_dev
in
devs_to_add
:
rc
,
_
,
err
=
module
.
run_command
(
"
pvcreate
%
s"
%
current_dev
)
rc
,
_
,
err
=
module
.
run_command
(
"
%
s
%
s"
%
(
pvcreate_cmd
,
current_dev
)
)
if
rc
==
0
:
changed
=
True
else
:
module
.
fail_json
(
msg
=
"Creating physical volume '
%
s' failed"
%
current_dev
,
rc
=
rc
,
err
=
err
)
### add PV to our VG
rc
,
_
,
err
=
module
.
run_command
(
"vgextend
%
s
%
s"
%
(
vg
,
devs_to_add_string
))
vgextend_cmd
=
module
.
get_bin_path
(
'vgextend'
,
True
)
rc
,
_
,
err
=
module
.
run_command
(
"
%
s
%
s
%
s"
%
(
vgextend_cmd
,
vg
,
devs_to_add_string
))
if
rc
==
0
:
changed
=
True
else
:
...
...
@@ -210,7 +219,8 @@ def main():
### remove some PV from our VG
if
devs_to_remove
:
devs_to_remove_string
=
' '
.
join
(
devs_to_remove
)
rc
,
_
,
err
=
module
.
run_command
(
"vgreduce --force
%
s
%
s"
%
(
vg
,
devs_to_remove_string
))
vgreduce_cmd
=
module
.
get_bin_path
(
'vgreduce'
,
True
)
rc
,
_
,
err
=
module
.
run_command
(
"
%
s --force
%
s
%
s"
%
(
vgreduce_cmd
,
vg
,
devs_to_remove_string
))
if
rc
==
0
:
changed
=
True
else
:
...
...
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