Bug 2149 - vzlist exit code 1 if no VMs are running
vzlist exit code 1 if no VMs are running
Status: CLOSED FIXED
Product: OpenVZ
Classification: Unclassified
Component: vzctl
unspecified
Other Other
: P2 normal
Assigned To: Kir Kolyshkin
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-18 06:49 EST by Ilja Livenson
Modified: 2015-03-17 03:49 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilja Livenson 2012-01-18 06:49:56 EST
Using vzlist from vzctl-3.0.30.2-1.x86_64 whenever I'm trying to get a list of running machines, and there are none, the exit of vzlist is != 0, i.e. 1. This screws up a bit the logic of some monitoring programs, as they report that as a error condition. Is it? I mean, at least in my view it's a totally normal situation, when there are no VMs running.

For example, libvirt's python wrapper (0.9x) raises an error because of that - when asking for connection.listDomainsID and all VMs are suspended -- which is really unpleasant as a lot of hacks are needed to go around that.
Comment 1 Kir Kolyshkin 2012-01-22 16:59:00 EST
The error message was supposed for the case when you ask for specific CTs. Will fix.
Comment 2 Kir Kolyshkin 2012-01-22 17:47:51 EST
Thanks for reporting. Fixed in GIT:
http://git.openvz.org/?p=vzctl;a=commitdiff;h=fa6d54c0e970cd916b8d02fc87c2c2653470d298

Will appear in vzctl >= 3.0.31 and possibly in 3.0.30.3

This is how it works now:

[kir@kirpad vzctl]$ sudo ./src/vzlist
Container(s) not found
[kir@kirpad vzctl]$ echo $?
0


[kir@kirpad vzctl]$ sudo ./src/vzlist 101
      CTID      NPROC STATUS    IP_ADDR         HOSTNAME
       101          - suspended 192.168.33.101/ -
[kir@kirpad vzctl]$ echo $?
0


[kir@kirpad vzctl]$ sudo ./src/vzlist 102
Container(s) not found
[kir@kirpad vzctl]$ echo $?
1
Comment 3 Sergey Bronnikov 2015-03-17 03:49:20 EDT
Bug was fixed more than one year ago and there were no complains from reporter after fix. We treat bug as fixed and close bug.