Comment 1 for bug 812048

Revision history for this message
David Green (david4dev) wrote :

Actually I think the _id of dmedia/drive shouldn't be a random string because that has no relation to the actual drive. This means we might unintentionally get several entries for the same drive.

We really need a functional mapping of a drive to an id and I was thinking we could use the serial for this. The only thing holding me back is the possibility that serial is unknown and therefore blank (see: http://hal.freedesktop.org/docs/udisks/Device.html#Device:DriveSerial ).

Perhaps we could use a hash of the information we have. Something like this:

    hashlib.md5("%s-%s-%s-%s-%s" % (vendor,model,revision,serial,wwn)).hexdigest()

I know md5 isn't the most secure hashing algorithm but it's realistically good enough for this use case and gives a relatively terse id (only 32 characters).

Any feedback on this?