From 1f07c5c769019875d1b55003e88d8edae98438f1 Mon Sep 17 00:00:00 2001 From: phamt Date: Sat, 30 Mar 2013 21:38:55 +0000 Subject: [PATCH] Fixed disk format bug where code continues to run even though link is only R/O. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15742 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/zvm.pm | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 912c8f71e..bc0c23395 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -1671,24 +1671,28 @@ sub changeVM { # Link target disk xCAT::zvmUtils->printLn( $callback, "$tgtNode: Linking target disk ($tgtAddr) as ($tgtLinkAddr)" ); $out = `ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "$::SUDO /sbin/vmcp link $tgtUserId $tgtAddr $tgtLinkAddr MR"`; - + # If link fails - if ( $out =~ m/not linked/i ) { + if ( $out =~ m/not linked/i || $out =~ m/DASD $tgtLinkAddr forced R\/O/i ) { + # Detatch link because only linked as R/O + `ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "$::SUDO /sbin/vmcp det $tgtLinkAddr"`; # Wait before trying again sleep(5); $try = $try - 1; - } - else { + } else { last; } } # End of while ( $try > 0 ) # If target disk is not linked - if ( $out =~ m/not linked/i ) { + if ( $out =~ m/not linked/i || $out =~ m/DASD $tgtLinkAddr forced R\/O/i ) { xCAT::zvmUtils->printLn( $callback, "$tgtNode: (Error) Failed to link target disk ($tgtAddr)" ); xCAT::zvmUtils->printLn( $callback, "$tgtNode: Failed" ); + + # Detatch link because only linked as R/O + `ssh $::SUDOER\@$hcp "$::SUDO /sbin/vmcp det $tgtLinkAddr"`; # Exit return; @@ -1714,13 +1718,6 @@ sub changeVM { xCAT::zvmUtils->printLn( $callback, "$tgtNode: $out" ); return; } - - # Automatically create a partition using the entire disk - xCAT::zvmUtils->printLn( $callback, "$tgtNode: Creating a partition using the entire disk ($tgtDevNode)" ); - $out = `ssh $::SUDOER\@$hcp "$::SUDO /sbin/fdasd -a /dev/$tgtDevNode"`; - - # Sleep 2 seconds to let the system settle - sleep(2); } # Disable disk