summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xabs/core/LinHES-system/PKGBUILD4
-rw-r--r--abs/core/LinHES-system/add_storage.py111
2 files changed, 90 insertions, 25 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 524b090..7497028 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
pkgver=2
-pkgrel=126
+pkgrel=127
arch=('i686' 'x86_64')
MVDIR=$startdir/pkg/usr/LH
BINDIR=$startdir/pkg/usr/bin
@@ -98,7 +98,7 @@ md5sums=('06bc649bce56c22b9a1f56890e0765b6'
'ceec78815ed01af733cdbca14cb0942b'
'1be1d3dfc83f828eede93055713882ae'
'47e093e8cfe4b5b96602358e1f540832'
- '72313342e619acdb520d9d14bc05d5a2'
+ 'fd7dbbf960080619ef18d6843f6374d8'
'b9b0a8370f46f0b5e144a66897e8eefb'
'6519d209e151cdc39ae7e1091d189c3e'
'8f474e019d5fcb775497aca355d61b0b'
diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py
index d03da59..5e85260 100644
--- a/abs/core/LinHES-system/add_storage.py
+++ b/abs/core/LinHES-system/add_storage.py
@@ -302,7 +302,7 @@ class disk_device:
runcmd(cmd)
def add_sg(self,DB,host,SG_MAP,weight='0',install_call=False):
- print " Adding to storage groups"
+ print " Adding storage groups"
sgweight=int(weight)
for key in SG_MAP.iterkeys():
#print key," : ", SG_MAP[key]
@@ -455,7 +455,8 @@ def prompt_to_add(current_drive):
def prompt_to_continue():
loop = True
#while loop:
- str1 = raw_input("\n Ready to start, press Y to continue, anything else to abort:")
+ print "\n\n\n\n"
+ str1 = raw_input("\n Ready to add additional storage!\n Press Y to continue, anything else to abort:")
#if str1 in ['Y','N','y','n']:
# loop = False
@@ -465,9 +466,62 @@ def prompt_to_continue():
rc = True
else:
rc = False
+ print "-----"
return rc
+def prompt_sg(dir_be_sg,dir_fe_sg):
+ #check for backend storage groups
+ if dir_be_sg != True:
+ loop = True
+ print "@@@@@@@@@@@@@@@@@@@@@@"
+ prompt_string='''
+ Backend Storage Groups are used for things like
+ TV Recordings and database backups.
+ The content on these storage groups will
+ only be available while the system is online.
+
+ Do you wish enable this system for Backend Storage Groups(Y/N)?:'''
+
+ while loop:
+ str1 = raw_input(prompt_string)
+ if str1 in ['Y','N','y','n']:
+ loop = False
+ break
+ print "\n"
+
+ if str1 == 'Y' or str1 == 'y':
+ dir_be_sg = True
+ print " ** Will add Backend Storage Groups!"
+ else:
+ print " ** Will NOT add Backend Storage Groups!"
+ dir_be_sg = False
+
+ #now for frontend storage groups
+ if dir_fe_sg != True:
+ loop = True
+ print "++++++++++++++++++++++++"
+ prompt_string='''
+ Frontend Storage Groups are used for videos.
+ The content on these storage groups will
+ only be available while the system is online.
+
+ Do you wish enable this system for Frontend Storage Groups(Y/N)?:'''
+ while loop:
+ str1 = raw_input(prompt_string)
+ if str1 in ['Y','N','y','n']:
+ loop = False
+ break
+ print "\n"
+
+ if str1 == 'Y' or str1 == 'y':
+ dir_fe_sg = True
+ print " ** Will add Frontend Storage Groups!"
+ else:
+ dir_fe_sg = False
+ print " ** Will NOT add Frontend Storage Groups!"
+
+ return dir_be_sg,dir_fe_sg
def remove_pickle():
try:
@@ -487,7 +541,7 @@ def last_disk_num():
return num_list[-1]
#--------------------------------------------
-def main(scan_only, destruction, no_mount, install_call , dir_fe_only):
+def main(scan_only, destruction, no_mount, install_call , dir_fe_sg, dir_be_sg):
global bus
bus = dbus.SystemBus()
@@ -530,6 +584,7 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_only):
process_list.append(i)
print " End of scan"
print "---------------------------------------"
+
if scan_only:
if len(process_list) > 0:
f = open('/tmp/scan_report', 'w')
@@ -537,8 +592,8 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_only):
f.write("drive: %s , location: %s ,size: %s \n" %(i.model,i.block_path,i.device_size))
print "drive: %s , location: %s ,size: %s \n" %(i.model,i.block_path,i.device_size)
f.close()
-
sys.exit(0)
+
for i in no_process_list:
system_drive_list.append(i)
@@ -561,7 +616,9 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_only):
if len(process_list) > 0:
- print "\n Adding storage: \n"
+ print " Will add %s disks to systems" %len(process_list)
+
+ dir_be_sg , dir_fe_sg = prompt_sg(dir_be_sg,dir_fe_sg)
if prompt_to_continue() == True:
write_known_drive_list(system_drive_list)
disk_num = last_disk_num()
@@ -574,27 +631,29 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_only):
i.add_fstab()
i.mount_disk(no_mount)
if destruction == True:
- if dir_fe_only != True:
+ if dir_fe_sg == True:
+ i.mkdirs(FS_LIST_FE)
+ if dir_be_sg == True:
i.mkdirs(FS_LIST_BE)
- i.mkdirs(FS_LIST_FE)
+
i.set_disk_num(disk_num)
i.write_config()
system_drive_list.append(i)
write_known_drive_list(system_drive_list)
i.symlink_disk()
- #always create the FE groups(video)..do not need to create Be
- if dir_fe_only != True:
- i.add_sg(DB,host,SG_MAP_BE)
- i.add_sg(DB,host,SG_MAP_FE)
+ if dir_fe_sg == True:
+ i.add_sg(DB,host,SG_MAP_FE)
+ if dir_be_sg == True:
+ i.add_sg(DB,host,SG_MAP_BE)
print "-----"
cmd = "systemconfig.py -m fileshare"
runcmd(cmd)
#i.add_sg(DB,host,SG_MAP)
-def myth_main(no_mount,install_call,dir_fe_only):
+def myth_main(no_mount,install_call,dir_fe_sg):
global bus
bus = dbus.SystemBus()
#search for root
@@ -629,7 +688,7 @@ def myth_main(no_mount,install_call,dir_fe_only):
if i.block_path == device:
break
else:
- print "Could'nt find root device in block list"
+ print "Couldn't find root device in block list"
sys.exit(1)
if not install_call == True:
DB = MythDB()
@@ -647,12 +706,12 @@ def myth_main(no_mount,install_call,dir_fe_only):
#if not install_call:
i.mount_disk(no_mount)
i.write_config()
- #always create the FE groups(video)..do not need to create Be
- if dir_fe_only != True:
+ #no need to make the sub directories because the install process has taken care of it.
+ if dir_fe_sg == True:
+ i.add_sg(DB,host,SG_MAP_FE,'99',install_call)
+ if dir_be_sg == True:
i.add_sg(DB,host,SG_MAP_BE,'99',install_call)
- i.add_sg(DB,host,SG_MAP_FE,'99',install_call)
-
i.symlink()
cmd = "systemconfig.py -m fileshare"
runcmd(cmd)
@@ -826,7 +885,8 @@ def usage():
--no_destruction: Will not partition or format the disk
--new_init : Erase the list of new disks and rescan.
--report : will scan the disks and print out if it found new storage.
- --fe_only : Will only create the storage group dir for videos..excludes tv
+ --add_fe_sg : Will only create the storage group dir for videos..excludes tv
+ --add_be_sg : Will only create the storage group dir for TV, backups, streaming
'''
print help
sys.exit(0)
@@ -840,7 +900,8 @@ if __name__ == "__main__":
no_mount = False
destruction = True
install_call = False
- dir_fe_only = False
+ dir_fe_sg = False
+ dir_be_sg = False
reconstruct = False
try:
os.remove("/tmp/scan_report")
@@ -868,18 +929,22 @@ if __name__ == "__main__":
if "--report" in sys.argv :
scan_only = True
- if "--fe_only" in sys.argv:
- dir_fe_only = True
+ if "--add_fe_sg" in sys.argv:
+ dir_fe_sg = True
+
+ if "--add_be_sg" in sys.argv:
+ dir_be_sg = True
+
if "--reconstruct" in sys.argv:
reconstruct = True
if "--double_myth" in sys.argv:
- myth_main(no_mount,install_call,dir_fe_only)
+ myth_main(no_mount,install_call,dir_fe_sg)
elif reconstruct == True:
reconstruct_mounts(no_mount)
else:
- main(scan_only,destruction,no_mount, install_call, dir_fe_only)
+ main(scan_only,destruction,no_mount, install_call, dir_fe_sg, dir_be_sg)