Bug 1518042

Summary: Black txt window keeps after deleting description for a guest
Product: Red Hat Enterprise Linux 8 Reporter: zhoujunqin <juzhou>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: zhoujunqin <juzhou>
Severity: low Docs Contact:
Priority: unspecified    
Version: ---CC: jdenemar, jsuchane, juzhou, mxie, phrdina, rbalakri, tzheng, xiaodwan, yalzhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-6.0.0-17.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 02:53:02 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 for step4
none
screenshot-1 for step6
none
screenshot-3 none

Description zhoujunqin 2017-11-28 02:28:30 UTC
Created attachment 1359668 [details]
screenshot-1 for step4

Description of problem:
Black txt window keeps after deleting description for a guest

Version-Release number of selected component (if applicable):
virt-manager-1.4.3-2.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running guest.
2. Launch virt-manager, double click guest, click "Show virtual hardware details".
3. Click "Overview", edit "Description" in "Basic Details",input some txt(eg:test), then click "Apply".
4. Go back to virt-manager main page, move the cursor above guest name.
5. Turn to "Show virtual hardware details" page again, delete content in 'Description', then click 'Apply'.
6. Repeat step4 again.

Actual results:
After step4, the description 'test' is taken effective immediately, detail in Screenshot-1.
After step6, the description txt window keeps in black, detail in Screenshot-2.

Expected results:
After step6, hide description txt window.

Additional info:
After restart libvirtd service, then re-open virt-manager, check description for guest again, there is no txt window.
Detail in Screenshot-3.

Comment 2 zhoujunqin 2017-11-28 02:32:28 UTC
Created attachment 1359669 [details]
screenshot-1 for step6

Comment 3 zhoujunqin 2017-11-28 02:33:39 UTC
Created attachment 1359670 [details]
screenshot-3

Comment 5 Pavel Hrdina 2019-02-26 11:33:11 UTC
Hi, I'm not able to reproduce it on latest RHEL-7 with virt-manager-1.5.0-1.el7.noarch.  Please make sure that in description there is no empty space left and just to be sure check guest XML whether there is <description> element.

Comment 6 zhoujunqin 2019-02-27 03:02:40 UTC
Hi Pavel,
I can also reproduce this issue with virt-manager-1.5.0-1.el7.noarch

1. Prepare a running guest.

2. Launch virt-manager, double click guest, click "Show virtual hardware details".

3. Click "Overview", edit "Description" in "Basic Details",input some text(eg:test), then click "Apply".

Result: description has been added in guest's xml file

# virsh dumpxml rhel7.6
<domain type='kvm' id='9'>
  <name>rhel7.6</name>
  <uuid>bc5eeeef-e26b-483a-a662-992373f90c5c</uuid>
  <description>test</description>
  <memory unit='KiB'>1048576</memory>
...

4. Go back to virt-manager main page, move the cursor above guest name.

Result: the description 'test' is taken effective immediately.
5. Turn to "Show virtual hardware details" page again, delete content in 'Description', then click 'Apply'.

Result for step5: description keeps in guest's xml file and with no value.

# virsh dumpxml rhel7.6
<domain type='kvm' id='9'>
  <name>rhel7.6</name>
  <uuid>bc5eeeef-e26b-483a-a662-992373f90c5c</uuid>
  <description></description>
  <memory unit='KiB'>1048576</memory>
...

6. Repeat step4 again.

Result: The description text window keeps in black, but no value.
So Pavel, I expected that we can hide this black text for i have removed value for description.

I also checked virt-manager debug log, the difference is that when i remove description value from virt-manager UI, debug log shows:
[Wed, 27 Feb 2019 10:55:19 virt-manager 6543] DEBUG (libvirtobject:73) Redefining <vmmDomain name=rhel7.6 id=0x7f2360781500> with XML diff:
--- Original XML
+++ New XML
@@ -111,4 +111,5 @@
       <address type="pci" domain="0x0000" bus="0x00" slot="0x08" function="0x0"/>
     </memballoon>
   </devices>
+  <description>test</description>
 </domain>

[Wed, 27 Feb 2019 10:55:19 virt-manager 6543] DEBUG (connection:788) domain lifecycle event: domain=rhel7.6 event=0 reason=1
[Wed, 27 Feb 2019 10:55:31 virt-manager 6543] DEBUG (libvirtobject:73) Redefining <vmmDomain name=rhel7.6 id=0x7f2360781500> with XML diff:
--- Original XML
+++ New XML
@@ -1,7 +1,6 @@
 <domain type="kvm">
   <name>rhel7.6</name>
   <uuid>bc5eeeef-e26b-483a-a662-992373f90c5c</uuid>
-  <description>test</description>
   <memory unit="KiB">1048576</memory>
   <currentMemory unit="KiB">1048576</currentMemory>
   <vcpu placement="static">1</vcpu>
...

It shows removing the whole line of description in debug log, but in fact just remove the value for 'description', hope it can help you, thanks.

Comment 7 Pavel Hrdina 2019-02-27 11:34:12 UTC
Thanks for testing it, I'm still not able to reproduce it.  So the issue is that for some reason the empty <description> element remains in the domain XML, I thought that is not possible.

What version of libvirt are you using?

Comment 8 Pavel Hrdina 2019-02-27 12:32:27 UTC
So I managed to finally reproduce it, the important part is that the guest has to be running, in that case virt-manager uses virDomainSetMetadata API which will end up having empty <description> in the domain XML.

The issue here is that virt-manager sends empty string '' if you remove description over the virDomainSetMetadata API and that will result in XML containing <description></description>.  However, if you try to add that empty element into XML and use virDomainDefineXML API it will correctly remove the empty element.

The bug is in libvirt where we should remove the description even for empty string.

Comment 10 Pavel Hrdina 2019-03-08 14:04:26 UTC
Upstream commit:

commit e387afeb9a148c5b1bb33fce5b0243369b74ceee
Author: Pavel Hrdina <phrdina>
Date:   Wed Feb 27 15:52:45 2019 +0100

    conf: fix title and description for virDomainSetMetadata API

Comment 11 Pavel Hrdina 2020-03-09 10:14:28 UTC
Fixed in v5.1.0-164-ge387afeb9a, moving to post.

Comment 14 zhoujunqin 2020-06-18 08:19:56 UTC
Try to verify this bug with latest libvirt build:
virt-manager-2.2.1-3.el8.noarch
libvirt-6.0.0-23.module+el8.3.0+6986+29a4dcd7.x86_64

Steps:

1. Prepare a running guest.

2. Launch virt-manager, double click guest, click "Show virtual hardware details".

3. Click "Overview", edit "Description" in "Basic Details",input some text(eg:test), then click "Apply".

Result: description has been added in guest's xml file

# virsh dumpxml vnc
...
  <name>vnc</name>
  <uuid>9e1d7acb-26e0-4754-9c2a-28f475c8d388</uuid>
  <description>test</description>
  <metadata>
...

4. Go back to virt-manager main page, move the cursor above guest name.

Result: the description 'test' is taken effective immediately.

5. Navigate to "Show virtual hardware details" page again, delete content in 'Description', then click 'Apply'.

6. Repeat step4 again.

Result: No description text window displays.

Also check the vm xml:
# virsh dumpxml vnc  |grep -A5 description

Result: No value 'description' in output.

And it also works well with AV libvirt verison: libvirt-6.4.0-1.module+el8.3.0+6881+88468c00.x86_64

So I move this bug from ON_QA to VERIFIED status, thanks.

Comment 17 errata-xmlrpc 2020-11-04 02:53:02 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 (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), 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/RHSA-2020:4676