Commit Graph

1937 Commits

Author SHA1 Message Date
Cole Robinson
e48ce4a31e delete: Default to not removing storage for disk removal
This is the old default we've always used, so better to stick with it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:39:14 -05:00
Cole Robinson
03a6272f81 delete: Code cleanups
* Comment the individual classes
* Move abstract methods to their own logical section
* Simplify some shared code calls

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:39:14 -05:00
Cole Robinson
1a9e2f4f76 delete: Don't run UI routines from a thread
Pull the remove_devobj_internal call outside of the async job,
otherwise we can have X11 threading issues

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:39:14 -05:00
Lily Nie
3ab35320a1 Use remove_devobj_internal function instead of vm.remove_device
remove_devobj_internal function handles more things than vm.remove_device.
We should call it first before performing the storage deletion.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:39:14 -05:00
Lily Nie
1e36ce05e3 Change remove_devobj_internal to a static method,and move it to vmmDeleteStorage
So that the callback doesn't need to be passed into the init function,
and vmmDetails can call that function directly

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:39:14 -05:00
Lily Nie
af59cd9825 details: remove all usage of 'self' in remove_devobj_internal function
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:39:14 -05:00
Lily Nie
71befc0f5d details: add a remove_devobj_internal function
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:39:14 -05:00
Cole Robinson
6f95ebc7fd devices: controller: Add get_attached_devices
Move the opencoded impl out of virt-manager details.py and into
virtinst, since this is entirely about XML comparison. Add tests for
it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson
eb5e087366 tests: Add full coverage for pollhelpers and VirtinstConnection
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
8fe0a208db Move virt-* code into their modules
This layout is closer to what most python modules have nowadays.
It also simplifies testing and static analysis setup.

Keep virt-* wrappers locally, for ease of running these commands
from a git checkout.

Adjust the wrapper binaries we install on via packaging to be
pure python, which makes things like running gdb easier.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 18:27:20 -05:00
Cole Robinson
3538a8df79 details: Fix perf icon with adwaita-icon-theme
We need to fallback to a more generic value if the
preferred icon is not around

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 15:41:21 -05:00
Cole Robinson
1002128c7b oslist: Only handle 'activate' if the oslist is visible
Otherwise when we press enter for an already selected OS, it chooses
the first alphabetic entry in the list, overwriting our selection

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
c6e85295e8 createvm: Grab OS list focus for manual install page
Since the page requires input and can't progress until the user enters
some value here, grab focus for the OS list

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
ba24d877bf createvm: Remove 'Network boot (PXE)', add 'Manual install'
For the dialog flow, these options are the same, the only effect
is that there's no longer an initial network boot phase.

PXE is dependent on an external server setup that is not common
in the scheme of things, so giving it a first class option on the
front of the new VM wizard isn't really sensible. Users that want
to PXE boot can easily do so via the 'customize before install'
option, or just manually create a VM and edit the boot device as
they see fit.

Explicitly advertising a Manual option is nicer for users that
just want to create a VM and deal with install later, among many
other minor use cases.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
f073ad6fb6 createvm: Remove kernel/initrd/dtb/kernel args UI
Add an info message that these can be set via the
'Customize before install' option. Duplicating this doesn't add a ton
of value here IMO

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
0bf65e6ce8 preferences: Remove old Interface confirm option
This hasn't been relevant since that UI was removed

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
d410773af8 virtManager: Remove virInterface polling
There are no more users of interface objects in the code. Remove
all the polling support, and all the remaining references to
interface objects throughout the code base

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
212c5f813d createnet: Add field for specifying forward device
And drop the explicit forward device listing. Similar to what
we did with bridge/macvtap domain <interface>

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
c92c454fde virtManager: Drop interface list for bridge and macvtap
Some related bits were discussed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

macvtap is problematic for inexperienced users so we shouldn't
be broadly advertising it, plus our device listing was incomplete
anyways.

Both bridge and macvtap device listing are largely dependent on
the libvirt virInterface APIs, which have varying degrees of
completeness across distros and are not particularly reliable to
begin with.

Drop both of these in favor of the available support for manually
specifying a device name

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
8ed9eef905 netlist: Use same default policy as virt-install
virt-manager's logic is hard to follow, and gives weird results
by just choosing the first bridge device it finds more or less.

Use virt-install's logic: bridge if it is the default route,
otherwise network 'default' if it exists

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
66e1eb7324 netlist: Add 'Macvtap device...' manual entry
Similar to the bridge option. We will be removing the explicit
device listing support soon, so this will be required for specifying
a macvtap device

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
00da972b14 netlist: Rename 'Specify shared device' to 'Bridge device...'
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
227d6982ae virtManager: Drop macvtap 'source mode' UI
Some related bits were discussed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

"""
  * macvtap is kinda problematic in general because it doesn't provide
    out of the box host<->guest communication, and it requires a
    special XML option just to get working ipv6. Users that know they
    want it usually know this distinction, but if someone chooses it
    without understanding the implications it can cause confusion.
    This puts it hovering the intermediate/advanced user line which
    makes me want to not advertise it as prominently as we currently do,
    with an explicit list of host interfaces
"""

Part of this is that the only source_mode that will work in a useful
way for the vast majority of users is mode=bridge. Any of the other
modes either require special hardware, permissions, or other
configuration. Default to bridge mode. The XML editor is there for
anyone that knows they need something different

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
4c3c53f773 virtManager: Remove network portgroup UI
portgroups are a way to group logical chunks of settings inside
a <network> object. They are a quite advanced feature that I expect
many few users are using, and the ones that are using it are certainly
advanced enough to edit the XML directly.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
8263d5c705 netlist: Reorganize row building a bit
This should be a no-op.

* Remove unused is_active field
* Access row indexes with named fields
* Move the row building outside the main class, to make it clear
    these are just helper methods

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
a18117ae30 createvm: Remove the PXE install network warning
This is pretty obscure, and PXE installs will likely be reworked
in the near future. Drop it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:34 -05:00
Cole Robinson
4fce7dde9a virtManager: Remove LXC idmap UI
This is pretty obscure, and requires a large amount of UI surface
to handle correctly. Users can use the XML editor if they know they
need or want this.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:32 -05:00
Cole Robinson
137b73df75 virtManager: Only allow editing disk bus for new VM
This was proposed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

"""
* disk: bus editing: maybe keep this for the customize wizard, but
it should go away for existing disks, changing it for an existing VM is
definitely a 'shoot yourself in the foot' type of thing for most users
"""

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:39:18 -05:00
Cole Robinson
7547905d79 virtManager: Remove max memory UI and memory hotplug support
This was proposed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

"""
* UI maxmem and maxcpu notions, and related memballoon and cpu hotplug
operations. These have been in the UI forever but I'm not sure people
actually use them. cpu hotplug has always been a mess, and unless the
user plans ahead by setting a high maxmem value ballooning is only good
for reducing memory. These all sound like advanced usage to me that
just confuses the typical usecase of adding more mem or vcpus to an
offline VM. And the hotplug operations with virsh are simple to invoke.
So I'd like to drop this from the UI
"""

The remaining field sets both max and current memory in the
inactive XML

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:24:22 -05:00
Cole Robinson
0335c9ce62 virtManager: Remove maximum VCPUS API and VCPU hotplug
This was proposed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

"""
* UI maxmem and maxcpu notions, and related memballoon and cpu hotplug
operations. These have been in the UI forever but I'm not sure people
actually use them. cpu hotplug has always been a mess, and unless the
user plans ahead by setting a high maxmem value ballooning is only good
for reducing memory. These all sound like advanced usage to me that
just confuses the typical usecase of adding more mem or vcpus to an
offline VM. And the hotplug operations with virsh are simple to invoke.
So I'd like to drop this from the UI
"""

The remaining UI field now sets both maximum and current VCPU
allocation.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:24:20 -05:00
Cole Robinson
b4b497e28f virtManager: Remove network virtualport UI
This was proposed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

"""
* network virtualport configuration: this is some really obscure
stuff for configuring VEPA for macvtap devices. I don't think it gets
any usage in practice. I think a smaller subset of this UI is shared
with openswitch config but I believe it's just a single field, we
could keep that even though I don't think many people use it either
"""

This removes it all. The openvswitch piece was not properly wired
up anyways, since it requires setting virtualport type for a bridge.
For users that know they need that, they can add it via the XML
editor.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:22:18 -05:00
Cole Robinson
3c861131dd virtManager: error: Break long lines in error dialogs
Errors from libvirt can be super long, and stretch out the dialog like
crazy.

This causes some changes in test suite output, so adjust tests to
match

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:21:59 -05:00
Cole Robinson
a162a3b845 virtManager: Remove disk driver_io UI
This was proposed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

The default driver_io value we use seems to be sufficient. It's very
rare to hear that users need to change the value to something
different, and if they do, they are advanced enough users that can
edit the XML directly IMO.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-25 14:30:07 -05:00
Cole Robinson
2367e70efa virtManager: Remove magic spapr-* device handling
We have lots of spapr-* pretty printing and some magic handling
spread around the codebase. These devices have fallen out of favor
and are rarely used, so drop the special handling

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-25 14:30:07 -05:00
Cole Robinson
b583ea7e66 virtManager: Remove disk SCSI reservations UI
This is another advanced feature with a limited appeal. Users that
know they need this can set it directly with the XML editor

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-25 14:30:07 -05:00
Cole Robinson
d9c0384607 virtManager: Remove disk SGIO UI
This is a very advanced field that is only shown for a quite
advanced disk device='lun' config. Users that know they need this
can easily set the value via the XML editor

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-25 14:30:07 -05:00
Cole Robinson
79fe886ac8 virtManager: Remove disk format/driver_type UI
This was proposed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

"""
* disk: storage format: this was from before the days when we
storage-ified everything and we could get the disk format wrong, telling
qemu it has a raw image when it's qcow2. shouldn't be needed anymore for
normal virt usage
"""

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-25 14:30:07 -05:00
Cole Robinson
1066867583 virtManager: Remove disk serial UI
This was proposed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

"""
* disk: serial: I know this is useful in some cases but seems quite
obscure. I think the XML editor is fine unless there's some common
usecase I'm missing
"""

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-25 13:45:43 -05:00
Cole Robinson
bd82ef6529 virtManager: Remove spice tlsport UI
This was discussed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

tlsPort is an advanced config feature. With the XML editing support,
it's less important to have this as a first class UI element. Users
that know they need this setting can set it directly in the XML

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:29 -05:00
Cole Robinson
7251ea25c2 virtManager: Remove graphics keymap UI
Removing this was discussed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

For a decade, qemu and xen and virt-manager work together to
make setting a manual keymap redundant. Advertising it in the UI does
more harm than good, because users may think they need to specify
one when in the vast majority of cases it will give worse behavior.

