Uh oh!
There was an error while loading. Please reload this page.
bpo-27584: New addition of vSockets to the python socket module - #2489
Conversation
caavery
commented
Jun 29, 2017
The patch is also in Issue number 27584 along with a README file that explains how to setup the environment for tests. |
There was a problem hiding this comment.
This is the line failing in the Travis. https://travis-ci.org/python/cpython/jobs/248412030#L2063
There was a problem hiding this comment.
You don't have the proper headers.
checking for linux/vm_sockets.h... no
So it looks like my checking for HAVE_LINUX_VM_SOCKETS_H is faulty.
There was a problem hiding this comment.
Okay, so please update that, and push in your branch, the bots will pick up the changes and will test.
There was a problem hiding this comment.
I've restored the original aclocal.m4 and fixed the issues you pointed out.
Thank you for your review,
Cathy
There was a problem hiding this comment.
Why are we using an old version here?
There was a problem hiding this comment.
I must have an older version installed. automake-1.13.4-3.el7.noarch I can upgrade that.
So do I make the corrections and ask for another pull?
There was a problem hiding this comment.
I rebased my code to remove my patch. Is rebasing and pushing an acceptable way to make changes? Or do I need to add a new commit each time?
Thanks
There was a problem hiding this comment.
Sorry to remove the aclocal.m4 from my patch.
berkerpeksag
left a comment
There was a problem hiding this comment.
Thank you for the PR. Could you please add your name to Misc/ACKS?
There was a problem hiding this comment.
I'd use a shorter version:
returngetCid() isnotNoneThere was a problem hiding this comment.
I don't understand this syntax. It looks like return the cid if it is not None or do nothing and continue. getCid will return an integer or None. I want to translate that into return True or False in _have_socket_vsock().
There was a problem hiding this comment.
@caavery read @berkerpeksag's suggestion as a contraction of the following:
foo=getCidisnotNonereturnfoofoo will contain a boolean value which will be returned.
There was a problem hiding this comment.
Yeah, that's what I was trying to say. Sorry for being unclear!
And +1 for renaming it to get_cid, thanks!
There was a problem hiding this comment.
Please don't make unrelated cosmetic changes.
There was a problem hiding this comment.
Style nit: Please add trailing comma.
There was a problem hiding this comment.
You may want to check if fcntl is available on the platform.
There was a problem hiding this comment.
Indentation is off here:
- :const:`AF_VSOCK` allows [...]
their hosts. [...]
Availability: Linux >= 4.8. QEMU >= 2.8.There was a problem hiding this comment.
Do we need to mention QEMU here? I'd say just document kernel version.
There was a problem hiding this comment.
Well I thought it would be better informationally to have it in but if it is not acceptable I can remove it.
There was a problem hiding this comment.
Style nit: (CID, port) -> ``(CID, port)``
There was a problem hiding this comment.
Style nit: Can we use an under_score name here?
There was a problem hiding this comment.
Style nit: No need to add spaces around =.
methodName='runTest'Same for line 411:
methodName=methodNameLooks like your branch contains additional commits and unfortunately it makes code review harder. Could you rebase your branch against current master? You might find https://devguide.python.org/gitbootcamp/#syncing-with-upstream helpful. |
caavery
commented
Jul 7, 2017
So you want me to sync my github branch bpo-27584 with the upstream cpython branch? Is that correct? I'm just a little unclear as to what you are asking. Cathy |
caavery
commented
Jul 7, 2017
Or do you want me to rebase both my master ( fork of upstream ) and my bpo-27584 branch? Thanks again |
berkerpeksag
commented
Jul 7, 2017
Correct. Your branch bpo-27584 now contains 34 commits and 30 of them are unrelated to the vSockets feature as you can see at https://github.com/python/cpython/pull/2489/files (the reason is probably this merge commit) |
caavery
commented
Jul 7, 2017
Sorry I seem to have an issue. Python Dev~/caavery.github/cpython# git push origin bpo-27584 |
caavery
commented
Jul 7, 2017
Sorry this is my first time with github and working with remote branches. I just forced the push into my branch bpo-27584. My branch says that 'This branch is 4 commits ahead of python:master. ' which is what I think you wanted. |
berkerpeksag
commented
Jul 7, 2017
Looks great, thanks! I will try to take another look at the patch while we wait for Kushal's review. |
caavery
commented
Jul 19, 2017
Is there anything else I should be doing? The patches have passed all tests so far and I have addressed all the issues raised. Thanks, Cathy |
There was a problem hiding this comment.
Shouldn't there be space after coma? (CID, port).
There was a problem hiding this comment.
Yes that got accidentally deleted.
There was a problem hiding this comment.
Given that vsockets originated with VMWare, add a note that they are available in that environment also?
There was a problem hiding this comment.
This is a bit more complicated. The availability in a particular linux kernel depends on the implementation.
virtio-vsock is Linux >= 4.8. QEMU >= 2.8.
vmci_transport is Linux >= 3.9
Should I just change it to when it first appeared which is v3.9?
There was a problem hiding this comment.
I meant availability when running under the VMWare hypervisor. As for the kernel, to keep it simple, whichever version supplies full functionality with both qemu and vmware.
There was a problem hiding this comment.
Please rewrite this block with proper context manager. You can skip the os.path.exists check, too.
try:
with open(...) as f:
r = fcntl.ioctl(f, socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID, " ")
except OSError:
return None
else:
return struct.unpack("I", r)[0]
There was a problem hiding this comment.
I've been starring at this block for a minute until I realized that it handles uint64_t instead of int. Please add a comment that this block that explains the difference.
There was a problem hiding this comment.
It's an uint64_t, you have to use PyLong_FromUnsignedLong().
bedevere-bot
commented
Aug 17, 2017
A Python core developer, tiran, has requested some changes be Once you have made the requested changes, please leave a comment |
caavery
commented
Aug 25, 2017
I didn't expect the Spanish Inquisition! |
bedevere-bot
commented
Aug 25, 2017
Nobody expects the Spanish Inquisition! @kushaldas, @tiran: please review the changes made to this pull request. |
There was a problem hiding this comment.
I don't think #undef AF_VSOCK is necessary. Please remove it.
There was a problem hiding this comment.
It needs to be there. In the case that vm_sockets.h is not available in include/linux which is the case on the last build bot run. Not all of the bots have the newer kernel.That way the code dependent on vm_sockets.h (AF_VSOCK) will not try to compile.
checking for linux/vm_sockets.h... no
This is also the way its done it at the top of socketmodule.h with AF_NETLINK
I also noticed AF_CAN was not adding the #undef AF_CAN in socketmodule.h so I renamed linux/can.h, ran configure and make and sure enough any code conditionally compiling under #ifdef AF_CAN in socketmodule.c failed.
There was a problem hiding this comment.
Please be consistent and use #ifdef AF_VSOCK in all places.
bedevere-bot
commented
Aug 26, 2017
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
caavery
commented
Aug 26, 2017
OK there seems to be a problem with the build now. I'll address it next week. Thanks. |
tiran
commented
Aug 28, 2017
You were right, either |
caavery
commented
Sep 5, 2017
I didn't expect the Spanish Inquisition! |
bedevere-bot
commented
Sep 5, 2017
Nobody expects the Spanish Inquisition! @kushaldas, @tiran: please review the changes made to this pull request. |
Support for AF_VSOCK on Linux only
Fixed syntax and naming problems. Fixed #ifdef AF_VSOCK checking Restored original aclocal.m4
Added checking for fcntl and thread modules.
Fixed white space error
Added back comma in (CID, port).
Added news file. socket.rst now reflects first Linux introduction of AF_VSOCK. Fixed get_cid in test_socket.py. Replaced PyLong_FromLong with PyLong_FromUnsignedLong in socketmodule.c Got rid of extra AF_VSOCK #define. Added sockaddr_vm to sock_addr.
Minor cleanup.
Put back #undef AF_VSOCK as it is necessary when vm_sockets.h is not installed.
vstinner
commented
May 23, 2024
FYI I wrote PR gh-119463 to skip the tests if get_cid() returns VMADDR_CID_ANY. Apparently, the Linux kernel 6.9 changed |
Support for AF_VSOCK on Linux only
https://bugs.python.org/issue27584