[Libguestfs] [PATCH nbdkit v2 3/3] tests: Add a simple test of nbdkit_export_name.

Eric Blake eblake at redhat.com
Thu Sep 12 22:32:32 UTC 2019


On 9/12/19 4:41 PM, Eric Blake wrote:

>> +# Try to read back various export names from the plugin.
>> +for e in "" "test" "/" "//" " " \
>> +         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
>> +do
>> +    export e sock

You could hoist the export out of the loop, but it doesn't really matter.

>> +    nbdsh -c '
>> +import os
>> +
>> +e = os.environ["e"]
>> +h.set_export_name (e)
>> +h.connect_unix (os.environ["sock"])
> 
> Could be done with nbdsh --connect "nbd+unix://$e?socket=$sock".

well, it could be done for some of the names. But for e=" ", you'd have
to URI-encode it and connect to nbd+unix://%20?socket=..., so your
approach is a lot easier for not having to worry about that.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190912/8188d1a7/attachment.sig>


More information about the Libguestfs mailing list