Bug 1566187

Summary: Disable guest discovery in virt-manager
Product: Red Hat Enterprise Linux 7 Reporter: g.danti
Component: virt-managerAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.4CC: crobinso, daniel.arena, g.danti, juzhou, mzhan, phrdina, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-manager-1.5.0-2.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 13:07:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Screenshot-1 to reproduce bug none

Description g.danti 2018-04-11 17:57:47 UTC
Description of problem:
On CentOS7 / RHEL7 launching virt-manager causes a "discovery process" of the various configured VMs. This discovery is executed by inspection and overlayed disk files and it create a very short lived guest-xxxzzzyyy virtual machine. The end result is a pretty icon to the left of the virtual machine entry (ie: CentOS icon for a CentOS VM) and the list of installad packages inside the virtual disk. However, it generates a non-negligible CPU/IO load. Uninstalling libguestfs will prevent the autodiscovery from running but, as libguestfs is a very valuable asset, it would be useful to have an option to disable the autodiscovery without uninstalling libguestfs.
Upstream already has the fix in place[1], so all is needed is to backport it.

[1] https://github.com/virt-manager/virt-manager/commit/6b1278ccda1bf52fd51c619858dfeaffb12a4029

Version-Release number of selected component (if applicable):
virt-manager-1.4.1-7.el7.noarch (really any currently RHEL7-shipping virt-manager)

How reproducible:
Create one or more virtual machines and close/open virt-manager: you will see very short lived guest-xxxzzzyyy virtual machines used for vm inspection and autodetection.

Steps to Reproduce:
1. Create one or more VMs
2. Close/reopen virt-manager
3. Pay attention to the short-lived guest-xxxyyyzzz VMs spawned by the autodetection process.

Actual results:
A significant amount of CPU/IO time is spent on guest autodiscovery

Expected results:
The autodiscovery process should be deactivated (on hosts with many VMs, the impact is quite significant)

Additional info:
Upstream fix: https://github.com/virt-manager/virt-manager/commit/6b1278ccda1bf52fd51c619858dfeaffb12a4029

Comment 2 kuwei@redhat.com 2018-04-19 08:00:14 UTC
HI,I meet the problem:
libvirt-3.9.0-14.el7_5.2.x86_64
virt-v2v-1.36.10-6.el7_5.1.x86_64
libguestfs-1.36.10-6.el7_5.1.x86_64
virt-manager-1.4.3-3.el7.noarch

Steps:
1.The virt-manager is opened, and some guest on it(some installed by local ISO, some convirt by virt-v2v)

2.But sometimes the guest on virt-manager are disappear and the virt-manager --debug log as below:
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:831) storage pool refresh event: pool=default
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:788) domain lifecycle event: domain=vmx-rhel7.4 event=0 reason=0
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=xen-hvm-rhel6.9-x86_64 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=xen-hvm-rhel7.4-x86_64 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=esx5.5-rhel7.4-x86_64 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=rhel7.4-node1 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=kvm-rhel7.4-x86_64-qcow2 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=avocado-vt-vm1 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=fedora26-node2 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=fedora26-node1 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=win7 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=guestfs-dg5kxgud22mc8du4 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=fedora26 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=7.4-test-6 removed
[Thu, 19 Apr 2018 14:58:46 virt-manager 10586] DEBUG (connection:1157) domain=Auto-esx5.5-rhel7.4-uefi removed

Hi,crobinso, what do you think my problem?

Comment 3 Pavel Hrdina 2018-04-19 08:42:52 UTC
(In reply to kuwei from comment #2)
> HI,I meet the problem:
> libvirt-3.9.0-14.el7_5.2.x86_64
> virt-v2v-1.36.10-6.el7_5.1.x86_64
> libguestfs-1.36.10-6.el7_5.1.x86_64
> virt-manager-1.4.3-3.el7.noarch
> 
> Steps:
> 1.The virt-manager is opened, and some guest on it(some installed by local
> ISO, some convirt by virt-v2v)

Hi, this issue is not related to this new feature request so please create a new BZ or send an e-mail to upstream mailing list.

Thanks,
Pavel

Comment 4 zhoujunqin 2018-04-19 08:57:03 UTC
Hi Pavel,
Are the following steps enough to reproduce this bug?

# rpm -q virt-manager libguestfs
virt-manager-1.4.3-3.el7.noarch
libguestfs-1.36.10-6.el7_5.1.x86_64

# virt-manager --debug
...
[Wed, 18 Apr 2018 23:46:50 virt-manager 29170] DEBUG (connection:602) conn=qemu:///system changed to state=Active
[Wed, 18 Apr 2018 23:46:54 virt-manager 29170] DEBUG (connection:788) domain lifecycle event: domain=guestfs-o46y2d4cd6mma2nc event=4 reason=0
[Wed, 18 Apr 2018 23:46:54 virt-manager 29170] DEBUG (connection:788) domain lifecycle event: domain=guestfs-o46y2d4cd6mma2nc event=2 reason=0
[Wed, 18 Apr 2018 23:46:54 virt-manager 29170] DEBUG (connection:1196) domain=guestfs-o46y2d4cd6mma2nc status=Running added
[Wed, 18 Apr 2018 23:46:54 virt-manager 29170] DEBUG (inspection:68) ignore libvirt/guestfs temporary VM guestfs-o46y2d4cd6mma2nc
[Wed, 18 Apr 2018 23:46:54 virt-manager 29170] DEBUG (connection:1190) New domain=guestfs-o46y2d4cd6mma2nc requested, but it's already tracked.
[Wed, 18 Apr 2018 23:47:10 virt-manager 29170] DEBUG (connection:788) domain lifecycle event: domain=guestfs-o46y2d4cd6mma2nc event=5 reason=1
[Wed, 18 Apr 2018 23:47:10 virt-manager 29170] DEBUG (libvirtobject:284) Error refreshing <vmmDomain name=guestfs-o46y2d4cd6mma2nc id=0x7f09f404d370> from events: Domain not found: no domain with matching uuid '973e2274-0a67-4096-a4ef-05f1bc2d87ee' (guestfs-o46y2d4cd6mma2nc)

Result:
In virt-manager log and GUI it shows guestfs-xxxxxxxxxx, details please see screenshot-1, thanks.

Comment 5 zhoujunqin 2018-04-19 08:58:02 UTC
Created attachment 1423944 [details]
Screenshot-1 to reproduce bug

Comment 6 zhoujunqin 2018-04-28 03:34:05 UTC
Hi Pavel,
when you have time please help me have a look of Comment 4 and Comment 5, is it enough to reproduce this bug, thanks.

Comment 7 Pavel Hrdina 2018-04-30 08:12:15 UTC
Hi Junqin, yes this is enough to reproduce this bug.  If you run virt-manager and you see guestfs-xxx in debug logs the guest discovery is enabled and the required python-libguestfs is installed.

There is one thing to keep in mind, if you run virt-manager as normal user and not as root the guestfs-xxx guest is started in session mode so if you have only system connection configured in virt-manager you will not see the guest in virt-manager GUI unless you open also the session connection.

Comment 11 ysu@redhat.com 2019-05-07 01:25:55 UTC
Verify this bug with new build:
virt-manager-1.5.0-3.el7.noarch
virt-install-1.5.0-3.el7.noarch
libvirt-4.5.0-16.el7.x86_64
qemu-kvm-rhev-2.12.0-27.el7.x86_64
libvirt-python-4.5.0-1.el7.x86_64
libguestfs-1.40.2-4.el7.x86_64
python-libguestfs-1.40.2-4.el7.x86_64

Steps:

1. Make sure package "python-libguestfs-1.40.2-4.el7.x86_64 " is installed on your host.
2. Verify enable/disable libguestfs inspection settings works well on virt-manager.
2.1 Launch virt-manager.
2.2 Prepare several rhel guests and windows guest on your host, such as rhel6, rhel7 and win10.
2.3 Click 'Edit' on Virtual Machine Manager dialog then select 'Preference'.
2.4 Choose 'General' on Preferance dialog.
Result:'Enable libguestfs VM introspection' is an optional button on Preferance dialog.
2.5 Check 'Enable libguestfs VM introspection'.
Result:Libguestfs intorspetion is selected with a warning appears:You must restart the appllication for this changing to take effect.
2.6 Resart virt-manager.
2.6.1 Login as root user and also add the session connection.(Or Login as normal user to reopen virt-manager)

Result:A guestfs-xxxyyyzzz will live shortly on virt-manager GUI and the OS icons of vms display.

2.7 Double click rhel7.6 vm then click "Show virtual hardware details".

Result:
2.7.1 "OS information" item is displayed under "Overview". 
2.7.2 It detects "Operating System" and "Applications" of vm and displays correctly.

2.8 Rerun step2.1 to step2.4, and uncheck 'Enable libguestfs VM introspection' choice, then restart virt-manager and check again.

Result: 
2.8.1 OS icons of vms hide and there is no vm named "guestfs-xxxyyyzzz" shows.
2.8.2   "OS information" item is hidden in  "Show virtual hardware details" page.
So I move this bug from ON_QA to VERIFIED based on above testing.

Comment 12 Daniel Arena 2019-06-28 13:33:24 UTC
In my opinion this should also be disabled by default. If you don't know about this feature it is confusing to see the guestfs VMs show up in virt-manager every time you start it. It is a near useless feature that is just bloat and waste of resources.

Comment 13 zhoujunqin 2019-07-01 03:48:58 UTC
(In reply to Daniel Arena from comment #12)
> In my opinion this should also be disabled by default. If you don't know
> about this feature it is confusing to see the guestfs VMs show up in
> virt-manager every time you start it. It is a near useless feature that is
> just bloat and waste of resources.

Hi Daniel Arena,
The "enable/disable libguestfs inspection" function is only enabled when "python-libguestfs-1.40.2-4.el7.x86_64 " is installed on your host.
so if the package "python-libguestfs" is not installed, this function is disabled, thanks.

@Pavel, and do you have additional information to add, thanks.

Comment 14 Pavel Hrdina 2019-07-09 14:14:36 UTC
I think it's nice to have feature and the only improvement we can do is
to ignore the VMs started by guestfs and not show them to users.

If we disable it by default we will most likely see a bug report why
that feature is not working anymore.

Comment 15 g.danti 2019-07-09 14:20:19 UTC
(In reply to Pavel Hrdina from comment #14)
> I think it's nice to have feature and the only improvement we can do is
> to ignore the VMs started by guestfs and not show them to users.
> 
> If we disable it by default we will most likely see a bug report why
> that feature is not working anymore.

Guest autodiscovery uses significant amount of I/O bandowidth, so it is not only an aesthetical issue.
However, as it can be useful to some users, I suggest to create an *option* to let the user enable/disable it, defaulting to "disabled".
If, for some reasons, you want to leave autodiscovery enabled by default, fine; but let us *disable* it if needed.
Thanks.

Comment 16 Pavel Hrdina 2019-07-09 14:35:04 UTC
(In reply to g.danti from comment #15)
> (In reply to Pavel Hrdina from comment #14)
> > I think it's nice to have feature and the only improvement we can do is
> > to ignore the VMs started by guestfs and not show them to users.
> > 
> > If we disable it by default we will most likely see a bug report why
> > that feature is not working anymore.
> 
> Guest autodiscovery uses significant amount of I/O bandowidth, so it is not
> only an aesthetical issue.
> However, as it can be useful to some users, I suggest to create an *option*
> to let the user enable/disable it, defaulting to "disabled".
> If, for some reasons, you want to leave autodiscovery enabled by default,
> fine; but let us *disable* it if needed.
> Thanks.

Well, this BZ fixes exactly that, it gives you the option in "Edit -> Preferences"
to enable/disable libguestfs vm introspection.  Yes, the default was always
"enabled" and you could have workaround it by not installing "python-libguestfs".

So now you have 2 options:

  - disable this feature from UI (it's clickable only if python-libguestfs is installed)

  - not-install/uninstall python-libguestfs

I'm not sure how much it affects I/O, some measuring would be nice to support that
statement.

The main reason why I kept it enabled by default is because it was like that since
the feature was introduced and to not break the behavior.

Comment 17 Daniel Arena 2019-07-09 14:52:01 UTC
I have python-libguestfs installed as a dependency for something else, so would prefer not to uninstall it. Telling us to uninstall a lib to disable a feature is pretty silly, don't you agree? :)

We do not have the option to disable it in the UI on REHL 7 at the moment, as the latest RHEL 7 has virt-manager 1.5, and it looks like the option to disable the feature was added for the 2.0 release.

Comment 18 Pavel Hrdina 2019-07-09 15:00:23 UTC
(In reply to Daniel Arena from comment #17)
> I have python-libguestfs installed as a dependency for something else, so
> would prefer not to uninstall it. Telling us to uninstall a lib to disable a
> feature is pretty silly, don't you agree? :)

Agreed :) if you need it for something else.  It was just a workaround.

> We do not have the option to disable it in the UI on REHL 7 at the moment,
> as the latest RHEL 7 has virt-manager 1.5, and it looks like the option to
> disable the feature was added for the 2.0 release.

Correct, that feature was added in upstream to virt-manager 2.0.0 and this
BZ is created in order to backport that feature into virt-manager 1.5 shipped
in RHEL-7.7, the beta should be available now and it should be part of
virt-manager-1.5.0-2.el7 package.

Comment 19 g.danti 2019-07-09 16:18:52 UTC
(In reply to Pavel Hrdina from comment #16)
> Well, this BZ fixes exactly that, it gives you the option in "Edit ->
> Preferences"
> to enable/disable libguestfs vm introspection.  Yes, the default was always
> "enabled" and you could have workaround it by not installing
> "python-libguestfs".
> 
> So now you have 2 options:
> 
>   - disable this feature from UI (it's clickable only if python-libguestfs
> is installed)
> 
>   - not-install/uninstall python-libguestfs

Awesome, thanks!

> I'm not sure how much it affects I/O, some measuring would be nice to
> support that
> statement.

Well, to gather the list of installed packet libguest/virt-manager needs to do the equivalent of a `rpm -qa` inside the VM overlay. Now imagine to have 50+ VMs and suddenly it is not difficult to understand how much CPU/IO is expended on such actions.

> The main reason why I kept it enabled by default is because it was like that
> since
> the feature was introduced and to not break the behavior.

I can understand it. Still, I would like it as an "opt-in" feature.
Thanks.

Comment 21 errata-xmlrpc 2019-08-06 13:07:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2232