<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Jun 27, 2018 at 2:10 PM Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Jun 27, 2018 at 12:37:20PM +0300, Nir Soffer wrote:<br>
> I tested the patch yesterday, and unix socket did not work - silently.<br>
> <br>
> After changing the code to:<br>
> <br>
>     try:<br>
>         with builtin_open("/etc/vdsm/<a href="http://vdsm.id" rel="noreferrer" target="_blank">vdsm.id</a>") as f:<br>
>             vdsm_id = f.readline().strip()<br>
>     except Exception as e:<br>
>         debug("cannot read host hardware id: %s" % e)<br>
>         return None<br>
> <br>
> Then I got this message:<br>
> <br>
>     cannot read host hardware id: name 'builtin_open' is not defined<br>
> <br>
> We are paying the price of python :-)<br>
<br>
Ah, that's a typo.<br>
<br>
The Python 3 version is meant to use builtins.open.<br>
<br>
However confusingly I was testing the Python 2 version which has<br>
a RHEL-only patch that does:<br>
<br>
  -import builtins<br>
  +from __builtin__ import open as builtin_open <br>
<br>
  (<a href="https://github.com/libguestfs/libguestfs/commit/e5826e63b53a0aadc8a8d5261ebfca843d0e4068" rel="noreferrer" target="_blank">https://github.com/libguestfs/libguestfs/commit/e5826e63b53a0aadc8a8d5261ebfca843d0e4068</a>)<br>
<br>
Because I wasn't expecting the Python 3 version to work, I didn't<br>
notice this error.<br>
<br>
And yes you're right, Strong Typing FTW.  It's why we use OCaml where<br>
possible.<br>
<br>
I will fix this.  Were there any other problems?<br></blockquote><div><br></div><div>It worked fine.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Rich.<br>
<br>
-- <br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
virt-p2v converts physical machines to virtual machines.  Boot with a<br>
live CD or over the network (PXE) and turn machines into KVM guests.<br>
<a href="http://libguestfs.org/virt-v2v" rel="noreferrer" target="_blank">http://libguestfs.org/virt-v2v</a><br>
</blockquote></div></div>