openattic/openattic-docker

Unable to use disks module inside openattic-docker

Closed this issue · 4 comments

When running openattic inside a docker container, we can't access disks.

Error we get from docker run output:

checking disk /dev/sda
serial not found

This problem happens because some device properties like "ID_SCSI_SERIAL", "ID_SERIAL_SHORT" and "ID_SERIAL" are not available inside the docker container (see line 57 of file "backend/volumes/management/__init__.py").

To reproduce, we can execute this code manually:

import pyudev
ctx = pyudev.Context()
for dev in ctx.list_devices(subsystem="block", DEVTYPE="disk"): dev.keys()

The output is:

Inside docker container

[u'DEVNAME', u'DEVPATH', u'DEVTYPE', u'MAJOR', u'MINOR', u'SUBSYSTEM']

Outside docker container

[u'DEVLINKS', u'DEVNAME', u'DEVPATH', u'DEVTYPE', u'ID_ATA', u'ID_BUS', u'ID_MODEL', u'ID_MODEL_ENC', u'ID_PART_TABLE_TYPE', u'ID_PART_TABLE_UUID', u'ID_PATH', u'ID_PATH_COMPAT', u'ID_PATH_TAG', u'ID_REVISION', u'ID_SCSI', u'ID_SCSI_COMPAT', u'ID_SCSI_COMPAT_TRUNCATED', u'ID_SCSI_DI', u'ID_SCSI_SN', u'ID_SERIAL', u'ID_SERIAL_SHORT', u'ID_TYPE', u'ID_VENDOR', u'ID_VENDOR_ENC', u'ID_WWN', u'ID_WWN_WITH_EXTENSION', u'MAJOR', u'MINOR', u'SCSI_IDENT_LUN_ATA', u'SCSI_IDENT_LUN_NAA_REG', u'SCSI_IDENT_LUN_T10', u'SCSI_IDENT_LUN_VENDOR', u'SCSI_IDENT_SERIAL', u'SCSI_MODEL', u'SCSI_MODEL_ENC', u'SCSI_REVISION', u'SCSI_TPGS', u'SCSI_TYPE', u'SCSI_VENDOR', u'SCSI_VENDOR_ENC', u'SUBSYSTEM', u'TAGS', u'USEC_INITIALIZED']   
rjfd commented

@ricardoasmarques how are you exposing disks to the docker container? are you exposing with the "-v" option when doing a "docker run" ?

@rjfd yes, I tried with -v /dev:/dev without success

Closing this issue because this is not needed to work on master branch (this is an 2.x branch issue).