RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1448766 - When the vm name is non-acsii, and the truncation happens to be on a multi-byte character, then vm will be unmanaged after daemon restarted.
Summary: When the vm name is non-acsii, and the truncation happens to be on a multi-by...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-08 03:15 UTC by Lili Zhu
Modified: 2018-04-10 10:44 UTC (History)
6 users (show)

Fixed In Version: libvirt-3.7.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 10:43:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 10:44:08 UTC

Description Lili Zhu 2017-05-08 03:15:25 UTC
Description of problem:
 When the vm name is non-acsii, and the truncation happens to be on a multi-byte character, then vm will be unmanaged after daemon restarted. 

Version-Release number of selected component:
   libvirt-3.2.0-4.el7
   qemu-kvm-rhev-2.9.0-3.el7

How reproducible:
   100%

Steps to Reproduce:
1. Start a vm with non-ACSII name, and the length of the name is longer than 20.
# virsh start 朱莉莉的虚拟机 
Domain 朱莉莉的虚拟机 started
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     朱莉莉的虚拟机          running

2. Check the length of the domain name and the last character
# expr length 朱莉莉的虚拟机
21
# expr length 机
3

3. Restart libvirtd 
# systemctl restart libvirtd 

4. Check the status of vm
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     朱莉莉的虚拟机          shut off


Actual result:
The status of the vm is shut off. When domain name length is more than 20 bytes, libvirt will truncate the domain to use the first 20 bytes.
But libvirt doesn't handler it correctly when the character in domain name is not single-byte.

Expected results: 
The status of the vm should be running

Additional info:
After the vm being undefined, the qemu process of that vm still exists.
1. # virsh undefine 朱莉莉的虚拟机
Domain 朱莉莉的虚拟机 has been undefined

2. # virsh list --all
 Id    Name                           State
----------------------------------------------------

3. # ps aux | grep qemu
qemu     23653 13.6 10.9 1774632 853700 ?      Sl   21:38   0:19 /usr/libexec/qemu-kvm -name guest=朱莉莉的虚拟机,

Comment 2 Martin Kletzander 2017-08-23 11:55:51 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2017-August/msg00636.html

Comment 3 Martin Kletzander 2017-08-29 09:27:40 UTC
Fixed upstream with v3.6.0-229-g5102be52d869:
commit 5102be52d8699a5200f25091de2d25afe3841d6d
Author: Martin Kletzander <mkletzan>
Date:   Wed Aug 23 13:18:19 2017 +0200

    conf: Properly truncate wide character names in virDomainObjGetShortName

Comment 5 Lili Zhu 2017-10-27 06:33:33 UTC
Reproduced this bug with libvirt-3.2.0-14.el7_4.3.x86_64
Test steps are as following:
1. start a guest, whose name consisting of multi-byte characters
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     1234567890123456789č          running

2. Check the length of the domain name and the last character
# expr length 1234567890123456789č 
21
# expr length č
2

3. Check the truncated name
# virsh dumpxml 1234567890123456789č 
....
 <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-1-1234567890123456789�/org.qemu.guest_agent.0'/>   <==The guest name is not properly truncated
....     
 </channel>
....

4. restart libvirtd
# systemctl restart libvirtd

5. Check the state of the vm
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     1234567890123456789č          shut off


Verify this bug with libvirt-3.8.0-1.el7.x86_64
Test steps are as following:

1. start a guest, whose name consisting of multi-byte characters
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     1234567890123456789č          running

2. restart libvirtd
[root@ibm-x3850x5-08 ~]# systemctl restart libvirtd 

3. check the state of the guest
[root@ibm-x3850x5-08 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     1234567890123456789č          running

4. Check the truncated name of the vm
# virsh dumpxml 1234567890123456789č 
....
 <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-9-1234567890123456789č/org.qemu.guest_agent.0'/>     <==The guest name is properly truncated
....
 </channel>
....

Since the result match with the expected result, mark it as verified

Comment 9 errata-xmlrpc 2018-04-10 10:43:32 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/RHEA-2018:0704


Note You need to log in before you can comment on or make changes to this bug.