Bug 221485 - Changes to python-virtinst have caused virt-install to reject a VM name that contains a hyphen
Changes to python-virtinst have caused virt-install to reject a VM name that ...
Product: Fedora
Classification: Fedora
Component: python-virtinst (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Hugh Brock
Depends On:
Blocks: 221542
  Show dependency treegraph
Reported: 2007-01-04 14:36 EST by Karl Ward
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version: 0.103.0-1.fc6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-06-18 12:48:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Karl Ward 2007-01-04 14:36:11 EST
Description of problem: Changes to
/usr/lib/python2.4/site-packages/virtinst/XenGuest.py have changed the behavior
of virt-install in a way that I find irritating.  Our Xen guests have a hyphen
in their names, but virt-install rejects any name that has a hyphen in it now. 
It was not this way in python-virtinst-0.95.0-1.fc6 , but it is so in
python-virtinst-0.98.0-1.fc6 .  I traced the error back to this chunk of
/usr/lib/python2.4/site-packages/virtinst/XenGuest.py : 

    def set_name(self, val):
        # FIXME: need some validation here
        if re.match("^[a-zA-Z0-9_]*$", val) == None:
            raise ValueError, "Domain name must be alphanumeric or _"

This is unfortunate, because this new code restricts virtual machine names to
alphanumeric characters and the underscore.  Now, a hyphen is a valid character
in a DNS A record (while an underscore character is not).  I like my Xen guest
OS domain names to match their DNS names for obvious reasons.  XenGuest.py
should allow any characters allowed in DNS names as a minimum.  

Version-Release number of selected component (if applicable):

How reproducible: Try supplying a hyphenated name to virt-install, either on the
command line with the -n argument, or manually when virt-install prompts for a
name.  It will reject any name with a hyphen in it.  

Steps to Reproduce:
1. virt-install -n host-name

Actual results: ERROR:  Domain name must be alphanumeric or _

Expected results: Completed virt-install with no errors 

Additional info: There is a workaround: I created the virtual machine with an
underscore in the name instead of a hyphen.  After the virt-install process and
Kickstart were finished, I renamed the /etc/xen/host_name file to
/etc/xen/host-name.  Then I started the virtual machine and it is fine.
Comment 1 Jeremy Katz 2007-01-04 16:41:25 EST
The regex is just a bit too restrictive.  You should be able to add - to it
without problems and I've done so in hg, will be in the next build.
Comment 2 Karl Ward 2007-01-05 09:34:18 EST
Thanks, Jeremy, for the quick response. 

One last note on the workaround I supplied above: you should also edit the
/etc/xen/host-name file and change the line that reads 

     name = host_name

to read 

     name = host-name
Comment 3 Hugh Brock 2007-03-21 13:49:06 EDT
Fixed at
http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=aec5777422c0. Sorry
for the delay. Will close this when we release next.


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