Description of problem: You can create a libvirt domain (using virsh define) where the name of the domain contains a '/' character. However this causes unexpected failures with logfile creation. The log file is named /var/log/libvirt/qemu/<name>.log If <name> is "/" or contains a slash character then you get a log file like: /var/log/libvirt/qemu/.log or a complete failure: error: Failed to define domain from /tmp/chars.xml error: cannot create config file '/etc/libvirt/qemu/a/b.xml': No such file or directory Version-Release number of selected component (if applicable): libvirt-0.8.3-2.fc14.x86_64 How reproducible: Always. Steps to Reproduce: 1. Try to define a domain which contains '/' character in the name. 2. 3. Upstream discussion: https://www.redhat.com/archives/libvir-list/2010-October/thread.html#00053
Oops, that's the config file, not the log file, but the same argument applies.
Somebody might have a domain named e.g. "/asdf" which would disappear if we fix this. I'm inclined to close this as wontfix.
I think that's a pretty unlikely scenario. Plus if they have a '/' anywhere except for the first character, it will cause libvirt to try to create things in the wrong directory which is even worse. IMHO it is worth explicitly denying use of '/' because the liklihood of breaking people is really slim and worthwhile IMHO.
Patch posted upstream: http://www.redhat.com/archives/libvir-list/2016-April/msg01764.html
Upstream now: commit b1fc6a7b73f2058742b4c980c2e3573e9d0c65a2 Author: Cole Robinson <crobinso> Date: Tue Apr 26 11:23:12 2016 -0400 conf: domain: reject name containing '/'
I did some testing, and find that the patch works well with "virsh define"(step 1~3) and "virsh edit"(step4), but for "virsh domrename"(step 5&6), it still doesn't check the '/'. 1) # /usr/local/bin/virsh define /tmp/rhel7.xml error: Failed to define domain from /tmp/rhel7.xml error: XML error: name rhel7/ cannot contain '/' 2) # /usr/local/bin/virsh define /tmp/rhel7.xml error: Failed to define domain from /tmp/rhel7.xml error: XML error: name /rhel7 cannot contain '/' 3) # /usr/local/bin/virsh define /tmp/rhel7.xml error: Failed to define domain from /tmp/rhel7.xml error: XML error: name / cannot contain '/' 4) # /usr/local/bin/virsh define /tmp/rhel7.xml Domain rhel7 defined from /tmp/rhel7.xml # /usr/local/bin/virsh list --all Id Name State ---------------------------------------------------- - rhel7 shut off # /usr/local/bin/virsh edit rhel7 error: XML error: name rh/el7 cannot contain '/' Failed. Try again? [y,n,i,f,?]: error: XML error: name / cannot contain '/' Failed. Try again? [y,n,i,f,?]: error: XML error: name rhel7/ cannot contain '/' Failed. Try again? [y,n,i,f,?]: 5) # /usr/local/bin/virsh domrename rhel7 / Domain successfully renamed # /usr/local/bin/virsh list --all Id Name State ---------------------------------------------------- - / shut off # /usr/local/bin/virsh start / error: Failed to start domain / error: XML error: name / cannot contain '/' 6) # /usr/local/bin/virsh domrename / /rhel7 Domain successfully renamed # /usr/local/bin/virsh list --all Id Name State ---------------------------------------------------- - /rhel7 shut off # /usr/local/bin/virsh start /rhel7 error: Failed to start domain /rhel7 error: XML error: name /rhel7 cannot contain '/'
Please file a separate bug for the rename issue: rename should be calling DomainDefPostParse after editing the domain definition but before saving the config to disk