Problems with pygrub: ValueError:unableto open file
A message that is not in the archive (sent off-list or not yet received): 011601c64eb4$39a8a030$0f01a8c0@zaphod
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 003f01c65493$5de82b20$7801a8c0@zaphod
Sorry for the last empty mail (hit the wrong button). Attached is a patch against xen-unstable to improve the error messages in pygrub when the e2fsprogs do not support the newer ext2fs_open2 function. This should help beginners to identify the real problem when pygrub does not work (e.g. on RHEL4).
Please apply to xen-unstable.
Best Regards,
Michael Paesold
# HG changeset patch
# User [email protected]
# Node ID 6d90c95b919b324b7d8e4c7a568040334c8862e9
# Parent f0e14b4e535c7d99c56c286384b0d512c5220884 Improve pygrub error reporting when opening ext2 fs is not possible
As reported in the thread:
http://lists.xensource.com/archives/html/xen-users/2006-03/msg00721.html,
pygrub does not open ext2 file systems in partitioned images or sub partitions on e.g. CentOS/RHEL 4, because e2fsprogs ext2fs_open does not support an offset into the file to be opened.
With this patch, the error is correctly reported instead of a generic "unable to open file" (and leaving the user searching in the dark).
# HG changeset patch
# User [email protected]
# Node ID 6d90c95b919b324b7d8e4c7a568040334c8862e9
# Parent f0e14b4e535c7d99c56c286384b0d512c5220884 Improve pygrub error reporting when opening ext2 fs is not possible
As reported in the thread:
http://lists.xensource.com/archives/html/xen-users/2006-03/msg00721.html,
pygrub does not open ext2 file systems in partitioned images or sub partitions on e.g. CentOS/RHEL 4, because e2fsprogs ext2fs_open does not support an offset into the file to be opened.
With this patch, the error is correctly reported instead of a generic "unable to open file" (and leaving the user searching in the dark).
tools/pygrub/src/fsys/ext2/ext2module.c +9 -2
@@ -213,7 +213,9 @@ ext2_fs_open (Ext2Fs *fs, PyObject *argsint flags =0 , superblock =0 , offset =0 , err;unsigned int block_size =0 ;ext2_filsys efs; +#ifdef HAVE_EXT2FS_OPEN2 char offsetopt[30 ]; +#endif if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|iiii", kwlist, &name, &flags, &superblock,
@@ -225,19 +227,24 @@ ext2_fs_open (Ext2Fs *fs, PyObject *argsreturn NULL ; } +#ifdef HAVE_EXT2FS_OPEN2 if (offset !=0 ) {snprintf (offsetopt,29 ,"offset=%d" , offset); } -#ifdef HAVE_EXT2FS_OPEN2 err =ext2fs_open2 (name, offsetopt, flags, superblock, block_size, unix_io_manager, &efs);#else +if (offset !=0 ) { +PyErr_SetString (PyExc_ValueError,"offset argument not supported" ); +return NULL ; + } + err =ext2fs_open (name, flags, superblock, block_size, unix_io_manager, &efs);#endif if (err) { -PyErr_SetString (PyExc_ValueError,"unable to open file" ); +PyErr_SetString (PyExc_ValueError,"unable to open filesystem" );return NULL ; }
_______________________________________________
Xen-users mailing list
[email protected]
http://lists.xensource.com/xen-users
Ewan Mellor
AppliedQuoted 40 lines · Michael Paesold
Sorry for the last empty mail (hit the wrong button). Attached is a patch against xen-unstable to improve the error messages in pygrub when the e2fsprogs do not support the newer
ext2fs_open2function. This should help beginners to identify the real problem when pygrub does not work (e.g. on RHEL4).Please apply to xen-unstable.
Best Regards,
Michael Paesold# HG changeset patch
# User [email protected]
# Node ID6d90c95b919b324b7d8e4c7a568040334c8862e9
# Parentf0e14b4e535c7d99c56c286384b0d512c5220884Improve pygrub error reporting when opening ext2 fs is not possibleAs reported in the thread:
http://lists.xensource.com/archives/html/xen-users/2006-03/msg00721.html,
pygrub does not open ext2 file systems in partitioned images or sub partitions on e.g. CentOS/RHEL 4, because e2fsprogsext2fs_opendoes not support an offset into the file to be opened.With this patch, the error is correctly reported instead of a generic "unable to open file" (and leaving the user searching in the dark).
Signed-off-by Michael Paesold <[email protected]># HG changeset patch
# User [email protected]
# Node ID6d90c95b919b324b7d8e4c7a568040334c8862e9
# Parentf0e14b4e535c7d99c56c286384b0d512c5220884Improve pygrub error reporting when opening ext2 fs is not possibleAs reported in the thread:
http://lists.xensource.com/archives/html/xen-users/2006-03/msg00721.html,
pygrub does not open ext2 file systems in partitioned images or sub partitions on e.g. CentOS/RHEL 4, because e2fsprogsext2fs_opendoes not support an offset into the file to be opened.
Quoted 4 lines
With this patch, the error is correctly reported instead of a generic "unable to open file" (and leaving the user searching in the dark).
Signed-off-by Michael Paesold <[email protected]>
Applied, thanks.
Ewan.