Skip to content
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

main: Add -version #444

Merged
merged 1 commit into from
Oct 16, 2018
Merged

main: Add -version #444

merged 1 commit into from
Oct 16, 2018

Commits on Oct 15, 2018

  1. main: Add -version

    Give callers an easy way to extract both the plugin version and the
    dependency versions.  With this commit:
    
      $ ./terraform-provider-libvirt -version
      ./terraform-provider-libvirt 48adac3-dirty
      Compiled against library: libvirt 3.9.0
      Using library: libvirt 3.9.0
      Running hypervisor: QEMU 2.9.0
      Running against daemon: 3.9.0
    
    The details are very similar to:
    
      $ virsh version --daemon
      Compiled against library: libvirt 3.9.0
      Using library: libvirt 3.9.0
      Using API: QEMU 3.9.0
      Running hypervisor: QEMU 2.9.0
      Running against daemon: 3.9.0
    
    except the Go bindings do not currently expose the API version [1].
    I've submitted a patch to libvirt-go adding ParseVersion there.  But
    until then, carrying our own parseVersion shouldn't be too much
    trouble.
    
    Passing an empty string to NewConnect ends up passing a nil pointer
    through to virConnect [2], which will give us libvirt's internal
    default URI logic [3,4].
    
    I hunted around for a way to expose the version information in
    Terraform.  Currently:
    
      $ cat main.tf
      provider "libvirt" {
        uri = "qemu:///system"
      }
      $ terraform version
      Terraform v0.11.8
      + provider.libvirt (unversioned)
    
    but the RPC API is not particularly clear to me, and the versions
    there may be extracted from plugin filenames and not from RPC calls.
    
    [1]: https://libvirt.org/git/?p=libvirt-go.git;a=blob;f=connect.go;h=8cc7cc771f7d258400175df47fcc8b3779ef4930;hb=9c5bdce3c18faad94cb383e7ec42f5122a8c7fa1#l313
    [2]: https://libvirt.org/git/?p=libvirt-go.git;a=blob;f=connect.go;h=8cc7cc771f7d258400175df47fcc8b3779ef4930;hb=9c5bdce3c18faad94cb383e7ec42f5122a8c7fa1#l322
    [3]: https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpen
    [4]: https://libvirt.org/uri.html#URI_default
    wking committed Oct 15, 2018
    Configuration menu
    Copy the full SHA
    91d0e45 View commit details
    Browse the repository at this point in the history