Bug 417051 - Special characters are not escaped in filenames for domain XML
Special characters are not escaped in filenames for domain XML
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: python-virtinst (Show other bugs)
5.1
All Linux
low Severity urgent
: ---
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-09 01:40 EST by Pieter De Wit
Modified: 2009-12-14 16:16 EST (History)
1 user (show)

See Also:
Fixed In Version: RHEA-2008-0371
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-21 12:45:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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 12:48 EST, Daniel Berrange
no flags Details | Diff
Escape & and ' in XML attrs (845 bytes, patch)
2008-01-09 12:52 EST, Daniel Berrange
no flags Details | Diff

  None (edit)
Description Pieter De Wit 2007-12-09 01:40:32 EST
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'>
  <name>fff</name>
  <currentMemory>1048576</currentMemory>
  <memory>1048576</memory>
  <uuid>b56c5dfe-cf11-4d07-2c87-de3f8b506a63</uuid>
  <os>
    <type>hvm</type>
    <loader>/usr/lib/xen/boot/hvmloader</loader>
    <boot dev='cdrom'/>
  </os>
  <features>
    <apic/><acpi/><pae/>
  </features>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <vcpu>2</vcpu>
  <devices>
    <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
    <console device='pty'/>
    <disk type='block' device='disk'>
      <source dev='/dev/LVM_XEN_OS/fail_over_os'/>
      <target dev='hda'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='/mnt/isos/ISO's/Microsoft/Windows/Server STD 2003 R2
SP2/Disk1a.iso'/>
      <target dev='hdc'/>
      <readonly/>
    </disk>

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

    <graphics type='vnc' port='-1' keymap='en-us' />
  </devices>
</domain>
'
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
start_install
    return self._do_install(consolecb, meter)
  File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 666, in
_do_install
    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:

Everytime

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 01:42:40 EST
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 16:08:18 EST
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
SP2/Disk1a.iso'/>


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 16:14:34 EST
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
release.
Comment 4 Pieter De Wit 2007-12-09 16:40:53 EST
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 16:41:29 EST
oh - sorry - and confirmed it works with virt-manager
Comment 7 Daniel Berrange 2008-01-09 12:48:34 EST
Created attachment 291174 [details]
Escape quotes in disk paths
Comment 8 Daniel Berrange 2008-01-09 12:52:52 EST
Created attachment 291175 [details]
Escape & and ' in XML attrs

Uploaded wrong patch before, this is correct one.
Comment 9 Daniel Berrange 2008-01-17 11:56:42 EST
Available in python-virtinst 0.300.2-1.el5
Comment 12 errata-xmlrpc 2008-05-21 12:45:29 EDT
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.

http://rhn.redhat.com/errata/RHEA-2008-0371.html

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