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
957a7bf3
Commit
957a7bf3
authored
May 31, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3020 from rtheys/virt-state
Support state parameter in list_vms command
parents
69d51410
e97f7899
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
library/cloud/virt
+12
-2
No files found.
library/cloud/virt
View file @
957a7bf3
...
...
@@ -275,13 +275,18 @@ class Virt(object):
}
return
info
def
list_vms
(
self
):
def
list_vms
(
self
,
state
=
None
):
self
.
conn
=
self
.
__get_conn
()
vms
=
self
.
conn
.
find_vm
(
-
1
)
results
=
[]
for
x
in
vms
:
try
:
results
.
append
(
x
.
name
())
if
state
:
vmstate
=
self
.
conn
.
get_status2
(
x
)
if
vmstate
==
state
:
results
.
append
(
x
.
name
())
else
:
results
.
append
(
x
.
name
())
except
:
pass
return
results
...
...
@@ -395,6 +400,11 @@ def core(module):
v
=
Virt
(
uri
)
res
=
{}
if
state
and
command
==
'list_vms'
:
res
=
v
.
list_vms
(
state
=
state
)
if
type
(
res
)
!=
dict
:
res
=
{
command
:
res
}
return
VIRT_SUCCESS
,
res
if
state
:
if
not
guest
:
...
...
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