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
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
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.
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
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
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.
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
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.
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.
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
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>
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>
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
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()
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
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.
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>
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
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>