Bug 1276239 - Restart libvirtd service should report error when setting negative value for parameters expected unsigned value in qemu.conf
Restart libvirtd service should report error when setting negative value for ...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Libvirt Maintainers
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-29 04:28 EDT by yafu
Modified: 2016-04-28 16:10 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-10-29 05:01:02 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description yafu 2015-10-29 04:28:26 EDT
Description of problem:
When set the value to negative in the file /etc/libvirt/qemu.conf, 'service libvirtd restart' does not report error and the exited value is '0',but the status of the libvirtd service is inactive. 

Version-Release number of selected component (if applicable):
libvirt-1.2.17-13.el7.x86_64
qemu-kvm-rhev-2.3.0-31.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Set anyone of below value to negative value:
  #cat /etc/libvirt/qemu.conf
   remote_websocket_port_min = -5702
   remote_websocket_port_max = -65535
   remote_display_port_min = -5900  
   remote_display_port_max = -65535
   migration_port_min = -49152
   migration_port_max = -49215
   max_processes = -5
   max_files = -5
   max_queued = -3
2.Restart libvirtd service:
  #systemctl restart libvirtd.service
3.Check the exited value of step 2:
  #echo $?
   0
4.Check the status of libvirtd service:
  #systemctl status libvirtd.service
  ● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Thu 2015-10-29 16:16:11 CST; 4s ago
     Docs: man:libvirtd(8)
           http://libvirt.org
  Process: 14895 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 2303 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 2303 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/libvirtd.service
           ├─9302 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_le...
           └─9303 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_le...

Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 15
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 16
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 17
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 18
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 19
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 20
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 21
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 22
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 24
Oct 29 16:16:11 yafu-test libvirtd[2303]: 2015-10-29 08:16:11.023+0000: 2432: debug : virFileClose:102 : Closed fd 26


Actual results:
As the output of step 2/3/4 shows,restart libvirtd service output nothing,but the status of libvirtd service is inactive.

Expected results:
Restart libvirtd service should report error when setting negative value for parameters expected unsigned value  in qemu.conf

Additional info:
Comment 1 Peter Krempa 2015-10-29 05:01:02 EDT
The journal output already contains the error.

Oct 29 09:58:25 localhost libvirtd[26017]: Initialization of QEMU state driver failed: internal error: /etc/lib
Oct 29 09:58:25 localhost libvirtd[26017]: Driver state initialization failed

The exit value you are testing comes from systemd, which indicates success to stop and start the new process. The return value does not show whether the daemon was started successfully.
Comment 2 yafu 2015-10-30 02:29:27 EDT
(In reply to Peter Krempa from comment #1)
> The journal output already contains the error.
> 
> Oct 29 09:58:25 localhost libvirtd[26017]: Initialization of QEMU state
> driver failed: internal error: /etc/lib
> Oct 29 09:58:25 localhost libvirtd[26017]: Driver state initialization failed
> 
> The exit value you are testing comes from systemd, which indicates success
> to stop and start the new process. The return value does not show whether
> the daemon was started successfully.

The exit value comes from the exit value of libvirtd process,systemd just accept the value. Where the exit value comes from can check with the command 'strace libvirtd --listen'.
If the wrong setting of qemu.conf will interrupt libvirtd process,maybe it's better to exit the libvirtd process with non-zero value and report the error to the user.It also can avoid confusing the user who use 'systemctl restart libvirtd.service' to restart libvirtd and just check the exit value as the result.

Note You need to log in before you can comment on or make changes to this bug.