2019-01-06 17:34:02 +01:00
|
|
|
import os
|
2020-01-06 23:01:25 +01:00
|
|
|
import logging
|
2019-01-06 21:29:21 +01:00
|
|
|
import backive.config.config as cfg
|
2019-01-06 17:34:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Device:
|
|
|
|
disks_by_uuid = "/dev/disk/by-uuid"
|
|
|
|
|
2020-01-05 13:17:46 +01:00
|
|
|
def __init__(self, name, config=None):
|
|
|
|
self.name = name
|
2019-01-06 21:29:21 +01:00
|
|
|
self.config = config
|
|
|
|
|
2020-01-05 13:17:46 +01:00
|
|
|
@classmethod
|
|
|
|
def instance(cls, name, config=None):
|
2020-01-06 23:01:25 +01:00
|
|
|
logging.debug("Device instance created (%s)", name)
|
2020-01-05 13:17:46 +01:00
|
|
|
return Device(name, config)
|
|
|
|
|
2019-01-06 17:34:02 +01:00
|
|
|
@classmethod
|
2019-01-06 21:29:21 +01:00
|
|
|
def get_list(cls):
|
2019-01-06 17:34:02 +01:00
|
|
|
if os.path.exists(cls.disks_by_uuid):
|
|
|
|
uuids = os.listdir(cls.disks_by_uuid)
|
|
|
|
return uuids
|
|
|
|
return []
|
2019-01-06 21:29:21 +01:00
|
|
|
|
2020-01-05 13:17:46 +01:00
|
|
|
def mount(self, path):
|
2019-01-06 21:29:21 +01:00
|
|
|
pass
|
|
|
|
|
|
|
|
def unmount(self):
|
|
|
|
pass
|
|
|
|
|