Create schema: dmedia/drive and dmedia/partition.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Dmedia |
In Progress
|
High
|
David Green |
Bug Description
This is related to:
lp:692449
lp:714941
I've created a simple udisks wrapper in lp:~david4dev/dmedia/udisks .
We need a way to store drive and partition information for imports and file stores. IMO the best way to do this is through separate schema for partition and drive. That way imports and file stores could simply link to the document for the partition (which itself could link to the drive).
I suggest something like this for the partition schema:
>>> doc = {
... '_id': '1a123456-
... 'type': 'dmedia/partition',
... 'size':
... 'label':'Data',
... 'partition_
... 'fs':'ext4',
... 'drive'
... }
Where _id is the UUID (http://
Something like this for the drive schema:
>>> doc = {
... '_id': 'irojEJDwkdmsoJ
... 'type': 'dmedia/device',
... 'size':
... 'serial'
... 'wwn':'
... 'vendor':'BELKIN',
... 'model'
... 'revision':'3.07'
... }
Where _id is a random id. size is the drive size in bytes. serial is the drive serial (http://
So the filestore and import schema can have a 'partition' key which has the value of the _id or the partition document.
Does this make sense?
Related branches
- Jason Gerard DeRose: Approve
-
Diff: 801 lines (+503/-22)8 files modifieddmedia/importer.py (+14/-2)
dmedia/schema.py (+245/-12)
dmedia/tests/test_core.py (+2/-0)
dmedia/tests/test_importer.py (+3/-1)
dmedia/tests/test_schema.py (+17/-6)
dmedia/udisks.py (+146/-0)
dmedia/views.py (+57/-1)
misc/debug-udisks.py (+19/-0)
Changed in dmedia: | |
status: | New → Triaged |
importance: | Undecided → High |
Changed in dmedia: | |
assignee: | nobody → David Green (david4dev) |
tags: | added: udisk |
Changed in dmedia: | |
status: | Triaged → In Progress |
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?