Bug 963161

Summary: generated UUIDs are not compliant with RFC4122
Product: Red Hat Enterprise Linux 7 Reporter: Xuesong Zhang <xuzhang>
Component: virt-managerAssignee: Martin Kletzander <mkletzan>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, cwei, dyuan, jdenemar, joseph.keller, lcui, milos.vyletel, mkletzan, mzhan, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-0.10.0-3.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 949969 Environment:
Last Closed: 2014-06-13 09:44:36 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
libvirt log
none
virt-manager log none

Description Xuesong Zhang 2013-05-15 09:42:33 UTC
This bug is also occurred in rhel7.

version:
libvirt-1.0.5-2.el7.x86_64




+++ This bug was initially created as a clone of Bug #949969 +++

Created attachment 733169 [details]
upstream patch

Description of problem:
Libvirt mentions in documentation that UUIDs for guests must be RFC 4122 compliant but it does not follow this requirement itself. I have posted patch upstream that ensures that each UUID generated by libvirt during guest creation is RFC 4122 version 4 (pseudo)randomly generated.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-18.el6_4.2.x86_64

How reproducible:
always

Steps to Reproduce:
1. create guest (virt-manager, virt-install...)
2. grep "<uuid>" /etc/libvirt/qemu/g1.xml
  
Actual results:
  <uuid>449bd261-614a-bdf8-a7b2-5ca5b6719512</uuid>

Expected results:

xxxxxxxx-xxxx-Axxx-Bxxx-xxxxxxxxxxxx

where
A is version defined in 4.1.3 of RFC
Msb0  Msb1  Msb2  Msb3   Version  Description
0     1     0     0        4     The randomly or pseudo-
                                 randomly generated version
                                 specified in this document.

B is variant defined in 4.1.1 of RFC
Msb0  Msb1  Msb2  Description
1     0     x    The variant specified in this document.


Additional info:
Upstream patch modified for RHEL 6.4 libvirt attached.

--- Additional comment from Jiri Denemark on 2013-04-09 11:59:29 EDT ---

This is now fixed upstream by v1.0.4-97-g396c4d3:

commit 396c4d34f8875df0322d15151c2fb07121f5590e
Author: Milos Vyletel <milos.vyletel>
Date:   Mon Apr 8 14:10:54 2013 -0400

    Generate RFC4122 compliant UUIDs
    
    Even though http://libvirt.org/formatdomain.html#elementsMetadata
    states that it requires RFC4122 compliance UUIDs that are generated
    by virUUIDGenerate() are not. Following patch modifies generated
    UUIDs to conform to rules described in RFC.
    
    Signed-off-by: Milos Vyletel <milos.vyletel>

Comment 2 Jiri Denemark 2013-05-15 11:56:57 UTC
(In reply to comment #0)
> This bug is also occurred in rhel7.
> 
> version:
> libvirt-1.0.5-2.el7.x86_64

Have you actually tested it? If so what were the steps and what was the result? The bug is supposed to be fixed in 1.0.5, i.e., in the current rhel7 package.

Comment 3 Xuesong Zhang 2013-05-16 06:01:57 UTC
Yeah, I have tried on rhel7 and found the UUID isn't compliant with RFC4122, then clone it from rhel6.

Here is the steps:
1. new one VM via virt-manager
2. #virsh dumpxml b|grep uuid
  <uuid>b6c1e7dd-8759-eeb9-5dc8-61f6da088a42</uuid>

I attached the log for your reference.
virt-manager version:
virt-manager-0.10.0-0.2.gitb68faac8.el7.noarch

(In reply to comment #2)
> (In reply to comment #0)
> > This bug is also occurred in rhel7.
> > 
> > version:
> > libvirt-1.0.5-2.el7.x86_64
> 
> Have you actually tested it? If so what were the steps and what was the
> result? The bug is supposed to be fixed in 1.0.5, i.e., in the current rhel7
> package.

Comment 4 Xuesong Zhang 2013-05-16 06:05:03 UTC
Created attachment 748591 [details]
libvirt log

Comment 5 Jiri Denemark 2013-05-16 10:15:00 UTC
Can you retest with just virsh? You can use the following steps if you already have domain "b" defined:

1. virsh dumpxml b | grep -v '<uuid>' >b.xml
2. virsh undefine b
3. virsh define b.xml
4. virsh dumpxml | grep uuid

Also virt-manager logs generated when you created a new VM with it would be helpful too.

Comment 6 Xuesong Zhang 2013-05-16 10:30:08 UTC
If just virsh, the uuid seems correct.

# virsh dumpxml b | grep -v '<uuid>' >b.xml
# virsh undefine b
Domain b has been undefined
# virsh define b.xml 
Domain b defined from b.xml
# virsh dumpxml b|grep uuid
  <uuid>1c40166d-1091-41dd-91d4-adca8b8a2f15</uuid>


If use the virt-manager, the uuid didn't compliant with RFC4122.
Update the virt-manager log for your reference.






(In reply to comment #5)
> Can you retest with just virsh? You can use the following steps if you
> already have domain "b" defined:
> 
> 1. virsh dumpxml b | grep -v '<uuid>' >b.xml
> 2. virsh undefine b
> 3. virsh define b.xml
> 4. virsh dumpxml | grep uuid
> 
> Also virt-manager logs generated when you created a new VM with it would be
> helpful too.

Comment 7 Xuesong Zhang 2013-05-16 10:31:47 UTC
Created attachment 748725 [details]
virt-manager log

1. New one VM "c" via virt-manager
2. # virsh dumpxml c|grep uuid
  <uuid>79836aee-e9c5-4164-5944-c6abbdb798ed</uuid>

Attached is the virt-manager log while new VM "c".

Comment 8 Jiri Denemark 2013-05-16 10:39:31 UTC
OK, the bad UUID is generated by virt-manager. I'm not sure why virt-manager puts <uuid> element into the XML.

Comment 9 Martin Kletzander 2013-06-03 12:29:00 UTC
Patch proposed upstream:

https://www.redhat.com/archives/virt-tools-list/2013-June/msg00001.html

Comment 10 Martin Kletzander 2013-06-05 08:25:37 UTC
Moving to POST:

commit 74aa8c8a588ebde20767f328cb88068d23da6f1e
Author: Martin Kletzander <mkletzan>
Date:   Mon May 20 18:00:13 2013 +0200

    Generate valid UUIDs according to RFC4122

Comment 12 hyao@redhat.com 2013-08-15 02:46:18 UTC
The bug is not fixed according to the follwoing steps:


# rpm -qa libvirt virt-manager
libvirt-1.1.1-2.el7.x86_64
virt-manager-0.10.0-2.el7.noarch

Steps:
1. New a domain N with virt-manager
2. check the uuid of the domain
# virsh dumpxml N | grep uuid 
  <uuid>677c094d-8ffb-ad4d-f292-bd9e56ef721a</uuid>

Comment 15 tingting zheng 2013-09-04 07:21:34 UTC
Tested with:
virt-manager-0.10.0-3.el7.noarch

Use virt-manager to install a new guest,check it's uuid.
# virsh dumpxml test | grep uuid 
  <uuid>1351fa2a-c355-41b0-ac57-6b4025a067d2</uuid>

Checked several guests,the uuid met the variant specification,so move the bug to  VERIFIED.

Comment 16 Ludek Smid 2014-06-13 09:44:36 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.