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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]