summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/add_storage.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2017-03-09 19:52:37 (GMT)
committerBritney Fransen <brfransen@gmail.com>2017-03-09 19:52:37 (GMT)
commit90d2d0a5437b2c5d2eabcd02e90d241a069753ca (patch)
tree6f00a3721a007e6e71c9d5535c3bed59360307c8 /abs/core/LinHES-system/add_storage.py
parent6872f58e91980db8ece16adb22eb5afbfd550b4d (diff)
downloadlinhes_pkgbuild-90d2d0a5437b2c5d2eabcd02e90d241a069753ca.zip
linhes_pkgbuild-90d2d0a5437b2c5d2eabcd02e90d241a069753ca.tar.gz
linhes_pkgbuild-90d2d0a5437b2c5d2eabcd02e90d241a069753ca.tar.bz2
LinHES-system: remove_storage.py: initial inclusion
add_storage.py: in reconstruct and reconstruct_sg add some checks for removed in .conf files
Diffstat (limited to 'abs/core/LinHES-system/add_storage.py')
-rwxr-xr-xabs/core/LinHES-system/add_storage.py45
1 files changed, 31 insertions, 14 deletions
diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py
index c172f6f..29eecde 100755
--- a/abs/core/LinHES-system/add_storage.py
+++ b/abs/core/LinHES-system/add_storage.py
@@ -518,16 +518,16 @@ def prompt_sg(dir_sg):
if dir_sg != True:
loop = True
prompt_string='''
- MythTV Storage Groups are used for artwork, database backups,
+ MythTV storage groups are used for artwork, database backups,
photos, music, streaming, TV recordings, and videos.
The content on these storage groups will
only be available while the system is online.
- Enabling MythTV Storage Groups will create the directories
+ Enabling MythTV storage groups will create the directories
on the disk(s) and add the paths to the MythTV database.
- Enable MythTV Storage Groups (Y/N)?:'''
+ Enable MythTV storage groups (Y/N)?:'''
while loop:
str1 = raw_input(prompt_string)
@@ -538,14 +538,14 @@ def prompt_sg(dir_sg):
if str1 == 'Y' or str1 == 'y':
dir_sg = True
- print " ** Will add MythTV Storage Groups!"
+ print " ** Will add MythTV storage groups!"
else:
- print " ** Will NOT add MythTV Storage Groups!"
+ print " ** Will NOT add MythTV storage groups!"
dir_sg = False
else:
dir_sg = True
print "\n --add_sg option used"
- print " ** Will add MythTV Storage Groups!"
+ print " ** Will add MythTV storage groups!"
return dir_sg
@@ -774,7 +774,7 @@ def myth_main(no_mount,install_call,dir_sg):
runcmd(cmd)
def reconstruct_storagegroups():
- print "\nRecreating Storage Groups from contents of /etc/storage.d/\n"
+ print "\nRecreating storage groups from contents of /etc/storage.d/\n"
DB = MythDB()
host=gethostname()
@@ -784,15 +784,22 @@ def reconstruct_storagegroups():
parser.read(conf_file)
mount_point = parser.get('storage', 'mountpoint')
mmount = parser.getboolean('storage', 'mmount')
+ try:
+ removed = parser.getboolean('storage', 'removed')
+ except:
+ removed = False
+ if removed:
+ print "Skipping: " + mount_point + " - removed"
+ continue
if not os.path.ismount(mount_point):
- print "Skipping: " + mount_point + " not mounted"
+ print "Skipping: " + mount_point + " - not mounted"
continue
try:
dir_sg = parser.getboolean('storage', 'storage_groups')
except ConfigParser.NoOptionError, err:
print "SG not found in conf, get setting from DB"
dir_sg = False
- # Get Storage Group directories from DB
+ # Get storage sroup directories from DB
recs = DB.getStorageGroup(groupname="Default")
for record in recs:
if record.dirname.startswith(mount_point):
@@ -875,6 +882,10 @@ class reconstruct_path:
self.fstype = parser.get('storage', 'fstype')
except:
self.fstype = self.get_fstype()
+ try:
+ self.removed = parser.get('storage', 'removed')
+ except:
+ self.removed = False
def get_fstype(self):
cmd = "fsck -N UUID=%s" %self.uuid
@@ -903,6 +914,9 @@ class reconstruct_path:
def get_disk_num(self):
return self.disk_num
+ def get_removed(self):
+ return self.removed
+
def create_mount_point(self):
try:
os.stat(self.mount_point)
@@ -1035,6 +1049,9 @@ def reconstruct_mounts(no_mount):
print "\n"
cf = reconstruct_path(conf_file)
+ # skip if the disk was removed
+ if cf.get_removed():
+ continue
#print cf.get_conf()
#print cf.get_uuid()
print " Recreating %s" %cf.get_mount_point()
@@ -1070,15 +1087,15 @@ def usage():
Add disk to /etc/fstab
Mount the disk
Create the directories
- (if user enables MythTV Storage Groups)
+ (if user enables MythTV storage groups)
Write out the disk config file to /etc/storage.d/
Create disk# symlink at /data/storage/
Create /myth symlink (if applicable)
- Create MythTV Storage Group paths in MythTV database
- (if user enables MythTV Storage Groups)
+ Create MythTV storage group paths in MythTV database
+ (if user enables MythTV storage groups)
Options:
- --add_sg: Create the MythTV Storage Group directories and
+ --add_sg: Create the MythTV storage group directories and
database entries for database backups, TV
recordings, photos, music, streaming, videos
and artwork.
@@ -1095,7 +1112,7 @@ def usage():
/data/storage/disk# symlink, and mount the disk.
--no_mount is the only option that works with
--reconstruct.
- --reconstruct_sg: Recreate the MythTV Storage Group directories and
+ --reconstruct_sg: Recreate the MythTV storage group directories and
database entries if they don't exist.
No other options work with --reconstruct_sg.
--report: Scan disks and print new found disks.