Bug 638962

Summary: [6.0] 'virsh start' succeeds even if an invalid domain is configured to an xml file.
Product: Red Hat Enterprise Linux 6 Reporter: Sadique Puthen <sputhenp>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: ccui, dallan, dyuan, eblake, mzhan, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-01 16:42:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sadique Puthen 2010-09-30 13:54:59 UTC
Description of problem:

"virsh start" succeeds even if an invalid guest name is configured to an xml
file. Assume an invalid "#" is specified as a domain name, "virsh start" should report an error message like "invalid domain name", but the guest is started successfully without any errors.

# is an illegal name. When I try to name a guest as # via virt-manager, it says.

"Invalid system name, Guest name can only contain alphanumeric, '-', '.' or '-'  characters."

So virsh would report an error message and should not start the guest.

Version-Release number of selected component:

Red Hat Enterprise Linux Version Number: 6
Release Number: snapshot13
Architecture: x86_64
Kernel Version: kernel-2.6.32-70.el6.x86_64
Related Package Version: libvirt-client-0.8.1-27.el6.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. Edit the xml file and change the name of the guest to #

<domain type='kvm'>
  <name>#</name>
  <uuid>92ae9226-70ca-d0e8-ab41-2ebfe2edbf3c</uuid>
  <memory>1048576</memory>

2.start the guest

# virsh start \#
Domain # started 

# virsh dumpxml \#
<domain type='kvm' id='1'>
  <name>#</name>
  <uuid>92ae9226-70ca-d0e8-ab41-2ebfe2edbf3c</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>

 # virsh list
 Id Name                 State
----------------------------------
  1 #                    running
 
Actual results:

virsh is able to start the guest if an invalid name is specified in the guest xml file.

Expected results:

virsh should report an error and should not start the guest.

Additional info:

Comment 2 Dave Allan 2011-03-01 16:42:23 UTC
virsh does not enforce the XML schema for permissible domain names.  However, the XML schema needs to be very broad to encompass all possible valid names across all hypervisors, and the validity of the name should be enforced by the hypervisor driver or the hypervisor.  IMO, the bug is that the domain.rng is too restrictive, as "#" may be a valid name for some hypervisors.  I'm closing this bz as a duplicate of 639599, and we can discuss the proper behavior there.  BTW, it's perfectly correct for virt-manager to enforce a stricter definition of what's a valid name.

*** This bug has been marked as a duplicate of bug 639599 ***