When cloning a guest in virt-manager the GUI shows a list of disks and
select default cloning policy for every disk. For storage pools where
we know that cloning is not possible we should not select that option
as default one.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1463066
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This fixes virt-xml to return an XML for command:
virt-xml --build-xml --boot os_type=hvm
The VirtCLIParser.parse() expects the _parse() method to return
the parsed object.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Apart from the fact, that 'virtio' is not a valid scsi controller model
the 'has_virtio_scsi' variable is not needed at all. It is used only
in one condition where both 'has_any_scsi' and 'has_virtio_scsi' has to
be false which can happen only if there is no 'scsi' controller defined
by user.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Instead of duplicating the code into CLI and GUI move it into graphics
device file which is used from both places. This also fixes a bug in
virt-xml where changing listen to address was not working.
This also changes behavior to always configure one listen type when
using CLI listen option or GUI. If user wants to modify only specific
listen type they can use listens[] options from CLI.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1565968
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
If a distribution has no EOL date set, always consider it supported if
its release status is "rolling".
(crobinso: reformat a bit, appease pylint)
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
As os-variant has a new "install" parameter that can be passed, let's
take advantage of it and automatically fill options.location with data
from osinfo-db whenever install=location is passed (and, of course,
osinfo-db has the information).
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
The new "install" parameter receives "location|cdrom" and will be used,
at least for now, to automatically get the URL location of an OS from
osinfo-db.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
get_location() is a new method that returns the osinfo-db tree URL of an
OS, according to the passed architecture.
This method will need some improvement later on once we start having a
specific set of definitions on osinfo-db about what's the type of the OS
we're dealing with (like Server, Desktop, ...).
For now, the new method returns the first URL found without taking into
the consideration the types speficied above.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Commit 45ab922b2c moved the code to the way it was before the libosinfo
default changes. However, by not setting "options.disk" the parser will
error out and bail the installation as this option must be set. Only
parsing the disk doesn't seem to be enough as the check is actually done
against "options.disk".
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
A `KeyError` indicates that the `boot_order` input was
invalid. Therefore we shouldn't ignore this error silently.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Don't exclude redirected devices since they're also bootable. They
won't clutter the UI of virt-manager as we're excluding them
explicitly for the UI in the `get_bootable_devices` method defined in
virtManager/domain.py.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Move set boot order responsibility to guest XML builder.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Add 'get_boot_order' method. This method has an optional parameter for
getting the legacy boot order defined in the OS node of the domain
definition.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Move get boot order methods to guest XML builder. For this we must
replace self.get_bootable_devices() with
self.get_bootable_devices(exclude_redirdev=True) in the
_get_device_boot_order and set_device_boot_order to have no
functionality change.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Move use_device_boot_order to guest XML builder and rename it into
'set_device_boot_order'.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Operate only on @boot_order and @guest and not on @self. This allows
us to refactor this functionality in the next patch. Additionally,
simplify the used algorithm without functionality change.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Try to avoid self access since this function operates on the guest
definition only. This is needed for later refactoring as it will
reduce side-effects.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Add a method to the Guest XMLBuilder for getting all bootable devices
of the guest definition with the option to exclude the redirdevs in
the returned list.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Move (find_compare)_device functions to guest.py as it will be used
there in an upcoming patch.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
This could break some command line invocations, but there's no
guarantee libosinfo might not add capitalized IDs in the future,
and there's an easy workaround to just lowercase the passed value
So we validate the CDROM disk contents too. This revealed we were
using a cdrom path in the test driver that was assigned as a
writeable disk to another test VM, which is a correct warning, so
fix the fallout, and ensure that we don't warn when colliding with
another cdrom device
This is how it was before the libosinfo defaults changes. In general
this pattern is more sensible: we serialize all the Guest data, then
create the installer which acts on a Guest, then fill in any missing
config with libosinfo bits.
We need to manually parse a disk option string now which is a bit funky
There's two cases: for an explicitly requested --os-variant, we
want to set it ASAP, since more things will depend on it in the
future, like grabbing install media from libosinfo. For the
'auto' case, we need to wait until the installer is setup.
guess_os_from_media() has been deprecated for a while and
identify_media() should be used instead.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
The Python binding of libguestfs errors out in case any of the details
(e.g. summary, description) of an application are not proper UTF-8.
This seems a rare situation, which nevertheless causes the failure of
the inspection of a guest, making the rest of the metadata not used.
While these encoding issues are tackled, and fixed in python-libguestfs
(or libguestfs itself), gracefully handle the failure of
inspect_list_applications(), so at least the rest of the details of a
guest are used/shown.
When a VM is using interface type=network with a forward mode=bridge
network, on qemu domain startup the runtime XML will be changed to
type=bridge and both source/@bridge and source/@network will be filled
in, which breaks some assumptions virt-manager had internally.
Unfortunately this isn't easy to test with the unittest driver either.
https://bugzilla.redhat.com/show_bug.cgi?id=1669265
The convenient 'source' abstraction is not sufficient in all cases,
like is using type=network with a forward mode=bridge network: on
startup, the qemu driver will change the runtime XML to type=bridge
but still list a source network= and bridge= value.