-
Notifications
You must be signed in to change notification settings - Fork 458
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
information returned by node-info from recent PR #1042 is incorrect #1074
Comments
Hi, at the time I implemented node-info using https://libvirt.org/html/libvirt-libvirt-host.html#virNodeInfo which returns what you saw (with incorrect data) and I did not see that virConnectGetCapabilities exists. Since a release was not cut that includes this format, I'd say feel free to update it to the capabilities structure. Alternatively, you can add a libvirt_node_capabilities data source, which would map to the virConnectGetCapabilities better, if someone is already using the current node_info (doubt it). Edit: what I needed at the time was a way to determine total memory on the host and cpu cores, in order to make decisions about the number of cpu cores and memory allocated to VMs. On second thought I would recommend implementing an additional data source named libvirt_node_capabilities because memory doesn't "fit" in the capabilities object and to better map 1:1 what libvirt has with what the provider providess |
@memetb I think we can merge your approach, however I am a bit confused on:
If we get it with the right naming, I'd then suggest to deprecate the node info version: |
@dmacvicar I'm open to name by consensus. Reason for my chosing nodeinfo is because of the
Note that With regards to your highlighted warning in the libvirt documentation, the implementation does end up using virtConn.ConnectGetCapabilities(), however the way I read it, that documentation is saying "use virtConn.ConnectGetCapabilities() to obtain nodeinfo". However, all that said (as to why I did it that way), there is clearly some dirty abstraction leaks going on above, which is unfortunate. Here are the outputs of the two calls on my system:
The original goal of this PR was to quickly (and without any hacks like running a command remotely) determine the host's native CPU arch. I ended up using the capabilities path because the output was incorrect as @muresan noted. The implementation as it is right now only unmarshalls nodeinfo related information, and lacks the full unmarshalling of available capabilities (in particular, topology isn't unmarshalled yet), however it is more correctly the capabilities. In conclusion, I think your request is sensible: we can name it |
Looking at the virsh nodeinfo implementation, it is using cmdCapabilities is implemented with So, I think it make sense to separate them. The prefix could be |
That sounds good. I will get these updates done sometime this week. We should at least move these conclusions over to #1073 comment thread for posterity. |
this is related to the conversation in issue dmacvicar#1074. The original implementation of nodeinfo (as released in PR dmacvicar#1042) has a bug - which may very well be easily fixed - however the current PR and branch specifically addressed that issue by calling virConnectGetCapabilities instead of virNodeGetInfo. Instead of doing this, a new feature "host_capabilities" is added, and the nodeinfo code is left unchanged (it may be addressed in a separate PR)
System Information
Linux distribution
any
Terraform version
Provider and libvirt versions
Description of Issue/Question
Setup
I recently implemented a very similar feature in PR #1073 without realizing that #1042 had very recently been merged. I'm happy to close my PR however the output of the node info is incorrect and less expansive than it could.
Example:
produces
By contrast, this is the output of the node info as implemented in PR #1073
The implementation for #1073 libvirt/data_source_libvirt_nodeinfo.go pulls and parses the direct XML dump from virt.
I believe it to be more expressive and open to upgrading, especially given that the actual topology can be decoded with a bit extra effort.
I am working on two other PR's right now (#1072 and #1059). I'd be happy to rework #1073 to fix the above. My only ask would be to name the parameters as I've done (i.e.
cores
notcpu_cores_per_socket
) mainly because I've used the sames names as libvirt capabilities schema@michaelbeaumont @rustydb @dmacvicar
The text was updated successfully, but these errors were encountered: