Tendrl / node-agent

A python agent local to every managed storage node in the sds cluster
GNU Lesser General Public License v2.1
4 stars 14 forks source link

Digitalocean disk "Device File" contains space char, cannot save disk to tendrl etcd store #481

Closed r0h4n closed 7 years ago

r0h4n commented 7 years ago

Digital ocean setup ( help, @japplewhite please provide exact digital ocean os/vm/hardware details)

hwinfo --partition

[root@centos-512mb-nyc1-01 ~]# hwinfo --partition
19: None 00.0: 11300 Partition                                  
  [Created at block.414]
  Unique ID: bdUI.SE1wIdpsiiC
  Parent ID: R7kM.oC9+7MTYZl4
  SysFS ID: /class/block/sda/sda1
  Hardware Class: partition
  Model: "Partition"
  Device File: /dev/sda1
  Device Files: /dev/sda1, /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1, /dev/disk/by-partlabel/primary, /dev/disk/by-partuuid/29174586-f9f9-411f-a15b-a2916c82ed05, /dev/disk/by-path/virtio-pci-0000:00:05.0-scsi-0:0:0:1-part1
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #18 (Disk)

22: None 00.0: 11300 Partition
  [Created at block.414]
  Unique ID: tyyG.SE1wIdpsiiC
  Parent ID: KSbE.Fxp0d3BezAE
  SysFS ID: /class/block/vda/vda1
  Hardware Class: partition
  Model: "Partition"
  Device File: /dev/vda1
  Device Files: /dev/vda1, /dev/disk/by-label/DOROOT, /dev/disk/by-partlabel/primary, /dev/disk/by-partuuid/d9f7f085-531d-4036-abb8-0fef6cd2aaf4, /dev/disk/by-path/virtio-pci-0000:00:06.0-part1, /dev/disk/by-uuid/a5111785-8c00-4a47-bb70-85b24efa82d5
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #21 (Disk)

23: None 00.0: 11300 Partition
  [Created at block.414]
  Unique ID: Pqtf.SE1wIdpsiiC
  Parent ID: KSbE.Fxp0d3BezAE
  SysFS ID: /class/block/vda/vda15
  Hardware Class: partition
  Model: "Partition"
  Device File: /dev/vda15
  Device Files: /dev/vda15, /dev/disk/by-partlabel/bios_grub, /dev/disk/by-partuuid/8aea724b-6dce-4176-983a-bc6cf9691ce0, /dev/disk/by-path/virtio-pci-0000:00:06.0-part15
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #21 (Disk)

hwinfo --disk

[root@centos-512mb-nyc1-01 ~]# hwinfo --disk
18: SCSI 200.1: 10600 Disk
  [Created at block.245]
  Unique ID: R7kM.oC9+7MTYZl4
  Parent ID: O+ol.4Ex5C38ZXm7
  SysFS ID: /class/block/sda
  SysFS BusID: 2:0:0:1
  SysFS Device Link: /devices/pci0000:00/0000:00:05.0/virtio2/host2/target2:0:0/2:0:0:1
  Hardware Class: disk
  Model: "DO Volume"
  Vendor: "DO"
  Device: "Volume"
  Revision: "1.5."
  Driver: "virtio_scsi", "sd"
  Driver Modules: "virtio_scsi"
  Device File: /dev/sda (/dev/sg0)
  Device Files: /dev/sda, /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01, /dev/disk/by-path/virtio-pci-0000:00:05.0-scsi-0:0:0:1
  Device Number: block 8:0-8:15 (char 21:0)
  Geometry (Logical): CHS 11264/64/32
  Size: 23068672 sectors a 512 bytes
  Capacity: 11 GB (11811160064 bytes)
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #15 (Unclassified device)

19: SCSI 200.2: 10600 Disk
  [Created at block.245]
  Unique ID: uI_Q.oC9+7MTYZl4
  Parent ID: O+ol.4Ex5C38ZXm7
  SysFS ID: /class/block/sdb
  SysFS BusID: 2:0:0:2
  SysFS Device Link: /devices/pci0000:00/0000:00:05.0/virtio2/host2/target2:0:0/2:0:0:2
  Hardware Class: disk
  Model: "DO Volume"
  Vendor: "DO"
  Device: "Volume"
  Revision: "1.5."
  Driver: "virtio_scsi", "sd"
  Driver Modules: "virtio_scsi"
  Device File: /dev/sdb (/dev/sg1)
  Device Files: /dev/sdb, /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-06, /dev/disk/by-path/virtio-pci-0000:00:05.0-scsi-0:0:0:2
  Device Number: block 8:16-8:31 (char 21:1)
  Geometry (Logical): CHS 11264/64/32
  Size: 23068672 sectors a 512 bytes
  Capacity: 11 GB (11811160064 bytes)
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #15 (Unclassified device)

20: None 00.0: 10600 Disk
  [Created at block.245]
  Unique ID: KSbE.Fxp0d3BezAE
  Parent ID: l50U.+FFPFBVXZu6
  SysFS ID: /class/block/vda
  SysFS BusID: virtio3
  SysFS Device Link: /devices/pci0000:00/0000:00:06.0/virtio3
  Hardware Class: disk
  Model: "Disk"
  Driver: "virtio-pci", "virtio_blk"
  Driver Modules: "virtio_pci", "virtio_blk"
  Device File: /dev/vda
  Device Files: /dev/vda, /dev/disk/by-path/virtio-pci-0000:00:06.0
  Device Number: block 253:0-253:15
  BIOS id: 0x80
  Geometry (Logical): CHS 41610/16/63
  Size: 41943040 sectors a 512 bytes
  Capacity: 20 GB (21474836480 bytes)
  Geometry (BIOS EDD): CHS 41610/16/63
  Size (BIOS EDD): 41943040 sectors
  Geometry (BIOS Legacy): CHS 1023/255/63
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #16 (Storage controller)

lsblk --all --bytes --noheadings --output=NAME,KNAME,PKNAME,MAJ:MIN,FSTYPE,MOUNTPOINT,LABEL,UUID,RA,RO,RM,SIZE,STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,TYPE --path --raw

/dev/sda /dev/sda  8:0     4096 0 0 11811160064 running root disk brw-rw---- 0 512 0 512 512 1 deadline 128 0 4096 1073741824 0 disk
/dev/sda1 /dev/sda1 /dev/sda 8:1     4096 0 0 11809062912  root disk brw-rw---- 0 512 0 512 512 1 deadline 128 0 4096 1073741824 0 part
/dev/sdb /dev/sdb  8:16     4096 0 0 11811160064 running root disk brw-rw---- 0 512 0 512 512 1 deadline 128 0 4096 1073741824 0 disk
/dev/vda /dev/vda  253:0     4096 0 0 21474836480  root disk brw-rw---- 0 512 0 512 512 1  128 0 0 0 0 disk
/dev/vda1 /dev/vda1 /dev/vda 253:1 ext4 / DOROOT a5111785-8c00-4a47-bb70-85b24efa82d5 4096 0 0 21471690752  root disk brw-rw---- 0 512 0 512 512 1  128 0 0 0 0 part
/dev/vda15 /dev/vda15 /dev/vda 253:15     4096 0 0 1048576  root disk brw-rw---- 0 512 0 512 512 1  128 0 0 0 0 part

Problem 1: Tendrl uses the "Device File" attribute in "hwinfo --disk" as part of the primary key for that disk in Tendrl central store, This causes the Tendrl central store etcd key to look like "/nodes/:node_id/LocalStorage/<disk_primary_key_contains space" , etcd keys cannot have space characters.

Problem 2: The actual raw disk is "/dev/sda" as shown by "lsblk" command, but Digital ocean shows the "Device File" as "/dev/sda (/dev/sg0)"

To fix this, in such cases, Tendrl will only consider the "Device File" string until there's a space character encountered i.e the raw disk name "/dev/sda" will be considered and not "/dev/sda (/dev/sg0)"

Inputs welcome

cc: @mbukatov @nthomas-redhat @nnDarshan @shtripat @brainfunked

r0h4n commented 7 years ago

@nigelbabu Can you please take a look at this, This is a Tendrl env on Digital ocean similar to the Tendrl sandbox you know of

japplewhite commented 7 years ago

@r0h4n [root@centos-512mb-nyc1-01 ceph]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core)

512MB system memory

I manually added volumes to the node. They show up as /dev/sda, /dev/sdb, and so on though they have the weird output in the hwinfo --disk output as you noted.

The boot disk is:

[root@centos-512mb-nyc1-01 ceph]# mount |grep " / " /dev/vda1 on / type ext4 (rw,relatime,seclabel,data=ordered)

japplewhite commented 7 years ago

On AWS with a flash disk (xvdb) and a spinning disk (xvdc),

[root@ip-172-30-48-223 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.3 (Maipo) even with epel enabled - not sure how to get this command on RHEL in aws

[root@ip-172-30-48-223 ~]# yum provides hwinfo Loaded plugins: amazon-id, rhui-lb, search-disabled-repos No matches found

[root@ip-172-30-48-223 ~]# lsblk --all --bytes --noheadings --output=NAME,KNAME,PKNAME,MAJ:MIN,FSTYPE,MOUNTPOINT,LABEL,UUID,RA,RO,RM,SIZE,STATE,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,TYPE --path --raw /dev/xvda /dev/xvda 202:0 4096 0 0 10737418240 root disk brw-rw---- 0 512 0 512 512 0 deadline 128 0 0 0 0 disk /dev/xvda1 /dev/xvda1 /dev/xvda 202:1 4096 0 0 1048576 root disk brw-rw---- 0 512 0 512 512 0 deadline 128 0 0 0 0 part /dev/xvda2 /dev/xvda2 /dev/xvda 202:2 xfs / 3ed41454-00c8-4803-bf61-2ee88aa54dbf 4096 0 0 10735304192 root disk brw-rw---- 0 512 0 512 512 0 deadline 128 0 0 0 0 part /dev/xvdb /dev/xvdb 202:16 4096 0 0 11811160064 root disk brw-rw---- 0 512 0 512 512 0 deadline 128 0 0 0 0 disk /dev/xvdc /dev/xvdc 202:32 4096 0 0 536870912000 root disk brw-rw---- 0 512 0 512 512 0 deadline 128 0 0 0 0 disk

Below the larger disk is the spinning disk (500GB) and the smaller one is flash (11.8GB)

[root@ip-172-30-48-223 ~]# fdisk -l WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/xvda: 10.7 GB, 10737418240 bytes, 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: gpt

     Start          End    Size  Type            Name

1 2048 4095 1M BIOS boot parti 2 4096 20971486 10G Microsoft basic

Disk /dev/xvdb: 11.8 GB, 11811160064 bytes, 23068672 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/xvdc: 536.9 GB, 536870912000 bytes, 1048576000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

r0h4n commented 7 years ago

You can get hwinfo from this repo https://copr.fedorainfracloud.org/coprs/tendrl/dependencies/packages/

r0h4n commented 7 years ago

@japplewhite closing this one, let me know if anything else is required specific to DO