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

need to identify "Ephemeral" / Temporary disks #77

Open
smoser opened this issue May 27, 2020 · 1 comment
Open

need to identify "Ephemeral" / Temporary disks #77

smoser opened this issue May 27, 2020 · 1 comment

Comments

@smoser
Copy link
Collaborator

smoser commented May 27, 2020

Ephemeral disks (aka Temporary or Resource Disks) are typically local disks to a cloud instance. They have lower reliability than other disks. users of disko would like to be able to know if a disk is Ephemeral so they can make decisions on how to use it.

Attached is an example diff I came up with that adds Properties to the Disk. One of the properties is 'Ephemeral'. ephemeral-as-properties.diff.txt.

@tych0 suggested that I just add an 'IsEphemeral()' method on the Disk type. The thing I didn't like about that was that the implementation supporting Azure looked like below, which was very linux specific, but the Disk is (ignoring UdevInfo) not linux-specific.

// IsEphemeral - is this an Ephemeral Disk (aka Resource or Temporary Disk or Instance Store)
func (d *Disk) IsEphemeral() bool {
        rx := regexp.MustCompile(`.*/VMBUS:\d\d/00000000-0001-\d{4}-\d{4}-\d{12}/host.*`)
        return rx.MatchString(d.UdevInfo.SysPath)
}

Second, when I looked at support EC2 (#76) a IsEphemeral implementation would be EC2 and linux specific and require hitting the HTTP metadata service.

My feeling was to instead just add Properties or something to that effect that would be correctly populated in Scan() and then not have to deal with a cache. Unfortunately as it is right now, I don't know what other kinds of Properties I'd have.

IsEphemeral would just look like:

func (d *Disk) IsEphemeral() bool {
    for _, p := range(d.Properties) {
        if p == Ephemeral { return true ; }
    }
    return false
}

I decided to write things down (in this issue) for the moment and table it until the IsEphemeral is actually requested.

Links:

@tych0
Copy link
Contributor

tych0 commented May 27, 2020

The thing I didn't like about that was that the implementation supporting Azure looked like below, which was very linux specific, but the Disk is (ignoring UdevInfo) not linux-specific.

So perhaps Disk should be an interface, instead of a struct? Then you can have a LinuxDisk, which has all this stuff, and the interface would just specify IsEphemeral() (bool, error), and return an error in the non-linux case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants