Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OCI provider [7/7] #8541

Merged
merged 1 commit into from
Sep 26, 2018
Merged

Conversation

gabriel-samfira
Copy link
Contributor

Adds storage implementation.

Depends on: #8540

@gabriel-samfira gabriel-samfira changed the title Add OCI provider [7/8] Add OCI provider [7/7] Mar 27, 2018
@gabriel-samfira gabriel-samfira force-pushed the oci-provider-storage branch 6 times, most recently from 2794e54 to 1c23b6c Compare April 11, 2018 15:09
@gabriel-samfira gabriel-samfira force-pushed the oci-provider-storage branch 7 times, most recently from 91b7e57 to a6c7d93 Compare April 26, 2018 12:09
@gabriel-samfira gabriel-samfira force-pushed the oci-provider-storage branch 3 times, most recently from 55a3d72 to cab8b62 Compare May 16, 2018 14:29
@jameinel
Copy link
Member

Does this depend on the Plug collection patch? Is there an order that we should review them?

Copy link
Member

@jameinel jameinel left a comment

Choose a reason for hiding this comment

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

some early comments as we get started reviewing this

expect.Times(times)
}
}
// func (e *environSuite) setupListInstancesExpectations(instanceId string, state ociCore.InstanceLifecycleStateEnum, times int) {
Copy link
Member

Choose a reason for hiding this comment

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

commented out code

// minVolumeSizeInGB represents the minimum size in GiB for
// a single volume. For more information please see:
// https://docs.oracle.com/cloud/latest/stcomputecs/STCSA/op-storage-volume--post.html#request
minVolumeSizeInGB = 50
Copy link
Member

Choose a reason for hiding this comment

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

I realize this is a different storage, but how does this compare with the ones we use for root disk? Can these values be shared, should they be caveated so that it is clear which one is used when?
minRootVolumeSize, etc?
And then its a little odd that one is in MB and one is in GB


func makeVolumeInfo(vol ociCore.Volume) storage.VolumeInfo {
var size uint64
if vol.SizeInMBs != nil {
Copy link
Member

Choose a reason for hiding this comment

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

The response can have either? or it always has both, or ? Is there a reason to prefer MB? (presumably just better fidelity?)

}
response, nestedErr := v.storageAPI.DeleteVolume(context.Background(), req)
if nestedErr != nil && !v.env.isNotFound(response.RawResponse) {
logger.Warningf("failed to cleanup volume: %s", *details.Id)
Copy link
Member

Choose a reason for hiding this comment

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

we should probably also log the nestedErr content, since it is being suppressed.

string(ociCore.VolumeLifecycleStateTerminated),
5*time.Minute)
if nestedErr != nil && !errors.IsNotFound(nestedErr) {
logger.Warningf("failed to cleanup volume: %s", *details.Id)
Copy link
Member

Choose a reason for hiding this comment

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

same here

@manadart
Copy link
Member

There is a race condition here.

WARNING: DATA RACE
Read at 0x00c4201752a0 by goroutine 106:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances.func1()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:647 +0xf8

Previous write at 0x00c4201752a0 by goroutine 108:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances.func1()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:647 +0x197

Goroutine 106 (running) created at:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:644 +0x1ce
  github.com/juju/juju/provider/oci.(*Environ).StopInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:631 +0x1fd
  github.com/juju/juju/provider/oci_test.(*environSuite).TestStopInstancesMultipleFail()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ_test.go:635 +0x2a5
  runtime.call32()
      /snap/go/2130/src/runtime/asm_amd64.s:573 +0x3a
  reflect.Value.Call()
      /snap/go/2130/src/reflect/value.go:308 +0xc0
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:772 +0x954
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:666 +0x89

Goroutine 108 (finished) created at:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:644 +0x1ce
  github.com/juju/juju/provider/oci.(*Environ).StopInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:631 +0x1fd
  github.com/juju/juju/provider/oci_test.(*environSuite).TestStopInstancesMultipleFail()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ_test.go:635 +0x2a5
  runtime.call32()
      /snap/go/2130/src/runtime/asm_amd64.s:573 +0x3a
  reflect.Value.Call()
      /snap/go/2130/src/reflect/value.go:308 +0xc0
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:772 +0x954
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:666 +0x89
==================
==================
WARNING: DATA RACE
Read at 0x00c420298320 by goroutine 106:
  runtime.growslice()
      /snap/go/2130/src/runtime/slice.go:89 +0x0
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances.func1()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:647 +0x376

Previous write at 0x00c420298320 by goroutine 108:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances.func1()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:647 +0x158

Goroutine 106 (running) created at:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:644 +0x1ce
  github.com/juju/juju/provider/oci.(*Environ).StopInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:631 +0x1fd
  github.com/juju/juju/provider/oci_test.(*environSuite).TestStopInstancesMultipleFail()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ_test.go:635 +0x2a5
  runtime.call32()
      /snap/go/2130/src/runtime/asm_amd64.s:573 +0x3a
  reflect.Value.Call()
      /snap/go/2130/src/reflect/value.go:308 +0xc0
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:772 +0x954
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:666 +0x89

Goroutine 108 (finished) created at:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:644 +0x1ce
  github.com/juju/juju/provider/oci.(*Environ).StopInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:631 +0x1fd
  github.com/juju/juju/provider/oci_test.(*environSuite).TestStopInstancesMultipleFail()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ_test.go:635 +0x2a5
  runtime.call32()
      /snap/go/2130/src/runtime/asm_amd64.s:573 +0x3a
  reflect.Value.Call()
      /snap/go/2130/src/reflect/value.go:308 +0xc0
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:772 +0x954
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:666 +0x89
==================
==================
WARNING: DATA RACE
Read at 0x00c420175200 by goroutine 106:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances.func1()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:648 +0x1db

Previous write at 0x00c420175200 by goroutine 108:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances.func1()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:648 +0x279

Goroutine 106 (running) created at:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:644 +0x1ce
  github.com/juju/juju/provider/oci.(*Environ).StopInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:631 +0x1fd
  github.com/juju/juju/provider/oci_test.(*environSuite).TestStopInstancesMultipleFail()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ_test.go:635 +0x2a5
  runtime.call32()
      /snap/go/2130/src/runtime/asm_amd64.s:573 +0x3a
  reflect.Value.Call()
      /snap/go/2130/src/reflect/value.go:308 +0xc0
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:772 +0x954
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:666 +0x89

Goroutine 108 (finished) created at:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:644 +0x1ce
  github.com/juju/juju/provider/oci.(*Environ).StopInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:631 +0x1fd
  github.com/juju/juju/provider/oci_test.(*environSuite).TestStopInstancesMultipleFail()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ_test.go:635 +0x2a5
  runtime.call32()
      /snap/go/2130/src/runtime/asm_amd64.s:573 +0x3a
  reflect.Value.Call()
      /snap/go/2130/src/reflect/value.go:308 +0xc0
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:772 +0x954
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:666 +0x89
==================
==================
WARNING: DATA RACE
Read at 0x00c420298330 by goroutine 106:
  runtime.growslice()
      /snap/go/2130/src/runtime/slice.go:89 +0x0
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances.func1()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:648 +0x309

Previous write at 0x00c420298330 by goroutine 108:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances.func1()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:648 +0x233

Goroutine 106 (running) created at:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:644 +0x1ce
  github.com/juju/juju/provider/oci.(*Environ).StopInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:631 +0x1fd
  github.com/juju/juju/provider/oci_test.(*environSuite).TestStopInstancesMultipleFail()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ_test.go:635 +0x2a5
  runtime.call32()
      /snap/go/2130/src/runtime/asm_amd64.s:573 +0x3a
  reflect.Value.Call()
      /snap/go/2130/src/reflect/value.go:308 +0xc0
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:772 +0x954
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:666 +0x89

Goroutine 108 (finished) created at:
  github.com/juju/juju/provider/oci.(*Environ).terminateInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:644 +0x1ce
  github.com/juju/juju/provider/oci.(*Environ).StopInstances()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ.go:631 +0x1fd
  github.com/juju/juju/provider/oci_test.(*environSuite).TestStopInstancesMultipleFail()
      /workspace/_build/src/github.com/juju/juju/provider/oci/environ_test.go:635 +0x2a5
  runtime.call32()
      /snap/go/2130/src/runtime/asm_amd64.s:573 +0x3a
  reflect.Value.Call()
      /snap/go/2130/src/reflect/value.go:308 +0xc0
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:772 +0x954
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /workspace/_build/src/gopkg.in/check.v1/check.go:666 +0x89
==================
OK: 55 passed
--- FAIL: TestPackage (7.80s)
	testing.go:730: race detected during execution of test
FAIL
FAIL	github.com/juju/juju/provider/oci	14.811s

@manadart
Copy link
Member

The Windows build has also been failing since 6/7 landed. Not sure exactly what is going on here.

go build github.com/oracle/oci-go-sdk/core: C:\tools\go\pkg\tool\windows_amd64\compile.exe: fork/exec C:\tools\go\pkg\tool\windows_amd64\compile.exe: The filename or extension is too long.

@gabriel-samfira
Copy link
Contributor Author

The error message is probably not the real cause of the issue. Investigating.

@manadart
Copy link
Member

manadart commented Jul 2, 2018

Resolved the Windows error in CI. It's a known Go issue, slated for 1.11 fix:
golang/go#18468

@@ -39,19 +78,46 @@ func (s *storageProvider) Releasable() bool {
}

func (s *storageProvider) DefaultPools() []*storage.Config {
return nil
iscsiPool, _ := storage.NewConfig("iscsi", ociStorageProviderType, map[string]interface{}{
Copy link
Member

Choose a reason for hiding this comment

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

I'd rename this so it doesn't conflict with the const name.

@gabriel-samfira gabriel-samfira force-pushed the oci-provider-storage branch 2 times, most recently from c98d856 to 4e624b5 Compare August 3, 2018 14:48
return errs, nil
}

func (v *volumeSource) ReleaseVolumes(ctx envcontext.ProviderCallContext, volIds []string) ([]error, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I know these are interface implementations, with comments on the interface itself, but it would be good to get comments on all these public methods - something to summarise the actions taken. In this case that releasing is disassociating the volumes from the model and controller by removing them from the volume tag collections.

@gabriel-samfira
Copy link
Contributor Author

!!build!!

@gabriel-samfira
Copy link
Contributor Author

!!build!!

@gabriel-samfira gabriel-samfira force-pushed the oci-provider-storage branch 2 times, most recently from b0982e1 to a07d063 Compare September 25, 2018 14:45
@manadart
Copy link
Member

$$merge$$

@gabriel-samfira
Copy link
Contributor Author

$$merge$$

@manadart
Copy link
Member

FAIL: storage_volumes_test.go:189: storageVolumeSuite.TestListVolumes

[LOG] 0:00.000 INFO juju.provider.oci opening model "testmodel"
storage_volumes_test.go:200:
    c.Assert(volumes[0], gc.Equals, "fakeVolumeId")
... obtained string = "fakeVolumeId2"
... expected string = "fakeVolumeId"

!!build!!

@gabriel-samfira
Copy link
Contributor Author

Yeah, appears the order in which the API returns is not always the same. Replaced with a deepequals. Current failure seems something else.

@gabriel-samfira
Copy link
Contributor Author

$$merge$$

@gabriel-samfira
Copy link
Contributor Author

$$merge$$

@jujubot jujubot merged commit a7c9e43 into juju:develop Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants