mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-26 17:54:05 +00:00
fix(plugins): mask passwords in plugin log messages
Six modules wrote passwords to their own log and diagnostic messages, outside the daemon redaction pipeline. The z/VM plugin logged each smcli command line through printSyslog, with the disk read, write and multi passwords, the image password, the provision root password and the page volume parm disk password, passed the real disk passwords to checkSSH_Rc, which echoes the command to syslog and to the client on failure, and logged raw directory entries whose USER and MDISK statements carry the logon and disk passwords. The bmcconfig plugin logged the BMC password in its attribute report, in syslog and in the command response. The energy plugin logged the HCP password in a verbose message, and the CIM utilities dumped the whole HTTP request, with its basic authorization header, to the verbose callback. The PPC configuration module logged the HMC, FSP and BPA passwords in its verbose credential reports. Mask the passwords in the logged text. The executed commands keep the real values. The page volume log string is built by operand position, so a decoy value in another operand cannot divert the mask. The checkSSH_Rc calls receive the masked command string, as the routine documentation asks. Add redact_directory_entry to the z/VM utilities. The routine masks the USER, IDENTITY and IDENT logon password, the MDISK passwords after the access mode in the range form and in the DEVNO, V-DISK and T-DISK forms, the APPCPASS statement, and the keyword password assignments in the short and the full spelling. The match separators stay on one line, so a record without passwords never masks the record below it, and one or more comment stars do not hide a credential record from the rules. The COMMAND statement masks whole, because it can start any CP command with an inline password. Every directory query sink logs through it, and the clone loops redact the query output at the source, because the failure checker and the retained disk list reuse the text. The directory helpers keep their raw return value for the callers and hand a redacted copy to the failure checker. Every error branch that echoes a fetched record after the output check does so through the redactor, because a password can spell an error word and trip the check: the directory fetch, the mini disk keyword fetch, and the four disk list callers. The CIM dump masks the authorization header. The bmcconfig report now names the password state, set or missing, which the report needs for diagnosis.
This commit is contained in:
@@ -441,7 +441,9 @@ sub send_http_request
|
||||
}
|
||||
|
||||
if (defined($http_params->{verbose}) && defined($http_params->{callback})) {
|
||||
$http_params->{callback}({ data => [ "\n========CIM Request Start========", $http_request->as_string(), "=======CIM Request End=======" ] });
|
||||
my $request_text = $http_request->as_string();
|
||||
$request_text =~ s/^(Authorization:).*$/$1 xxxxxxxx/mi;
|
||||
$http_params->{callback}({ data => [ "\n========CIM Request Start========", $request_text, "=======CIM Request End=======" ] });
|
||||
}
|
||||
|
||||
# send request and receive the response
|
||||
|
||||
@@ -1184,7 +1184,7 @@ sub get_rsp_dev
|
||||
#############################################
|
||||
foreach (keys %$hmc) {
|
||||
($hmc->{$_}->{username}, $hmc->{$_}->{password}) = xCAT::PPCdb::credentials($hmc->{$_}->{name}, lc($hmc->{$_}->{'type'}), "hscroot");
|
||||
xCAT::MsgUtils->verbose_message($request, "user/passwd for $_ is $hmc->{$_}->{username} $hmc->{$_}->{password}");
|
||||
xCAT::MsgUtils->verbose_message($request, "user/passwd for $_ is $hmc->{$_}->{username} xxxxxxxx");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1195,7 +1195,7 @@ sub get_rsp_dev
|
||||
#############################################
|
||||
foreach (keys %$fsp) {
|
||||
($fsp->{$_}->{username}, $fsp->{$_}->{password}) = xCAT::PPCdb::credentials($fsp->{$_}->{name}, lc($fsp->{$_}->{'type'}), "admin");
|
||||
xCAT::MsgUtils->verbose_message($request, "user/passwd for $_ is $fsp->{$_}->{username} $fsp->{$_}->{password}");
|
||||
xCAT::MsgUtils->verbose_message($request, "user/passwd for $_ is $fsp->{$_}->{username} xxxxxxxx");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1206,7 +1206,7 @@ sub get_rsp_dev
|
||||
#############################################
|
||||
foreach (keys %$bpa) {
|
||||
($bpa->{$_}->{username}, $bpa->{$_}->{password}) = xCAT::PPCdb::credentials($bpa->{$_}->{name}, lc($bpa->{$_}->{'type'}), "admin");
|
||||
xCAT::MsgUtils->verbose_message($request, "user/passwd for $_ is $bpa->{$_}->{username} $bpa->{$_}->{password}");
|
||||
xCAT::MsgUtils->verbose_message($request, "user/passwd for $_ is $bpa->{$_}->{username} xxxxxxxx");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -329,6 +329,37 @@ sub printLn {
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 redact_directory_entry
|
||||
|
||||
Description : Mask the passwords of a z/VM directory entry, so the
|
||||
text is safe to log. The USER and IDENTITY statements
|
||||
carry the logon password in their third field. The
|
||||
MDISK statement carries the read, write and multi
|
||||
passwords after the access mode. The COMMAND statement
|
||||
can start any CP command with an inline password, so
|
||||
the whole statement masks. The keyword form carries
|
||||
the passwords as PW assignments.
|
||||
Arguments : Directory entry text
|
||||
Returns : The text with each password masked
|
||||
Example : my $safe = xCAT::zvmUtils->redact_directory_entry($entry);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub redact_directory_entry {
|
||||
my ( $class, $entry ) = @_;
|
||||
return $entry unless defined $entry;
|
||||
$entry =~ s/^([ \t]*(?:\*[ \t]*)*(?:USER|IDENTITY|IDENT)[ \t]+\S+[ \t]+)\S+/$1xxxxxxxx/img;
|
||||
$entry =~ s/^([ \t]*(?:\*[ \t]*)*MDISK[ \t]+\S+[ \t]+\S+[ \t]+(?:DEVNO|V-DISK|T-DISK)[ \t]+\S+[ \t]+\S+)[ \t]+\S.*$/$1 xxxxxxxx/img;
|
||||
$entry =~ s/^([ \t]*(?:\*[ \t]*)*MDISK[ \t]+(?:\S+[ \t]+){5}\S+)[ \t]+\S.*$/$1 xxxxxxxx/img;
|
||||
$entry =~ s/^([ \t]*(?:\*[ \t]*)*APPCPASS\b).*$/$1 xxxxxxxx/img;
|
||||
$entry =~ s/^([ \t]*(?:\*[ \t]*)*COMMAND\b).*$/$1 xxxxxxxx/img;
|
||||
$entry =~ s/\b((?:READ|WRITE|MULTI)?(?:PASSWORD|PW)|APPCPASS)=\S+/$1=xxxxxxxx/ig;
|
||||
return $entry;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 printSyslog
|
||||
|
||||
Description : Print a string to syslog
|
||||
@@ -803,7 +834,7 @@ sub getMdisks {
|
||||
my $outmsg;
|
||||
my $rc;
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/getuserentry $userId"`;
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "ssh $user\@$hcp \"$sudo $dir/getuserentry $userId\"", $hcp, "getMdisks", $out, $node );
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "ssh $user\@$hcp \"$sudo $dir/getuserentry $userId\"", $hcp, "getMdisks", xCAT::zvmUtils->redact_directory_entry($out), $node );
|
||||
if ($rc != 0) {
|
||||
return $outmsg;
|
||||
}
|
||||
@@ -863,7 +894,7 @@ sub getDedicates {
|
||||
my $outmsg;
|
||||
my $rc;
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/smcli Image_Query_DM -T $userId"`;
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "commandString", $hcp, "getMdisks", $out, $node );
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "commandString", $hcp, "getMdisks", xCAT::zvmUtils->redact_directory_entry($out), $node );
|
||||
if ($rc != 0) {
|
||||
return $outmsg;
|
||||
}
|
||||
@@ -919,7 +950,7 @@ sub getCommands {
|
||||
my $outmsg;
|
||||
my $rc;
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/smcli Image_Query_DM -T $userId"`;
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "ssh $user\@$hcp \"$sudo $dir/smcli Image_Query_DM -T $userId\"", $hcp, "getCommands", $out, $node );
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "ssh $user\@$hcp \"$sudo $dir/smcli Image_Query_DM -T $userId\"", $hcp, "getCommands", xCAT::zvmUtils->redact_directory_entry($out), $node );
|
||||
if ($rc != 0) {
|
||||
return $outmsg;
|
||||
}
|
||||
@@ -987,7 +1018,7 @@ sub getUserEntryWODisk {
|
||||
my $outmsg;
|
||||
my $rc;
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/smcli Image_Query_DM -T $userId"`;
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "ssh $user\@$hcp \"$sudo $dir/smcli Image_Query_DM -T $userId\"", $hcp, "getUserEntryWODisk", $out, $node );
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "ssh $user\@$hcp \"$sudo $dir/smcli Image_Query_DM -T $userId\"", $hcp, "getUserEntryWODisk", xCAT::zvmUtils->redact_directory_entry($out), $node );
|
||||
if ($rc != 0) {
|
||||
return $outmsg;
|
||||
}
|
||||
@@ -4277,7 +4308,7 @@ sub findUsablezHcpNetwork {
|
||||
# Search directory entry for network name
|
||||
my $userEntry = `ssh $user\@$hcp "$sudo $::DIR/smcli Image_Query_DM -T $userId" | sed '\$d'`;
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() smcli Image_Query_DM -T $userId");
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() $userEntry");
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() " . xCAT::zvmUtils->redact_directory_entry($userEntry));
|
||||
|
||||
my $out = `echo "$userEntry" | grep "NICDEF"`;
|
||||
my @lines = split('\n', $out);
|
||||
@@ -4324,7 +4355,7 @@ sub findUsablezHcpNetwork {
|
||||
|
||||
# Get user profile
|
||||
my $userProfile = xCAT::zvmUtils->getUserProfile($user, $hcp, $words[1]);
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() $userProfile");
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() " . xCAT::zvmUtils->redact_directory_entry($userProfile));
|
||||
|
||||
# Get the NICDEF statement
|
||||
$out = `echo "$userProfile" | grep "NICDEF"`;
|
||||
|
||||
@@ -149,8 +149,9 @@ sub process_request {
|
||||
foreach my $sbmc (split /,/, $bmc) {
|
||||
(my $ip, my $mask, my $gw) = net_parms($sbmc);
|
||||
unless ($ip and $mask and $username and $password) {
|
||||
xCAT::MsgUtils->message('S', "Unable to determine IP, Netmask, Username, or Password for $sbmc. Ensure that hostname resolution is working. [IP=$ip Netmask=$mask User=$username Pass=$password]",);
|
||||
$callback->({ error => ["Invalid/Missing BMC related attributes in the node defintion (IP=$ip Netmask=$mask User=$username Pass=$password). Unable to configure the BMC, check the node definition."], errorcode => [1] });
|
||||
my $passtate = defined($password) && length($password) ? "set" : "missing";
|
||||
xCAT::MsgUtils->message('S', "Unable to determine IP, Netmask, Username, or Password for $sbmc. Ensure that hostname resolution is working. [IP=$ip Netmask=$mask User=$username Pass=$passtate]",);
|
||||
$callback->({ error => ["Invalid/Missing BMC related attributes in the node defintion (IP=$ip Netmask=$mask User=$username Pass=$passtate). Unable to configure the BMC, check the node definition."], errorcode => [1] });
|
||||
return 1;
|
||||
}
|
||||
if ($request->{command}->[0] eq 'remoteimmsetup') {
|
||||
@@ -187,4 +188,3 @@ sub process_request {
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -476,7 +476,7 @@ sub process_request {
|
||||
if ($verbose) {
|
||||
$args{verbose} = 1;
|
||||
$args{callback} = $callback;
|
||||
xCAT::MsgUtils->message("I", { data => ["$node: Access hcp [$ip], user [$user], passowrd [$password]"] }, $callback);
|
||||
xCAT::MsgUtils->message("I", { data => ["$node: Access hcp [$ip], user [$user], password [xxxxxxxx]"] }, $callback);
|
||||
}
|
||||
|
||||
# call the cim utils to connect to cim server
|
||||
|
||||
@@ -1041,10 +1041,10 @@ sub changeVM {
|
||||
|
||||
# Add to directory entry
|
||||
my $error = 0;
|
||||
xCAT::zvmUtils->printSyslog( "ssh $::SUDOER\@$hcp \"$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $userId -v $addr -t 3390 -a AUTOG -r $pool -u 1 -z $cyl -m $mode -f 1 -R $readPw -W $writePw -M $multiPw\"" );
|
||||
xCAT::zvmUtils->printSyslog( "ssh $::SUDOER\@$hcp \"$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $userId -v $addr -t 3390 -a AUTOG -r $pool -u 1 -z $cyl -m $mode -f 1 -R xxxxxxxx -W xxxxxxxx -M xxxxxxxx\"" );
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $userId -v $addr -t 3390 -a AUTOG -r $pool -u 1 -z $cyl -m $mode -f 1 -R $readPw -W $writePw -M $multiPw"`;
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?,
|
||||
"ssh $::SUDOER\@$hcp \"$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $userId -v $addr -t 3390 -a AUTOG -r $pool -u 1 -z $cyl -m $mode -f 1 -R $readPw -W $writePw -M $multiPw\"",
|
||||
"ssh $::SUDOER\@$hcp \"$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $userId -v $addr -t 3390 -a AUTOG -r $pool -u 1 -z $cyl -m $mode -f 1 -R xxxxxxxx -W xxxxxxxx -M xxxxxxxx\"",
|
||||
$hcp, "changeVM", $out, $node );
|
||||
if ( $rc != 0 ) {
|
||||
xCAT::zvmUtils->printLn( $callback, $outmsg );
|
||||
@@ -1330,7 +1330,7 @@ sub changeVM {
|
||||
my $error = 0;
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $userId -v $addr -t 9336 -a AUTOG -r $pool -u 2 -z $blks -m $mode -f 1 -R $readPw -W $writePw -M $multiPw 2>&1"`;
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?,
|
||||
"ssh $::SUDOER\@$hcp \"$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $userId -v $addr -t 9336 -a AUTOG -r $pool -u 2 -z $blks -m $mode -f 1 -R $readPw -W $writePw -M $multiPw 2>&1\"",
|
||||
"ssh $::SUDOER\@$hcp \"$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $userId -v $addr -t 9336 -a AUTOG -r $pool -u 2 -z $blks -m $mode -f 1 -R xxxxxxxx -W xxxxxxxx -M xxxxxxxx 2>&1\"",
|
||||
$hcp, "changeVM", $out, $node );
|
||||
if ( $rc != 0 ) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$node: $out" );
|
||||
@@ -1617,15 +1617,17 @@ EOF"`;
|
||||
my $i;
|
||||
my @options = ("", "vol_addr=", "volume_label=", "volume_use=", "system_config_name=", "system_config_type=", "parm_disk_owner=", "parm_disk_number=", "parm_disk_password=");
|
||||
my $argStr = "";
|
||||
my $logStr = "";
|
||||
foreach $i ( 1 .. $argsSize ) {
|
||||
if ( $args->[$i] ) {
|
||||
$argStr .= " -k \"$options[$i]$args->[$i]\"";
|
||||
$logStr .= ( $i == 8 ) ? " -k \"$options[$i]xxxxxxxx\"" : " -k \"$options[$i]$args->[$i]\"";
|
||||
}
|
||||
}
|
||||
|
||||
# Add a full volume page or spool disk to the system
|
||||
$out .= `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Page_or_Spool_Volume_Add -T $hcpUserId $argStr"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Page_or_Spool_Volume_Add -T $hcpUserId $argStr");
|
||||
xCAT::zvmUtils->printSyslog("smcli Page_or_Spool_Volume_Add -T $hcpUserId $logStr");
|
||||
$out = xCAT::zvmUtils->appendHostname( $node, $out );
|
||||
}
|
||||
|
||||
@@ -3034,7 +3036,7 @@ EOF"`;
|
||||
my $pw = $args->[1];
|
||||
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Password_Set_DM -T $userId -p $pw"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Password_Set_DM -T $userId -p $pw");
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Password_Set_DM -T $userId -p xxxxxxxx");
|
||||
$out = xCAT::zvmUtils->appendHostname( $node, $out );
|
||||
}
|
||||
|
||||
@@ -4434,7 +4436,7 @@ sub listVM {
|
||||
# Not return $out to upper layer as it might contain password
|
||||
xCAT::zvmUtils->printLn( $callback, "$node: (Error) not able to find $dev in user direct");
|
||||
|
||||
xCAT::zvmUtils->printSyslog("$node: (Error) not able to find $dev in user direct: $out");
|
||||
xCAT::zvmUtils->printSyslog("$node: (Error) not able to find $dev in user direct: " . xCAT::zvmUtils->redact_directory_entry($out));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -5106,7 +5108,7 @@ sub cloneVM {
|
||||
my %srcDiskType;
|
||||
my @srcDisks = xCAT::zvmUtils->getMdisks( $callback, $::SUDOER, $sourceNode );
|
||||
if (xCAT::zvmUtils->checkOutput( $srcDisks[0] ) == -1) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$srcDisks[0]" );
|
||||
xCAT::zvmUtils->printLn( $callback, xCAT::zvmUtils->redact_directory_entry($srcDisks[0]) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5115,8 +5117,8 @@ sub cloneVM {
|
||||
# MDISK=VDEV=0100 DEVTYPE=3390 START=0001 COUNT=10016 VOLID=EMC2C4 MODE=MR
|
||||
$out = `ssh $::SUDOER\@$srcHcp "$::SUDO $::DIR/smcli Image_Definition_Query_DM -T $sourceId -k MDISK"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Definition_Query_DM -T $sourceId -k MDISK");
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printSyslog("srcDisks:@srcDisks");
|
||||
xCAT::zvmUtils->printSyslog(xCAT::zvmUtils->redact_directory_entry($out));
|
||||
xCAT::zvmUtils->printSyslog("srcDisks:" . xCAT::zvmUtils->redact_directory_entry("@srcDisks"));
|
||||
my $srcDiskDet = xCAT::zvmUtils->trimStr($out);
|
||||
foreach (@srcDisks) {
|
||||
|
||||
@@ -5220,7 +5222,7 @@ sub cloneVM {
|
||||
xCAT::zvmCPUtils->loadVmcp($::SUDOER, $sourceNode);
|
||||
$out = `ssh $::SUDOER\@$srcHcp "$::SUDO $::DIR/smcli Image_Definition_Query_DM -T $sourceId -k NICDEF"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Definition_Query_DM -T $sourceId -k NICDEF");
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printSyslog(xCAT::zvmUtils->redact_directory_entry($out));
|
||||
# Output is similar to:
|
||||
# NICDEF_PROFILE=VDEV=0800 TYPE=QDIO LAN=SYSTEM SWITCHNAME=VSW2
|
||||
# NICDEF=VDEV=0900 TYPE=QDIO DEVICES=3 LAN=SYSTEM SWITCHNAME=GLAN1
|
||||
@@ -5640,7 +5642,7 @@ sub clone {
|
||||
# Check if user entry is created
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Query_DM -T $tgtUserId" | sed '\$d'`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Query_DM -T $tgtUserId | sed '\$d'");
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printSyslog(xCAT::zvmUtils->redact_directory_entry($out));
|
||||
$rc = xCAT::zvmUtils->checkOutput( $out );
|
||||
|
||||
if ( $rc == -1 ) {
|
||||
@@ -5732,7 +5734,7 @@ sub clone {
|
||||
xCAT::zvmUtils->printLn( $callback, "$tgtNode: Trying again ($try) to add minidisk ($addr)" );
|
||||
}
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 3390 -a AUTOG -r $pool -u 1 -z $cyl -m $mode -f 1 -R $tgtPw -W $tgtPw -M $tgtPw"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 3390 -a AUTOG -r $pool -u 1 -z $cyl -m $mode -f 1 -R $tgtPw -W $tgtPw -M $tgtPw");
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 3390 -a AUTOG -r $pool -u 1 -z $cyl -m $mode -f 1 -R xxxxxxxx -W xxxxxxxx -M xxxxxxxx");
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printLn( $callback, "$out" );
|
||||
|
||||
@@ -5776,7 +5778,7 @@ sub clone {
|
||||
xCAT::zvmUtils->printLn( $callback, "$tgtNode: Trying again ($try) to add minidisk ($addr)" );
|
||||
}
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 9336 -a AUTOG -r $pool -u 1 -z $blks -m $mode -f 1 -R $tgtPw -W $tgtPw -M $tgtPw"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 9336 -a AUTOG -r $pool -u 1 -z $blks -m $mode -f 1 -R $tgtPw -W $tgtPw -M $tgtPw");
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 9336 -a AUTOG -r $pool -u 1 -z $blks -m $mode -f 1 -R xxxxxxxx -W xxxxxxxx -M xxxxxxxx");
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printLn( $callback, "$out" );
|
||||
|
||||
@@ -5814,13 +5816,14 @@ sub clone {
|
||||
# Get disks within user entry
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Query_DM -T $tgtUserId");
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Query_DM -T $tgtUserId"`;
|
||||
$out = xCAT::zvmUtils->redact_directory_entry($out);
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "ssh $::SUDOER\@$hcp \"$::SUDO $::DIR/smcli Image_Query_DM -T $tgtUserId\"", $hcp, "clone", $out, $tgtNode );
|
||||
if ($rc != 0) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$outmsg" );
|
||||
return;
|
||||
}
|
||||
$out = `echo "$out" | sed '\$d' | grep -a -i "MDISK"`;
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printSyslog(xCAT::zvmUtils->redact_directory_entry($out));
|
||||
@disks = split( '\n', $out );
|
||||
|
||||
if ( @disks != @tgtDisks ) {
|
||||
@@ -6988,7 +6991,7 @@ sub nodeSet {
|
||||
$out = `sed -i -e "s,replace_master,$master,g" $customTmpl`;
|
||||
$out = `sed -i -e "s,replace_install_dir,$installDir,g" $customTmpl`;
|
||||
|
||||
xCAT::zvmUtils->printSyslog("***Provision settings for SLES:replace_host_address,$hostIP replace_long_name,$hostname replace_short_name,$node replace_domain,$domain replace_hostname,$node replace_nameserver,$nameserver replace_broadcast,$broadcast replace_device,$device replace_ipaddr,$hostIP replace_lladdr,$mac replace_netmask,$mask replace_network,$network replace_ccw_chan_ids,$chanIds replace_ccw_chan_mode,FOOBAR replace_gateway,$gateway replace_root_password,$passwd replace_nic_addr,$readChannel replace_master,$master replace_install_dir,$installDir $customTmpl");
|
||||
xCAT::zvmUtils->printSyslog("***Provision settings for SLES:replace_host_address,$hostIP replace_long_name,$hostname replace_short_name,$node replace_domain,$domain replace_hostname,$node replace_nameserver,$nameserver replace_broadcast,$broadcast replace_device,$device replace_ipaddr,$hostIP replace_lladdr,$mac replace_netmask,$mask replace_network,$network replace_ccw_chan_ids,$chanIds replace_ccw_chan_mode,FOOBAR replace_gateway,$gateway replace_root_password,xxxxxxxx replace_nic_addr,$readChannel replace_master,$master replace_install_dir,$installDir $customTmpl");
|
||||
|
||||
# Attach SCSI FCP devices (if any)
|
||||
# Go through each pool
|
||||
@@ -7278,7 +7281,7 @@ END
|
||||
$out = `sed -i -e "s,replace_master,$master,g" $customTmpl`;
|
||||
$out = `sed -i -e "s,replace_install_dir,$installDir,g" $customTmpl`;
|
||||
|
||||
xCAT::zvmUtils->printSyslog("***Provision settings for RedHat:replace_url,$repo replace_ip,$hostIP replace_netmask,$mask replace_gateway,$gateway replace_nameserver,$nameserver replace_hostname,$hostname replace_rootpw,$passwd replace_master,$master replace_install_dir,$installDir for file==>$customTmpl");
|
||||
xCAT::zvmUtils->printSyslog("***Provision settings for RedHat:replace_url,$repo replace_ip,$hostIP replace_netmask,$mask replace_gateway,$gateway replace_nameserver,$nameserver replace_hostname,$hostname replace_rootpw,xxxxxxxx replace_master,$master replace_install_dir,$installDir for file==>$customTmpl");
|
||||
|
||||
# Attach SCSI FCP devices (if any)
|
||||
# Go through each pool
|
||||
@@ -7374,7 +7377,7 @@ END
|
||||
# Get mdisk virtual address
|
||||
my @mdisks = xCAT::zvmUtils->getMdisks( $callback, $::SUDOER, $node );
|
||||
if (xCAT::zvmUtils->checkOutput( $mdisks[0] ) == -1) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$mdisks[0]" );
|
||||
xCAT::zvmUtils->printLn( $callback, xCAT::zvmUtils->redact_directory_entry($mdisks[0]) );
|
||||
return;
|
||||
}
|
||||
@mdisks = sort(@mdisks);
|
||||
@@ -7729,7 +7732,7 @@ END
|
||||
# Get the list of mdisks
|
||||
my @srcDisks = xCAT::zvmUtils->getMdisks( $callback, $::SUDOER, $node );
|
||||
if (xCAT::zvmUtils->checkOutput( $srcDisks[0] ) == -1) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$srcDisks[0]" );
|
||||
xCAT::zvmUtils->printLn( $callback, xCAT::zvmUtils->redact_directory_entry($srcDisks[0]) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11145,7 +11148,7 @@ sub imageCapture {
|
||||
# Get the list of mdisks
|
||||
my @srcDisks = xCAT::zvmUtils->getMdisks( $callback, $sudoer, $node );
|
||||
if (xCAT::zvmUtils->checkOutput( $srcDisks[0] ) == -1) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$srcDisks[0]" );
|
||||
xCAT::zvmUtils->printLn( $callback, xCAT::zvmUtils->redact_directory_entry($srcDisks[0]) );
|
||||
return;
|
||||
}
|
||||
foreach (@srcDisks) {
|
||||
@@ -11570,7 +11573,7 @@ sub specialcloneVM {
|
||||
xCAT::zvmUtils->printSyslog("Executing: ssh $::SUDOER\@$tgtZhcp $::SUDO $dir/smcli Image_Query_DM -T $sourceId | sed '\$d'\n");
|
||||
$out = `ssh $::SUDOER\@$tgtZhcp "$::SUDO $dir/smcli Image_Query_DM -T $sourceId" | sed '\$d'`;
|
||||
if (xCAT::zvmUtils->checkOutput( $out ) == -1) {
|
||||
xCAT::zvmUtils->printLn( $callback, "(Error) Did not get the $sourceId directory. Return output was: $out." );
|
||||
xCAT::zvmUtils->printLn( $callback, "(Error) Did not get the $sourceId directory. Return output was: " . xCAT::zvmUtils->redact_directory_entry($out) . "." );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11589,7 +11592,7 @@ sub specialcloneVM {
|
||||
# MDISK=VDEV=0100 DEVTYPE=3390 START=0001 COUNT=10016 VOLID=EMC2C4 MODE=MR
|
||||
$out = `ssh $::SUDOER\@$tgtZhcp "$::SUDO $::DIR/smcli Image_Definition_Query_DM -T $sourceId -k MDISK"`;
|
||||
if (xCAT::zvmUtils->checkOutput( $out ) == -1) {
|
||||
xCAT::zvmUtils->printLn( $callback, "(Error) Did not get the $sourceId mini disks. Return output was: $out." );
|
||||
xCAT::zvmUtils->printLn( $callback, "(Error) Did not get the $sourceId mini disks. Return output was: " . xCAT::zvmUtils->redact_directory_entry($out) . "." );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12037,7 +12040,7 @@ sub specialClone {
|
||||
xCAT::zvmUtils->printLn( $callback, "$tgtNode: Trying again ($try) to add minidisk ($addr)" );
|
||||
}
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 3390 -a AUTOG -r $ECKD_Pool -u 1 -z $disksize -m $mode -f 1 -R $tgtPw -W $tgtPw -M $tgtPw"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 3390 -a AUTOG -r $ECKD_Pool -u 1 -z $disksize -m $mode -f 1 -R $tgtPw -W $tgtPw -M $tgtPw");
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 3390 -a AUTOG -r $ECKD_Pool -u 1 -z $disksize -m $mode -f 1 -R xxxxxxxx -W xxxxxxxx -M xxxxxxxx");
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printLn( $callback, "$out" );
|
||||
|
||||
@@ -12080,7 +12083,7 @@ sub specialClone {
|
||||
xCAT::zvmUtils->printLn( $callback, "$tgtNode: Trying again ($try) to add minidisk ($addr)" );
|
||||
}
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 9336 -a AUTOG -r $FBA_Pool -u 1 -z $disksize -m $mode -f 1 -R $tgtPw -W $tgtPw -M $tgtPw"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 9336 -a AUTOG -r $FBA_Pool -u 1 -z $disksize -m $mode -f 1 -R $tgtPw -W $tgtPw -M $tgtPw");
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Disk_Create_DM -T $tgtUserId -v $addr -t 9336 -a AUTOG -r $FBA_Pool -u 1 -z $disksize -m $mode -f 1 -R xxxxxxxx -W xxxxxxxx -M xxxxxxxx");
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printLn( $callback, "$out" );
|
||||
|
||||
@@ -12118,13 +12121,14 @@ sub specialClone {
|
||||
# Get disks within user entry
|
||||
xCAT::zvmUtils->printSyslog("smcli Image_Query_DM -T $tgtUserId");
|
||||
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Query_DM -T $tgtUserId"`;
|
||||
$out = xCAT::zvmUtils->redact_directory_entry($out);
|
||||
($rc, $outmsg) = xCAT::zvmUtils->checkSSH_Rc( $?, "ssh $::SUDOER\@$hcp \"$::SUDO $::DIR/smcli Image_Query_DM -T $tgtUserId\"", $hcp, "specialClone", $out, $tgtNode );
|
||||
if ($rc != 0) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$outmsg" );
|
||||
return;
|
||||
}
|
||||
$out = `echo "$out" | sed '\$d' | grep -a -i "MDISK"`;
|
||||
xCAT::zvmUtils->printSyslog("$out");
|
||||
xCAT::zvmUtils->printSyslog(xCAT::zvmUtils->redact_directory_entry($out));
|
||||
@disks = split( '\n', $out );
|
||||
|
||||
if ( @disks != @tgtDisks ) {
|
||||
|
||||
Reference in New Issue
Block a user