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