Michal Novotny
2010-Jul-26 13:59 UTC
[Xen-devel] [PATCH] pyGrub: Implement error handling on kernel/initrd extraction
Hi, this is the patch to implement error handling on kernel/initrd extraction to pyGrub. There was no error handling before my patch applied and this patch adds error handling code to kernel/initrd extraction for write code. When dom0 is running out of space the standard OSError is being printed to stderr and then pygrub exists when an error on writing those files occured. This was tested on RHEL-5 dom0 with upstream Xen-4.1 unstable installed with RHEL-5 i386 PV guest for both cases when dom0 had enough space and when it didn''t. For the case where there were not enough space on dom0 it returned the error "pyGrub: [Errno 28] No space left on device" and then failed with "Boot loader didn''t return any data" message. For dom0 with enough space the PV guest was started successfully. Since we agreed that introduction of dom0-min-space is not the right way to go, it''s superseeded by this patch. Michal Signed-off-by: Michal Novotny <minovotn@redhat.com> -- Michal Novotny<minovotn@redhat.com>, RHCE Virtualization Team (xen userspace), Red Hat _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2010-Jul-26 15:23 UTC
Re: [Xen-devel] [PATCH] pyGrub: Implement error handling on kernel/initrd extraction
Michal Novotny writes ("[Xen-devel] [PATCH] pyGrub: Implement error handling on kernel/initrd extraction"):> Since we agreed that introduction of dom0-min-space is not the right way > to go, it''s superseeded by this patch....> - os.write(tfd, data) > - os.close(tfd) > + try: > + os.write(tfd, data) > + os.close(tfd) > + except OSError, e: > + print >>sys.stderr, "pyGrub: %s" % str(e) > + sys.exit(1)Thanks, but this is not even slightly correct. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Michal Novotny
2010-Jul-27 08:49 UTC
Re: [Xen-devel] [PATCH] pyGrub: Implement error handling on kernel/initrd extraction
On 07/26/2010 05:23 PM, Ian Jackson wrote:> Michal Novotny writes ("[Xen-devel] [PATCH] pyGrub: Implement error handling on kernel/initrd extraction"): > >> Since we agreed that introduction of dom0-min-space is not the right way >> to go, it''s superseeded by this patch. >> > ... > >> - os.write(tfd, data) >> - os.close(tfd) >> + try: >> + os.write(tfd, data) >> + os.close(tfd) >> + except OSError, e: >> + print>>sys.stderr, "pyGrub: %s" % str(e) >> + sys.exit(1) >> > Thanks, but this is not even slightly correct. > > Ian. >Why not? It''s been tested and working fine. The try/except block is working fine and sys.exit(1) is necessary to terminate pyGrub. Michal -- Michal Novotny<minovotn@redhat.com>, RHCE Virtualization Team (xen userspace), Red Hat _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Paolo Bonzini
2010-Jul-27 16:42 UTC
[Xen-devel] Re: [PATCH] pyGrub: Implement error handling on kernel/initrd extraction
On 07/27/2010 10:49 AM, Michal Novotny wrote:> On 07/26/2010 05:23 PM, Ian Jackson wrote: >> Michal Novotny writes ("[Xen-devel] [PATCH] pyGrub: Implement error >> handling on kernel/initrd extraction"): >>> Since we agreed that introduction of dom0-min-space is not the right way >>> to go, it''s superseeded by this patch. >> ... >>> - os.write(tfd, data) >>> - os.close(tfd) >>> + try: >>> + os.write(tfd, data) >>> + os.close(tfd) >>> + except OSError, e: >>> + print>>sys.stderr, "pyGrub: %s" % str(e) >>> + sys.exit(1) >> Thanks, but this is not even slightly correct. >> >> Ian. > > Why not? It''s been tested and working fine. The try/except block is > working fine and sys.exit(1) is necessary to terminate pyGrub.If os.write gets the OSError it will write the error message as part of the backtrace, and exit anyway. That said I could reproduce the failure Michal started from, which is this error: Error creating domain: (1, ''Internal error'', ''xc_dom_do_gunzip: inflate failed (rc=-5)\\n'') But I think xend can be forgiven for not treating very well about out-of-disk-space situations... let''s just not care. Paolo _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel