-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add external network #185
Conversation
Signed-off-by: Vaidotas Bauzys <[email protected]>
Improved tests Signed-off-by: Vaidotas Bauzys <[email protected]>
There was a problem hiding this 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.
govcd/extension_test.go
Outdated
for i := 0; i < 30; i++ { | ||
err = newExternalNetwork.Refresh() | ||
check.Assert(err, IsNil) | ||
if len(newExternalNetwork.ExternalNetwork.Tasks.Task) == 0 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
There was a problem hiding this 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.
types/v56/types.go
Outdated
@@ -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"` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated according API
govcd/sample_govcd_test_config.yaml
Outdated
@@ -77,6 +77,15 @@ vcd: | |||
# An external Network name | |||
externalNetwork: myexternalnet | |||
# | |||
# A port group name for creating an external network |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already updated that
govcd/extension_test.go
Outdated
for i := 0; i < 30; i++ { | ||
err = newExternalNetwork.Refresh() | ||
check.Assert(err, IsNil) | ||
if len(newExternalNetwork.ExternalNetwork.Tasks.Task) == 0 { |
There was a problem hiding this comment.
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]>
govcd/extension_test.go
Outdated
} | ||
task, err := CreateExternalNetwork(vcd.client, externalNetwork) | ||
check.Assert(err, IsNil) | ||
check.Assert(task, Not(Equals), Task{}) |
There was a problem hiding this comment.
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:
check.Assert(task, Not(Equals), Task{}) | |
check.Assert(task.Task, Not(Equals), types.Task{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tx. Added
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]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more changes
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]>
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]>
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]>
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Based on Megalord work: #159
Related issue: (#129 )
Add methods for creating, getting and deleting an external network.