Commit Graph

5485 Commits

Author SHA1 Message Date
Cole Robinson
374a3779c4 urlfetcher: Write test file as binary content
Triggers an test_ui error otherwise:

TypeError: write() argument must be str, not bytes
2017-10-21 19:41:33 -04:00
Cole Robinson
d82022bd2c manager: Drop python2 only cmp() usage
Manually implement it
2017-10-21 19:41:33 -04:00
Cole Robinson
be7db97ecf uitests: launch UI with same python executable
As the tests were launched with
2017-10-21 19:41:33 -04:00
Chen Hanxiao
7f1b4cee82 pycodestyle: fix all E125 warnings
Fix all E125:
     Continuation line with same indent as next logical line

   Also remove ignore options of E125

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-10-21 23:26:16 +08:00
Cole Robinson
999dbb3665 cli: Make _VirtCLIArgument instantiation less crazy
Motivation is that the other way had changed behavior with python3
which breaks things
2017-10-20 17:07:19 -04:00
Cole Robinson
d2648d81cc virtconv: Don't implicitly depend on dict hash order 2017-10-20 16:13:04 -04:00
Cole Robinson
b8fa0c6b67 xmlnsqemu: Order XML output like libvirt does
args before env
2017-10-20 16:13:04 -04:00
Cole Robinson
91c0669cf6 cli: Fix OrderedDict mutated during iteration on python3 2017-10-20 16:13:04 -04:00
Cole Robinson
e4aed23427 tests: Convert file()->open() usage
One snuck in recently
2017-10-20 16:13:04 -04:00
Radostin Stoyanov
f41aafc721 Use enumerate instead of range and len 2017-10-20 13:18:31 -04:00
Radostin Stoyanov
37ea520773 Replace 'StandardError' with 'Exception'
Python 2 has an exception class called StandardError that has
been removed in Python 3. Use Exception instead. [1]

[1] http://python3porting.com/differences.html#standarderror
2017-10-20 13:18:31 -04:00
Radostin Stoyanov
69c84bea47 Import reduce() from functools module
The built-in function reduce() [1] has been moved in the functools
module [2] [3].

[1] https://docs.python.org/2/library/functions.html#reduce
[2] https://docs.python.org/3/library/functools.html#functools.reduce
[3] https://docs.python.org/2/library/functools.html#functools.reduce
2017-10-20 13:18:31 -04:00
Radostin Stoyanov
44de92b772 Use reload() from imp module
In Python 3 the reload() function [1] has been moved in the imp
module. [2]

[1] https://docs.python.org/2/library/functions.html#reload
[2] https://docs.python.org/3/library/importlib.html#importlib.reload
2017-10-20 13:18:31 -04:00
Radostin Stoyanov
a2bcd6c43a Do not compare between None and int
In Python 2 comparison between int and None is allowed but in
Pyhton 3 it is not.

Example:

Pyhton 2

    >>> None > 0
    False

Python 3

    >>> None > 0
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: '>' not supported between instances of 'NoneType' and 'int'
2017-10-20 13:18:31 -04:00
Radostin Stoyanov
75210ed37c Replace StringIO with io.(StringIO or BytesIO)
StringIO and cStringIO modules no longer exists in Python 3. [1]
Use either io.StringIO [2] for text or io.BytesIO [3] for bytes.

[1] http://docs.python.org/3.0/whatsnew/3.0.html
[2] https://docs.python.org/3/library/io.html#text-i-o
[3] https://docs.python.org/3/library/io.html#binary-i-o
2017-10-20 13:18:31 -04:00
Radostin Stoyanov
dff00d4fc0 Remove deprecated statvfs module
The statvfs module has been removed in Python 3. [1]
It is replaced by os.statvfs which is also available in Pyhton 2.

[1] https://docs.python.org/2/library/statvfs.html#module-statvfs
[2] https://docs.python.org/3/library/os.html#os.statvfs
2017-10-20 11:49:14 -04:00
Radostin Stoyanov
e2ad4b2fde Convert iteritems() to items()
In Python 2 iteritems() [1] returns an iterator over the dictionary and
items() [2] returns a list of pairs.