With the XML editing UI, users still have a way to do this by hand
if they really know what they are doing.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:29 -05:00
Cole Robinson
419f8cd31b pollhelpers: Streamline usage a bit
* Explicitly define the build 'cb', don't use lambda
* Rename pollhelpers arguments, clarifying use of cb
* Check support status in pollhelpers
* Move 'dopoll' checking up a level in vmmConnection

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:29 -05:00
Cole Robinson
4147f760e8 connection: Explicitly error if domain listing APIs are not supported
This will be more important when we drop old domain polling APIs,
because it will be more likely we encounter an old libvirt or weird
connection without the expected API support

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 15:39:41 -05:00
Cole Robinson
1aff5a611e connection: Remove is_*_capable wrappers
Call the conn.support check directly. Move the check logging to
the initial startup path

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 15:39:41 -05:00
Lily Nie
b2a424baa6 delete: remove redundant code
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 10:27:15 -05:00
Lily Nie
3c6a5f4536 delete: Add _destroy_vm method
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-21 19:53:53 -05:00
Lily Nie
928c049c9d delete: Add _delete_disks method
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-21 19:53:53 -05:00
Lily Nie
52782a4958 delete: Add _delete_vm method
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-21 19:53:53 -05:00
Lily Nie
8ae0c8ca0e delete: Add _vm_active_status method
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-21 19:53:53 -05:00
Lily Nie
92200ef413 delete: Add _get_title_text method
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-21 19:53:53 -05:00
Lily Nie
1ae83cbb82 delete: Add _get_disk_datas method
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-21 19:53:53 -05:00
Lily Nie
4971e47566 delete: Add vmmDeleteStorage class
We should try to hide all the self.vm vs self.disk differences into
individual functions to make the code easier to follow and to avoid
touch those values by accident in the future

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-01-21 19:53:53 -05:00
Cole Robinson
9346c22134 baseclass: Log if emit() called from non-MainThread
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-15 15:19:55 -05:00
Lin Ma
15a9502b7b details: Fix showing the firmware type in case of firmware auto selection
For a shutoff VM, If user select uefi firmware auto selection, e.g.
<os firmware='efi'>
...
</os>

Its firmware information is set to 'BIOS' in details, This is incorrect.
This fixes it.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Lin Ma <lma@suse.com>
2020-01-15 10:21:46 -05:00
Cole Robinson
af3d678bdd domain: Only log once about waiting for qemu agent for set_time
Rather than one every wait period, which spams the debug logs

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-14 14:21:30 -05:00
Michael Weiser
b7a223030b virtManager: object: domain: Stop set time thread
Wire up stoppping of the time setting thread for actions that make
setting of guest time pointless.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-01-14 14:10:28 -05:00
Michael Weiser
f29196f3af virtManager: object: domain: Increase set time timeout
With the potential for annoyance eliminated, raise the timeout for guest
agent connectivity to 30 seconds.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-01-14 14:10:28 -05:00
Michael Weiser
9aa5997dd7 virtManager: object: domain: Add timeout config
Make the guest agent wait timeout and sleep interval properties of the
thread manager class better visibility and easier adjustment.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-01-14 14:10:28 -05:00
Michael Weiser
bfafe1e4b2 virtManager: object: domain: Spawn thread for set time
Sleeping in a loop waiting for the qemu guest agent to come online would
leave an annoying progress dialog while the domain would actually be
fully useable already. Additionally, multiple progress dialogs could
actually accumulate on screen if the user managed to suspend/resume fast
enough or the timeout was just long enough.

Defer regular retries into a separate thread to allow the progress
dialog to disappear immediately after the actual action completed. The
thread is encapsulated in a new class _vmmDomainSetTimeThread which
holds state, decides whether to at all wait for an agent to come online
or even try to set the guest time in the first place. It also holds
state (thread running or not), configuration (timeout and retry
interval) and provides an interface to start and stop the time setting
operation.

A later patch will wire up stopping the operation.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Suggested-by: Cole Robinson <crobinso@redhat.com>
2020-01-14 14:10:28 -05:00
Michael Weiser
4f8a27688d virtManager: object: domain: Refactor guest time setting
Sleeping in a loop waiting for the qemu guest agent to come online
leaves an annoying progress dialog while the domain may actually be
fully useable already. Additionally, multiple progress dialogs can
actually accumulate on screen if the user manages to suspend/resume fast
enough or the timeout is just long enough.

To avoid these, we want to defer retries into a separate thread to allow
the progress dialog to disappear immediately after the actual action
completed.

In preparation for that, add a new class _vmmDomainSetTimeThread that
will eventually manage that separate thread for guest time setting
operations. Move the current code for waiting for the qemu guest agent
into it without any semantic changes.

Make set_time() and agent_read() of vmmDomain accessible from the
outside so that _vmmDomainSetTimeThread can call back into them. Add
has_agent() to be able to find out if the domain has an agent configured
without leaking the actual agent config.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Suggested-by: Cole Robinson <crobinso@redhat.com>
2020-01-14 14:10:28 -05:00
Michael Weiser
827c948121 virtManager: object: domain: Simplify agent ready check
Just return the boolean value of the condition for simlicity.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-01-14 14:10:28 -05:00
Cole Robinson
a9cbc4e583 error: Set a cap on error dialog text size
Otherwise we can get some crazy sized dialogs with errors from
libvirt

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-14 12:40:39 -05:00
Pino Toscano
b1b9e4b688 Avoid string puzzle
Do not join two parts of sentences together, because it is problematic
to translate. Instead, use a different sentence depending on the
condition.

Fixes commit d52c9d1ffa.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-01-14 12:40:25 -05:00
Lily Nie
2138cca6a5 Handle the warning messages for disk device and non-disk device differently
add a remove-non-disk function and move the yes/no confirmation handling there

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-12-23 16:43:05 -05:00
Michael Weiser
d62ca8220b details: snapshots: Warn of saved state on creation
Add a confirmation dialog when creating a new snapshot if there is saved
memory state so the user is aware that memory state will not be part of
the snapshot.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Suggested-by: Cole Robinson <crobinso@redhat.com>
2019-12-23 16:27:52 -05:00
Michael Weiser
a8c25450bd details: snapshots: Drop saved state on restore
Refuse to restore a non-running state from snapshot while there is saved
memory state in order to avoid filesystem corruption. Present a message
to the user to that effect and let them choose to either abort the
operation or drop the saved state before restoring the snapshot.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Suggested-by: Cole Robinson <crobinso@redhat.com>
2019-12-23 16:27:52 -05:00
Michael Weiser
8084639cd8 virtManager: object: domain: Fix snapshot run check
snap.is_running() returns a boolean and checking that against
VIR_DOMAIN_RUNNING worked by pure coincidence only. Just use the bool
value and give it a more speaking name while at it.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2019-12-23 15:35:38 -05:00
Lily Nie
d52c9d1ffa Offer to delete the storage files without removing the VM
we should let users decide whether they want to also delete the
storage files or just dev from UI when they click the Remove button

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-12-18 16:29:58 -05:00
Lily Nie
8b7854af1f Modify the remove_xml_dev function
add a remove_disk function,so that we can do some special things when remove a disk

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-12-18 16:29:58 -05:00
Christian Ehrhardt
2a63003133 virtManager: disambiguize LXC
LXC can be many things and in particular when seeing just "LXC" in the
virt-manager UI one might think of either
- Libvirt-LXC => https://libvirt.org/drvlxc.html
- Linuxcontainers LXC => https://linuxcontainers.org

Clarify that this is specifically Libvirt-LXC

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2019-12-17 17:56:54 -05:00
Michael Weiser
adbcb06dd4 virtManager: object: domain: Set time on unpause and revert
Wire up setting of guest time on snapshot restore and resume from pause.
Do not try to set time if the restored snapshot does not contain a
running domain state.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Suggested-by: Cole Robinson <crobinso@redhat.com>
2019-12-17 17:51:05 -05:00
Michael Weiser
fa7d3eeb7b virtManager: object: domain: Check for guest agent
For qemu, only run the API if the VM has the qemu guest agent in the
XML. If it is present, wait for it to come online instead of
unconditionally retrying a number of times.

Reuse agent function agent_ready() from refresh_interface_addresses()
and refactor it into two methods of which get_agent() can be used to
check for agent presence and further work with the channel object.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Suggested-by: Cole Robinson <crobinso@redhat.com>
2019-12-17 17:51:05 -05:00
Michael Weiser
163eea6924 virtManager: object: domain: Restrict time sync to qemu
Only run the API for qemu and test drivers, they are the only ones
that support it. This will save spamming logs with error output.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Suggested-by: Cole Robinson <crobinso@redhat.com>
2019-12-17 17:51:05 -05:00
Michael Weiser
8457145608 virtManager: object: domain: Set time on resume
Use a potentially available agent inside the domain to update guest time
after resume. Based on the same function in Nova[1].

[1] 414df1e56e

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
https: //bugzilla.redhat.com/show_bug.cgi?id=1222069
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2019-12-17 17:51:05 -05:00
Cole Robinson
82b75a93b6 delete: Add _DiskData class for tracking path delete metadata
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 15:22:03 -05:00
Cole Robinson
57a1f19841 delete: Clean up code layout a bit
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 14:47:07 -05:00
Cole Robinson
fb2bfd610f details: Use Guest.lookup_domcaps helper
This ensures the Guest object domcaps cache is primed as well, which
prevents the CPU security features handling from constantly refetching
domcaps info.

We need to tweak the cache invalidation check in Guest to handle
some of the test suite hackery we do

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-12 14:20:36 -05:00
Michael Weiser
51d84c54cb connection: Avoid repeated default pool creation attempts
During startup virtinst.StoragePool.build_default_pool() tries to
determine whether the default storage pool already exists. Because
events have not yet been processed, the list of existing storage pools
is still empty. Therefore it seems as if it does not exist yet and
build_default_pool() falls back to creating it which causes an error
message from libvirtd in the system log:

libvirtd: operation failed: pool 'default' already exists with uuid.

Move default pool creation after event processing to avoid these
redundant creation attempts.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2019-11-12 12:28:34 -05:00
Florian Ludwig
ae19d6d6ec fix resizing of spice clients with guest resizing enabled
Fixes 1414718
2019-11-12 11:46:35 -05:00
Fabiano Fidêncio
d9736db9d9 addhardware: Add "bochs" display to the video list
https://bugzilla.redhat.com/show_bug.cgi?id=1753644

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-04 11:17:14 -04:00
Cole Robinson
aadaaf8785 manager: Don't hardcode black text color
Improves readability on dark theme

Resolves: #52

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-02 10:32:04 -04:00
Cole Robinson
aaa065d38e createpool: Add more coverage testing 2019-07-03 19:37:01 -04:00
Cole Robinson
616a7f2dd5 createpool: Simplify LVM volume group UI
Only show the volgroup name, and nothing else, which is all mostly
extraneous

https://bugzilla.redhat.com/show_bug.cgi?id=1316977
2019-07-03 19:37:01 -04:00
Cole Robinson
105553563a storage: Simplify source pool enumeration
Don't return an XML object stub, just return the relevant data.
Make it explicit that we currently are only supporting lvm
enumeration
2019-07-03 19:37:01 -04:00
Cole Robinson
4d86e1129b createpool: Add _get_visible_text helper 2019-07-03 19:37:01 -04:00
Cole Robinson
f21d7e4c27 storage: Add explicit StoragePool.lookup_default_pool
Rather than adding an option to build_default_pool which is only
used in one location
2019-07-03 19:37:01 -04:00
Cole Robinson
f64655a843 storage: Replace pool supports_property with supports_X
Makes usage more explicit, and easier to track for coverage testing
2019-07-03 19:37:01 -04:00
Cole Robinson
b8074b4505 storage: Replace volume supports_property with supports_format
Helps to make usage more explicit
2019-07-03 19:37:01 -04:00
Cole Robinson
657b2bcb26 storage: move supports_volume_creation to virtManager
It's the only user
2019-07-03 19:37:01 -04:00
Cole Robinson
4a0b7f61c8 storage: move pool pretty printing to virtManager
It's the only user
2019-07-03 19:37:01 -04:00
Cole Robinson
267f226134 xmleditor: Fix the gtksource version checking
Previous commit was incomplete
2019-06-18 10:50:49 -04:00
Cole Robinson
033e97021e xmleditor: Handle gtksourceview3 as well as gtksourceview4
API differences don't seem to affect our usage
2019-06-18 09:54:58 -04:00
Cole Robinson
3062b5ce08 virtManager: Move a lot of misc files to lib/ 2019-06-17 00:12:32 -04:00
Cole Robinson
fa3f25dc1c virtManager: rename connect.py -> createconn.py
connect.py is too ambiguous, and this naming is more consistent
2019-06-17 00:12:32 -04:00
Cole Robinson
121cf5528d virtManager: rename create.py -> createvm.py
To be more consistent with other create wizard naming
2019-06-17 00:12:32 -04:00
Cole Robinson
b15510f3fd virtManager: rename storagelist to hoststorage
To match hostnets naming, and to be a bit more clear
2019-06-17 00:12:32 -04:00
Cole Robinson
16a608c37b virtManager: move vmwindow components to virtManager/details 2019-06-17 00:12:32 -04:00
Cole Robinson
9be836102e virtManager: move device UI files to virtManager/device/ 2019-06-17 00:12:32 -04:00
Cole Robinson
a6c07fbfdc virtManager: Move object .py files to virtManager/object/ 2019-06-17 00:12:32 -04:00
Cole Robinson
f107e39989 Switch to more traditional logging structure
Init a shared log instance in virtinst/logger.py, and use that
throughout the code base, so we aren't calling directly into
'logging'. This helps protect our logging output from being
cluttered with other library output, as happens with some
'requests' usage
2019-06-17 00:12:31 -04:00
Cole Robinson
2c03ea5c92 hostnets: Remove SR-IOV info listing
This is fairly advanced stuff and it should be fine to get this
info from the XML editor page
2019-06-16 23:48:51 -04:00
Cole Robinson
59873f3876 hostnets: Remove QoS viewing/editing
This is fairly niche, and can be reviewed or edited with the XML
editor
2019-06-16 20:25:42 -04:00
Cole Robinson
e25318e037 console: Fix graphics_type_pretty invocation 2019-06-16 20:19:26 -04:00
Cole Robinson
337e84083f storagepool: Force refresh XML on refresh signal
The XML will report things like updated capacity information,
which we want to mirror in the UI

https://bugzilla.redhat.com/show_bug.cgi?id=1447962
2019-06-16 19:43:20 -04:00
Cole Robinson
a2a09a49c7 clone: Fix syntax error 2019-06-16 19:23:27 -04:00
Cole Robinson
b513388979 domain: Remove internal 'cloning' marker
qemu nowadays should reject the common cases here with its default
image locking. Our impl wasn't very good anyways so let's just leave
it up to the lower layers
2019-06-16 17:32:41 -04:00
Pavel Hrdina
d6b6397ce0 virtManager: xmleditor: warn when switching to XML tab
If there are unapplied changes in the UI warn user when they tries to
switch to XML editor.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-06-15 15:05:28 +02:00
Cole Robinson
5eb5913f34 domain: Ensure nvram path before trying to access it
https://bugzilla.redhat.com/show_bug.cgi?id=1667025
2019-06-14 21:50:08 -04:00
Cole Robinson
d61f9d9995 details: Check for mac conflict in customize wizard
https://bugzilla.redhat.com/show_bug.cgi?id=1660467
2019-06-14 21:11:37 -04:00
Cole Robinson
147a3b4790 preferences: Disable systray option if we know it won't work
Basically on wayland, if appindicator isn't available

https://bugzilla.redhat.com/show_bug.cgi?id=1666597
2019-06-14 20:05:09 -04:00
Cole Robinson
aabde5bbe6 domain: Remove pre-startup USB collision check
Libvirt nowadays will throw an explicit warning about this
exact situation. It doesn't guide people to virt-manager UI, but
then again it should be obscure enough that it doesn't warrant this
special corner case code to inform the user
2019-06-14 20:04:18 -04:00
Cole Robinson
b9981b4623 createpool: Drop disk and netfs pool source listing
Both of these are awkward to use and IMO not really useful.
2019-06-14 17:16:48 -04:00
Cole Robinson
ab7b3c189f Move virtcli/cliconfig.py to virtinst/buildconfig.py
There's really no reason for the split, just contain it all
within virtinst for simplicity
2019-06-14 17:12:19 -04:00
Cole Robinson
d9729855ee guest: break out disable_hyperv_for_uefi
Having this at set_uefi time complicates the domain XML building
machinery, where we don't want things to have osinfo access.
Rearrange it so that editing cases call this explicitly, and
the XML builder just deals with it at the set_defaults time
2019-06-13 17:55:37 -04:00
Cole Robinson
19bcec651c virt-install: Push validation down into the installer
It's hard to validate whether something like --extra-args or
--initrd-inject is supported based on the command line arguments. It's
easier to let the installer.py figure it out because it's the
authoritative source
2019-06-13 14:00:04 -04:00
Cole Robinson
2266b650a5 preferences: Disable XML editing by default
This adds a field in gsettings and preferences UI to enable
XML editing. It's off by default. The XML tab page is still visible,
but the textview is not editable, and there's a warning at the top:

  XML editing is disabled in 'Preferences'.
  Only enable it if you know what you are doing.

When the setting is enabled, the warning goes away and the textview
is editable. This puts a roadblock up for people that don't know what
they are doing, but still advertises the feature and keeps the
UI surface difference fairly small between on/off states.
2019-06-13 07:17:34 -04:00
Cole Robinson
a5f4033493 details: add xmleditor UI
Handling this is a bit different from other bits, because:

1) the <device> editing paradigm is unique. We need to replace the
   device in line in the XML which is a new operation
2) the New VM customize pattern is tricky and needs lots of
   special handling
2019-06-13 07:15:46 -04:00
Cole Robinson
df80852952 addhardware: add xmleditor UI 2019-06-13 07:15:46 -04:00
Cole Robinson
0937c1e54b createvol: add xmleditor UI 2019-06-13 07:15:46 -04:00
Cole Robinson
68b3cb16e5 createpool: add xmleditor UI 2019-06-13 07:15:46 -04:00
Cole Robinson
50d13d8c12 storagelist: add xmleditor UI 2019-06-13 07:15:46 -04:00
Cole Robinson
7d9d8d9237 createnet: add xmleditor UI 2019-06-13 07:15:46 -04:00
Cole Robinson
5f4510b4df hostnets: add xmleditor UI 2019-06-13 07:13:43 -04:00
Cole Robinson
18af72212b xmleditor: Add the shared code
The XML editor ui is a two tabbed notebook, one 'Details' tab
and one 'XML' tab. The latter has a gtksourceview and allows editing
the raw libvirt XML for whatever the selected object is.

API users will programmatically insert the xmleditor notebook into
their UI, with the existing UI under the details tab.
2019-06-13 07:13:43 -04:00
Cole Robinson
ecb60c3062 Drop use of logging.info
Just use logging.debug in these random places
2019-06-11 17:55:09 -04:00
Cole Robinson
078348fbbf create: move generate_name to Guest
This will be used by virt-install.
Tweak the logic a bit to not have 'generic' in the name
2019-06-11 17:54:45 -04:00
Cole Robinson
387614c641 generatename: Move libvirt collision handling to callers
Make every caller pass an explicit cb that handles libvirt
collision processing. Makes it easier to see exactly what is going
on at the call impls
2019-06-11 17:54:45 -04:00
Cole Robinson
47a6f3a6d5 storage: Handle guest collision checking
This pattern is already used in two places. Formalize and centralize
it
2019-06-11 17:54:45 -04:00
Cole Robinson
58dfe05344 virtManager: Remove some unnecessary generatename collidelist usage
The libvirt callbacks will handle this for us already
2019-06-11 17:54:45 -04:00
Cole Robinson
6e6a0b8a6a connection: Use shared default pool lookup logic
It wasn't abiding a different pool name pointing to our default
path
2019-06-11 17:54:45 -04:00
Cole Robinson
e27202d178 createpool: Use StoragePool.default_target_path
Indirectly, rather than the less useful get_default_dir
2019-06-11 17:54:45 -04:00
Cole Robinson
abb4719cee addstorage: Drop non-storagepool fallback code
This isn't tested, and the usecase will error later anyways when
we attempt to create storage.
2019-06-11 17:54:45 -04:00
Cole Robinson
b5a664bd1b virtinst: move UI only functions into virtManager
These throw off code coverage testing. They are mostly:

* pretty* device helpers
* network + snapshot validation + creation routines
2019-06-09 18:33:45 -04:00
Cole Robinson
388850f04e virtinst: Rename util to xmlutil
The only functions left in there are largely for xml handling, so
make it explicit
2019-06-07 18:21:24 -04:00
Cole Robinson
6677f677da util: move generate_name to generatename.py 2019-06-07 18:16:53 -04:00
Cole Robinson
c2de4d7c36 util: Move get_cache_dir to VirtinstConnection
Renaming it get_app_cache_dir so it doesn't conflict with get_cache_dir
usage in virtManager
2019-06-07 17:53:15 -04:00
Cole Robinson
6f5cd58ead util: Move pretty_* into virtManager code 2019-06-07 17:21:25 -04:00
Cole Robinson
ca10e4094b util: move is_error_nosupport to SupportCache 2019-06-07 16:49:19 -04:00
Cole Robinson
ecc3e3d34e support: add is_libvirt_error_no_domain
Repurpose the generic util.exception_is_libvirt_error for the one
purpose that it's actually used, add it as a SupportCache staticmethod,
and test it
2019-06-07 16:44:14 -04:00
Cole Robinson
f85e6def55 support: Convert callers to the new format 2019-06-07 16:26:03 -04:00
Cole Robinson
566a4681a8 support: Rework support check invocations
SupportCache.check_support(SUPPORT_FOOBAR, args) becomes
SupportCache.foobar(args)

And SupportCache absorbs the caching infrastructure from
VirtinstConnection.

