Commit Graph

1486 Commits

Author SHA1 Message Date
Cole Robinson f69b823fad devices: Switch to normal _XML_PROP_ORDER
Drop the register_device stuff, rename virtual_device_type
2018-03-21 11:17:36 -04:00
Cole Robinson 7b61c45d3b guest: Move all_devices to guest.devices.X
The way we enumerate devices doesn't conform with the way all
other XMLBuilder instances expose child objects. Move more towards
that direction.

This requires some virt-xml and cli.py hacks but we will remove those
in future patches
2018-03-21 11:17:36 -04:00
Cole Robinson fe9ed2340c virtinst: move <domain> XML files to virtinst/domain
And give the classes consistent naming
2018-03-21 11:17:36 -04:00
Cole Robinson b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson 1c911ce567 virtinst: Give device classes consistent DeviceX naming
Previous state was inconsistenty and needlessly wordy. Fix up
a few other class namings that have redundant Virtual in the name
2018-03-21 07:29:40 -04:00
Cole Robinson a55abc8e89 details: Again fix default page showing 2018-03-18 11:36:02 -04:00
Cole Robinson 4d4a07c65b tests: uitests: Add window cleanup tests
And fix some bugs I found as a result
2018-03-17 19:42:19 -04:00
Cole Robinson 259c70a090 error: Drop unused parent callback 2018-03-17 18:49:55 -04:00
Cole Robinson defdfd4b51 engine: Fix backtrace from manager->exit 2018-03-17 18:47:13 -04:00
Cole Robinson 97db1ac18a manager: Simplify row management a bit
Drop the self.rows dict, use more pygobject row[] convenience
helpers, add some helper properties for VM
2018-03-17 18:46:40 -04:00
Cole Robinson 7de9028221 manager: Fix some menu item sensitivity issues 2018-03-17 18:46:40 -04:00
Cole Robinson b5377f8f0f engine: Make a decorator function for showing startup errors 2018-03-17 18:46:40 -04:00
Cole Robinson 3c1e0a8a12 virtManager/*: Give pylint hints about singleton classes
It can't seem to figure out that what 'cls' is in this context,
so make it explicit.
2018-03-17 18:46:39 -04:00
Cole Robinson 7ad15769dc virt-manager: fix git startup on wayland
Apparently we need to do these env settings much earlier...
2018-03-17 13:14:04 -04:00
Cole Robinson 483a8de6c1 systray: Change window tracking a bit
We should only prevent app closing if the systray is actually embedded
2018-03-17 12:18:38 -04:00
Cole Robinson 9ec865e4c0 systray: Only create statusicon if showing
Since even if it's marked as not visible, it can cause some movement
on the gnome3 topbar with topicons extension
2018-03-17 11:42:12 -04:00
Cole Robinson dac860e8ce engine: Show modal startup errors if window open fails 2018-03-16 19:09:55 -04:00
Cole Robinson ee817c32ce s/connect_opt_out/connect_once/ for open-completed callback
Forgot about that helper function...
2018-03-16 18:05:52 -04:00
Cole Robinson ad632383c8 virt-manager: if new --connect fails, don't save the URI 2018-03-16 18:05:52 -04:00
Cole Robinson 2f0e730efc error: Don't double log summary
details is often composed of a summary + traceback, so if users copy
it into a bug report we get all the info. But when logging the contents
we don't want to double log the summary, so try to strip it out
2018-03-16 17:30:39 -04:00
Cole Robinson c9b2ec163f preferences: Add UI for disabling spice usb autoredir
We already have a gconf key and command line option for this.
Drop the CLI option and add UI for it, we should have just done
that to begin with
2018-03-16 14:38:22 -04:00
Cole Robinson dabbc8d5bd engine: Remove centralized conn.open handling
Move connection opening logic to each caller, since needs are
slightly different.
2018-03-15 21:24:48 -04:00
Cole Robinson 5ebe8b8184 create: Fix customize dialog launching
After the increment/decrement rework
2018-03-15 21:24:48 -04:00
Cole Robinson cad809fe80 Make all dialogs clean up when vm/conn disappears
Moves all the window cleanup handling to each class and audit for
all --test-leak-debug errors and fix
2018-03-15 21:24:48 -04:00
Cole Robinson 2ee69edc8e snapshots: Fix generating screenshot after py3 conversion 2018-03-15 21:24:48 -04:00
Cole Robinson 20d5c1887a baseclass: Export GObject.SignalFlags.RUN_FIRST
Saves some typing and imports
2018-03-15 21:24:48 -04:00
Cole Robinson 1d17b98852 engine: Move most remaining window tracking to UI classes
Kind of a big mess but it was difficult to untangle piecemeal.
Basically this drops nearly all the centralized window tracking
in engine.py and moves it to each UI class. If manager.py wants
to open a details window it does it directly, and vmmDetails tracks
the window object list itself. This simplifies things and makes
the code easier to follow.

There's still some weirdness with vmmConnect and connection callbacks,
but future patches will break those apart.
2018-03-15 21:24:48 -04:00
Cole Robinson 92aea7c565 engine: Have windows increment/decrement windows directly 2018-03-15 21:24:48 -04:00
Cole Robinson 9fa9777f1c engine: Have windows call exit_app directly 2018-03-15 21:24:48 -04:00
Cole Robinson 6180a3c81f engine: Cleanup function names, comments, etc. 2018-03-15 21:24:48 -04:00
Cole Robinson 58f872a205 clone: Convert to per-connection singleton-ish pattern
And convert the dialog VM handling to match other dialogs
2018-03-15 21:24:48 -04:00
Cole Robinson b94a9fdffb migrate: convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson a915b089cd migrate: Drop cached conn list
Not needed since we have connmanager now
2018-03-15 21:24:48 -04:00
Cole Robinson 65b512ae6f delete: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson 1780d0e9f0 details: Call inspection VM refresh directly 2018-03-15 21:24:48 -04:00
Cole Robinson f088537798 engine: break out vmmConnectionManager
Have a separate class for tracking the connection list, and emitting
conn-added and conn-removed signals. It exists as a singleton instance
that UI classes can talk directly to
2018-03-15 21:24:48 -04:00
Cole Robinson befafe9dc7 engine: connect conn-added in UI classes
This creates a weird situation where we pass the engine to those
classes UI functions, but this is a step towards untangling that.

While here, get rid of the conn-added connect magic and add a
simpler way to access the connection list from the engine
2018-03-15 21:24:48 -04:00
Cole Robinson 2dcfaafcac inspection: Show inspection error in details page 2018-03-15 21:24:48 -04:00
Cole Robinson c21e0db6ea inspection: Remove startup delay
Like the comment says it shouldn't matter
2018-03-15 21:24:48 -04:00
Cole Robinson 48e97e85a6 inspection: Skip for test connections 2018-03-15 21:24:48 -04:00
Cole Robinson 6b1278ccda prefs: Add a setting to enable/disable libguestfs inspection
Rather than key it on the library being available. Makes it much
easier to test both modes of behavior.

Fix up a few inspection bugs while I'm in the area, and convert
it to be more singleton like.
2018-03-15 21:24:48 -04:00
Cole Robinson 6959a41ff2 connection: Drop vm-added emission on connect
We don't use this for most other signals and it's kind of unexpected
2018-03-15 21:24:48 -04:00
Cole Robinson 3187078f10 config: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson 33def3c4af preferences: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson b6a61818af about: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson 717ff72684 engine: Move VM action callbacks to vmmenu.py
Call the callbacks directly rather than using signals. engine.py
has become a bit of a catchall for shared functionality and this
is a step towards disentangling it
2018-03-15 21:24:48 -04:00
Cole Robinson 42e4cc33bf systray: Fix VM leak on conn close 2018-03-15 21:24:48 -04:00
Cole Robinson fbf1bc80b5 connection: Dispatch object remove signals on close 2018-03-15 21:24:48 -04:00
Cole Robinson b25c38816a pylint: Enable 'fixme' checking
Using these for long term TODO type items is not effective, however
it's nice to label things as FIXME during a coding session and have
pylint warn you about them before pushing.
2018-03-15 21:24:48 -04:00
Cole Robinson 6ad6f44920 connection: Call virConnectClose and log the return value
This can help us find object leaks within the code. virConnectClose
is just a deference and will return 1 if other references are still
floating around.
2018-03-15 21:24:48 -04:00
Cole Robinson 7e1cddef18 virt-manager: Add hidden --test-leak-debug option
That enables the pre-existing debug_ref_leaks behavior
2018-03-15 21:24:48 -04:00
Cole Robinson b3c69a05a2 connection: Fix connecting to conn with no objects
Our thread handling leaves us permanently in the 'connecting' state
2018-03-15 21:24:48 -04:00
Cole Robinson c6c24c59ac connection: Remove unused argument 2018-03-15 21:24:48 -04:00
Cole Robinson eb5cd8b2c9 host: Drop vestiges of old VM restore support
This hasn't been in the UI for a long time
2018-03-15 21:24:48 -04:00
Cole Robinson 56cf42e6ea engine: Only init systray if launching new app
We were doing it too early, and the systray could pop up for a moment
when connecting to a remote app
2018-03-15 21:24:48 -04:00
Cole Robinson cfe633f964 systray: Drop appindicator support
Does anyone care about this anymore? Unity is gone, if the libs are
present on a gnome install it's always been funky (currently doesn't
display an icon on f27), libappindator seems largely dead upstream,
and traditional systray icons give very similar behavior.

Kill it and see if anyone complains
2018-03-15 21:24:48 -04:00
Radostin Stoyanov b8b997fc3a pylint: Resolve consider-using-enumerate
Use enumerate instead of iterating with range and len.
This pylint message is emitted when code that iterates with range and
len is encountered. Such code can be simplified by using the enumerate
built-in. [1]

In addition, remove some unused variables to avoid warnings
`unused-argument` and `redefined-variable-type`.

[1] https://pylint.readthedocs.io/en/latest/technical_reference/features.html#id23

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 16:04:14 -05:00
Radostin Stoyanov 1ae5c4ff75 pylint: Resolve logging-not-lazy
A new Python checker was added to warn about using a + operator inside
call of logging methods when one of the operands is a literal string.

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

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 16:04:12 -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 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 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 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
Cole Robinson b42e37be1f Fix last bits of python3 pylint 2018-02-06 19:02:53 -05:00
Cole Robinson b8e2952a9c connect: Fix urllib usage on py3 2018-02-06 18:56:15 -05:00
Cole Robinson 3086c7fda9 Drop python3 compat imports
We are going completely python3
2018-02-06 18:56:15 -05:00
Radostin Stoyanov 4d9c6141dd Convert the output of range() to list
In Python 2 the range() function returns a list [1].
In Python 3 the range function returns a range type [2] which
represents an immutable sequence of numbers [3].

[1] https://docs.python.org/2.7/library/functions.html#range
[2] https://docs.python.org/3/library/functions.html#func-range
[3] https://docs.python.org/3/library/stdtypes.html#typesseq-range
2018-02-06 18:49:17 -05:00
Radostin Stoyanov 5854b7bb17 Replace "Queue" with "queue"
The Queue module has been renamed to queue in Python 3. [1]

[1] https://docs.python.org/2/library/queue.html
2018-02-06 18:49:17 -05:00
Radostin Stoyanov 95c695d774 Convert long to int
- Python 2 only
k = 9223372036854775808L

- Python 2 and 3:
k = 9223372036854775808

See http://python-future.org/compatible_idioms.html#long-integers
2018-02-06 18:49:17 -05:00
Radostin Stoyanov 5553cbeb38 Replace ipaddr module with ipaddress
The `ipaddress` is available in Python 3.3+ [1] and backport for
Python 2 is available on PyPI [2].

The main differences between ipaddr and ipaddress are:

- ipaddress *Network classes are equivalent to the ipaddr *Network
  class counterparts with the strict flag set to True.
- ipaddress *Interface classes are equivalent to the ipaddr *Network
  class counterparts with the strict flag set to False.
- The factory functions in ipaddress were renamed to disambiguate them
  from classes.
- A few attributes were renamed to disambiguate their purpose as well.
  (eg. network -> network_address, numhosts -> num_addresses)
- A number of methods and functions which returned containers in ipaddr
  now return iterators. This includes subnets, address_exclude,
  summarize_address_range and collapse_address_list.

Another major difference is that in Python 2 the `ipaddress` module
must use unicode. [3]

[1] https://www.python.org/dev/peps/pep-3144/
[2] https://pypi.python.org/pypi/ipaddress
[3] https://github.com/phihag/ipaddress
2018-02-06 18:49:17 -05:00
Radostin Stoyanov 978fb25ac7 Wrap keys(), values() in a list
In Python 3 dict.values() [1] , dict.keys() [2] and dict.items() [3]
return a view [4] of the dictionary’s values, keys and items.

In Python 2 these functions return a list. [5] [6] [7]

To resolve this we can convert the result of these function to a list.

[1] https://docs.python.org/3/library/stdtypes.html#dict.values
[2] https://docs.python.org/3/library/stdtypes.html#dict.keys
[3] https://docs.python.org/3/library/stdtypes.html#dict.items
[4] https://docs.python.org/3/library/stdtypes.html#dict-views
[5] https://docs.python.org/2/library/stdtypes.html#dict.items
[6] https://docs.python.org/2/library/stdtypes.html#dict.keys
[7] https://docs.python.org/2/library/stdtypes.html#dict.values
2018-02-06 18:49:17 -05:00
Cole Robinson 2fc2eed938 Drop more cmp() usage for python3 2018-01-27 16:27:41 -05:00
Cole Robinson ec8ee78d18 addhardware: Only add virtio-scsi if no other scsi controllers present 2018-01-27 16:07:26 -05:00
Radostin Stoyanov 6712261510 Python 2/3 division compatability
In Python 2 the classic devision of integers returns an integer
but in Python 3 it might return float.

Example:
- Python 2:          - Python 3:
    >>> 9 / 4            >>> 9 / 4
    2                    2.25
    >>> 9 // 4           >>> 9 // 4
    2                    2
    >>> 9 / 4.0          >>> 9 / 4.0
    2.25                 2.25
    >>> 9 // 4.0         >>> 9 // 4.0
    2.0                  2.0

For more info see: https://www.python.org/dev/peps/pep-0238/
2018-01-27 15:30:17 -05:00
Cole Robinson a10fda6b5c uitests: console: Add live lxc serial test 2018-01-21 14:42:44 -05:00
Cole Robinson d774d01e1c uitests: Add live console tests
Using transient VMs connecting to real qemu:///system. uitests are
already system invasive so I think this is okay
2018-01-21 14:42:44 -05:00
Cole Robinson 94e4e8bf5a details: Tweak sound hwlist entry to be consistent with others
Dropping the colon
2018-01-21 14:42:44 -05:00
Cole Robinson 3ccb947ce3 uitests: Add choosecd dialog tests 2018-01-21 10:02:08 -05:00
Cole Robinson e4c6c64653 addhardware: Don't allow adding floppy controller
It's either built in, or not available
2018-01-21 10:02:08 -05:00
Cole Robinson dc3c0b29f7 uitests: addhardware storage/disk testing 2018-01-21 10:02:08 -05:00
Cole Robinson c620e7405c uitests: addhardware: add network tests 2018-01-21 10:02:08 -05:00
Cole Robinson 2f12823cb5 snapshots: Maintain selection after refresh 2018-01-18 16:55:57 -05:00
Pavel Hrdina 0e812e3c42 vnc: don't skip authentication for listen type none with fixed QEMU
This was fixed by commit <fa03cb7fd21> in QEMU.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-01-16 09:42:11 +01:00
Cole Robinson d8d71bddfb ui: Add createnet/pool/vol/interface tests 2018-01-11 21:02:34 -05:00
Cole Robinson 8716fd92af ui: connect: Add 'Custom URI' option
Proper UI option to just enter your own URI
2018-01-09 17:58:55 -05:00
Cole Robinson 08049bfb0b manager: Add accessible names to conn context menu
Needed to differentiate identical menu items in the ui test suite
2018-01-09 17:58:55 -05:00
Cole Robinson dc344fc8ee error: Add accessible strings for error dialogs
Makes UI testing easier
2018-01-09 17:58:55 -05:00
Cole Robinson 950e8803bc config: Explain and simplify our gsettings wrapper a bit 2018-01-09 17:41:20 -05:00
Cole Robinson 61158d3bce config: Use memory backend with --test-first-run
Meaning we start with a blank slate of gsettings data, and never
save anything to disk.
2018-01-09 17:41:20 -05:00
Cole Robinson b4a2c46f6a virt-manager: If --connect passed, wait for it to init
...before showing the UI. This helps the UI test suite be less
racy at least.
2018-01-09 13:51:53 -05:00
Cole Robinson ab1b4f8628 virt-manager: Gracefully exit app on ctrl-c, not sys.exit
Will be needed for uitests coverage support
2018-01-09 09:57:20 -05:00
Cédric Bosdonnat 50fd011153 oscontainer: ask root password in the wizard
When creating a new root file system out of an downloaded image,
the root password is likely to be changed. Add a field for this
in the new guest wizard.
2018-01-06 17:21:35 -05:00
Lin Ma c4c78d2894 details: Show attached disk information in scsi controller page
It helps users to recognize controllers <-> disks mapping relationship.

Signed-off-by: Lin Ma <lma@suse.com>
2018-01-06 16:40:30 -05:00
Lin Ma 12c5945be0 details: Disallow removing the scsi controller if disks attached to it
Through virt-manager, After we removed a virtio-scsi controller which
virtual disks still attach to it, Libvirt will add a LSI scsi controller
for this guest automatically and trigger a lifecycle event, virt-manager
updates and shows this new scsi controller in details panel once it got
the lifecycle event.

It may confuse user that a LSI scsi controller occurs while one removes
the virtio-scsi controller.

This patch prevents removing a scsi controller if any disks attaching to
it.

Signed-off-by: Lin Ma <lma@suse.com>
2018-01-06 16:40:30 -05:00
Lin Ma 066b91b2a0 ui: details: Add ui for showing attached controller devices in the future
Signed-off-by: Lin Ma <lma@suse.com>
2018-01-06 16:40:30 -05:00
Lin Ma 2c06086495 details: Rename the variable 'dev' to 'controller' in refresh_controller_page
Use the more appropriate name for more correctly identifies controllers.

Signed-off-by: Lin Ma <lma@suse.com>
2018-01-06 16:01:54 -05:00
Chen Hanxiao 3e3ffe1e2d pylint: remove a unnecessary pass
pylint complains:
  Unnecessary pass statement (unnecessary-pass)

Reviewed-by: Pavel Hrdina <phrdina.redhat.com>
Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-12-22 21:48:35 +08:00
Cédric Bosdonnat 0c6bcb0917 python3: fix bytes/string mess in serial console
Add a few encode() and decode() to convert between libvirt stream
functions expecting bytes arrays and Vte callbacks providing strings.
2017-12-20 16:09:35 -05:00
Cole Robinson b5b2433ad5 baseclass: Fix UI file loading on py3
We were passing in a unicode string object, but add_from_string
depends on knowing binary length. This caused signals to not
be registered which broke reopening the details window

Just switch to add_from_file to sidestep the issue
2017-12-20 16:04:36 -05:00
Cole Robinson c174b5509f connection: Another py3 exception variable fix 2017-12-20 14:16:13 -05:00
Cédric Bosdonnat 60968fa259 py3: store exception variables for use outside except
In python3 exceptions aren't defined outside the except block. Leading
to 'UnboundLocalError: local variable 'e' referenced before assignment'
errors.

To work around this, store the local variable into one that will have a
longer life.
2017-12-20 14:13:27 -05:00
Lin Ma 08b2b808bd addhardware: Remove IDE from list while adding controllers
Libvirt only supports built-in IDE controller so far, There is no
any case that needs us manually add an IDE controller, So remove
it from the controller list.

Signed-off-by: Lin Ma <lma@suse.com>
2017-12-20 13:15:46 -05:00
Cole Robinson bd1c6e55ad gfxdetails: Select rendernode by default when user requests gl=on
Since it's required for qemu:///system to work
2017-11-25 17:28:57 -05:00
Cole Robinson 29a5e7a230 details: Remove q35 support warning (bz #1443021)
It's been around long enough and in use long enough that this
isn't required anymore
2017-11-25 15:15:08 -05:00
Pavel Hrdina b9bc3b605a delete: undefine only persistent domain
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1517119

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-11-24 17:39:58 +01:00
Lin Ma 2eb455c97f addhardware: Correctly calculate virtio-scsi controller index
Because sata, usb and scsi use same device prefix: sd*, They will be
included into occupied list while we add virtio-scsi disks, This is
wrong and may cause adding additional virtio-scsi controller.

How to reproduce:
1. fresh install a qemu guest.
2. add 6 virtual USB disks.
3. add disk A on scsi bus.
   (then a virtio-scsi controller 0 will be added automatically)
4. add disk B on scsi bus.
5. observe.

Expected:
disk A and disk B  should be connected to virtio-scsi controller 0 because
controller 0 has enough available slots.

Actual:
disk A was connected to virtio-scsi controller 0.
An additional virtio-scsi controller 1 was added and disk B was connected
to it because virt-manager thought the virtio-scsi controller 0 doesn't
have available slot.

Signed-off-by: Lin Ma <lma@suse.com>
2017-11-22 16:50:33 -05:00
Cole Robinson 7fc7e94f21 addhardware: Fix virtio-scsi controller target calculation
More details here: https://www.redhat.com/archives/virt-tools-list/2017-November/msg00014.html

Reported-by: Lin Ma <lma@suse.com>
2017-11-22 16:50:33 -05:00
Lin Ma 2e85ad5675 details: Show controller description + index
This patch and future patches can help users to better recognize which
disks connect to which scsi controllers.

Signed-off-by: Lin Ma <lma@suse.com>
2017-11-21 17:18:56 -05:00
Radostin Stoyanov 73de828524 systray: Remove redundant variable assignment
The explicit assignment of "name" is unnecessary.
2017-10-27 10:10:08 +02:00
Cole Robinson 3be78d1f3f addhardware: Don't allow panic option where it isn't supported
Like aarch64, basically any arch that doesn't have an explicit panic
model
2017-10-27 09:47:38 +02:00
Cole Robinson d82022bd2c manager: Drop python2 only cmp() usage
Manually implement it
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
Radostin Stoyanov f41aafc721 Use enumerate instead of range and len 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 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 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
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
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
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
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
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
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
Cole Robinson 901dbaf4b7 details: Fix displaying isa panic device 2017-09-15 19:36:58 -04: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
Pavel Hrdina 12117ba148 connection: change blacklist from array to dict
If initialization of new object fails we put it into blacklist and
newer parse it again until virt-manager is restarted.  This helps to
reduce number of failures if some object fails initialization every
time.

However, there are some cases where we put object into blacklist
incorrectly.  One of the cases is while creating new storage pool.
If the storage pool requires to be build before started but user
doesn't check to build it as well the start of the new storage pool
fails.  The issue is that at first we define that object which triggers
a lifecycle event for storage pool and queues new poll operation over
storage pools.  Before the poll operation starts the starting of the
storage pools fails and we undefine that storage pool before it is
initialized.  The initialization fails and the storage pool is never
managed from that point.

This patch modifies the blacklist to allow 3 failures before we give up
on a specific object and if the object is initialized without error
we remove it from blacklist completely.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:12:12 +02:00
Pavel Hrdina f1976155cd sshtunnels: use <listen> element to get UNIX socket for graphics
Graphics devices has a new XML element to configure UNIX socket path:

  <graphics type='vnc' socket='/path/to/socket'>
    <listen type='socket' socket='/path/to/socket'/>
  </graphics>

  <graphics type='spice'>
    <listen type='socket' socket='/path/to/socket'/>
  </graphics>

and as you can see SPICE uses only the new XML element.  For VNC the
old 'socket' attribute is for backward compatibility.

In order to connect to SPICE graphics on remote host using SSH tunnel
we need to get the UNIX socket path from <listen> element.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:11:42 +02:00
Pavel Hrdina f14b1f88a0 domain: only the first device from each group is bootable
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1488480

This also fixes an issue with floppy not showing at all, the proper
boot.dev name is 'fd' but we were looking for 'floppy'.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:11:04 +02:00
Pavel Hrdina abcff9e230 domain: use migrateToURI3() for tunneled migration
The migrate3() API doesn't support tunneled migration.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:10:39 +02:00
Pavel Hrdina 5d0296d438 domain: use correct name for variables in migration code
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:10:39 +02:00
Pavel Hrdina 9f191da5c5 devicepanic: add all models supported by libvirt
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:09:46 +02:00
Pavel Hrdina 36230c9a18 devicepanic: use model instead of address.type
There are multiple models of the panic device, the address type is only
one and is valid only for "isa" model.

To not break the virt-install/virt-xml the command line parser needs to
be updated.  Before this patch there was only one parameter that
configured the "iobase".  Now the first parameter configures a model
but to keep it backward compatible it follows these rules:

1. there is only one parameter and it matches known model:

  --panic isa

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

2. there is only one parameter and it doesn't match any model:

  --panic 0x505

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

3. there are two parameters:

  --panic isa,iobase=0x505

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:09:46 +02:00
Pavel Hrdina 9655f7dfaf virtManager: remove panic iobase from GUI
This is advanced configuration and it's not required to configure
at all to have a working panic device.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:09:46 +02:00
Chen Hanxiao b44aa0e3bb pycodestyle: fix all E131 warnings
Fix all E131:
     Continuation line unaligned for hanging indent

   Also remove ignore options of E131

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-08-26 20:03:21 +08:00
Christian Ehrhardt e76b904656 engine: improve message about missing binaries
The message when failing to connect can be misleading as package names
will differ per Distribution as well as not apply for e.g. self built
binaries.
This changes the message in a way to be more generic not implying literal
package names.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2017-08-16 17:32:18 -04:00
Chen Hanxiao c92aade081 pycodestyle: fix all E203 warnings
Fix all E203 whitespace before ':'
   Also remove E203 ignore option of pycodestyle

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-08-11 00:01:38 +08:00
Cole Robinson cf522bfc0c engine: Remove manual line wrapping of connect error messages
This was needed once upon a time when the UI was wrong, but it
wraps correctly now
2017-08-07 18:17:00 -04:00
Cole Robinson 9e7426b64f engine: Drop offer to install askpass package (bz 1354304)
Dealing with packagekit across desktops and in a consistent
manner is a pain. This code path is rarely exercised and difficult
to test, so just fallback to giving a hint error message and
let the user install if they care.
2017-08-07 17:41:52 -04:00
Cole Robinson cc72f74f97 packageutils: Ensure packages argument is a list
It's easy to screw this up from the callers, and gives weird
interactions with apper
2017-08-07 17:27:30 -04:00
Cole Robinson 4cdae27cb2 engine: With --test-first-run, don't try default URI detection
default URI detection gets testing via the 'connect' dialog, this
makes it easier to test the fallback when no packages are locally
present
2017-08-07 17:27:30 -04:00
Cole Robinson 08a7eaed4d config: If --test-first-run, fill in some default package names
Simplifies testing the feature from git
2017-08-07 17:25:55 -04:00
Radostin Stoyanov b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Radostin Stoyanov 00ffb3340e Remove unintentionally added '+' 2017-08-02 13:15:27 -04:00
Radostin Stoyanov 89e5783cad create: Auto-generate fs path if not provided
Use default place to store file systems of bootstraped containers.

If the current user has effective UID 0 use:
    /var/lib/libvirt/filesystems/<container-name>

otherwise use:
    ~/.local/share/libvirt/filesystems/<container-name>
2017-08-02 13:13:57 -04:00
Radostin Stoyanov c5264a2390 create: Stop if virt-bootstrap has failed
Prevent container creation if virt-bootstrap has not finished
successfully.
2017-08-02 13:13:17 -04:00
Cole Robinson a9903ae0e0 connection: Remove clear_cache callback
It doesn't actually accomplish what we want for the virt-manager case,
and cache_new_pool should cover our needs now
2017-07-20 17:30:37 -04:00
Cole Robinson 4792c7cb8e connection: Add a default impl of cache_new_pool
Inserts it into the cache, and adds its associated volumes too
2017-07-20 17:30:36 -04:00