In Python 3 iteritems() does not exist and items() returns a view of
the dictionary's items.[3]

[1] https://docs.python.org/2/library/stdtypes.html#dict.iteritems
[2] https://docs.python.org/2/library/stdtypes.html#dict.items
[3] https://docs.python.org/3/library/stdtypes.html#dict.items
2017-10-20 11:49:14 -04:00
Radostin Stoyanov
2d276ebed8 progress: Don't overwrite "format"
Do not overwrite built-in format. [1]

https://docs.python.org/2/library/functions.html#format
2017-10-20 11:49:14 -04:00
Radostin Stoyanov
bc3c9a9d7b progress: Remove unused import 2017-10-20 11:49:14 -04:00
Radostin Stoyanov
08a58d6145 pycodestyle: Remove description of fixed errors 2017-10-20 11:49:14 -04:00
Radostin Stoyanov
63fce081ed pycodestyle: Use isinstance() for type checking
This is E721 in pycodestyle [1]:
   "do not compare types, use ‘isinstance()’"

The main differece between "type() is" and "isinstance()" is that
isinstance() supports inheritance. [1]

This can be seen in the example below:
    >>> type(True) is int
    False
    >>> isinstance(True, int)
    True

As we can see in python 'bool' a subclass of 'int'.

[1] https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
[2] https://docs.python.org/2/library/functions.html#isinstance
2017-10-20 11:49:13 -04:00
Radostin Stoyanov
d1e1cf64a7 progress: Remove trailing white space 2017-10-20 11:49:12 -04:00
Cole Robinson
2fe444323b engine: Don't attempt --test-first-run if --connect passed
Which we do for uitests, we don't want it trying to connect to
qemu:///system while uitests are running
2017-10-20 11:47:15 -04:00
Lin Ma
23aaf8527d network: Set bridge name to None instead of blank
Trigger libvirt error if user leaves 'net-bridge-name' GtkEntry
blank when specifying shared device name.

Signed-off-by: Lin Ma <lma@suse.com>
2017-10-19 18:09:19 -04:00
Pavel Hrdina
6e6f59e7ab diskbackend: get a proper size of existing block device while cloning
We cannot use os.statvfs() if the clone disk is a block device because
it gets stats about filesystem which in this case is "devtmpfs" mounted
as "/dev".

As a workaround we can seek to the end of the block device to get
the actual size.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1450908

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-10-19 09:12:05 +02:00
Pavel Hrdina
e73abe5a3a diskbackend: convert to long the calculated size
If we convert to long the disk size, it may end up "0".  The size is
in GiB so it can be "0.1".

Introduced by commit <fab55c128ff3f092039bb950ecfd337568d2a9a8>.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-10-19 09:06:44 +02:00
Cole Robinson
9617d1267d systray: Use APPLICATION_STATUS for appindicator
Not OTHER, as the reporter points out this shouldn't be used, and
causes issues on KDE

https://bugzilla.redhat.com/show_bug.cgi?id=1501173
2017-10-18 19:14:17 -04:00
Cole Robinson
f0987ed9b8 tests: Add more hostkeymap tests 2017-10-18 18:42:50 -04:00
Jim Fehlig
9a9f9ecd2c virtinst: ignore comments in keymap conf files
On a host system with keyboard configured to en-US, it was noticed
that virt-install created install XML with keymap='de'. The host
system did not have /etc/vconsole.conf, so /etc/sysconfig/keyboard
was the next file to check, which contained the following

KEYTABLE=""

Currently the parsing code does not ignore comments and incorrectly
parsed a 'de' keymap. Fix by ignoring any lines that start with '#'
after trimming whitespace.
2017-10-18 17:46:41 -04:00
Cole Robinson
09a53eb2a3 tests: Add basic hostkeymap test
To validate an upcoming bugfix
2017-10-18 17:44:29 -04:00
Lin Ma
083dfcc8ec host: Show details about the network of SR-IOV VF pool
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-10-09 10:22:48 +02:00
Lin Ma
6dfc4de125 network: add support for parsing/formatting SR-IOV VFs
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-10-09 10:22:48 +02:00
Pavel Hrdina
c9a26c84b0 urlfetcher: fix kernel/initrd paths for Ubuntu install CD
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-10-04 12:32:17 +02:00
Jia He
3def27badd Add arm64 check to urlfetcher to cater for Debian based distro
Without this check, the virt-install will report:
RuntimeError: Couldn't find hvm kernel for Ubuntu tree.

Signed-off-by: Jia He <hejianet@gmail.com>
2017-10-04 09:53:28 +02:00
Pavel Hrdina
3b76964365 domain: don't add URI into params for tunneled migration
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1456185

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-10-03 12:24:39 +02:00
Cole Robinson
eb47d94308 Prep for release 1.4.3 2017-09-19 20:07:34 -04:00
Pavel Hrdina
c0710c74ff choosecd: change order of check operations
The current order of check operations is wrong.  First we set the new
path for the disk in question and after that we check whether some
guest already uses a disk with the same path.

The issue is that virt-manager returns a cached list of guests in
path_in_use_by() and the cached guest has the disk path already
updated.

Ideally we don't update the path at all, but we do it to run some
checks before the path is actually changed.  In order to fix the
referenced bug, change the order of check operations.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1453094

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-19 20:04:39 -04:00
Cole Robinson
2d27142c9c tests: urls: check for latest ubuntu LTS 2017-09-19 19:55:57 -04:00
Pavel Hrdina
fd420fdacd domain: invalidate domain caps if machine type is changed
This forces to reload domain capabilities.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1461684

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-19 10:40:09 +02:00
Pavel Hrdina
8e0303059e cloner: get original XML with security informations
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1455491

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-18 09:04:35 +02:00
Cole Robinson
6b8f0b6e1a tests: uitests: Add a delay for nvram rename test
Seems to fail a bit otherwise
2017-09-15 19:42:40 -04:00
Cole Robinson
901dbaf4b7 details: Fix displaying isa panic device 2017-09-15 19:36:58 -04:00
Cole Robinson
cc1a0f8b0a tests: Add multi <panic> example 2017-09-15 19:33:22 -04:00
Lin Ma
40f70d4fe5 virt-install: add param cache.mode and cache.level for option '--cpu'
libvirt supports guest CPU cache by commit df13c0b, So add this feature
to virt-install to configure cpu L3 cache mode.

Currently, The valid values are 'passthrough', 'emulate' or 'disable'.
say:
  --cpu host-passthrough,cache.mode=passthrough
or
  --cpu $CPU,cache.mode=emulate,cache.level=3
or
  --cpu $CPU,cache.mode=disable

Signed-off-by: Lin Ma <lma@suse.com>
2017-09-14 18:54:01 -04:00
Lin Ma
8034748c22 virt-install: add a host cpu passthrough example to the -help output
Signed-off-by: Lin Ma <lma@suse.com>
2017-09-14 18:49:59 -04:00
Viktor Mihajlovski
d2dce02522 virtinst: Add s390x cd detection for Debian
Enable the installation from Debian s390x CD images.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2017-09-14 17:49:00 -04:00
Viktor Mihajlovski
5ce84fccf0 virtinst: Get rid of the s390x-specific cd detection function
Move the s390x-specific code into the generic cd detection function.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2017-09-14 17:49:00 -04:00
Viktor Mihajlovski
6d38c3c457 virtinst: Fix cd recognition on Ubuntu
The Ubuntu c recognition was looking for a file .disk/mini-info.
However, the correct name is .disk/info.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2017-09-14 17:49:00 -04:00
Pavel Hrdina
af91d51fc8 cli: introduce snapshot_policy parameter for disk device
This allows to configure snapshot behavior for each disk.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1430642

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-12 08:58:31 +02:00
Chen Hanxiao
04e35b2d85 pycodestyle: fix all E124 warnings
Fix all E124:
     Closing bracket does not match visual indentation

   Also remove ignore options of E124

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-09-09 23:21:42 +08:00