[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]