[libvirt] PATCH: Handle case of no domains in openvz driver

If running the openvz driver on a machine with no containers currently defined, it throws an error # ./src/virsh --connect openvz:///system list libvir: OpenVZ error : internal error Failed to parse vzlist output Id Name State ---------------------------------- This is because of a failure to check for the EOF condition. This patch adds the missing check Daniel diff -r 1fc0d8258838 src/openvz_conf.c --- a/src/openvz_conf.c Tue Aug 19 13:58:56 2008 +0100 +++ b/src/openvz_conf.c Tue Aug 19 13:59:51 2008 +0100 @@ -534,6 +534,9 @@ openvzGetVPSInfo(virConnectPtr conn) { vm = *pnext; if (fscanf(fp, "%d %s\n", &veid, status) != 2) { + if (feof(fp)) + break; + openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("Failed to parse vzlist output")); goto error; -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Tue, Aug 19, 2008 at 02:14:04PM +0100, Daniel P. Berrange wrote:
If running the openvz driver on a machine with no containers currently defined, it throws an error
# ./src/virsh --connect openvz:///system list libvir: OpenVZ error : internal error Failed to parse vzlist output Id Name State ----------------------------------
Looks okay, +1 Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Tue, Aug 19, 2008 at 03:56:35PM +0200, Daniel Veillard wrote:
On Tue, Aug 19, 2008 at 02:14:04PM +0100, Daniel P. Berrange wrote:
If running the openvz driver on a machine with no containers currently defined, it throws an error
# ./src/virsh --connect openvz:///system list libvir: OpenVZ error : internal error Failed to parse vzlist output Id Name State ----------------------------------
Looks okay, +1
Comitted this too. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard