Bug 882915

Summary: virsh doesn't report error if updated data argument for command "schedinfo" is invalid
Product: Red Hat Enterprise Linux 6 Reporter: Peter Krempa <pkrempa>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, bili, dyasny, dyuan, mzhan, rwu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-11.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:28:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 886216    

Description Peter Krempa 2012-12-03 10:50:35 UTC
Description of problem:
When the user provides an invalid argument for "virsh schedinfo --set tunable=argument" virsh doesn't report an error and fails ($? == 1)


Version-Release number of selected component (if applicable):
libvirt-client-0.10.2-10.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. virsh schedinfo guest --set emulator_period=1aaa --config ; echo $?
  
Actual results:
$ virsh schedinfo pxe --set emulator_period=1aaa --config ; echo $?
Scheduler      : posix

1

Expected results:
An error message printed:
$ virsh schedinfo pxe --set emulator_period=1aaa --config ; echo $?
error: invalid argument: Invalid value for tunable emulator_period

Comment 1 Peter Krempa 2012-12-03 14:19:06 UTC
Fix posted upstream: http://www.redhat.com/archives/libvir-list/2012-December/msg00012.html

Comment 2 Peter Krempa 2012-12-03 15:46:43 UTC
Fixed with:

commit bf7209595445782dc106fadaf01d81afc34c4afb
Author: Peter Krempa <pkrempa>
Date:   Mon Dec 3 14:17:52 2012 +0100

    virsh: Report errors if arguments of the schedinfo command are incorrect
    
    Libvirt's helper API's when called directly don't raise the error so
    that virsh remembers it. Subsequent calls to libvirt API's might reset
    the error.
    
    In case of schedinfo virDomainFree() in the cleanup section resets the
    error when virTypedParameterAssignFromStr() fails.
    
    This patch adds function vshSaveLibvirtError() that can be called after
    calling libvirt helper APIs to ensure the error is remembered.

Comment 5 EricLee 2012-12-07 05:35:04 UTC
Verified the bug with libvirt-0.10.2-11.el6.x86_64:

# virsh schedinfo r6u3 --set emulator_period=1aaa --config ; echo $?
Scheduler      : posix
error: invalid argument: Invalid value for field 'emulator_period': expected unsigned long long

1

Get error info when updated data argument is invalid; and working well when giving valid argument:

# virsh schedinfo r6u3 --set emulator_period=1000 --config ; echo $?
Scheduler      : posix
cpu_shares     : 0
vcpu_period    : 0
vcpu_quota     : 0
emulator_period: 1000
emulator_quota : 0

0

So moving to VERIFIED.

Comment 6 errata-xmlrpc 2013-02-21 07:28:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0276.html