summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/add_storage.py
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-system/add_storage.py')
-rw-r--r--abs/core/LinHES-system/add_storage.py39
1 files changed, 31 insertions, 8 deletions
diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py
index 9b20546..92a6120 100644
--- a/abs/core/LinHES-system/add_storage.py
+++ b/abs/core/LinHES-system/add_storage.py
@@ -362,7 +362,7 @@ def remove_pickle():
#--------------------------------------------
-def main():
+def main(scan_only):
global bus
bus = dbus.SystemBus()
@@ -384,14 +384,27 @@ def main():
#print i.model
continue
else:
- print "\n"
- print "-------------------------------------------------------------"
- print "Found new hard drive: %s location: %s size: %s \n" %(i.model,i.block_path,i.device_size)
- if prompt_to_add(i) :
- print "\nDisk will be added to the storage pool!"
+ if not scan_only:
+ print "\n"
+ print "-------------------------------------------------------------"
+ print "Found new hard drive: %s location: %s size: %s \n" %(i.model,i.block_path,i.device_size)
+ if prompt_to_add(i) :
+ print "\nDisk will be added to the storage pool!"
+ process_list.append(i)
+ else:
process_list.append(i)
+ if scan_only:
+ if len(process_list) > 0:
+ f = open('/tmp/scan_report', 'w')
+ for i in process_list:
+ 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)
+
if len(process_list) > 0:
DB = MythDB()
host=gethostname()
@@ -400,7 +413,7 @@ def main():
#BE = MythBE(db=DB)
#save new list to disk_device
- # write_known_drive_list(system_drive_list)
+ write_known_drive_list(system_drive_list)
for i in process_list:
i.partition_disk()
@@ -414,12 +427,22 @@ def main():
if __name__ == "__main__":
+ scan_only = False
+ try:
+ os.remove("/tmp/scan_report")
+ except:
+ pass
+
if not os.geteuid()==0:
sys.exit("\nRoot access is required to run this program\n")
if "--new_init" in sys.argv :
remove_pickle()
- main()
+
+ if "--report" in sys.argv :
+ scan_only = True
+
+ main(scan_only)