Commit Graph

5677 Commits

Author SHA1 Message Date
Radostin Stoyanov
474f60fc56 pylint: Silence inconsistent-return-statements
A new Python checker was added to warn about "inconsistent return
statements" [1]. A function or a method has inconsistent return
statements if it returns both explicit and implicit values.

[1] https://pylint.readthedocs.io/en/latest/whatsnew/1.8.html

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 16:04:08 -05:00
Radostin Stoyanov
4f7bc4f4e6 pylint: Use pylint.lint module
The `pylint-3` executable is provided by the python3-pylint rpm
package on Fedora.
For Debian the equivalent is `pylint3`.
On Arch Linux the default version of Python is 3.

Pylint lints for the version of Python it is running. Instead of
spawning an executable, import the `pylint.lint` module and call
`Run()`.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 15:59:05 -05:00
Cole Robinson
5ac2fe7fe4 libvirtenummap: Absorb similar functionality from domain.py
For mapping state enums to string names and other similar bits
2018-02-27 12:31:56 -05:00
Cole Robinson
1d8cd69f82 connection: Map event vals to libvirt enum names in debug output
Shove this logic into its own class LibvirtEnumMap in its own file,
since this may grow over time.
2018-02-27 12:31:56 -05:00
Cole Robinson
da0d0600da connection: Show event name in debug output for xml misc events 2018-02-27 11:59:15 -05:00
Cole Robinson
435fdf2a6a tests: Add xmlns remove_child test case
And tighten up the xmlbuilder xmlns hackery
2018-02-26 14:56:24 -05:00
Cole Robinson
84c02da998 xmlbuilder: Make sure split out XML has xmlns as needed
Otherwise libxml2 whines
2018-02-23 14:41:22 -05:00
Cole Robinson
0624209028 util: Drop libxml2 error callback
If libvirt calls into it, we crash. Fun...

https://www.redhat.com/archives/virt-tools-list/2018-February/msg00029.html
2018-02-23 14:18:55 -05:00
Cole Robinson
a58f458fb3 tests: storage: destroy/undefine created objects
Otherwise we pollute the test driver which causes collisions on
libvirt.git
2018-02-23 11:57:57 -05:00
Cole Robinson
3079426c82 virtinst: Drop doc= for properties
This data never gets to the user and largely is just duplicating
libvirt docs. It's redundant
2018-02-22 20:49:07 -05:00
Cole Robinson
e70eb82db1 virt-install: Remove redundant isActive check 2018-02-22 20:49:07 -05:00
Cole Robinson
6f578ffeff xmlbuilder: Remove get_xml_config prep wrappers
The only user was Guest, and in fact it's not needed for the standard
get_xml_config, only for the custom _get_install_xml. So drop it
2018-02-22 20:49:07 -05:00
Cole Robinson
472a52b170 virtconv: Drop all the chdir hackery
This was just lazy stuff to avoid having to assumble abspaths. Plus
it confuses cprofile
2018-02-22 20:49:07 -05:00
Cole Robinson
6cad350649 storage: Use a threading event to signal progress thread
Much more reactive and saves us time in the test suite
2018-02-22 19:12:23 -05:00
Cole Robinson
8c3388697c virt-xml: Remove redundant XML roundtripping
Based on how we do diff reporting it doesn't accomplish anything anyways
2018-02-22 18:48:31 -05:00
Cole Robinson
8371a681b1 tests: Remove some redundant clitests
- Consolidate tests if they don't add coverage
- Remove some categories that aren't really required
2018-02-22 18:26:50 -05:00
Marc-André Lureau
55fa6c4caa tests: add xmlparse/change vmcoreinfo test
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-22 16:23:40 -05:00
Marc-André Lureau
84bc80a900 virtinst/support: add SUPPORT_CONN_VMCOREINFO check
It is supported since qemu 2.11 and libvirt 3.10.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-22 16:23:40 -05:00
Marc-André Lureau
0a62ae0b7a virtinst: add <vmcoreinfo/> feature
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-22 16:23:40 -05:00
Marc-André Lureau
39721cbe1b connection: support checking for a list of features
Make check_support() accept a list of features.

This will let tests have more complex conditions on the features they
require.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-22 16:23:40 -05:00
Cole Robinson
6954c6774a tests: Fix running testsuite on older libvirt
If we try to run the testsuite on anything older than libvirt 3.1,
it immediately throws an exception before processing any tests,
due to choking on parsing drm bits from testdriver.xml. This global
failure is only due to sloppy coding though.

Turn all test cases that use testdriver.xml into skips in this case,
so we can at least get some test coverage otherwise.
2018-02-22 16:01:24 -05:00
Cole Robinson
62fecb09d3 tests: Create a smaller testsuite.xml
Right now, most test cases will create a libvirt test driver using
tests/testdriver.xml. This is problematic for 2 reasons:

1) testdriver.xml is 3500 lines of XML, and it's parsed hundreds of
   times. Opening it is responsible for about 25% of test suite time
2) Older libvirt chokes on testdriver.xml, meaning the test suite will
   be useless there. This is a recurring problem as new features are
   added to testdriver.xml

Most test cases don't actually need all the test state in testdriver.xml
though. So this creates a smaller testsuite.xml which has a lower
libvirt requirement and is much quicker to parse. New XML bits should
continue to go into testdriver.xml so we can keep testsuite.xml as
the more stripped down option.
2018-02-22 15:44:06 -05:00
Cole Robinson
47afa912b3 setup: tests: Add --testverbose option
Can't use --verbose because it conflicts with setuptools options
2018-02-22 15:18:47 -05:00
Cole Robinson
c05cd52772 setup: Use CLIState for setting --debug value 2018-02-22 15:18:47 -05:00
Cole Robinson
8ee2f62efe tests: Simplify clonetest.py 2018-02-22 15:18:41 -05:00
Cole Robinson
cb1c020c13 tests: Simplify virtconvtest.py 2018-02-22 15:18:06 -05:00
Cole Robinson
0adae891a6 tests: Use testdefault more 2018-02-22 15:08:09 -05:00
Cole Robinson
4205272384 tests: Add explicit test_dist target
Things like po validation don't need to be done on every test run
2018-02-20 12:33:57 -05:00
Cole Robinson
98d880a179 tests: Differentiate conn cache based on actual open URI
Since what is actually passed to libvirt here is what actually matters,
not all our fakeuri trickery
2018-02-20 12:21:45 -05:00
Cole Robinson
059fb7d0ba xmlbuilder: Order child props before serializing
We were implicitly depending on dict hash ordering here, which
was causing some different XML output in centos CI
2018-02-20 11:41:04 -05:00
Cole Robinson
a8fb49dbe0 xmlapi: Fix some pylint 2018-02-20 11:27:55 -05:00
Cole Robinson
dfa0fa34b4 tests: xmlparse: Add a roundtrip metadata test
To ensure the xml engine doesn't mangle unknown XML
2018-02-20 11:23:37 -05:00
Cole Robinson
bc94666778 tests: xmlparse: Add qemu xmlns tests
Since reproducing via manual clitest is hard since it requires
XML on stdin
2018-02-20 11:23:37 -05:00
Cole Robinson
2bea4ecbf6 xmlapi: Some libxml2 simplifications 2018-02-20 11:23:37 -05:00
Cole Robinson
f04b284f21 xmlbuilder: Abstract libxml2 API and cleanup
Moves the libxml2 bits to a separate xmlapi file and class, a bunch
of cleanups to xmlbuilder internals dealing with XML stuff.

The main point is to experiment with different XML library impls,
since libxml2 is unfun to deal with and we are having python3
issues like

https://bugzilla.gnome.org/show_bug.cgi?id=776815
2018-02-20 11:23:37 -05:00
Cole Robinson
1302156265 setup: Add explicit error if running with python2 2018-02-16 12:37:54 -05:00
Cole Robinson
a20230091b xmlbuilder: Move xpath string ops to their own class
This streamlines the actual libxml2 interaction quite a bit
2018-02-14 14:49:35 -05:00
Cole Robinson
dce3484e95 xmlbuilder: Move all libxml2 interaction to a single class
Makes the boundaries clearer
2018-02-14 11:29:12 -05:00
Cole Robinson
a853387866 xmlbuilder: Remove more redundant xml state
We don't need to carry around a separate xml_node. Dropping it simplifies
a few things
2018-02-14 11:08:09 -05:00
Cole Robinson
d108bbe143 Convert docstrings to standard reStructuredText param format 2018-02-14 11:08:09 -05:00
Cole Robinson
7cf0b310cc capabilities: Move machine canonicalizing to capsinfo
Rather than overright XML content on every parse
2018-02-14 11:08:09 -05:00
Cole Robinson
c4fdd1d56a xmlbuilder: Remove unused code 2018-02-14 11:08:09 -05:00
Cole Robinson
8917305a6e Don't use count() for substring checking
Use the idiomatic 'X in Y'
2018-02-14 11:08:09 -05:00
Cole Robinson
ab884b620f virtconv: ovf: convert to ElementTree 2018-02-14 09:57:39 -05:00
Cole Robinson
fe728f899d tests: virtconvtest: Accumulate more errors before exiting 2018-02-14 09:57:39 -05:00
Chen Hanxiao
a9596c7492 pylint: fix logging-too-few-args issue
From: Chen Hanxiao <chenhanxiao@gmail.com>

pylint complain:
  Not enough arguments for logging format string (logging-too-few-args)

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2018-02-13 16:42:29 +08:00
Cole Robinson
4c7c45908f manager: Fix mem, disk, net stats graphs (bz 1543896)
python2/3 division compat messed this up

https://bugzilla.redhat.com/show_bug.cgi?id=1543896
2018-02-09 14:02:04 -05:00
Cole Robinson
1550e70a4e uitests: Silence noisy harmless warnings
Could mean a code error but more likely is just slightly racy
UI bits disappearing that we weren't looking for anyways, so hide
it behind a debug statement
2018-02-08 14:23:11 -05:00
Cole Robinson
8e7b5ed2d8 Drop __future__ imports, no longer needed 2018-02-08 14:08:23 -05:00
Cole Robinson
dae8642bb1 xmlbuilder: centralize adding child new child prop instances
Currently the domain CPU class has a child property like:

  siblings = XMLChildProperty(_CPUCellSibling)

If a user wants to add a new sibling, we add a convenience function:

    def add_sibling(self):
        obj = _CPUCellSibling(self.conn)
        self.add_child(obj)
        return obj

Rather than require every child property to define a similar matching
helper function, this adds infrastructure in xmlbuilder to do this
generically for every child property. Now callers can do

    obj = guest.cpu.siblings.add_new()
2018-02-08 14:03:47 -05:00