[libvirt] Test results (was: Re: Valid characters in domain names?)

Richard W.M. Jones rjones at redhat.com
Mon Oct 4 10:26:32 UTC 2010


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>&#x00;</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?

*** <name>#</name> ***

virsh define - OK
virsh list - OK
virsh start - OK
virt-viewer - OK
virt-df - OK
virsh destroy - OK
virt-list-filesystems - OK

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.

*** <name>></name> ***

virsh define - OK
virsh list - OK
virsh start - OK
virt-viewer - OK
virt-df - OK
virsh destroy - OK
virt-list-filesystems - OK

*** <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

*** <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.

*** <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 will file bugs for the above issues.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the libvir-list mailing list