nvme-amz

Crates.ionvme-amz
lib.rsnvme-amz
version0.3.0
sourcesrc
created_at2024-09-08 04:11:09.693012
updated_at2024-09-21 03:12:18.198151
descriptionA library to probe NVMe devices in Amazon EC2
homepage
repositoryhttps://github.com/cloudboss/nvme-amz
max_upload_size
id1367752
size20,728
rust-team (github:ensicoindevs:rust-team)

documentation

README

nvme-amz

A Rust library to probe NVMe devices in Amazon EC2.

It provides functionality similar to that of the ebsnvme-id command but adds information about instance store devices, not only EBS.

To use this library, you must define one of the features ioctl-nix or ioctl-rustix. Either nix or rustix will be pulled in as dependencies, respectively. The chosen library is used to make ioctl system calls.

The library implements TryFrom<File> for Nvme, so this is how to interact with it. For example:

use nvme_amz::Nvme;

fn main() {
    let file = File::open("/dev/nvme0").expect("unable to open device");
    let nvme: Nvme = file.try_into().expect("unable to probe device");
    println!("{:?}", nvme);
}

Output for an EBS volume:

Nvme { names: Names { device_name: Some("sda"), virtual_name: None }, model: AmazonElasticBlockStore, vendor_id: VendorId(7439) }

Output for an instance store volume:

Nvme { names: Names { device_name: Some("sdb"), virtual_name: Some("ephemeral0") }, model: AmazonInstanceStore, vendor_id: VendorId(7439) }
Commit count: 13

cargo fmt