On Wed, Sep 11, 2019 at 02:57:50PM +0100, Richard W.M. Jones wrote:
On Wed, Sep 11, 2019 at 08:48:28AM -0500, Eric Blake wrote:
> On 9/11/19 5:40 AM, Richard W.M. Jones wrote:
> > Very much a work in progress as there are still many tests using
> > qemu-io which are candidates for conversion.
> >
> > You'll notice at the end of test-full.sh that the new test has some
> > duplicated code which looks as if it ought to be refactored into a
> > Python function. When I tried to do that, I got loads of strange
> > Python problems which may indicate bugs in nbdsh itself or problems
> > with my understanding of how Python works, but I wasn't sure how to
> > fix it. The current implementation works.
>
> I'm not sure if I'd spot the problem, but I'd least need to see your
> alternative that didn't work before I can tell for sure :)
Attached is my alternative (on top of the current patch), which seems
to me straightforward, but actually fails with the attached error.
I tried variations inserting ‘global h’ in various places but couldn't
make it work.
Also note there are two related errors, because ‘nbd’ somehow get
"unimported" from the function too.
Needs help from someone who knows more Python :-)
This turned out to be a bug in nbdsh:
https://github.com/libguestfs/libnbd/commit/d6cbd130101add28431bd6e67aa2e...
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW