diff --git a/utils/nvme.go b/utils/nvme.go index 020083398..10787e92f 100644 --- a/utils/nvme.go +++ b/utils/nvme.go @@ -108,16 +108,15 @@ func (n *Nvme) Drives(ctx context.Context) ([]*model.Drive, error) { drives[i] = model.NewDrive(&common.Drive{ Common: common.Common{ - LogicalName: d.DevicePath, - Serial: d.SerialNumber, - Vendor: vendor, - Model: dModel, - ProductName: d.ProductName, - Description: d.ModelNumber, - Firmware: &common.Firmware{ - Installed: d.Firmware, - }, - Metadata: metadata, + LogicalName: d.DevicePath, + Serial: d.SerialNumber, + Vendor: vendor, + Model: dModel, + ProductName: d.ProductName, + Description: d.ModelNumber, + Firmware: &common.Firmware{Installed: d.Firmware}, + Capabilities: capabilitiesFound, + Metadata: metadata, }, }, nil) } diff --git a/utils/nvme_test.go b/utils/nvme_test.go index 0dafc0e00..21822263e 100644 --- a/utils/nvme_test.go +++ b/utils/nvme_test.go @@ -19,6 +19,15 @@ func Test_NvmeComponents(t *testing.T) { expected := []*model.Drive{ {Drive: common.Drive{Common: common.Common{ LogicalName: "/dev/nvme0n1", Serial: "Z9DF70I8FY3L", Vendor: "TOSHIBA", Model: "KXG60ZNV256G TOSHIBA", Description: "KXG60ZNV256G TOSHIBA", Firmware: &common.Firmware{Installed: "AGGA4104"}, ProductName: "NULL", + Capabilities: []*common.Capability{ + {Name: "fmns", Description: "Format Applies to All/Single Namespace(s) (t:All, f:Single)", Enabled: false}, + {Name: "cens", Description: "Crypto Erase Applies to All/Single Namespace(s) (t:All, f:Single)", Enabled: false}, + {Name: "cese", Description: "Crypto Erase Supported as part of Secure Erase", Enabled: true}, + {Name: "cer", Description: "Crypto Erase Sanitize Operation Supported", Enabled: false}, + {Name: "ber", Description: "Block Erase Sanitize Operation Supported", Enabled: false}, + {Name: "owr", Description: "Overwrite Sanitize Operation Supported", Enabled: false}, + {Name: "ndi", Description: "No-Deallocate After Sanitize bit in Sanitize command Supported", Enabled: false}, + }, Metadata: map[string]string{ "Block Erase Sanitize Operation Supported": "false", "Crypto Erase Applies to All/Single Namespace(s) (t:All, f:Single)": "false", @@ -31,6 +40,15 @@ func Test_NvmeComponents(t *testing.T) { }}}, {Drive: common.Drive{Common: common.Common{ LogicalName: "/dev/nvme1n1", Serial: "Z9DF70I9FY3L", Vendor: "TOSHIBA", Model: "KXG60ZNV256G TOSHIBA", Description: "KXG60ZNV256G TOSHIBA", Firmware: &common.Firmware{Installed: "AGGA4104"}, ProductName: "NULL", + Capabilities: []*common.Capability{ + {Name: "fmns", Description: "Format Applies to All/Single Namespace(s) (t:All, f:Single)", Enabled: false}, + {Name: "cens", Description: "Crypto Erase Applies to All/Single Namespace(s) (t:All, f:Single)", Enabled: false}, + {Name: "cese", Description: "Crypto Erase Supported as part of Secure Erase", Enabled: true}, + {Name: "cer", Description: "Crypto Erase Sanitize Operation Supported", Enabled: false}, + {Name: "ber", Description: "Block Erase Sanitize Operation Supported", Enabled: false}, + {Name: "owr", Description: "Overwrite Sanitize Operation Supported", Enabled: false}, + {Name: "ndi", Description: "No-Deallocate After Sanitize bit in Sanitize command Supported", Enabled: false}, + }, Metadata: map[string]string{ "Block Erase Sanitize Operation Supported": "false", "Crypto Erase Applies to All/Single Namespace(s) (t:All, f:Single)": "false",