-
-
Notifications
You must be signed in to change notification settings - Fork 400
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 NSM topology probe #1636
Add NSM topology probe #1636
Conversation
topology/probes/nsm/nsm.go
Outdated
|
||
// Stop .... | ||
func (p *Probe) Stop() { | ||
atomic.CompareAndSwapInt64(&p.state, common.RunningState, common.StoppingState) |
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.
You should test the return value of CompareAndSwapInt64:
if !atomic.CompareAndSwapInt64(&p.state, common.RunningState, common.StoppingState) {
return
}
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 is going to happen the swap fails? subsequent Stop are sent by the analyzer?
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.
No. But this means the probe was not started.
topology/probes/nsm/nsm.go
Outdated
go p.monitorCrossConnects(mgr.Status.URL) | ||
} | ||
} | ||
for atomic.LoadInt64(&p.state) == common.RunningState { |
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.
This waiting loop doesn't seem to be useful. Why not simply let the function exit ? (I don't think you need to execute run
in a goroutine)
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.
you're right, let's remove run() and move this code to Start()
481fbed
to
4f3dea2
Compare
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.
topology/probes/nsm/nsm.go
Outdated
|
||
// Stop .... | ||
func (p *Probe) Stop() { | ||
atomic.CompareAndSwapInt64(&p.state, common.RunningState, common.StoppingState) |
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 is going to happen the swap fails? subsequent Stop are sent by the analyzer?
topology/probes/nsm/nsm.go
Outdated
go p.monitorCrossConnects(mgr.Status.URL) | ||
} | ||
} | ||
for atomic.LoadInt64(&p.state) == common.RunningState { |
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.
you're right, let's remove run() and move this code to Start()
topology/probes/nsm/nsm.go
Outdated
} | ||
|
||
// OnNodeAdded event | ||
// We assume skydive has locked the graph before calling this function |
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.
nit: correct, therefor this comment can safely be removed :-)
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.
fine, that was just a reminder :)
run skydive-functional-tests-backend-orientdb |
a121158
to
de1d1f9
Compare
run skydive-functional-tests-backend-orientdb |
You should add skydive CI tests to maintain probe quality if not handled in this PR then open an issue to track. This would include:
|
Regarding comments please see: https://blog.golang.org/godoc-documenting-go-code Specifically the convention is to proceed the comment text with the name of function/method being documented. |
Other than nsm.NewNsmProve() used by the analyzer ( https://github.com/skydive-project/skydive/pull/1636/files#diff-a990c838e9c8856f44e8e5edebf41b96 ) all other function/types should be private and start with a lowercase |
de1d1f9
to
52d2bf2
Compare
@hunchback thanks for your review. I've updated and rebased the Patch. |
52d2bf2
to
6a2f45d
Compare
4650437
to
d1be563
Compare
return | ||
} | ||
p.g.RemoveEventListener(p) | ||
for _, conn := range p.nsmds { |
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.
p.nsmds should be protected by a mutex as it is read/write from two go-routine L104, L124 and 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.
I'll use the mutex of the probe struct
run skydive-scale-tests |
77a2a70
to
56496d1
Compare
This probe listens at NSM crossconnect monitoring events. For each new crossconnect reported by nsm, a new Skydive edge is created. See: https://github.com/networkservicemesh/networkservicemesh Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
This patch contains the probe used for NSM demos.
Rendering patches, related to javascript files, will be part of subsequent patches.