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

Specification: Adding disk details in hardware inventory #21

Merged
merged 1 commit into from
Jan 5, 2017

Conversation

GowthamShanmugam
Copy link
Contributor

Signed-off-by: GowthamShanmugam gshanmug@redhat.com

@GowthamShanmugam GowthamShanmugam changed the title Specification for disk details in hardware inventory Specification: Adding disk details in hardware inventory Dec 7, 2016
@GowthamShanmugam
Copy link
Contributor Author

@shtripat @r0h4n @nnDarshan please review it

@@ -0,0 +1,113 @@
= Specification for adding disk details in node hardware inventory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer my comments from: #19 (review) . More or less all the suggestions hold good here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will change it

@GowthamShanmugam
Copy link
Contributor Author

@nnDarshan @shtripat @r0h4n @Tendrl/qe Please review it

Currently disk details are missing in node hardware inventory. Add disk details
in node hardware inventory and disk details should contain device_name, fs_type,
fs_uuid, model, mount_point, parent, size, name, disk_type, used, ssd, vendor,
disk_id, node_id.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an issue of disk names getting remapped when one of the disks are removed from existing inventory. @brainfunked was talking about some disk-id/fsid maintained by kernel can be used to maintain the uniqueness of the disk. This needs to figured out and added to this spec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will find it out and update in this specification file


=== Tendrl/node_agent impact

Modify persistence and manager modules to find and store disks details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any changes required in the tendrl definitions should be captured here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will add it

node_inventory list.
* Create a new class in persistence module to keep disk details.
* Populate the object using node_inventory list and persist the object in etcd.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More details should go in here like the command used and output as in the pull request #6

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will add command and output in this spec file


== Tendrl API impact:

Api to get disk details v2/keys/nodes/node_id/Disks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need a separate API to get the disk details of the node?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think no need, everything comes from node api. I will remove it


== Notifications/Monitoring impact

We might have to monitor the status of the disk.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How? If you think this should be addressed as part of another spec, raise github issues and link it here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a field called "used", it will tell whether a disk is used or not. I have mentioned this field as monitor here.

@GowthamShanmugam
Copy link
Contributor Author

@brainfunked I have checked disk id for formatted and un formatted disk, I can't find out any unique id for both disk. A command ls /dev/disk/by-id is giving id for all disks but it generated based on disk serial number, But this id is not in good format

lrwxrwxrwx. 1 root root 9 Dec 9 17:07 ata-QEMU_DVD-ROM_QM00003 -> ../../sr0
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 dm-name-centos_dhcp43--215-home -> ../../dm-2
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 dm-name-centos_dhcp43--215-root -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 dm-name-centos_dhcp43--215-swap -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 dm-uuid-LVM-siZdB23ClU7bGFdOVaKmF9zbfrzHitPC7jfbdLR3L2ZXrZbfWxpmhsfAOZlzC8Rr -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 dm-uuid-LVM-siZdB23ClU7bGFdOVaKmF9zbfrzHitPCgY4PWjp2pkMPfW0YWs2zQ1ZOxdBDgcop -> ../../dm-2
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 dm-uuid-LVM-siZdB23ClU7bGFdOVaKmF9zbfrzHitPCIBcS9jnPs9Y3g7RmKXi2JeQXjWuKZmdh -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 lvm-pv-uuid-rbjgZ0-WzdS-Jjjv-rSEN-Nldu-BCUI-at138w -> ../../vda2
lrwxrwxrwx. 1 root root 9 Dec 9 17:07 virtio-539e2d8b-86d9-4d43-a -> ../../vda
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 virtio-539e2d8b-86d9-4d43-a-part1 -> ../../vda1
lrwxrwxrwx. 1 root root 10 Dec 9 17:07 virtio-539e2d8b-86d9-4d43-a-part2 -> ../../vda2
lrwxrwxrwx. 1 root root 9 Dec 9 17:07 virtio-b8910937-0697-4030-9 -> ../../vdc
lrwxrwxrwx. 1 root root 9 Dec 9 17:07 virtio-ee4e2f4b-754f-4d6d-9 -> ../../vdb

I dont think it is usable

@mkudlej
Copy link

mkudlej commented Dec 12, 2016

