Tendrl / specifications

Tendrl specs go here
GNU Lesser General Public License v3.0
6 stars 16 forks source link

Spec disk inventory etcd structure #159

Closed GowthamShanmugam closed 7 years ago

GowthamShanmugam commented 7 years ago

@brainfunked @r0h4n @nnDarshan please review

GowthamShanmugam commented 7 years ago

@brainfunked @r0h4n @shtripat @nnDarshan hwinfo gives Device Files: /dev/vdh, /dev/disk/by-id/virtio-78065dbf-92db-4574-8, /dev/disk/by-path/virtio-pci-0000:00:0e.0 here /dev/disk/by-id/virtio-78065dbf-92db-4574-8 is never change for that particular disk even disk name change when we do deactivate disk. we can use this, but problem is for real machine it gives two id like Device Files: /dev/sda, /dev/disk/by-id/ata-SAMSUNG_MZ7TE512HMHP-000L1_S1GJNSAG400778, /dev/disk/by-id/wwn-0x4d30445853885002

both format looks different

GowthamShanmugam commented 7 years ago

Here only problem is id

GowthamShanmugam commented 7 years ago

Some unique id is needed we can't use (manufacturer-id+vendor-id+device-serial-number), Because Vm does not have vendor details

shtripat commented 7 years ago

@GowthamShanmugam I feel /dev/disk/by-id/ata-SAMSUNG_MZ7TE512HMHP-000L1_S1GJNSAG400778 is more meaningful if you can get and use.

GowthamShanmugam commented 7 years ago

@shtripat in VM it comes like /dev/disk/by-id/virtio-78065dbf-92db-4574-8 is that ok?

shtripat commented 7 years ago

@GowthamShanmugam I feel that should be fine as long as it doesnt change on removal and addition of new disks in between the list.

@Tendrl/tendrl-core comments?

brainfunked commented 7 years ago

The disk id for a physical disk is assembled using the "Vendor", "Device" and "Serial ID" attributes.

If these three fields are absent, check if the values of the "Driver" attribute are virtio*. If yes, then use the value of the virtio- part from the "Device Files" list where the first value in the list matches the regex .+\/by-id\/(virtio-.+). The match 1 would contain the string virtio- which would be used as the id.

GowthamShanmugam commented 7 years ago

@brainfunked @r0h4n @nnDarshan if we store disk(hwinfo), block_device(lsblk) then free disk will not have disk_size and ssd or not. Because hwinfo is not providing these details.

One more issue is we can use block_device object to append lsblk details with disk because, key for block device should be one per object but this case key comes twice like it has to store under disk and partition also.

Is hashing will solve the issue like disk directory contain two disk details but locally collected disk detail have one disk detail, is that extra one is deleted from etcd. what kind of approach for that hashing. because i have to delete extra disk under /Disks and extra partition details for particular Disk.

/dev/disk gives by-id/ by-uuid/ for some machine by-id/ by-partlabel/ by-partuuid/ by-path/ by-uuid/ so it is not fixed am i create object for this like class RawReferences contains attr: reference (json) Here json structure like { "by-id": "all by id details as single string", "by-uuid": "all uuid details as single string" . . . }