On 03/15/2013 02:44 PM, liyang wrote:
Signed-off-by: Li Yang <[email protected]>
---
virttest/virsh.py | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/virttest/virsh.py b/virttest/virsh.py
index f847d92..df41976 100644
--- a/virttest/virsh.py
+++ b/virttest/virsh.py
@@ -1080,6 +1080,18 @@ def detach_interface(name, option="", **dargs):
return command(cmd, **dargs)
+def net_uuid(network, extra="", **dargs):
+ """
+ Get network UUID on host.
+
+ @param: network: name/parameter for network option/argument
+ @param: extra: extra parameters to pass to command (e.g. --disable)
+ @param: dargs: standardized virsh function API keywords
+ @return: CmdResult object
+ """
+ return command("net-uuid %s %s" % (network, extra), **dargs)
+
+
def net_dumpxml(net_name="", extra="", **dargs):
"""
Dump XML from network named net_name.
@@ -1137,7 +1149,7 @@ def net_state_dict(only_names=False, **dargs):
@param: dargs: standardized virsh function API keywords
@return: dictionary
"""
- dargs['ignore_status'] = True # so persistent check can work
+ dargs['ignore_status'] = False # so persistent check can work
Oh, yes, No doubt I have not occurred CmdError in net_state_dict().
netlist = net_list("--all",
print_info=True).stdout.strip().splitlines()
# First two lines contain table header
netlist = netlist[2:]
@@ -1162,7 +1174,7 @@ def net_state_dict(only_names=False, **dargs):
persistent = True
except error.CmdError, cmdstatus:
# Keep search fast & avoid first-letter capital problems
- if not bool(cmdstatus.stdout.count("ransient")):
+ if bool(cmdstatus.result_obj.stderr.count("ransient")):
LGTM, but how about judging by its exit_status, I think it's enough.
I'm afraid that the output may be changed someday. :(
persistent = False
else:
# Different error occured, re-raise it
--
1.7.1
--
Best Regards
Yu Mingfei
_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel