* [PATCH] pyGrub: Implement error handling on kernel/initrd extraction
@ 2010-07-26 13:59 Michal Novotny
2010-07-26 15:23 ` Ian Jackson
0 siblings, 1 reply; 4+ messages in thread
From: Michal Novotny @ 2010-07-26 13:59 UTC (permalink / raw)
To: 'xen-devel@lists.xensource.com'
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
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
[-- Attachment #2: xen-unstable-pygrub-fix-error-handling.patch --]
[-- Type: text/x-patch, Size: 1248 bytes --]
diff -r 2b768d52bc7f tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Sun Jul 25 22:20:47 2010 +0100
+++ b/tools/pygrub/src/pygrub Mon Jul 26 15:57:40 2010 +0200
@@ -779,8 +779,12 @@ if __name__ == "__main__":
data = fs.open_file(chosencfg["kernel"]).read()
(tfd, bootcfg["kernel"]) = tempfile.mkstemp(prefix="boot_kernel.",
dir=output_directory)
- 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)
if chosencfg["ramdisk"]:
if not_really:
@@ -789,8 +793,12 @@ if __name__ == "__main__":
data = fs.open_file(chosencfg["ramdisk"],).read()
(tfd, bootcfg["ramdisk"]) = tempfile.mkstemp(
prefix="boot_ramdisk.", dir=output_directory)
- 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)
else:
initrd = None
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pyGrub: Implement error handling on kernel/initrd extraction
2010-07-26 13:59 [PATCH] pyGrub: Implement error handling on kernel/initrd extraction Michal Novotny
@ 2010-07-26 15:23 ` Ian Jackson
2010-07-27 8:49 ` Michal Novotny
0 siblings, 1 reply; 4+ messages in thread
From: Ian Jackson @ 2010-07-26 15:23 UTC (permalink / raw)
To: Michal Novotny; +Cc: 'xen-devel@lists.xensource.com'
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pyGrub: Implement error handling on kernel/initrd extraction
2010-07-26 15:23 ` Ian Jackson
@ 2010-07-27 8:49 ` Michal Novotny
2010-07-27 16:42 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Michal Novotny @ 2010-07-27 8:49 UTC (permalink / raw)
To: Ian Jackson; +Cc: 'xen-devel@lists.xensource.com'
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pyGrub: Implement error handling on kernel/initrd extraction
2010-07-27 8:49 ` Michal Novotny
@ 2010-07-27 16:42 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2010-07-27 16:42 UTC (permalink / raw)
To: Michal Novotny; +Cc: 'xen-devel@lists.xensource.com', Ian Jackson
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-27 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-26 13:59 [PATCH] pyGrub: Implement error handling on kernel/initrd extraction Michal Novotny
2010-07-26 15:23 ` Ian Jackson
2010-07-27 8:49 ` Michal Novotny
2010-07-27 16:42 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).