Hi Chris,Lucas:
I changed some codes to make sure the test can avoid network which is transient.

BTW, I think there's a bug in virsh.net_state_dict():
def net_state_dict(only_names=False, **dargs):

    dargs['ignore_status'] = True # so persistent check can work

        try:
            # These will throw exception if network is transient
            if autostart:
                net_autostart(name, **dargs)
            else:
                net_autostart(name, "--disable", **dargs)
            # no exception raised, must be persistent
            persistent = True
        except error.CmdError, cmdstatus:
            # Keep search fast & avoid first-letter capital problems
            if not bool(cmdstatus.stdout.count("ransient")):
                persistent = False
            else:
                # Different error occured, re-raise it
                raise
1.If "ignore_status" is set to be "True", net_autostart() will not throw any exception
no matter if network is transient or not.

2.cmdstatus.stdout.count("ransient")...
Actually, cmdstatus is CmdError class which has no member named "stdout",I think it should be
cmdstatus.result_obj.stderr.count("ransient")
And if user found "ransient" in stderr, persistent must be False..I thinks the logic maybe wrong,
it should be:
if bool(cmdstatus.result_obj.stderr.count("ransient")):
    persistent = False

That's right?
I fixed it and tested it, now the test runs smoothly..

Li Yang (3):
  virt-libvirt:Add configuration for virsh net-dumpxml test.
  virt: add virsh function and fix a bug about net_state_dict() for
    virshnet-dumpxml test.
  virt-libvirt: add test module for virsh net-dumpxml test.

 libvirt/tests/cfg/virsh_net_dumpxml.cfg |   36 +++++++++++++++++
libvirt/tests/virsh_net_dumpxml.py | 64 +++++++++++++++++++++++++++++++
 virttest/virsh.py                       |   16 +++++++-
 3 files changed, 114 insertions(+), 2 deletions(-)
 create mode 100644 libvirt/tests/cfg/virsh_net_dumpxml.cfg
 create mode 100644 libvirt/tests/virsh_net_dumpxml.py

--
Regards,
--------------------------------------------------
Li Yang
TEL:+86+25-86630566-8526
EMail:[email protected]
--------------------------------------------------



_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to