virt-libvirt: Pylint fixes for vm_xml

Mainly minor items that should have no effect on tests.  Some
more risky changes were made to set_agent_channel() and
get_iface_dev() methods.  Those changes were made because
it made line-wrapping easier (lines were too long) and to
make parameter passing more clear (redundant ** magic).

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Unittest causing failures in others

Our check_patch and run_unittests scripts both run all unittest files IN
PARALLEL, not one at a time. This leads to some really interesting and
difficult to debug problems, like one test deleting/modifying temp files
or state for another test.  Problems here are:

1) The VIRSH_EXEC logic isn't working right, and because the virsh
module is sharing memory, changing virsh.virsh_exec in your test is
interfering with other tests.

2) Many tests are calling self.sp.method() which execute real virsh
commands. This is fine, except that they don't all work w/o root access
and therefore are dependant on external state.

Signed-off-by: Chris Evich <cevich@redhat.com>
qemu.tests: make mutli_disk test works for linux guest

fix not all disk listed issue, get cdrom drive letter with
utils_misc.get_winutils_vol();

Signed-off-by: Xu Tian <xutian@redhat.com>
virttest: Add unittest for libvirt_storage module.

* Replace real virsh module with a bogus virsh module
* Rewrite relative virsh pool functions for unittest.
  With setting output to static strings.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virt-libvirt: Fix small bug in storage_unittest

The pool_autostart function was not being overriden in virsh instance,
but dummy function already written.  I just added it into setUp() now
unittest is working perfectly when run as non-root.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Avoid future param. order problems

Signed-off-by: Chris Evich <cevich@redhat.com>
libvirt_xml_unittest: Fix wrong arguments passed to function

This unittest was calling vm_xml.VMXML.new_from_dumpxml
with wrong positional arguments, making the function
ignore the dummy virsh instance passed, causing errors.
Let's fix this bug.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tools: add tool for pep8 reformatting

This calls the PEP8 linter called autopep8:

https://github.com/hhatto/autopep8

So we can make autotest to fully adhere to PEP8,
since there's a tool that can enforce the standard.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
tools: add pep8 check into check_patch

Integrate the PEP8 linter into the virt-test full
tree and patch verification process. It works by
verifying whether the PEP8 linter modified the file in
place, if it did, it means there are non compliances
in the code.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
tools: Add codespell

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tools/check_patch.py: Add codespell check

Integrate codespell to our own check_patch.py script.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run_pep8 refactor

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Mass spelling fixes

Using the program codespell

https://github.com/lucasdemarchi/codespell

We found a number of spelling mistakes, that could be
found and fixed. The result of the automated script
was double checked, of course.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tools/run_pep8.py: Ignoring E501,W601
PEP8 mass fixes

With the help of the PEP8 script, a semi-automated clean
of the code base was made, and effectively changing some
of the coding style rules of our code base:

 * No more 2 lines spacing among functions
 * No more combined module imports

In the end, it was going to be too difficult to take
into consideration E501 (line length > 80) errors and
W601 (.has_key() is deprecated), so these were ignored,
at least for now.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tools/check_patch.py: Fix incorrect logic

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.utils_misc: Convert host_setup_flag into int

If host_setup_flag is set up in cfg files. Convert it to int in this
step. This can ignore the type error when use it for bit check.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.libvirt_storage_unittest: remove ModuleLoadCheckVirsh class.

Since we initialize a bogus_virsh in setup to provide a fake virsh for unittest,
then there is no need to skip if virsh command is not available.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Merge pull request #833 from yangdongsheng/libvirt_storage_unittest

virttest.libvirt_storage_unittest: remove ModuleLoadCheckVirsh class.
virt-libvirt: Error message enhancement

It's possible to install libvirt bits w/o installing kvm or xen.  This
will be reflected in 'virsh capabilities' output, but the VM class just
reports a key error.  Added two specific error logging messages to make
the problem clearer, but continue to raise the original exception.

Signed-off-by: Chris Evich <cevich@redhat.com>