Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
lio-utils.216
0020-tcm_dump-Error-checking-in-startup-script....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0020-tcm_dump-Error-checking-in-startup-script.patch of Package lio-utils.216
From ff05d56bf0770fb688836e7be6ca88622c74c36f Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <hare@suse.de> Date: Fri, 1 Feb 2013 15:11:30 +0100 Subject: tcm_dump: Error checking in startup script When tcm_dump generates the startup script it should insert some error checking to allow the script to abort and report an error. Signed-off-by: Hannes Reinecke <hare@suse.de> --- tcm-py/tcm_dump.py | 52 ++++++++++++++-------------------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/tcm-py/tcm_dump.py b/tcm-py/tcm_dump.py index e4a99e6..9e182b1 100755 --- a/tcm-py/tcm_dump.py +++ b/tcm-py/tcm_dump.py @@ -39,7 +39,12 @@ def tcm_dump_configfs(option, opt_str, value, parser): if lu_gp == "default_lu_gp": continue - print "mkdir -p " + tcm_root + "/alua/lu_gps/" + lu_gp + lu_gp_dir = tcm_root + "/alua/lu_gps/" + lu_gp + print "mkdir -p " + lu_gp_dir + print "if [ $? -eq 0 ] ; then" + print " echo \"Failed to create " + lu_gp_dir + "\"" + print " exit 1" + print "fi" lu_gp_id_file = tcm_root + "/alua/lu_gps/" + lu_gp + "/lu_gp_id" p = os.open(lu_gp_id_file, 0) value = os.read(p, 8) @@ -53,8 +58,6 @@ def tcm_dump_configfs(option, opt_str, value, parser): if f == "alua": continue; -# print "mkdir -p " + tcm_root + "/" + f - dev_root = tcm_root + "/" + f + "/" for g in os.listdir(dev_root): if g == "hba_info" or g == "hba_mode": @@ -72,6 +75,7 @@ def tcm_dump_configfs(option, opt_str, value, parser): if not params: continue print "tcm_node --establishdev " + f + "/" + g + " " + str(params) + print "[ $? -eq 0 ] || exit 1" result = re.search('iblock_', f) if result: dev = dev_root + g @@ -79,6 +83,7 @@ def tcm_dump_configfs(option, opt_str, value, parser): if not params: continue print "tcm_node --establishdev " + f + "/" + g + " " + str(params) + print "[ $? -eq 0 ] || exit 1" result = re.search('rd_dr_', f) if result: dev = dev_root + g @@ -86,6 +91,7 @@ def tcm_dump_configfs(option, opt_str, value, parser): if not params: continue print "tcm_node --establishdev " + f + "/" + g + " " + str(params) + print "[ $? -eq 0 ] || exit 1" result = re.search('rd_mcp_', f) if result: dev = dev_root + g @@ -93,6 +99,7 @@ def tcm_dump_configfs(option, opt_str, value, parser): if not params: continue print "tcm_node --establishdev " + f + "/" + g + " " + str(params) + print "[ $? -eq 0 ] || exit 1" result = re.search('fileio_', f) if result: dev = dev_root + g @@ -100,6 +107,7 @@ def tcm_dump_configfs(option, opt_str, value, parser): if not params: continue print "tcm_node --establishdev " + f + "/" + g + " " + str(params) + print "[ $? -eq 0 ] || exit 1" # Dump T10 VP Unit Serial for all non Target_Core_Mod/pSCSI objects result = re.search('pscsi_', f) @@ -112,6 +120,7 @@ def tcm_dump_configfs(option, opt_str, value, parser): unit_serial = value[off:] # Note that this will handle read, parse and set any PR APTPL metadata print "tcm_node --setunitserialwithmd " + f + "/" + g + " " + unit_serial.rstrip() + print "[ $? -eq 0 ] || exit 1" os.close(p) # Dump device object alias @@ -150,6 +159,7 @@ def tcm_dump_configfs(option, opt_str, value, parser): if not value: continue print "tcm_node --addaluatpgwithmd " + f + "/" + g + " " + tg_pt_gp + " " + value.rstrip() + print "[ $? -eq 0 ] || exit 1" # Dump the ALUA types tg_pt_gp_type_file = dev_root + g + "/alua/" + tg_pt_gp + "/alua_access_type" p = os.open(tg_pt_gp_type_file, 0) @@ -213,41 +223,7 @@ def tcm_dump_configfs(option, opt_str, value, parser): print "echo " + value.rstrip() + " > " + attrib_file os.close(p) - # Dump snapshot attributes - snap_attrib_root = dev_root + g + "/snap/" - if (os.path.isdir(snap_attrib_root) == False): - continue - - snap_enabled = 0 - enabled_attr_file = snap_attrib_root + "enabled" - p = open(enabled_attr_file, 'rU') - if not p: - continue - value = p.read() - enabled = value.rstrip() - p.close() - if enabled != "1": - continue - - snap_enabled = 1 - print "#### Snapshot Attributes for " + dev_root + g - for s in os.listdir(snap_attrib_root): - if s == "pid": - continue - if s == "usage": - continue - if s == "enabled": - continue - - attrib_file = snap_attrib_root + s - p = open(attrib_file, 'rU') - value = p.read() - p.close() - attr_val = value.rstrip() - print "echo " + attr_val + " > " + attrib_file - - if snap_enabled == 1: - print "tcm_node --lvsnapstart " + f + "/" + g + return def tcm_backup_to_file(option, opt_str, value, parser): datetime = str(value) -- 1.8.1.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor