agent: add GetGuestDetails gRPC function#358
agent: add GetGuestDetails gRPC function#358caoruidong merged 1 commit intokata-containers:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #358 +/- ##
==========================================
+ Coverage 46.92% 47.21% +0.28%
==========================================
Files 15 15
Lines 2391 2442 +51
==========================================
+ Hits 1122 1153 +31
- Misses 1129 1140 +11
- Partials 140 149 +9 |
91504c0 to
15cf4fb
Compare
|
@linzichang Thanks for the PR, but it looks a bit hacky to me to use I like the approach since we would rely on actual data from the guest OS, instead of having some hardcoded value from each hypervisor implementation, depending on the architecture. That being said, we need a fallback, by proposing some default values, in case the grpc function is not supported by the agent, or return a non valid value for some reason. |
|
@sboeuf So you think we should:
|
|
@linzichang - I think that's what @sboeuf is saying, yes. I have to admit, I'm still unclear about the gRPC best practice we're encountering here - should we be adding as many discrete functions as we need? Or should we be trying to provide more general functions that could return the values we need. In this case, the latter approach might be to create a new call like: Of course if each gRCP call took a significant amount of time, we'd be more motivated to go for the general approach. Although we now have tracing in the runtime and although that includes gRCP client flows, it's not that easy to determine how much time is attributable directly to the protocol handling itself. As noted in kata-containers/kata-containers#27 (comment), the first gRPC call ( However, I added a second call to that essentially "empty" / NOP call in /cc @grahamwhaley. |
|
@jodh-intel Like we talk in #357 , it's very wonderful for some experts to give a gRPC design guide for our project. In this single case, we can just add a |
|
Hi @linzichang - I agree, but I also think we're a little uncertain about the implications of gRPC changes. I've seen comments suggesting we should effectively "do all the gRPC changes 'now'" as the project is still changing rapidly". But at the same time, we're also being cautious to avoid breaking gRPC compatibility. We now have new stable branches and things like kata-containers/documentation#196 to think about now along with upgrade / downgrade strategies. I don't want us to stall on these sorts of issues but I do think we need clarification on such changes asap which suggests another discussion at the Architecture Committee meeting to me. /cc @egernst, @bergwolf, @sboeuf, @grahamwhaley. |
|
@linzichang Could you do this in a separate gRPC call? The check gRPC is too frequent for such a one time attribute query. What about something like, Then kata-runtime only needs to query when necessary. And the API is extensible for future needs if we want to query more resource attributes. |
|
@bergwolf Yes, after discuss in this conversation, we all decide to make new gRPC call. I will rework on this PR. |
|
Thanks @linzichang - sorry for the extra work as it was my suggestion to re-use (aka abuse) @bergwolf's - I like your suggested solution. btw, if you use the magic |
|
@linzichang Please fix CI as the mock server also needs to implement the new grpc API. Other than that it looks good to me. Thanks! |
485c6f4 to
c215570
Compare
|
Fixed CI and added a go test. |
grpc_test.go
Outdated
| MemBlockSize: true, | ||
| } | ||
|
|
||
| _, err := a.QueryResource(context.TODO(), req) |
There was a problem hiding this comment.
How about also comparing the return value with /sys/devices/system/memory/block_size_bytes?
There was a problem hiding this comment.
I think about this too but it's dispensable. I will update it.
455e03e to
1d8606d
Compare
|
PTAL |
|
Based on the discussion we just had in the Architecture Meeting, we probably want to change this to a more generic name as outlined in #358 (comment). |
|
Yes I agree. @linzichang the PR looks good and is almost ready to be merged, but please change |
|
@sboeuf @jodh-intel I'd like to keep the leading |
|
Yes, I think |
|
The latest kata-runtime build failed. |
|
@linzichang yeah, see kata-containers/runtime#710 |
|
a |
c2eb99c to
e492e4b
Compare
To get memory hotplug align boundary, need read /sys/devices/system/memory/block_size_bytes in guest. Add a function to do this and we can also extend to get other details in the future. Fixes kata-containers#354 Signed-off-by: Zichang Lin <linzichang@huawei.com>
|
CI is OK. |
Fixes #354