-
Notifications
You must be signed in to change notification settings - Fork 913
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
vcsim: add support for PropertyCollector incremental updates #1170
Conversation
Still some tests and doc to add, but the basics are functioning now. There are still methods that are setting object fields directly, we can convert more to using A few examples that now work against vcsim: % govc tasks -f
% govc events -f
% govc object.collect -wait 1h -type m / runtime.powerState |
8b4cddf
to
0f2ee66
Compare
Added more tests and property path filters since opening the PR, ready for review now. |
0c52d89
to
c7b8abd
Compare
govc/flags/client.go
Outdated
werr = f(wctx) | ||
}() | ||
|
||
sig := make(chan os.Signal) |
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.
sig := make(chan os.Signal, 1)?
https://gobyexample.com/signals as a reference
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.
That reference doesn't say why though. Go's docs are a bit better: https://golang.org/pkg/os/signal/#Notify
Your comment here also made me realize the sig
channel needs to be created earlier, before the go routine calling f
is started. Changed so that happens first.
simulator/race_test.go
Outdated
@@ -82,30 +131,19 @@ func TestRace(t *testing.T) { | |||
t.Fatal(err) |
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.
Here is the tricky part, about t.Fatal()
in goroutine. I have read similar code before when I was learning Golang and I searched online. There is a group discussion: Whenever t.Fatal is called in a goroutine, it is swallowed and lost.
(reference https://groups.google.com/forum/#!topic/vault-tool/zNlHJLxoo3w, also here ipfs/kubo#2043). One of their guys also used staticcheck
to check their code. So, for double check, I also ran it against this file. Result is the same as theirs. So, we can discuss about that.
Line 119, 126, 131, 152
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.
Good catch, I've changed those to use t.Error
instead.
Generally, I pulled your PR and ran some commands, it works well. |
f573a39
to
8a778fc
Compare
@dougm Travis CI build failed here. |
Yeah I've been re-running the Travis build manually as the race detector is finding some issues that I don't see locally. I'll fix the Fatal -> Error logs. |
8a778fc
to
7fe2394
Compare
Looks good to me 👍 |
3b18524
to
faaeee8
Compare
Prior to this change, clients could only call WaitForUpdatesEx once, which would return the current state. The next invocation with Version given would fail as unsupported. Clients can now use WaitForUpdatesEx to wait for multiple updates. The basic idea is that methods should now update object fields using the Registry.UpdateObject method instead of setting fields directly. UpdateObject uses the same PropertyChange structure that is sent as part of the WaitForUpdatesEx response. UpdateObject will also apply the PropertyChange(s) to the local object, removing the need to set fields directly. - govc commands now use Client.Flag.WithCancel to catch SIGINT, allowing proper cleanup of collectors - Add vcsim ListView support to ViewManager Fixes vmware#922
faaeee8
to
39e6592
Compare
Prior to this change, clients could only call WaitForUpdatesEx once,
which would return the current state. The next invocation with Version
given would fail as unsupported. Clients can now use WaitForUpdatesEx
to wait for multiple updates.
The basic idea is that methods should now update object fields using
the
Registry.Update
method instead of setting fields directly.Registry.Update
uses the same PropertyChange structure that is sent aspart of the WaitForUpdatesEx response.
Registry.Update
will also applythe PropertyChange(s) to the local object, removing the need to set
fields directly.
govc commands now use Client.Flag.WithCancel to catch SIGINT,
allowing proper cleanup of collectors
Add vcsim ListView support to ViewManager
Fixes #922