@nnDarshan
Copy link
Contributor

@mkudlej The initial plan was to use lsblk. But the concern we see is, when lsblk is used it doesn't give UUID for a raw disk. UUID is available only for provisioned disks. If you are aware of any tool that can give UUID for all type of disks(raw and used) please let us know.
NOTE: we cant use disk name to identify the disk as it might change after reboot.

@nthomas-redhat
Copy link
Contributor

@GowthamShanmugam suppose if you don't have any such id available, can you document an alternative approach to handle this?We need to make a decision and move on at the earliest.

@nnDarshan
Copy link
Contributor

nnDarshan commented Dec 13, 2016

If we don't have such IDs available then, my suggestion would be to store used and raw disks separately. And use disk-uuid to identify used-disks and use disk-name to identify unused raw disks.something like:

  • nodes/node-id/disks/used/disk-uuid/ for used
  • nodes/node-id/disks/free/disk-name/ for raw disks.

We are mainly concerned about the rename of the disks that are being used, If we use UUID for disks that are being used this issue will be solved. And we are not bothered about the rename of unused disks, any how the disk details will be updated as part of hardware inventory sync. Also, if we go with the above approach, lsblk command would suffice.

@GowthamShanmugam
Copy link
Contributor Author

@nnDarshan am i modify the specification file as per your comment?

@nnDarshan
Copy link
Contributor

@GowthamShanmugam wait.
@nthomas-redhat @r0h4n @brainfunked Please provide your inputs

@shtripat
Copy link
Member

@nnDarshan your suggestion looks good to me but the only thing is the etcd dir names dont look good. May be the I would suggest rather apis as below

/nodes/<node-id>/used_disks

/nodes/<node-id>/free_disks

The only issue with this I see is that we would have keep removing entries from free_disks once they are moved to used.

@nthomas-redhat
Copy link
Contributor

@nnDarshan looks good to me. Please double check

  • disk removal(free/used)
  • free --> used transition
  • used->free transition(OSD removed and formatted)
  • new disk addition

@shtripat etcd path suggested by @nnDarshan (nodes/node-id/disks/used/disk-uuid/ ) looks better to me.

@GowthamShanmugam
Copy link
Contributor Author

@nnDarshan , @nthomas-redhat @shtripat please review it

@shtripat
Copy link
Member

@nthomas-redhat

@shtripat etcd path suggested by @nnDarshan (nodes/node-id/disks/used/disk-uuid/ ) looks better to me.

My suggestion is almost matching with this. The only thing is I am merging words disks + used. so final apis could be like

/nodes/<node-id>/used_disks/<disk-uuid>   for used ones
/nodes/<node-id>/free_disks/<disk-name>  for free ones

It reduces one level of apis in URL :)

@GowthamShanmugam
Copy link
Contributor Author

Copy link
Contributor

@nthomas-redhat nthomas-redhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brainfunked
Copy link
Contributor

Implemented in Tendrl/node-agent#78

== Work Items

* Add Util-linux as a dependency.
* Create a new class called in persistence module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a new class called what?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New class nothing but Disk in persistence to keep disk details

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The statement is incomplete @GowthamShanmugam , "Create a new class called in persistence module"

shouldnt it be "Create a new class called Disk in persistence module" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disk details are stored from inventory list to Disk class instance , and store instance in etcd

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the document with the class name please.


== Work Items

* Add Util-linux as a dependency.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this available in epel and rhel6/7 and pip?

Copy link
Contributor Author

@GowthamShanmugam GowthamShanmugam Dec 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for rhel, util-linux, pip i dont know

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need it available in PIP and epel

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for epel it is available

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@r0h4n i am using lsblk command for find disk details.. do we really need this package... It is a default pakcage in linux right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for pip it is not available

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lsblk is a basic command in linux right.. it is available in all linux os... do we really need to specify this package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be in pip. We'll just need to execute system commands and parse their output.

None

== Other deployer impact

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a new dependency being added, please document impact @nthomas-redhat @TimothyAsir

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..and add the necessary dependencies to the RPM spec file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates @nthomas-redhat ?

== Work Items

* Add Util-linux as a dependency.
* Create a new class called in persistence module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The statement is incomplete @GowthamShanmugam , "Create a new class called in persistence module"

shouldnt it be "Create a new class called Disk in persistence module" ?

@GowthamShanmugam
Copy link
Contributor Author

@r0h4n ok i will change it in specification file


* Add used disk details in etcd with key nodes/node_id/Used_disks.
* Add free disk details in etcd with key nodes/node_id/Free_disks.
* Add two different object in tendrl definitions for used_disk and free_disk.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There needs to be one object per disk under the disks directory. This object's key needs to be it's unique id. This unique id must always be present, whether the disk is free or in use. The used and free directories under disks need to simply contain objects that are the same id as the object in disks. The objects under free and used can be empty. The objects under disks should contain all the information about a disk, including it's partitions. We'll get the following structure:

/nodes/<node_id>/disks
|--> <disk_id1> # object with all the details for disk_id1
|--> <disk_id2> # object with all the details for disk_id2
|--> /used
|--|--> <disk_id1> # empty object
|--> /free
|--|--> <disk_id2> #empty object

@GowthamShanmugam
Copy link
Contributor Author

@nthomas-redhat @shtripat @brainfunked please review this


== Proposed change

* "hwinfo" and "lsblk" to find the disk details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel some of the details like classes etc should move to implementation section

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


== Implementation

https://github.com/Tendrl/node_agent/issues/78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should talk about what classes, attributes, function etc to be written

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* Add used disks id in etcd with key nodes/node_id/Disks/Used.
* Add free disks id in etcd with key nodes/node_id/Disks/Free.
* Add all disks details in etcd with key nodes/node_id/Disks
* Add three different object in tendrl definitions for disks, used disks and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not three different objects- one object per disk. I'd mentioned this in my previous comment yesterday, but it seems to have been lost.

There needs to be one object per disk, which contains all the information about the disk. This needs to be in the disks directory. Lower case, not capitalised. The object's key needs to be the id that's guaranteed to always be available.

The objects under used and free directories under disks (again, lower case, not capitalised), need to be empty objects with their key being the id of the disk object under disks.

Add validations to ensure that the same id doesn't fall under both used and free.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brainfunked I have tried to say same :) i will change this paragraph

@GowthamShanmugam
Copy link
Contributor Author

@brainfunked review please

=== Tendrl/node_agent impact

* Add a new function in pull_hardware_inventory to collect disk details.
* Create three different classes Disks, FreeDisks, UsedDisks in persistence
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disk, UnusedDisk, UsedDisk. Both the latter ones should inherit from Disk.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brainfunked i will modify it to inherit both classes

```
1. columns = 'NAME,FSTYPE,MOUNTPOINT,UUID,SIZE,ROTA
lsblk --all --bytes --noheadings --output='%s' --path --raw" % columns
2. hwinfo --block --only disk_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you not using the output to file functionality from hwinfo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no i am not @nthomas-redhat told me no need to store the data in file and parse it directly

@GowthamShanmugam
Copy link
Contributor Author

@nthomas-redhat @brainfunked @shtripat review please

Copy link
Member

@shtripat shtripat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 1 minor comment.

device_files, device_number, bios_id, geometry_logical, geometry_bios_legacy).
```
* Create three different classes called Disks, FreeDisks, UsedDisks in persistence
module and inherit freeDisks and UsedDisks from Disks class.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%s/freeDisks/FreeDisks/g

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will change it

@GowthamShanmugam
Copy link
Contributor Author

@shtripat done

Copy link
Contributor

@brainfunked brainfunked left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Disk model needs to be defined as an object under the tendrl global namespace, along with node, cluster etc. However, that could be tackled in a separate specification.

@brainfunked
Copy link
Contributor

@anivargi Please check the data model and approve the specification if it meets your requirements.

spcification-issue: Tendrl#43

Signed-off-by: GowthamShanmugam <gshanmug@redhat.com>
@GowthamShanmugam
Copy link
Contributor Author

@r0h4n please review

1 similar comment
@GowthamShanmugam
Copy link
Contributor Author

@r0h4n please review

None

== Other deployer impact

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates @nthomas-redhat ?

@r0h4n r0h4n merged commit d30d65b into Tendrl:master Jan 5, 2017
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

Successfully merging this pull request may close these issues.

None yet

8 participants