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

[Xen-devel] libxc: Report a better error on state file EOF.


  • To: "Xen-devel@xxxxxxxxxxxxx" <Xen-devel@xxxxxxxxxxxxx>
  • From: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
  • Date: Tue, 27 Mar 2012 15:21:20 +0100
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Delivery-date: Tue, 27 Mar 2012 14:21:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: Ac0MJOHuByHixZbgQHmVFLEltP+I9g==
  • Thread-topic: libxc: Report a better error on state file EOF.

If a EOF is detected in state file 4 error are reported
 - 0-length
 - read_exact_timed failed
 - Error when reading batch size (0 = Success)
 - Error when reading batch (0 = Success)

With this patch just one error is reported
 - Error when reading batch size (32 = Broken pipe)

Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>

# HG changeset patch
# Parent 4bd752a4cdf323c41c50f8cd6286f566d67adeae
diff -r 4bd752a4cdf3 -r beb5ec839f95 tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c   Fri Mar 23 20:51:48 2012 +0000
+++ b/tools/libxc/xc_domain_restore.c   Tue Mar 27 15:13:10 2012 +0100
@@ -86,8 +86,8 @@ static ssize_t rdexact(xc_interface *xch
         if ( (len == -1) && ((errno == EINTR) || (errno == EAGAIN)) )
             continue;
         if ( len == 0 ) {
-            ERROR("0-length read");
-            errno = 0;
+            errno = EPIPE;
+            return -1;
         }
         if ( len <= 0 ) {
             ERROR("read_exact_timed failed (read rc: %d, errno: %d)", len, 
errno);
@@ -1479,7 +1479,7 @@ int xc_domain_restore(xc_interface *xch,
             pagebuf.nr_physpages = pagebuf.nr_pages = 0;
             pagebuf.compbuf_pos = pagebuf.compbuf_size = 0;
             if ( pagebuf_get_one(xch, ctx, &pagebuf, io_fd, dom) < 0 ) {
-                PERROR("Error when reading batch");
+                /* pagebuf_get_one already returned a proper error */
                 goto out;
             }
         }


Regards
  Frediano Ziglio

Attachment: libxc-better-error.patch
Description: libxc-better-error.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.