Bug 688795

Summary: virsh dommemstat command failed to deal with ''
Product: [Community] Virtualization Tools Reporter: Vivian Bian <vbian>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: crobinso, cwei, dallan, dyuan, eblake, jtomko, mzhan, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-25 10:59:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Vivian Bian 2011-03-18 03:12:30 UTC
Description of problem:


Version-Release number of selected component (if applicable):
libvirt-0.8.1-27.el6_0.5.x86_64
qemu-kvm-0.12.1.2-2.113.el6_0.8.x86_64
kernel-2.6.32-71.20.1.el6.x86_64


How reproducible:
always

Steps to Reproduce:
[read/write mode]
Failed to deal with '' when there is space in guest's name 
# virsh list --all
 Id Name                 State
----------------------------------
  9 local                running
  - a b                  shut off
  - ayal                 shut off


# virsh dommemstat 'local'

# virsh dommemstat 'ayal'
error: Failed to get memory statistics for domain ayal
error: Requested operation is not valid: domain is not running

# virsh dommemstat 'a b'
error: unexpected data 'b'

[readonly mode]
# virsh -r
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh > dommemstat 'a b'
error: unexpected data 'b''  ----> one more ' displayed
virsh > dommemstat 'ayal'
error: failed to get domain ''ayal''  ---> a pair more '' displayed 
error: Domain not found: no domain with matching name ''ayal'' ---> a pair more '' displayed 

virsh > dommemstat ayal
error: Failed to get memory statistics for domain ayal
error: Requested operation is not valid: domain is not running

virsh > dommemstat a b
error: unexpected data 'b'

virsh > dommemstat local



Actual results:
Failures are :
1. '' are handled differently between R/W and RO mode 
2. on R/W mode, failed to recognize the guest name if there is space in the name
3. on RO mode , failed to recognize the guest name if there is space in the name,also , messed up '''' displayed . 

Expected results:
Could deal with '' correctly . And make R/W and RO mode consistent . 

Additional info:
on RHEL6.1 , there is no such problem

Comment 2 RHEL Program Management 2011-04-04 01:56:32 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 6 Ján Tomko 2014-04-25 10:59:12 UTC
Fixed upstream:
commit 57868d121b85261888b6589ee98632483d0ada7b                                   
Author:     Lai Jiangshan <laijs.com>
AuthorDate: 2010-10-12 15:14:17 +0800
Commit:     Eric Blake <eblake>
CommitDate: 2010-10-13 07:52:33 -0600

    virsh: support single quote
    
    Some users may type command like this at the virsh shell:
    virsh # somecmd 'some arg'
    
    because they often use single quote in linux shell.
    
    Signed-off-by: Lai Jiangshan <laijs.com>

git describe: v0.8.4-97-g57868d1 contains: v0.8.5~146