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

Creates platform specific config and main modules #1482

Merged

Conversation

venilnoronha
Copy link
Contributor

Description

This commit separates platform specific config and plugin serving code from the generic one. It will aid to the development of the Windows plugin.

  • Extracts unix sock service from main.go into main_linux.go.
  • Moves linux specific config from config.go into config_linux.go.
  • Renames config_test.go to config_linux_test.go.

Test Results

The test-all target passes locally with the following output (tail'd):

ssh  -kTax -o StrictHostKeyChecking=no root@10.160.205.225 /tmp/docker-volume-vsphere/vmdkops.test -test.v
=== RUN   TestCommands
Detaching loopback device /dev/loop1001
Detaching loopback device /dev/loop1001
Detaching loopback device /dev/loop1001
--- PASS: TestCommands (0.65s)
	cmd_test.go:30: 
		Creating Test Volume with name = [TestVol]...
PASS
coverage: 43.3% of statements
ssh  -kTax -o StrictHostKeyChecking=no root@10.160.205.225 /tmp/docker-volume-vsphere/docker-volume-vsphere.test -test.v \
		-v DefaultTestVol \
		-H1 tcp://10.160.205.225:2375 -H2 tcp://10.160.207.83:2375
=== RUN   TestSanity
2017-06-26T10:45:39-07:00 START: Running TestSanity on  tcp://10.160.205.225:2375 (may take a while)...
2017-06-26T10:45:45-07:00 END: Running TestSanity on  tcp://10.160.205.225:2375 (may take a while)...
--- PASS: TestSanity (6.38s)
	sanity_test.go:201: Successfully connected to tcp://10.160.205.225:2375
	sanity_test.go:201: Successfully connected to tcp://10.160.207.83:2375
	sanity_test.go:219: Creating vol=DefaultTestVol on client tcp://10.160.205.225:2375.
	sanity_test.go:105: Running cmd=&[touch /mnt/testvol/DefaultTestVol/file_to_touch] with vol=DefaultTestVol on client tcp://10.160.205.225:2375
	sanity_test.go:105: Running cmd=&[stat /mnt/testvol/DefaultTestVol/file_to_touch] with vol=DefaultTestVol on client tcp://10.160.205.225:2375
=== RUN   TestConcurrency
2017-06-26T10:45:45-07:00 Running concurrent tests on tcp://10.160.205.225:2375 and tcp://10.160.207.83:2375 (may take a while)...
2017-06-26T10:45:45-07:00 START: Running create/delete multi-host concurrent test ...
2017-06-26T10:45:56-07:00 END: Running create/delete multi-host concurrent test ...
Running same docker host concurrent create/delete test on tcp://10.160.205.225:2375...
2017-06-26T10:46:03-07:00 START: Running clone concurrent test...
2017-06-26T10:46:11-07:00 END: Running clone concurrent test...
--- PASS: TestConcurrency (25.70s)
	sanity_test.go:201: Successfully connected to tcp://10.160.205.225:2375
	sanity_test.go:201: Successfully connected to tcp://10.160.207.83:2375
PASS
coverage: 39.1% of statements

This commit separates platform specific config and plugin serving
code from the generic one. It will aid development of the Windows
plugin.

* Extracts unix sock service from main.go into main_linux.go.
* Moves linux specific config from config.go into config_linux.go.
* Renames config_test.go to config_linux_test.go.
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.

Shahzeb and I have already reviewed this change on the private branch. Please get at least one more review from others.

@venilnoronha venilnoronha force-pushed the platform-refactor.venilnoronha branch 2 times, most recently from e30a8f9 to 8bf5c20 Compare June 26, 2017 18:17
@venilnoronha
Copy link
Contributor Author

@shaominchen sure, thanks!

Copy link
Contributor

@pshahzeb pshahzeb left a comment

Choose a reason for hiding this comment

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

LGTM

package config

const (
// Default paths - used in log init in main() and test:
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment can be made file level.

Copy link
Contributor Author

@venilnoronha venilnoronha Jun 26, 2017

Choose a reason for hiding this comment

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

That may not necessarily be true in the future i.e. it's only true for DefaultConfigPath and DefaultLogPath. We may add more linux specific config here, which may not relate to paths. What do you say?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Let's keep it.

Copy link
Contributor

@msterin msterin left a comment

Choose a reason for hiding this comment

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

LGTM with one nit

func fullSocketAddress(pluginName string) string {
return filepath.Join(pluginSockDir, pluginName+".sock")
// Server responds to HTTP requests from Docker.
type Server interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - Server is way too generic. It is better to name something like PluginRequestsServer (or whatever you prefer, as long as it is more specific than Server (the nit still applies if it's an old code :-) )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 4fb083b.

@venilnoronha venilnoronha merged commit d114a0b into vmware-archive:master Jun 26, 2017
shuklanirdesh82 pushed a commit that referenced this pull request Jun 29, 2017
[CI SKIP] Known issue doc.liping (#1475)

* Add known issue in README.md. [SKIP CI]

Adds Microsoft/go-winio vendor package (#1473)

This commit adds the Microsoft/go-winio vendor package, which will be used for implementing the npipe based Docker plugin for Windows.

Creates platform specific config and main modules (#1482)

This commit separates platform specific config and plugin serving code from the generic one. It will aid development of the Windows plugin.

* Extracts unix sock service from main.go into main_linux.go.
* Moves linux specific config from config.go into config_linux.go.
* Renames config_test.go to config_linux_test.go.

Adding a test for delete/recreate default vm group & fix cleanup in vmdk_ops_test.py (#1381)

Log cleanup for VMListener : VM object not found (#1489)

Update CONTRIBUTING.md

Refreshing test setup requirement and bring contributing.md to current.

[SKIP CI] Addressing Sam's comment

revamping contributing.md

Addressing Mark's comment

Update CONTRIBUTING.md
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