Bug 1333232 - domrename should not allow to use invalid characters in domain name
Summary: domrename should not allow to use invalid characters in domain name
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-05 03:33 UTC by Fangge Jin
Modified: 2018-05-10 09:56 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-05-03 20:26:45 UTC
Embargoed:


Attachments (Terms of Use)

Description Fangge Jin 2016-05-05 03:33:41 UTC
Description of problem:
Libvirt rejects name containing '/' in function virDomainDefPostParseCheckFeatures, but it doesn't work for domrename.

Refer to:
Bug 639923 - libvirt allows you to create a domain with '/' in the name

commit b1fc6a7b73f2058742b4c980c2e3573e9d0c65a2
Author: Cole Robinson <crobinso>
Date:   Tue Apr 26 11:23:12 2016 -0400

    conf: domain: reject name containing '/'


Version-Release number of selected component (if applicable):
# git describe 
v1.3.4-116-gf4bdf2e


How reproducible:
100%

Steps to Reproduce:
1)
# /usr/local/bin/virsh define /tmp/rhel7.xml 
error: Failed to define domain from /tmp/rhel7.xml
error: XML error: name rhel7/ cannot contain '/'

2) 
# /usr/local/bin/virsh define /tmp/rhel7.xml 
Domain rhel7 defined from /tmp/rhel7.xml


3)
# /usr/local/bin/virsh domrename rhel7 /
Domain successfully renamed

# /usr/local/bin/virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     /                              shut off

# /usr/local/bin/virsh start /
error: Failed to start domain /
error: XML error: name / cannot contain '/'


Actual results:
As step 3, Domrename doesn't check if the name contains '/'

Expected results:
Reject domrename when the name contains '/'


Additional info:

Comment 1 Julio Faracco 2018-05-03 17:39:55 UTC
Fixed upstream by:

commit 4e1a970
Author:     Julio Faracco <jcfaracco>
AuthorDate: Tue May 1 12:56:08 2018 -0300
Commit:     John Ferlan <jferlan>
CommitDate: Thu May 3 11:25:01 2018 -0400

    qemu: avoid slash characters to the new domain name.
    
    The 'domrename' command needs to check if the new domain name contains
    the slash character. This character is not accepted by libvirt XML
    definition because it is an invalid char (see Cole's commit b1fc6a7b7).
    This commit enhace the 'domrename' command adding this check.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1333232
    
    Signed-off-by: Julio Faracco <jcfaracco>
    Reviewed-by: John Ferlan <jferlan>

$ git describe 4e1a970
v4.3.0-18-g4e1a970


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