
On Mon, Oct 04, 2010 at 11:26:32AM +0100, Richard W.M. Jones wrote:
I tried creating several KVM domains with non-alnum names to see what actually happens.
The names as shown here are XML-encoded, ie. they are how they appear in the libvirt domain XML.
*** <name></name> ***
libvirt prevents me from defining this domain, with the following error:
error: Failed to define domain from /tmp/chars.xml error: at line 2: xmlParseCharRef: invalid xmlChar value 0
Am I specifying the XML correctly?
Forbidden character in XML, we just can't use this. http://www.w3.org/TR/REC-xml/#NT-Char defines the allowed character ranges, bizarre control characters from start of ASCII are forbidden not just 0, surrogates and values usually used as Byte Order Mark are also excluded. And this is a Good Thing (TM) :-)
*** <name>#</name> ***
virsh define - OK virsh list - OK virsh start - OK virt-viewer - OK virt-df - OK virsh destroy - OK virt-list-filesystems - OK
assuming a QEmu/KVM guest, right ?
Conclusion: RHBZ#639601 and RHBZ#639602 are just user error. The reporter is typing something like:
virt-list-filesystems #
but the shell takes the # character as a comment. If instead you do:
virt-list-filesystems '#'
or
virt-list-filesystems \#
then it works fine.
*** <name>,</name> ***
virsh define - OK virsh list - OK virsh start - FAILED virt-viewer - n/a virt-df - OK virsh destroy - n/a virt-list-filesystems - OK
virsh start failed with the error:
error: Failed to start domain , error: internal error process exited while connecting to monitor: Unknown subargument to -name
This looks like a real bug. The qemu driver should prevent domains from being created that contain characters that are special for the qemu command line.
okay, we should make a bug
*** <name>></name> ***
virsh define - OK virsh list - OK virsh start - OK virt-viewer - OK virt-df - OK virsh destroy - OK virt-list-filesystems - OK
I'm rather surprized this didn't break qemu execution, interesting...
*** <name>変な</name> ***
virsh define - OK virsh list - see below virsh start - OK virt-viewer - OK virt-df - OK virsh destroy - OK virt-list-filesystems - OK
'virsh list' command is fine, except the 'State' columns don't line up because these two characters are wide chars. You see something like this:
- Win7x32 shut off - [][] shut off
minor really, I would count this as a pass,
*** <name>/</name> ***
virsh define - OK virsh list - OK virsh start - see below virt-viewer - OK virt-df - FAILED virsh destroy - OK virt-list-filesystems - FAILED
The domain starts OK, but the log file is created as "/var/log/libvirt/qemu/.log". This is a bug, although sort of to be expected.
virt-df and virt-list-filesystems both failed. This was because these programs use a heuristic to determine if the parameter passed is a libvirt domain name or a local disk image file. Because "/" looks (a bit) like a local file, it tries to open it as such and fails. The error message is:
qemu: could not open disk image /: Is a directory unexpected end of file when reading from daemon at /usr/bin/virt-list-filesystems line 131.
I think realistically libvirt should prevent domains with / anywhere in the name from being defined.
at least for QEmu, yes
*** <name>:</name> ***
virsh define - OK virsh list - OK virsh start - OK virt-viewer - OK virt-df - OK virsh destroy - OK virt-list-filesystems - OK
Thanks for doing this, we actually did better than I expected :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/