Cleaned up code.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11470 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2012-02-03 19:17:59 +00:00
parent dfb844cacf
commit c97754e772
3 changed files with 20 additions and 29 deletions

View File

@ -18,7 +18,7 @@ use warnings;
=head3 getUserId
Description : Get the userID of a given node
Description : Get the user ID of a given node
Arguments : Node
Returns : UserID
Example : my $userID = xCAT::zvmCPUtils->getUserId($node);
@ -31,7 +31,7 @@ sub getUserId {
# Get inputs
my ( $class, $node ) = @_;
# Get userId using VMCP
# Get user ID using VMCP
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q userid"`;
my @results = split( ' ', $out );
@ -281,8 +281,7 @@ sub getNetwork {
my $out;
if ( $netName eq "all" ) {
$out = `ssh -o ConnectTimeout=5 $node "vmcp q lan"`;
}
else {
} else {
$out = `ssh -o ConnectTimeout=5 $node "vmcp q lan $netName"`;
}
@ -392,8 +391,7 @@ sub grantVSwitch {
my $retStr;
if ( $out =~ m/Command complete/i ) {
$retStr = "Done\n";
}
else {
} else {
$retStr = "Failed\n";
return $retStr;
}
@ -428,8 +426,7 @@ sub flashCopy {
my $retStr = "";
if ( $out =~ m/Command complete/i ) {
$retStr = "Done\n";
}
else {
} else {
$out = xCAT::zvmUtils->tabStr($out);
$retStr = "Failed\n$out";
}
@ -463,8 +460,7 @@ sub punch2Reader {
my $searchStr = "created and transferred";
if ( !( $out =~ m/$searchStr/i ) ) {
$out = "Failed\n";
}
else {
} else {
$out = "Done\n";
}

View File

@ -20,7 +20,7 @@ use warnings;
=head3 getNodeProps
Description : Get node properties
Arguments : Table name
Arguments : Table
Node
Properties
Returns : Node properties from given table
@ -101,7 +101,7 @@ sub getAllTabEntries {
=head3 setNodeProp
Description : Set a node property in a given table
Arguments : Table name
Arguments : Table
Node
Property name
Property value
@ -133,7 +133,7 @@ sub setNodeProp {
=head3 setNodeProps
Description : Set node properties in a given table
Arguments : Table name
Arguments : Table
Node
Reference to property name/value hash
Returns : Nothing
@ -544,7 +544,7 @@ sub sendFile {
=head3 getRootDeviceAddr
Description : Get the root device address of a given node
Arguments : Node name
Arguments : Node
Returns : Root device address
Example : my $deviceAddr = xCAT::zvmUtils->getRootDeviceAddr($node);
@ -837,14 +837,12 @@ sub getMacID {
if ( $out =~ m/File exists/i ) {
# Do nothing
}
else {
} else {
# Create next_macid file
$out = `ssh -o ConnectTimeout=5 $hcp "echo 'FFFFF0' > /opt/zhcp/conf/next_macid"`;
}
}
else {
} else {
# Create /opt/zhcp/conf directory
# Create next_mac - Contains next MAC address to use
@ -864,7 +862,7 @@ sub getMacID {
=head3 generateMacId
Description : Generate a new MACID
Arguments : HCP node
Arguments : zHCP node
Returns : Nothing
Example : my $macId = xCAT::zvmUtils->generateMacId($hcp);
@ -883,14 +881,12 @@ sub generateMacId {
if ( $out =~ m/File exists/i ) {
# Do nothing
}
else {
} else {
# Create next_macid file
$out = `ssh -o ConnectTimeout=5 $hcp "echo 'FFFFF0' > /opt/zhcp/conf/next_macid"`;
}
}
else {
} else {
# Create /opt/zhcp/conf directory
# Create next_mac - Contains next MAC address to use
@ -1074,8 +1070,7 @@ sub getUserProfile {
# Get user profiles and save it in a file
$out = `ssh $hcp "$hcpDir/getuserprofile $profile > $file"`;
}
}
else {
} else {
# Get user profiles and save it in a file
$out = `ssh $hcp "$hcpDir/getuserprofile $profile > $file"`;
@ -1091,8 +1086,8 @@ sub getUserProfile {
=head3 inArray
Description : Checks if a value exists in an array
Arguments : Value to search for
Array to search in
Arguments : Search value
Search array
Returns : The searched expression
Example : my $rtn = xCAT::zvmUtils->inArray($needle, @haystack);

View File

@ -3240,7 +3240,7 @@ sub nodeSet {
$layer = xCAT::zvmCPUtils->getNetworkLayer($hcp, $_);
# If template using DHCP, layer must be 2
if ((!$dhcp && $layer != 2) || ($dhcp && $layer == 2)) {
if ((!$dhcp && $layer != 2) || (!$dhcp && $layer == 2) || ($dhcp && $layer == 2)) {
# Save network name
$hcpNetName = $_;
@ -3286,7 +3286,7 @@ sub nodeSet {
$layer = xCAT::zvmCPUtils->getNetworkLayer($node, $_);
# If template using DHCP, layer must be 2
if ((!$dhcp && $layer != 2) || ($dhcp && $layer == 2)) {
if ((!$dhcp && $layer != 2) || (!$dhcp && $layer == 2) || ($dhcp && $layer == 2)) {
# Save network name
$hcpNetName = $_;