For now we add some hackery to hide the API change from callers, but
this will be undone in the next patch
2019-06-07 16:25:39 -04:00
Cole Robinson
3d2f678c0f support: Add a SupportCache class
For now it just contains all the SUPPORT ID numbers and public
functions.
2019-06-07 15:56:23 -04:00
Cole Robinson
50addfebca nodedev: Drop the non-standard .parse() handling 2019-06-05 16:35:34 -04:00
Cole Robinson
ab0c99057b nodedev: Fold DRMDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
b7ac99473d nodedev: Fold USBDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
a0881bc6f2 nodedev: Fold PCIDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
9e56169813 connection: Drop unused filter_nodedevs devcap value 2019-06-05 16:35:34 -04:00
Cole Robinson
8221061ec5 domain: Absorb conn.get_nodedev_count
It's the only user
2019-06-05 16:35:34 -04:00
Cole Robinson
d2462367ee virt-manager: Add --test-options
Will take a string of comma separated options which we can use to
tweak app behavior, for testing. Convert the existing --test-* options
to use the same abstraction internally. This will make it easier to
add new test options in the future
2019-06-05 16:28:05 -04:00
Cole Robinson
72dd4c8f83 config: Disable libguestfs inspection with --test-first-run
Adds some non-determinism to the active tests and pollutes the logs
2019-06-05 11:15:28 -04:00
Cole Robinson
f2304664d6 snapshots: Split out vmmSnapshotNew class
Simplifies code org
2019-06-05 11:15:28 -04:00
Cole Robinson
318e0c0a39 vmwindow: Clean up vmmDetails on window cleanup 2019-06-05 11:13:33 -04:00
Cole Robinson
d6e241897f createpool: Fix a couple gtk stderr warnings 2019-06-05 11:13:33 -04:00
Cole Robinson
5e7322edca libvirtobject: Make _redefine overrides more clear 2019-06-05 11:13:33 -04:00
Cole Robinson
0b4c6dd066 addhardware: tpm: select version 2.0 by default
The full default selection of CRB + version 1.2 is explicitly
rejected by libvirt. Select version 2.0 by default so it has
a chance of working
2019-05-17 15:57:53 -04:00
Cole Robinson
9d78759ac5 devices: redirdev: Use CharSource
redirdev does the same internally for libvirt, so let's follow that
pattern, and fix the fallout
2019-05-14 11:57:50 -04:00
Cole Robinson
6d46e37e09 devices: rng: Use CharSource
Re-use CharSource, just like libvirt does internally. Adjust all
callers to match. Rename type -> backend_model while we are here,
because type is ambiguous
2019-05-14 11:57:50 -04:00
Cole Robinson
b2b9d7d366 devices: char: Add CharSource
Move all ./source handling into CharSource, which will be reused by
other device classes as well. This requires us to add ../ handling
into our xmlapi xpath engine
2019-05-14 11:57:50 -04:00
Cole Robinson
1b3e8e1a32 addhardware: Remove supports_property usage
It's not a pattern I think is worth extending in the future, and
make internal refactorings more difficult. Drop it, and drop it
from tpm and char devices since it is now unused
2019-05-13 14:06:32 -04:00
Cole Robinson
bd6f751657 details: Drop char supports_property usage
Whether we show something in the UI should be more dependent on
whether it's actually set in the XML, not some internal hardcoded
list which can go out of date.
2019-05-13 13:38:46 -04:00
Cole Robinson
e6eb1d447b devices: char: Rename some properties to better match XML
* bind_port -> bind_service
* source_host -> connect_host
* source_port -> connect_service
2019-05-13 12:35:55 -04:00
Cole Robinson
a6495bb38f domain: virtinst: custom implement _redefine_xmlobj 2019-05-13 12:09:39 -04:00
Cole Robinson
cfa1a0569b create: Use self._guest less in install path
Pass it around to all the callbacks as needed. Makes the flow easier
to follow
2019-05-13 12:09:39 -04:00
Cole Robinson
a54b83072a addhardware: Remove unused is_customize_dialog 2019-05-13 12:09:39 -04:00
Cole Robinson
201dfdb23e netlist: Don't spam logs with errors on app shutdown 2019-05-13 12:08:55 -04:00
Cole Robinson
583dae7af5 details: Clarify config_apply variable names 2019-05-13 12:08:55 -04:00
Cole Robinson
a506e3c108 details: Have a separate hw column for unique key
Right now we overload the DEVICE column for non-device pages
like overview or memory. Add a separate column for KEY, and have
DEVICE==None for non-device pages
2019-05-13 12:08:55 -04:00
Cole Robinson
491da67cbf details: Add _make_hw_list_entry helper 2019-05-13 12:08:55 -04:00
Cole Robinson
03bddaaeb3 details: Hardcode list icon size
We use the same value everywhere, so don't include it in the model
2019-05-13 12:08:55 -04:00
Cole Robinson
f947afc3df details: split out a top level vmwindow
vmmVMWindow handles all the menuing, and coordinating between the
console, snapshots, and details panel. Simplifies the details
code a bit which will help when we add xmlediting
2019-05-13 12:08:55 -04:00
Cole Robinson
ad4f869405 netlist: Don't spam logs with errors on app shutdown 2019-05-13 12:08:55 -04:00
Cole Robinson
1752b22828 createnet: Drop _validate routines
It's a mix of stuff libvirt already catches, UI sanity checking
like if user specified an empty field, and prompting for really
obscure corner cases. This stuff isn't important enough to carry
around all this code IMO
2019-05-13 12:08:55 -04:00
Cole Robinson
4141f5c79b createnet: Shrink to one page
Name and forward mode config are always visible. ipv4, ipv6, and
domain name are under their own expanders which are collapsed by
default.

This will fit better with the XML editor pattern and reduce the
urge to squeeze more UI elements into the now smaller wizard
2019-05-13 12:08:55 -04:00
Cole Robinson
7322d906b4 createnet: Turn forward mode selector into single combo box
Rather than a mix of radio buttons and other combo boxes.
This follows the pattern we more commonly use in other UI, and
makes it easier to hide UI elements that aren't relevant for
specific choices, like the possibly large SR-IOV selector
2019-05-13 12:08:55 -04:00
Cole Robinson
4b414cbcca createnet: Remove explanatory network labels
This wizard is sufficiently obscure that I don't think it's
really valuable to try to explain networking concepts with
UI labels. If users don't know what they are trying to create
by using this wizard, there's no way we are going to adequately
explain to them what they are looking at. The example values
should be self explanatory enough anyways
2019-05-13 12:08:55 -04:00
Cole Robinson
1fa0f7261b createnet: drop the @ipv6 setting
This only applies for inter VM traffic when ipv6 networking is
disabled, which IMO is pretty obscure. If users want ipv6
connectivity, just enabling ipv6 will handle it appropriately
2019-05-13 12:08:55 -04:00
Cole Robinson
0ae80d84d7 createnet: Remove static route configuration
This is fairly advanced stuff IMO and complicates the UI, and
it's inflexible as it only allows a single route. Drop it
2019-05-13 12:08:55 -04:00
Cole Robinson
1b6b6b10e3 createvol: Always generate a default name
Let's users just quickly click through, gives more testing
to the name_hint path
2019-05-13 12:08:55 -04:00
Cole Robinson
bad894ad8c createvol: Modernize code style
* Have clear UI callbacks
* Group functions
* Privatize internal methods
* Don't carry around _vol internally
2019-05-13 12:08:55 -04:00
Cole Robinson
3694f45939 createpool: Modernize code style
* Have clear UI callbacks
* Group functions
* Don't carry around _pool internally
2019-05-13 12:08:55 -04:00
Cole Robinson
5b0b90c33e createpool: Switch to a single page
Just combine the pages. This simplifies the code and navigation, and
makes it easier to add XML editing
2019-05-13 12:08:55 -04:00
Cole Robinson
85a7b2cd61 virtManager: interface: Remove unused code after UI removal
Removal all the virtManager bits that are no longer used
2019-05-13 12:08:55 -04:00
Cole Robinson
a5ae150201 guest: Rename curvcpus and cpuset to better match XML hierarchy 2019-05-12 17:25:47 -04:00
Cole Robinson
12440b00c1 osdict: return _OsResources to callers
Use the class helper routines to save some tedious dict management
2019-05-12 17:25:47 -04:00
Cole Robinson
135b97637e guest: Rename memory properties to match XML values
Right now we have:

* memory -> ./currentMemory
* maxmem -> ./memory
* hotplugmaxmem -> ./maxMemory

Which is just a mess to know what we might be really setting behind
the scenes. Rename the properties to match the XML element name, and
adjust all users to the new names. cli options aren't changed though
2019-05-12 17:25:47 -04:00
Cole Robinson
274d686252 host: Ellipsize long net/pool object names
https://bugzilla.redhat.com/show_bug.cgi?id=1698088#c5

Reported-by: Martin Kolman <mkolman@redhat.com>
2019-04-18 15:31:14 -04:00
Pino Toscano
23b87295fc details: avoid extra check when showing application names
The current code already prefers the "display name" over the "name" of
each application; hence, use "name" only if the "display name" is not
available.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-18 13:44:34 -04:00
Pino Toscano
4f79c22bf4 inspection: switch to g.inspect_list_applications2
Use the non-deprecated g.inspect_list_applications2() call to list the
installed applications.  It is available since libguestfs >= 1.20, which
is lower than the current requirement (i.e. 1.22).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-18 13:44:34 -04:00
Pino Toscano
83f1544d32 inspection: create and use a separate vmmInspectionApplication
Instead of passing around the raw results of
g.inspect_list_applications(), create an helper vmmInspectionApplication
object with the data of an inspected application that we use.  This is
done for different reasons:
- when using the data, it is easier to use member variables instead of
  looking up values in a dictionary
- we keep only the data needed, slightly lowering the memory/objects
  used for the inspected applications
- it will be easier to switch from g.inspect_list_applications() to
  g.inspect_list_applications2() without changing code outside the
  inspection code

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-18 13:44:34 -04:00
Pino Toscano
6a5b06b8ed inspection: save the package format
Save the package format of a guest as part of its inspection data, so
later on it can be used to tweak other results (like the version of
installed packages).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Pino Toscano
ceed47558c inspection: fix check of mounted filesystems
The old code basically always set filesystems_mounted to True, even when
no filesystems were mounted successfully, unless
g.inspect_get_mountpoints() failed (very unlikely).

Instead, set it when at least one filesystem is mounted; considering
that the first filesystem to be mounted is usually /, then failing to
mount it will usually prevent the mounting of the others.  In any case,
we can try to extract data even when only / is mounted, which can work
depending on the mount points of the guest.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Pino Toscano
ac2949bab3 inspection: simplify mount points sort/mount
Rely on the Python 3 sorting facilities to sort the mount points using
a key based on the length of the mount point, doing the same effect as
the old compare function.

As side change required by this, enable python_return_dict on the
GuestFS handle, so we get proper hashes instead of lists.  This requires
libguestfs 1.22, which is 6 years old by now (and other virt-manager
requires are way more recent than that).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Pino Toscano
cf9f4a73f4 inspection: remove extra try/catch block
This block only catches failures in g.inspect_get_mountpoints(), as the
g.mount_ro() calls are already within own try/catch blocks.  Considering
that:
- g.inspect_get_mountpoints() is a simple API to query one of the
  results of the inspection, it is very unlikely that it fails
- the whole _inspect_vm function (that contains the inspection code) is
  already run within an own try/catch block, so even a failure in
  g.inspect_get_mountpoints() will not crash virt-manager
then just remove this extra try/catch block.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Cole Robinson
03fe68dedd addhardware: separate device building and explicit validation
Have two clear paths. This will be useful when we add direct XML
editing UI
2019-04-14 20:48:36 -04:00
Cole Robinson
cda9525a87 netlist: separate device building and explicit validation
Have two clear paths. This will be useful when we add direct XML
editing UI
2019-04-14 20:22:02 -04:00
Cole Robinson
11ffe2e569 addstorage: separate device building and explicit validation
Have two clear paths. This will be useful when we add direct XML
editing UI
2019-04-14 20:22:02 -04:00
Cole Robinson
eb870e4658 addstorage: Drop prompting to start default pool
Just let virtinst try and start it for us, and fail if it's the
startup fails. Prompting about this doesn't really buy us anything
2019-04-14 20:22:02 -04:00
Cole Robinson
202ac53831 addhardware: Drop self._dev
Return the generated virtinst device up through the call chain.
Makes the flow a lot more sensible, and will be needed for separating
device building from extra UI validation/prompting
2019-04-14 20:22:02 -04:00
Cole Robinson
5a90b669ff addhardware: Use vmmHost style error page paradigm
Rather than making the error page one of the hardware pages which is
the wrong layering approach
2019-04-14 18:24:35 -04:00
Cole Robinson
c3ea2d3119 host: Don't try to confirm changes on window close
It's a bit of a pain to get right, so only do it on net/pool list
change
2019-04-14 18:24:04 -04:00
Cole Robinson
f7ba2f2f99 error: Add helper confirm_unapplied_changes
For the common dialog we use to confirm changes
2019-04-14 18:24:04 -04:00