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 external network #185

Merged
merged 39 commits into from
May 8, 2019
Merged

Add external network #185

merged 39 commits into from
May 8, 2019

Conversation

vbauzys
Copy link
Contributor

@vbauzys vbauzys commented Apr 30, 2019

Based on Megalord work: #159

Related issue: (#129 )

Add methods for creating, getting and deleting an external network.

@vbauzys vbauzys requested review from Didainius, dataclouder and lvirbalas and removed request for dataclouder April 30, 2019 11:06
@vbauzys vbauzys self-assigned this Apr 30, 2019
@vbauzys vbauzys requested a review from dataclouder April 30, 2019 11:07
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

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

Very awaited feature! Few inline comments and one over here:

  • Please add CHANGELOG.md entry.

for i := 0; i < 30; i++ {
err = newExternalNetwork.Refresh()
check.Assert(err, IsNil)
if len(newExternalNetwork.ExternalNetwork.Tasks.Task) == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What kind of task are we waiting to finish here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Creation task. I have spent many hours tracking the issue - seems in home lab, create task returns it's finished, but in reality it isn't for second or so, so had to add additional wait for checking if task finished.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it is because of the data race issue mentioned above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@vbauzysvmware what do you think with respect to @Didainius comment above? I'm concerned these lines in current test may be masking a potentially bigger issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Race condition was due test and http handling go procedures. It is no implicate this case

vbauzys added 2 commits April 30, 2019 14:59
Signed-off-by: Vaidotas Bauzys <[email protected]>
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

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

Didn't check everything yet but there are some immediate concerns about race condition problems.

@@ -474,8 +475,8 @@ type Task struct {
// Since: 0.9
type CapacityWithUsage struct {
Units string `xml:"Units"`
Allocated int64 `xml:"Allocated,omitempty"`
Limit int64 `xml:"Limit,omitempty"`
Allocated int64 `xml:"Allocated"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any specific reason for these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Megalord changed, I think it is required field. Can be verified..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated according API

@@ -77,6 +77,15 @@ vcd:
# An external Network name
externalNetwork: myexternalnet
#
# A port group name for creating an external network
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's an ID, not a name. I guess this is missing updated after refactoring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I already updated that

for i := 0; i < 30; i++ {
err = newExternalNetwork.Refresh()
check.Assert(err, IsNil)
if len(newExternalNetwork.ExternalNetwork.Tasks.Task) == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it is because of the data race issue mentioned above.

Signed-off-by: Vaidotas Bauzys <[email protected]>
}
task, err := CreateExternalNetwork(vcd.client, externalNetwork)
check.Assert(err, IsNil)
check.Assert(task, Not(Equals), Task{})
Copy link
Collaborator

Choose a reason for hiding this comment

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

To avoid the triggering data race discussed above (because http.Client does some cleanups inside) I'd suggest to change this line to such:

Suggested change
check.Assert(task, Not(Equals), Task{})
check.Assert(task.Task, Not(Equals), types.Task{})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tx. Added

vbauzys added 2 commits May 2, 2019 09:24
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Copy link
Contributor

@dataclouder dataclouder left a comment

Choose a reason for hiding this comment

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

Some more changes

vbauzys added 6 commits May 6, 2019 11:36
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
vbauzys added 2 commits May 6, 2019 15:49
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
vbauzys added 7 commits May 7, 2019 11:09
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

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

LGTM

Tests green on vCD9.5
ok github.com/vmware/go-vcloud-director/v2/govcd 1568.423s

Reserved int64 `xml:"Reserved,omitempty"`
Used int64 `xml:"Used,omitempty"`
Overhead int64 `xml:"Overhead,omitempty"`
Overhead int64 `xml:"Overhead,omitempty"` // not available anymore from API v30.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

More of a question - we're using v27.0, how did you spot v30.0? Was it only in docs or did you hit it somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accidentally spotted checking against API:) from time to time I shuffle between versions

@vbauzys vbauzys merged commit a49114f into vmware:master May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants