Bug 417051 - Special characters are not escaped in filenames for domain XML
Summary: Special characters are not escaped in filenames for domain XML
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: python-virtinst (Show other bugs)
(Show other bugs)
Version: 5.1
Hardware: All Linux
Target Milestone: ---
: ---
Assignee: Daniel Berrange
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2007-12-09 06:40 UTC by Pieter De Wit
Modified: 2009-12-14 21:16 UTC (History)
1 user (show)

Fixed In Version: RHEA-2008-0371
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-05-21 16:45:29 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Escape quotes in disk paths (1.05 KB, patch)
2008-01-09 17:48 UTC, Daniel Berrange
no flags Details | Diff
Escape & and ' in XML attrs (845 bytes, patch)
2008-01-09 17:52 UTC, Daniel Berrange
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2008:0371 normal SHIPPED_LIVE python-virtinst enhancement and bug fix update 2008-05-20 13:36:35 UTC

Description Pieter De Wit 2007-12-09 06:40:32 UTC
Description of problem:

After creating a virtual machine with the GUI it fails to be created in xen.
Here is a dump of the log:

Sun, 09 Dec 2007 10:32:05 DEBUG    Creating guest from '<domain type='xen'>
    <boot dev='cdrom'/>
    <console device='pty'/>
    <disk type='block' device='disk'>
      <source dev='/dev/LVM_XEN_OS/fail_over_os'/>
      <target dev='hda'/>
    <disk type='file' device='cdrom'>
      <source file='/mnt/isos/ISO's/Microsoft/Windows/Server STD 2003 R2
      <target dev='hdc'/>

    <interface type='bridge'>
      <source bridge='xenbr0'/>
      <mac address='00:16:3e:77:26:ed'/>

    <graphics type='vnc' port='-1' keymap='en-us' />
Sun, 09 Dec 2007 10:32:05 ERROR    Unable to complete install
'libvirt.libvirtError virDomainCreateLinux() failed XML description for domain
is not well formed or invalid
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 681, in do_install
    dom = guest.start_install(False, meter = meter)
  File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 649, in
    return self._do_install(consolecb, meter)
  File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 666, in
    self.domain = self.conn.createLinux(install_xml, 0)
  File "/usr/lib64/python2.4/site-packages/libvirt.py", line 503, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: virDomainCreateLinux() failed XML description for domain is not
well formed or invalid

I have fully updated the machine using RHN.

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

RHEL5.1 fully patched

How reproducible:


Steps to Reproduce:
Install RHEL5.1
Update using RHN
Create VM
Actual results:
virt-manager aborts the create with above error

Expected results:
vm should be created

Additional info:

Comment 1 Pieter De Wit 2007-12-09 06:42:40 UTC
Hi Guys,

Forgot to add...

If I copy and paste that "config" into a file and ask xen to start it it fails
as below:

xm create w2k3.cfg 
Using config file "./w2k3.cfg".
Error: Errors were found at line 1 while processing ./w2k3.cfg:
        <domain type='xen'>

Comment 2 Daniel Berrange 2007-12-09 21:08:18 UTC
Your problem is that the directory containing your ISO image has a single quote
character in the path. This results in malformed XML:

      <source file='/mnt/isos/ISO's/Microsoft/Windows/Server STD 2003 R2

Now, virt-manager /virt-install should take care of escaping any embedded quotes
(or other special XML characters), so we need to fix this bug.

In the meantime though, the workaround is trivial - name your directories sanely
- ie don't have quotes in the directory names.

BTW, wrt the 'xm' command - that expects a different format of config - if you
want to create domains using XML, you should instead use  'virsh create
[xmlfile]' - see 'man virsh' for more details on that option - of course you
still need to remove the quote character from the directory name & XML before
it'll work with virsh.

Comment 3 RHEL Product and Program Management 2007-12-09 21:14:34 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update

Comment 4 Pieter De Wit 2007-12-09 21:40:53 UTC
Thanks - I dont know why, but i moved the ISO to another directory and manually
editted the file. all is fine as you expected :)

Thanks !

Comment 5 Pieter De Wit 2007-12-09 21:41:29 UTC
oh - sorry - and confirmed it works with virt-manager

Comment 7 Daniel Berrange 2008-01-09 17:48:34 UTC
Created attachment 291174 [details]
Escape quotes in disk paths

Comment 8 Daniel Berrange 2008-01-09 17:52:52 UTC
Created attachment 291175 [details]
Escape & and ' in XML attrs

Uploaded wrong patch before, this is correct one.

Comment 9 Daniel Berrange 2008-01-17 16:56:42 UTC
Available in python-virtinst 0.300.2-1.el5

Comment 12 errata-xmlrpc 2008-05-21 16:45:29 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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