Add isContainerdRunning() and getContainerdVersion().
This commit is contained in:
parent
fee9df03f4
commit
883b5f0397
@ -4,10 +4,10 @@ import (
|
||||
"github.com/containerd/containerd"
|
||||
)
|
||||
|
||||
func isContainerdRunning(c *containerd.Client) (bool, error) {
|
||||
return true, nil
|
||||
func (d *Driver) isContainerdRunning() (bool, error) {
|
||||
return d.client.IsServing(d.ctxContainerd)
|
||||
}
|
||||
|
||||
func getContainerdVersion(c *containerd.Client) (string, error) {
|
||||
return "1.3.3", nil
|
||||
func (d *Driver) getContainerdVersion() (containerd.Version, error) {
|
||||
return d.client.Version(d.ctxContainerd)
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ func (d *Driver) buildFingerprint() *drivers.Fingerprint {
|
||||
HealthDescription: drivers.DriverHealthy,
|
||||
}
|
||||
|
||||
isRunning, err := isContainerdRunning(d.client)
|
||||
isRunning, err := d.isContainerdRunning()
|
||||
if err != nil {
|
||||
d.logger.Error("Error in buildFingerprint(): failed to get containerd status: %v", err)
|
||||
fp.Health = drivers.HealthStateUndetected
|
||||
@ -274,13 +274,14 @@ func (d *Driver) buildFingerprint() *drivers.Fingerprint {
|
||||
}
|
||||
|
||||
// Get containerd version
|
||||
version, err := getContainerdVersion(d.client)
|
||||
version, err := d.getContainerdVersion()
|
||||
if err != nil {
|
||||
d.logger.Warn("Error in buildFingerprint(): failed to get containerd version: %v", err)
|
||||
return fp
|
||||
}
|
||||
|
||||
fp.Attributes["driver.containerd.containerd_version"] = structs.NewStringAttribute(version)
|
||||
fp.Attributes["driver.containerd.containerd_version"] = structs.NewStringAttribute(version.Version)
|
||||
fp.Attributes["driver.containerd.containerd_revision"] = structs.NewStringAttribute(version.Revision)
|
||||
return fp
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user