Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Updates vmci_client C library for supporting DLL generation #1443

Conversation

venilnoronha
Copy link
Contributor

@venilnoronha venilnoronha commented Jun 20, 2017

Description

This PR serves as a preliminary step for creating the vDVS plugin for Windows Containers.

esx_vmdkcmd.go uses CGO for making vmci_client calls to communicate with the VMDKOps service on ESXi. By default, CGO supports gcc, which causes compatibility issues on Windows, because the vmci_client implementation depends on libraries provided by Microsoft Build Tools. This PR enables exporting of the vmci_client library as a Windows DLL, which can then be used with the regular MinGW-w64 gcc on Windows for making calls via CGO.

  • Extracted vmci_client.h from vmci_client.c.
  • Updated vmci_client.c impl to support Winsock.
  • Added vmci_client.def for DLL export.

Test Output

test-all target passes locally, and following is the tail'd output.

	refcnt_test.go:76: 2017-06-20T09:58:49-07:00 Found: ""
	refcnt_test.go:76: 2017-06-20T09:58:49-07:00 Expected pattern: "count=5 mounted=true"
	refcnt_test.go:76: 2017-06-20T09:58:50-07:00 Found: ""
	refcnt_test.go:76: 2017-06-20T09:58:50-07:00 Expected pattern: "count=5 mounted=true"
	refcnt_test.go:76: 2017-06-20T09:58:51-07:00 Found: ""
	refcnt_test.go:76: 2017-06-20T09:58:51-07:00 Expected pattern: "count=5 mounted=true"
	refcnt_test.go:76: 2017-06-20T09:58:52-07:00 Cleaning up containers
	refcnt_test.go:76: 2017-06-20T09:58:53-07:00 Checking that the volume is unmounted and can be removed
	refcnt_test.go:76: 2017-06-20T09:58:54-07:00 refCountTestVol
	refcnt_test.go:76: 2017-06-20T09:58:54-07:00 TEST PASSED.
=== RUN   TestSanity
2017-06-20T09:58:54-07:00 START: Running TestSanity on  tcp://10.192.60.198:2375 (may take a while)...
2017-06-20T09:59:08-07:00 END: Running TestSanity on  tcp://10.192.60.198:2375 (may take a while)...
--- PASS: TestSanity (13.76s)
	sanity_test.go:201: Successfully connected to tcp://10.192.60.198:2375
	sanity_test.go:201: Successfully connected to tcp://10.192.46.211:2375
	sanity_test.go:219: Creating vol=DefaultTestVol on client tcp://10.192.60.198:2375.
	sanity_test.go:105: Running cmd=&[touch /mnt/testvol/DefaultTestVol/file_to_touch] with vol=DefaultTestVol on client tcp://10.192.60.198:2375
	sanity_test.go:105: Running cmd=&[stat /mnt/testvol/DefaultTestVol/file_to_touch] with vol=DefaultTestVol on client tcp://10.192.60.198:2375
=== RUN   TestConcurrency
2017-06-20T09:59:08-07:00 Running concurrent tests on tcp://10.192.60.198:2375 and tcp://10.192.46.211:2375 (may take a while)...
2017-06-20T09:59:08-07:00 START: Running create/delete multi-host concurrent test ...
2017-06-20T09:59:30-07:00 END: Running create/delete multi-host concurrent test ...
Running same docker host concurrent create/delete test on tcp://10.192.60.198:2375...
2017-06-20T09:59:42-07:00 START: Running clone concurrent test...
2017-06-20T09:59:56-07:00 END: Running clone concurrent test...
--- PASS: TestConcurrency (47.74s)
	sanity_test.go:201: Successfully connected to tcp://10.192.60.198:2375
	sanity_test.go:201: Successfully connected to tcp://10.192.46.211:2375
PASS
coverage: 40.6% of statements

@venilnoronha
Copy link
Contributor Author

@pshahzeb and @shaominchen have already reviewed this PR on my private branch, and it is ready for merging.

@venilnoronha venilnoronha removed their assignment Jun 20, 2017
Copy link
Contributor

@shaominchen shaominchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@msterin
Copy link
Contributor

msterin commented Jun 20, 2017

The change looks good.
2 requests - the both are about comments. There are no issues I see with the code.

  • Can you please add to description why the change is needed ? Add it to the Descritpion in the PR , and to commit message (git commit --amend is your friend here)
  • the comment in new .h file seems wrong - see inside.

Ready to go after that.

esx_vmdkcmd.go uses CGO for making vmci_client calls to communicate with the VMDKOps service on ESXi. By default, CGO supports gcc, which creates compatibility issues on Windows, because, the vmci_client implementation depends on libraries provided by Microsoft Build Tools. This commit enables exporting of the vmci_client library as a Windows DLL, which can then be used with the regular MinGW-w64 gcc on Windows for making calls via CGO.

* Extracted header file from vmci_client.c
* Updated vmci_client impl to support Winsock
* Added vmci_client.def for DLL export
@venilnoronha
Copy link
Contributor Author

venilnoronha commented Jun 20, 2017

Addressed both, @msterin. Thanks!

@venilnoronha venilnoronha merged commit ae30a65 into vmware-archive:skylight-master Jun 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants