git.annexia.org
/
mclu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build/import: Add --no-start flag.
[mclu.git]
/
mclu_stop.py
diff --git
a/mclu_stop.py
b/mclu_stop.py
index
bd7f116
..
883b67a
100644
(file)
--- a/
mclu_stop.py
+++ b/
mclu_stop.py
@@
-18,6
+18,8
@@
import argparse
import fnmatch
import argparse
import fnmatch
+import subprocess
+
import libvirt
import lib
import libvirt
import lib
@@
-37,18
+39,22
@@
def cmdline (subparsers):
)
p.set_defaults (run=run)
)
p.set_defaults (run=run)
-def run (c, args
, nodes
):
- running, _ = lib.get_all_guests (c
, nodes.values ()
)
+def run (c, args):
+ running, _ = lib.get_all_guests (c)
for vm in running.values():
for vm in running.values():
- node = vm['node']
-
dom = vm['do
m']
+ node
_name
= vm['node']
+
vm_name = vm['v
m']
# Form the name of this VM (eg. "ham0:vm") so we can match it
# against the wildcards (eg. "ham0:*")
# Form the name of this VM (eg. "ham0:vm") so we can match it
# against the wildcards (eg. "ham0:*")
- name = node
.name + ":" + dom.name()
+ name = node
_name + ":" + vm_name
for wc in args.wildcards:
for wc in args.wildcards:
- if fnmatch.fnmatch (name, wc) or fnmatch.fnmatch (
dom.name()
, wc):
+ if fnmatch.fnmatch (name, wc) or fnmatch.fnmatch (
vm_name
, wc):
if args.force:
if args.force:
- dom.destroy()
+ subprocess.check_call (["virsh",
+ "-c", lib.uri_of_node (node_name),
+ "destroy", vm_name])
else:
else:
- dom.shutdown()
+ subprocess.check_call (["virsh",
+ "-c", lib.uri_of_node (node_name),
+ "shutdown", vm_name])