[yast-commit] r67468 - in /trunk/s390/src/modules: DASDController.ycp ZFCPController.ycp
Author: aschnell Date: Fri Feb 17 11:39:27 2012 New Revision: 67468 URL: http://svn.opensuse.org/viewcvs/yast?rev=67468&view=rev Log: - improved logging - tiny optimization Modified: trunk/s390/src/modules/DASDController.ycp trunk/s390/src/modules/ZFCPController.ycp Modified: trunk/s390/src/modules/DASDController.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/DASDController.ycp?rev=67468&r1=67467&r2=67468&view=diff ============================================================================== --- trunk/s390/src/modules/DASDController.ycp (original) +++ trunk/s390/src/modules/DASDController.ycp Fri Feb 17 11:39:27 2012 @@ -99,11 +99,10 @@ string GetDeviceName(string channel) { - string cmd = sformat("ls '/sys/bus/ccw/devices/%1/block/' | tr -d '\n'", channel); - map<string, any> disk = (map<string, any>) SCR::Execute(.target.bash_output, cmd); - if (disk["exit"]:-1 == 0 && !isempty(disk["stdout"]:"")) - return sformat("/dev/%1", disk["stdout"]:""); - + string dir = sformat("/sys/bus/ccw/devices/%1/block/", channel); + list<string> files = (list<string>) SCR::Read(.target.dir, dir); + if (size(files) == 1) + return "/dev/" + files[0]:""; return nil; } @@ -480,20 +479,17 @@ /** - * Activate selected Disks + * Activate disk * @param channel string Name of the disk to activate * @param diag boolean Activate DIAG or not */ global void ActivateDisk(string channel, boolean diag) { - string command = sformat ( - "/sbin/dasd_configure '%1' '%2' '%3'", - channel, - 1, - diag ? 1 : 0 - ); - integer ret = (integer)SCR::Execute (.target.bash, command); - y2milestone ("Running command %1 with exit code %2", command, ret); + string command = sformat("/sbin/dasd_configure '%1' %2 %3", channel, 1, diag ? 1 : 0); + y2milestone("Running command \"%1\"", command); + integer ret = (integer) SCR::Execute(.target.bash, command); + y2milestone("Command \"%1\" returned with exit code %2", command, ret); + if (ret == 8) { string popup = sformat (_("Device %1 is not formatted. Format device now? @@ -518,32 +514,33 @@ DeactivateDisk(channel, diag); } else { - ReportActivationError (channel, ret); + ReportActivationError(channel, ret); } + disk_configured = true; } + /** - * Activate selected Disks + * Deactivate disk * @param channel string Name of the disk to deactivate * @param diag boolean Activate DIAG or not */ global void DeactivateDisk(string channel, boolean diag) { - string command = sformat ( - "/sbin/dasd_configure '%1' '%2' '%3'", - channel, - 0, - diag ? 1 : 0 - ); - y2milestone ("Running command %1", command); - integer ret = (integer)SCR::Execute (.target.bash, command); - ReportActivationError (channel, ret); + string command = sformat("/sbin/dasd_configure '%1' %2 %3", channel, 0, diag ? 1 : 0); + y2milestone("Running command \"%1\"", command); + integer ret = (integer) SCR::Execute(.target.bash, command); + y2milestone("Command \"%1\" returned with exit code %2", command, ret); + + ReportActivationError(channel, ret); + disk_configured = true; } + /** - * Activate selected Disks + * Format disks * @param disks_list list<string> List of disks to be formated * @param par integer Number of disks that can be formated in parallel * @param write_vl boolean Write a Volume label Modified: trunk/s390/src/modules/ZFCPController.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/ZFCPController.ycp?rev=67468&r1=67467&r2=67468&view=diff ============================================================================== --- trunk/s390/src/modules/ZFCPController.ycp (original) +++ trunk/s390/src/modules/ZFCPController.ycp Fri Feb 17 11:39:27 2012 @@ -471,16 +471,14 @@ { if (! activated_controllers[channel]:false) { - string command = sformat ( - "/sbin/zfcp_host_configure '%1' '%2'", - channel, - 1 - ); - y2milestone ("Running command %1", command); - integer ret = (integer)SCR::Execute (.target.bash, command); + string command = sformat("/sbin/zfcp_host_configure '%1' %2", channel, 1); + y2milestone("Running command \"%1\"", command); + integer ret = (integer) SCR::Execute(.target.bash, command); + y2milestone("Command \"%1\" returned with exit code %2", command, ret); + if (ret != 0) { - ReportControllerActivationError (channel, ret); + ReportControllerActivationError(channel, ret); } else { @@ -488,20 +486,18 @@ } } - string command = sformat ( - "/sbin/zfcp_disk_configure '%1' '%2' '%3' '%4'", - channel, - // bugzilla #205503 - HexNumSize (wwpn, 16), - HexNumSize (lun, 16), - 1 - ); - y2milestone ("Running command %1", command); - integer ret = (integer)SCR::Execute (.target.bash, command); - ReportActivationError (channel, ret); + string command = sformat("/sbin/zfcp_disk_configure '%1' '%2' '%3' %4", channel, + HexNumSize(wwpn, 16), HexNumSize(lun, 16), 1); + y2milestone("Running command \"%1\"", command); + integer ret = (integer) SCR::Execute(.target.bash, command); + y2milestone("Command \"%1\" returned with exit code %2", command, ret); + + ReportActivationError(channel, ret); + disk_configured = true; } + /** * Activate a disk * @param channel string channel id @@ -510,20 +506,18 @@ */ global void DeactivateDisk(string channel, string wwpn, string lun) { - string command = sformat ( - "/sbin/zfcp_disk_configure '%1' '%2' '%3' '%4'", - channel, - // bugzilla #205503 - HexNumSize (wwpn, 16), - HexNumSize (lun, 16), - 0 - ); - y2milestone ("Running command %1", command); - integer ret = (integer)SCR::Execute (.target.bash, command); - ReportActivationError (channel, ret); + string command = sformat("/sbin/zfcp_disk_configure '%1' '%2' '%3' %4", channel, + HexNumSize(wwpn, 16), HexNumSize(lun, 16), 0); + y2milestone("Running command \"%1\"", command); + integer ret = (integer) SCR::Execute(.target.bash, command); + y2milestone("Command \"%1\" returned with exit code %2", command, ret); + + ReportActivationError(channel, ret); + disk_configured = true; } + list<string> runCommand(string cmd){ list<string> ret = []; map<string, any> cmd_output = (map<string, any>)SCR::Execute(.target.bash_output, cmd); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn2.opensuse.org