From c3ae956dd3c6f5676d4ea2448ee588b170415410 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Thu, 5 Apr 2018 10:41:08 +0800 Subject: [PATCH 001/117] report ipmi_debug message under node name (#5033) --- xCAT-server/lib/perl/xCAT/IPMI.pm | 5 ++++- xCAT-server/lib/xcat/plugins/ipmi.pm | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index 4b444ac48..775583368 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -193,6 +193,9 @@ sub new { foreach (keys %args) { #store all passed parameters $self->{$_} = $args{$_}; } + unless ($args{'node'}) { #default to port 623 unless specified + $self->{'node'} = $args{'bmc'}; + } unless ($args{'port'}) { #default to port 623 unless specified $self->{'port'} = 623; } @@ -482,7 +485,7 @@ sub subcmd { my $command_string = $command_info{$args{netfn}}->{$args{command}}; my $data_values = join ", ", @{$args{data}}; my $msg = sprintf ("[ipmi_debug] $self->{onlogon_args}->{command}:$self->{onlogon_args}->{subcommand}(@{$self->{onlogon_args}->{extraargs}}), raw_cmd: netfn(0x%02x=>%s), cmd(0x%02x=>%s), data=[%s]", $args{netfn}, $netfn_types{$args{netfn}}, $args{command}, $command_string, $data_values); - xCAT::SvrUtils::sendmsg([0, $msg], $self->{onlogon_args}->{outfunc}); + xCAT::SvrUtils::sendmsg([0, $msg], $self->{onlogon_args}->{outfunc}, $self->{node}); } my $seqincrement = 7; while ($tabooseq{ $self->{expectednetfn} }->{ $self->{expectedcmd} }->{ $self->{seqlun} } and $seqincrement) { #avoid using a seqlun formerly marked 'taboo', but don't advance by more than 7, just in case diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 6b6684450..a1cda1a6f 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -9045,7 +9045,7 @@ sub donode { on_bmc_connect(0, $sessiondata{$node}); return 0; } - $sessiondata{$node}->{ipmisession} = xCAT::IPMI->new(bmc => $bmcip, userid => $user, password => $pass); + $sessiondata{$node}->{ipmisession} = xCAT::IPMI->new(bmc => $bmcip, userid => $user, password => $pass, node => $node); if ($sessiondata{$node}->{ipmisession}->{error}) { xCAT::SvrUtils::sendmsg([ 1, $sessiondata{$node}->{ipmisession}->{error} ], $callback, $node, %allerrornodes); } else { From 74874062d5998665696f4fe68f76194ddc3f79f6 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 11 Apr 2018 13:39:21 -0400 Subject: [PATCH 002/117] Processor DD version check in Perl --- .../lib/python/agent/hwctl/executor/openbmc_flash.py | 10 ++++++++++ xCAT-server/lib/xcat/plugins/openbmc.pm | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py index ffaa051a1..2f7a53fcc 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py @@ -527,6 +527,16 @@ class OpenBMCFlashTask(ParallelNodesCommand): try: obmc.login() + # Before uploading file, check CPU DD version + inventory_info_dict = obmc.get_inventory_info() + cpu_info = inventory_info_dict["CPU"] + for info in cpu_info: + if info.startswith("CPU0 Version : 20"): + # Display warning the only certain firmware versions are supported on DD 2.0 + self.callback.info( '%s: Warning: DD 2.0 processor detected on this node, should not have firmware > ibm-v2.0-0-r13.6 (BMC) and > v1.19_1.94 (Host).' % node) + if info.startswith("CPU0 Version : 21"): + if self.verbose: + self.callback.info( '%s: DD 2.1 processor' % node) except (SelfServerException, SelfClientException) as e: return self._msg_process(node, e.message, msg_type='E') diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index f576e20a5..4ce5cbcc1 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -4615,6 +4615,7 @@ sub rflash_upload { # curl commands my $curl_login_cmd = "curl -c $cjar_id -k -H 'Content-Type: application/json' -X POST $request_url/login -d '" . $content_login . "'"; my $curl_logout_cmd = "curl -b $cjar_id -k -H 'Content-Type: application/json' -X POST $request_url/logout -d '" . $content_logout . "'"; + my $curl_check_cpu_dd_cmd = "curl -b $cjar_id -k -H 'Content-Type: application/json' -X GET $request_url/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0 | grep Version | cut -d: -f2"; if (%fw_tar_files) { foreach my $key (keys %fw_tar_files) { @@ -4646,6 +4647,17 @@ sub rflash_upload { } if ($h->{message} eq $::RESPONSE_OK) { if(%curl_upload_cmds){ + # Before uploading file, check CPU DD version + my $curl_dd_check_result = `$curl_check_cpu_dd_cmd`; + if ($curl_dd_check_result =~ "20") { + # Display warning the only certain firmware versions are supported on DD 2.0 + xCAT::SvrUtils::sendmsg("Warning: DD 2.0 processor detected on this node, should not have firmware > ibm-v2.0-0-r13.6 (BMC) and > v1.19_1.94 (Host).", $callback, $node); + } + if ($curl_dd_check_result =~ "21") { + if ($::VERBOSE) { + xCAT::SvrUtils::sendmsg("DD 2.1 processor", $callback, $node); + } + } while((my $file,my $version)=each(%fw_tar_files)){ my $uploading_msg = "Uploading $file ..."; my $upload_cmd = $curl_upload_cmds{$file}; From 2419a7809834772b8b9650f3b7d9bd31c4fb1d97 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Wed, 11 Apr 2018 15:29:52 -0700 Subject: [PATCH 003/117] ddns: log more infornation to show the DNS entry when an error occurs --- xCAT-server/lib/xcat/plugins/ddns.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 903c3aea5..2b6a1b2e3 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -1528,7 +1528,7 @@ sub add_or_delete_records { next; } if ($reply->header->rcode ne 'NOERROR') { - xCAT::SvrUtils::sendmsg([ 1, "Failure encountered updating $zone, error was " . $reply->header->rcode . ". See more details in system log." ], $callback); + xCAT::SvrUtils::sendmsg([ 1, "Failure encountered updating $zone with entry '$entry', error was " . $reply->header->rcode . ". See more details in system log." ], $callback); } } else { @@ -1549,7 +1549,7 @@ sub add_or_delete_records { next; } if ($reply->header->rcode ne 'NOERROR') { - xCAT::SvrUtils::sendmsg([ 1, "Failure encountered updating $zone, error was " . $reply->header->rcode . ". See more details in system log." ], $callback); + xCAT::SvrUtils::sendmsg([ 1, "Failure encountered updating $zone with entry '$entry', error was " . $reply->header->rcode . ". See more details in system log." ], $callback); } } else { From deeb77ebd1fdf795e0c9d3d48aa8fcfbf8805b82 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Sun, 15 Apr 2018 23:10:38 -0400 Subject: [PATCH 004/117] Add the mlnxofedinstall default parameters xcat recommended into mlnx diskless installation document --- .../networks/infiniband/mlnxofed_ib_install_v2_diskless.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst index 3af2cb177..06b1064d7 100644 --- a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst +++ b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst @@ -28,10 +28,10 @@ Diskless Installation *Note: The $1 is a argument that is passed to the the postinstall script at runtime.* - **[kernel mismatch issue]** The Mellanox OFED ISO is built against a series of specific kernel version. If the version of the linux kernel does not match any of the Mellanox offered pre-built kernel modules, you can pass the ``--add-kernel-support`` argument to the Mellanox installation script to build the kernel modules based on the version you are using. :: + **[kernel mismatch issue]** The Mellanox OFED ISO is built against a series of specific kernel version. If the version of the linux kernel does not match any of the Mellanox offered pre-built kernel modules, you can pass the ``--add-kernel-support --without-32bit --without-fw-update --force`` arguments to the Mellanox installation script to build the kernel modules based on the version you are using. :: /install/postscripts/mlnxofed_ib_install \ - -p /install// -m --add-kernel-support -end- \ + -p /install// -m --add-kernel-support --without-32bit --without-fw-update --force -end- \ -i $1 -n genimage #. Generate the diskless image From 46528446a947351847e33fbc333a63575d122ab3 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 17 Apr 2018 03:23:42 -0400 Subject: [PATCH 005/117] add rspconfig test cases --- xCAT-test/autotest/testcase/rspconfig/cases1 | 303 +++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 xCAT-test/autotest/testcase/rspconfig/cases1 diff --git a/xCAT-test/autotest/testcase/rspconfig/cases1 b/xCAT-test/autotest/testcase/rspconfig/cases1 new file mode 100644 index 000000000..b59471a36 --- /dev/null +++ b/xCAT-test/autotest/testcase/rspconfig/cases1 @@ -0,0 +1,303 @@ +start:rspconfig_ipsrc +description: To test "rspconfig ipsrc",to get the IP source for OpenBMC +os:Linux +hcp:openbmc +cmd:rspconfig $$CN ipsrc +check:output=~$$CN\s*:\s*BMC IP Source: Static|BMC IP Source: Dynamic +check:rc == 0 +cmd:rspconfig $$CN hostname sshcfg +check:output =~Error: Configure sshcfg must be issued without other options. +check:rc != 0 +end + +start:rspconfig_dump_list +description: To test "rspconfig dump -l" and "rspconfig dump --list" +os:Linux +hcp:openbmc +cmd:rspconfig $$CN dump -l +check:output =~$$CN:\s*No attributes returned from the BMC.|\s*\[\d+\]\s* Generated: +check:rc == 0 +cmd:rspconfig $$CN dump --list +check:output =~$$CN:\s*No attributes returned from the BMC.|\s*\[\d+\]\s* Generated: +check:rc == 0 +end + +start:rspconfig_dump_generate +description: To test "rspconfig dump -g" and "rspconfig dump --generate" +os:Linux +hcp:openbmc +cmd:rspconfig $$CN dump -l|tee /tmp/dumplistold +check:output =~$$CN:\s*No attributes returned from the BMC.|\s*\[\d+\]\s* Generated: +check:rc == 0 +cmd:rspconfig $$CN dump -g|tee /tmp/dumpgenerate +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +end +cmd:sleep 300 +cmd:rspconfig $$CN dump -l +check:output =~$$CN:\s*\[\d+\]\s* Generated: +check:rc == 0 +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`|rspconfig $$CN dump --clear $dumpnumber +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* clear +cmd:rspconfig $$CN dump -l|tee /tmp/dumplistnew +cmd:diff /tmp/dumplistold /tmp/dumplistnew +check:rc == 0 +cmd:rspconfig $$CN dump --generate|tee /tmp/dumpgenerate +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:sleep 300 +cmd:rspconfig $$CN dump -l +check:output =~$$CN:\s*\[\d+\]\s* Generated: +check:rc == 0 +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* clear +cmd:rspconfig $$CN dump -l|tee /tmp/dumplistnew +cmd:diff /tmp/dumplistold /tmp/dumplistnew +check:rc == 0 +cmd:rm -rf /tmp/dumplistold /tmp/dumplistnew /tmp/dumpgenerate +end + +start:rspconfig_dump_clear +description: To test "rspconfig dump -c" and "rspconfig dump --clear" +os:Linux +hcp:openbmc +cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:sleep 300 +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* clear +cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:sleep 300 +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* clear +cmd:rspconfig $$CN dump -g +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:rspconfig $$CN dump -g +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:sleep 300 +cmd:rspconfig $$CN dump -c all +check:rc == 0 +check:output =~$$CN:\s*\[all\]\s* clear +cmd:rspconfig $$CN dump -l +check:output =~$$CN:\s*No attributes returned from the BMC. +cmd:rspconfig $$CN dump -g +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:rspconfig $$CN dump -g +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:sleep 300 +cmd:rspconfig $$CN dump --clear all +check:rc == 0 +check:output =~$$CN:\s*\[all\]\s* clear +cmd:rspconfig $$CN dump -l +check:output =~$$CN:\s*No attributes returned from the BMC. +end + +start:rspconfig_dump_download +description: To test rspconfig dump -d" and "rspconfig dump --download" +os:Linux +hcp:openbmc +cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:sleep 300 +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump -d $dumpnumber +check:rc == 0 +check:output =~$$CN:\s*Downloaded dump \s*\d+\s* to /var/log/xcat/dump/ +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --download $dumpnumber +check:rc == 0 +check:output =~$$CN:\s*Downloaded dump \s*\d+\s* to /var/log/xcat/dump/ +cmd:rspconfig $$CN dump -d all +check:rc == 0 +check:output =~Downloading all dumps +cmd:rspconfig $$CN dump --download all +check:rc == 0 +check:output =~Downloading all dumps +cmd:rm -rf /tmp/dumpgenerate +end + +start:rspconfig_dump_no_option +description: To test "rspconfig dump" +os:Linux +hcp:openbmc +cmd:rspconfig $$CN dump +check:rc == 0 +check:output =~$$CN:\s*Dump requested +check:output =~$$CN:\s*Downloading dump +end + +start:rspconfig_gard +description: To test "rspconfig gard -c" +os:Linux +hcp:openbmc +cmd:rspconfig $$CN gard -c +check:output =~$$CN:\s*GARD cleared +check:rc == 0 +cmd:rspconfig $$CN gard --clear +check:output =~$$CN:\s*GARD cleared +check:rc == 0 +end + +start:rspconfig_ntpserver +description: To test "rspconfig ntpservers" to show the ntp server of the node +os:Linux +hcp:openbmc +cmd:rspconfig $$CN ntpservers +check:output =~$$CN:\s*BMC NTP Servers:\s*None|\s*\d+.\d+.\d+.\d+ +check:rc == 0 +end + +start:rspconfig_powerrestorepolicy +description: To test "rspconfig powerrestorepolicy" to show the policy +os:Linux +hcp:openbmc +cmd:rspconfig $$CN powerrestorepolicy |tee /tmp/powerrestorepolicy +check:output =~$$CN:\s*BMC PowerRestorePolicy:\s*AlwaysOff|AlwaysOn|Restore +check:rc == 0 +cmd:rspconfig $$CN powerrestorepolicy=always_on +check:output =~$$CN:\s*BMC Setting BMC PowerRestorePolicy... +check:rc == 0 +cmd:rspconfig $$CN powerrestorepolicy +check:output =~$$CN:\s*BMC PowerRestorePolicy:\s*AlwaysOn +cmd:rspconfig $$CN powerrestorepolicy=always_off +check:output =~$$CN:\s*BMC Setting BMC PowerRestorePolicy... +check:rc == 0 +cmd:rspconfig $$CN powerrestorepolicy +check:output =~$$CN:\s*BMC PowerRestorePolicy:\s*AlwaysOff +cmd:rspconfig $$CN powerrestorepolicy=restore +check:output =~$$CN:\s*BMC Setting BMC PowerRestorePolicy... +check:rc == 0 +cmd:rspconfig $$CN powerrestorepolicy=abc +check:output =~$$CN:\s*Error: Invalid value '\S*' for 'powerrestorepolicy', Valid values: restore,always_on,always_off +check:rc != 0 +cmd:rspconfig $$CN powerrestorepolicy +check:output =~$$CN:\s*BMC PowerRestorePolicy:\s*Restore +cmd:policy=`cat /tmp/powerrestorepolicy | awk -F ":" '{print $3}'`;newpolicy=`echo $policy |tr 'A-Z' 'a-z'`;rspconfig $$CN powerrestorepolicy=$newpolicy +check:rc == 0 +cmd:rm -rf /tmp/powerrestorepolicy +end + +start:rspconfig_powersupplyredundancy +description: To test "rspconfig powersupplyredundancy" to show the powersupplyredundancy state +os:Linux +hcp:openbmc +cmd:rspconfig $$CN powersupplyredundancy |tee /tmp/powersupplyredundancy +check:output =~$$CN:\s*BMC PowerSupplyRedundancy:\s*Enabled|Disabled +check:rc == 0 +cmd:rspconfig $$CN powersupplyredundancy=enabled +check:output =~$$CN:\s*BMC Setting BMC PowerSupplyRedundancy... +check:rc == 0 +cmd:rspconfig $$CN powersupplyredundancy +check:output =~$$CN:\s*BMC PowerSupplyRedundancy:\s*Enabled +cmd:rspconfig $$CN powersupplyredundancy=disabled +check:output =~$$CN:\s*BMC Setting BMC PowerSupplyRedundancy... +check:rc == 0 +cmd:rspconfig $$CN powersupplyredundancy +check:output =~$$CN:\s*BMC PowerSupplyRedundancy:\s*Disabled +cmd:rspconfig $$CN powersupplyredundancy=abc +check:output =~$$CN:\s*Error: Invalid value \S* for 'powersupplyredundancy', Valid values: disabled,enabled +check:rc != 0 +cmd:redundancy=`cat /tmp/powersupplyredundancy | awk -F ":" '{print $3}'`;newredundancy=`echo $redundancy |tr 'A-Z' 'a-z'`;rspconfig $$CN powersupplyredundancy=$newredundancy +check:rc == 0 +cmd:rm -rf /tmp/powersupplyredundancy +end + +start:rspconfig_timesyncmethod +description: To test "rspconfig timesyncmethod" to show the timesyncmethod +os:Linux +hcp:openbmc +cmd:rspconfig $$CN timesyncmethod |tee /tmp/timesyncmethod +check:output =~$$CN:\s*BMC TimeSyncMethod:\s*NTP|Manual +check:rc == 0 +cmd:rspconfig $$CN timesyncmethod=ntp +check:output =~$$CN:\s*BMC Setting BMC TimeSyncMethod... +check:rc == 0 +cmd:rspconfig $$CN timesyncmethod +check:output =~$$CN:\s*BMC TimeSyncMethod:\s*NTP +cmd:rspconfig $$CN timesyncmethod=manual +check:output =~$$CN:\s*BMC Setting BMC TimeSyncMethod... +check:rc == 0 +cmd:rspconfig $$CN timesyncmethod +check:output =~$$CN:\s*BMC TimeSyncMethod:\s*Manual +cmd:rspconfig $$CN timesyncmethod=abc +check:output =~$$CN:\s*Error: Invalid value \S* for 'timesyncmethod', Valid values: ntp,manual +check:rc != 0 +cmd:syncmethod=`cat /tmp/timesyncmethod | awk -F ":" '{print $3}'`;newsyncmethod=`echo $syncmethod |tr 'A-Z' 'a-z'`;rspconfig $$CN timesyncmethod=$newsyncmethod +check:rc == 0 +cmd:rm -rf /tmp/timesyncmethod +end + +start:rspconfig_bootmode +description: To test "rspconfig bootmode" to show and change bootmode +os:Linux +hcp:openbmc +cmd:rspconfig $$CN bootmode|tee /tmp/bootmode +check:output =~$$CN:\s*BMC BootMode:\s*Regular|Safe|Setup +check:rc == 0 +cmd:rspconfig $$CN bootmode=regular +check:output =~$$CN:\s*BMC Setting BMC BootMode... +check:rc == 0 +cmd:rspconfig $$CN bootmode +check:output =~$$CN:\s*BMC BootMode:\s*Regular +cmd:rspconfig $$CN bootmode=safe +check:output =~$$CN:\s*BMC Setting BMC BootMode... +check:rc == 0 +cmd:rspconfig $$CN bootmode +check:output =~$$CN:\s*BMC BootMode:\s*Safe +cmd:rspconfig $$CN bootmode=setup +check:output =~$$CN:\s*BMC Setting BMC BootMode... +check:rc == 0 +cmd:rspconfig $$CN bootmode +check:output =~$$CN:\s*BMC BootMode:\s*Setup +cmd:rspconfig $$CN bootmode=abc +check:output =~$$CN:\s*Error: Invalid value \S* for 'bootmode', Valid values: regular,safe,setup +check:rc != 0 +cmd:mode=`cat /tmp/bootmode |awk -F ":" '{print $3}'`;newmode=`echo $mode |tr 'A-Z' 'a-z'`;rspconfig $$CN bootmode=$newmode +check:rc == 0 +cmd:rm -rf /tmp/bootmode +end + +start:rspconfig_autoreboot +description: To test "rspconfig autoreboot" to show and change autoreboot +os:Linux +hcp:openbmc +cmd:rspconfig $$CN autoreboot|tee /tmp/autoreboot +check:output =~$$CN:\s*BMC AutoReboot:\s*1|0 +check:rc == 0 +cmd:rspconfig $$CN autoreboot=1 +check:output =~$$CN:\s*BMC Setting BMC AutoReboot... +check:rc == 0 +cmd:rspconfig $$CN autoreboot +check:output =~$$CN:\s*BMC AutoReboot:\s*1 +cmd:rspconfig $$CN autoreboot=0 +check:output =~$$CN:\s*BMC Setting BMC AutoReboot... +check:rc == 0 +cmd:rspconfig $$CN autoreboot +check:output =~$$CN:\s*BMC AutoReboot:\s*0 +cmd:rspconfig $$CN autoreboot=2 +check:output =~$$CN:\s*Error: Invalid value \S* for 'autoreboot', Valid values: 0,1 +check:rc != 0 +cmd:autoreboot=`cat /tmp/autoreboot |awk -F ":" '{print $3}'`;newautoreboot=`echo $autoreboot |tr 'A-Z' 'a-z'`;rspconfig $$CN autoreboot=$newautoreboot +check:rc == 0 +cmd:rm -rf /tmp/autoreboot +end + +start:rspconfig_invalid +description: To test "rspconfig invalid_value" should throw out error message +os:Linux +hcp:openbmc +cmd:rspconfig $$CN aaa +check:output =~Error: Unsupported command: rspconfig aaa +check:rc != 0 +end + From 4163a6bb6c29e43645b304ed2049624baf9974db Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 17 Apr 2018 13:40:57 -0400 Subject: [PATCH 006/117] Token expiration setting --- perl-xCAT/xCAT/Schema.pm | 4 +- xCAT-server/lib/perl/xCAT/xcatd.pm | 62 ++++++++++++++++++++++++------ xCAT-server/sbin/xcatd | 15 ++++++-- 3 files changed, 64 insertions(+), 17 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index d06d4c780..ca97fd170 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1802,12 +1802,14 @@ zvmivp => { }, }, token => { - cols => [qw(tokenid username expire comments disable)], + cols => [qw(tokenid username created access expire comments disable)], keys => [qw(tokenid)], table_desc => 'The token of users for authentication.', descriptions => { tokenid => 'It is a UUID as an unified identify for the user.', username => 'The user name.', + created => 'Creation time for this token.', + access => 'Last access time for this token.', expire => 'The expire time for this token.', comments => 'Any user-provided notes.', disable => "Set to 'yes' or '1' to comment out this row.", diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index 48cb9c85a..7e4c97c3f 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -7,7 +7,9 @@ BEGIN $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use strict; +use Date::Parse; use xCAT::Table; +use xCAT::TableUtils; use xCAT::MsgUtils; use Data::Dumper; use xCAT::NodeRange; @@ -351,18 +353,21 @@ sub validate { return 0; } -my $tokentimeout = 86400; # one day +#MG +my $one_day = 86400; # one day in seconds +my $days = 1; # default days for token expiration +my $never_label = "never"; -# this subroutine search the token table -# 1. find the existed token entry for the user and reset the expire time -# 1.1. if not find existed token, create a new one and add it to token table -# 2. clean up the expired token +# this subroutine creates a new token in token table +# 1. clean up the expired token +# 2. create a new token and add it to token table # # this subroutine is called after the account has been authorized sub gettoken { my $class = shift; my $req = shift; + my $current_time = time(); my $user = $req->{gettoken}->[0]->{username}->[0]; my $tokentb = xCAT::Table->new('token'); unless ($tokentb) { @@ -371,16 +376,34 @@ sub gettoken { my $tokens = $tokentb->getAllEntries; foreach my $token (@{$tokens}) { - #clean the expired token - if ($token->{'expire'} < time()) { + # Clean the expired tokens + if (($token->{'expire'} ne $never_label) and (str2time($token->{'expire'}) < $current_time)) { $tokentb->delEntries({ 'tokenid' => $token->{tokenid} }); } } - # create a new token for this request + # create a new token id my $uuid = xCAT::Utils->genUUID(); - my $expiretime = time() + $tokentimeout; - $tokentb->setAttribs({ tokenid => $uuid, username => $user }, { expire => $expiretime }); + # extract site table setting for number of days before token expires + my @entries = xCAT::TableUtils->get_site_attribute("expiretokendays"); + my $token_days = $entries[0]; + my $expiretime = $current_time + $one_day; # default is one day + my $expire_time_string = timeToString($expiretime); + if ($token_days and (uc($token_days) eq uc($never_label))) { + # Tokens never expire + $expiretime = $never_label; + $expire_time_string = $never_label; + } + elsif ($token_days and $token_days > 0) { + # Use number of days from site table + $days = $token_days; + $expiretime = $current_time + $one_day * $days; + $expire_time_string = timeToString($expiretime); + } + my $access_time_string = timeToString($current_time); + # create a new token and set its expiration and creation time + $tokentb->setAttribs({ tokenid => $uuid, username => $user }, + { expire => $expire_time_string, created => $access_time_string }); $tokentb->close(); return ($uuid, $expiretime); @@ -391,6 +414,7 @@ sub verifytoken { my $class = shift; my $req = shift; + my $current_time = time(); my $tokenid = $req->{tokens}->[0]->{tokenid}->[0]; my $tokentb = xCAT::Table->new('token'); unless ($tokentb) { @@ -398,16 +422,30 @@ sub verifytoken { } my $token = $tokentb->getAttribs({ 'tokenid' => $tokenid }, ('username', 'expire')); if (defined($token) && defined($token->{'username'}) && defined($token->{'expire'})) { - my $expiretime = time() + $tokentimeout; - if ($token->{'expire'} < time()) { + # Clean the expired token and return + if (($token->{'expire'} ne $never_label) and (str2time($token->{'expire'}) < $current_time)) { + xCAT::MsgUtils->message("S", "MG (verify) Removing expired token " . $token->{tokenid}); $tokentb->delEntries({ 'tokenid' => $token->{tokenid} }); return undef; } else { + # Store current access time + $tokentb->setAttribs({ tokenid => $tokenid, username => $token->{'username'} }, {access => timeToString($current_time)}); return $token->{'username'}; } } else { + # Token entry was not found return undef; } } +# Return passed in time as a string in YYYY/MM/DD HH:MM:SS format +sub timeToString() { + my $unixtime = shift; + + my ($sec, $min, $hour, $mday, $mon, $year) = localtime($unixtime); + $year += 1900; + $mon += 1; + return "$year/$mon/$mday $hour:$min:$sec"; +} + 1; diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 6c717bebe..859192801 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -2826,11 +2826,18 @@ sub service_connection { if ($peername) { # for a valid account, get a token + my $htime; my ($tokenid, $exptime) = xCAT::xcatd->gettoken($req); - my ($sec, $min, $hour, $mday, $mon, $year) = localtime($exptime); - $year += 1900; - $mon += 1; - my $htime = "$year-$mon-$mday $hour:$min:$sec"; + if ($exptime eq "never") { + # If token expiration time was set to "never", return that to the user. + $htime = $exptime; + } else { + # Token expiration is a datetime, convert to readable string + my ($sec, $min, $hour, $mday, $mon, $year) = localtime($exptime); + $year += 1900; + $mon += 1; + $htime = "$year-$mon-$mday $hour:$min:$sec"; + } $resp = { data => [ { token => [ { id => $tokenid, expire => $htime } ] } ] }; } else { $resp = { error => ["Authentication failure"], errorcode => [1] }; From 36b0b69cf4af601701094f5c2a903e8a91c44116 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 17 Apr 2018 14:07:29 -0400 Subject: [PATCH 007/117] Documentation changes for REST API token --- .../restapi/restapi_usage/restapi_usage.rst | 10 +++++++++- .../admin-guides/references/man5/policy.5.rst | 2 +- .../guides/admin-guides/references/man5/site.5.rst | 2 ++ .../admin-guides/references/man5/token.5.rst | 14 +++++++++++++- .../admin-guides/references/man7/policy.7.rst | 2 +- perl-xCAT/xCAT/Schema.pm | 4 +++- 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst b/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst index 09c65095c..89729c2d2 100644 --- a/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst +++ b/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst @@ -58,7 +58,15 @@ Then in the subsequent REST API access, the token can be used to replace the use curl -X GET -k -H X-Auth-Token:5cabd675-bc2e-4318-b1d6-831fd1f32f97 'https:///xcatws/? -The validity of token is 24 hours. If an old token has expired, you will get a 'Authentication failure' error. Then you need reacquire a token with your account. +The default validity of a token is 1 day. This default can be changed by the setting of `expiretokendays` attribute in `site` table. :: + + chdef -t site clustersite expiretokendays= + +To make tokens valid forever use "never". :: + + chdef -t site clustersite expiretokendays=never + +If an old token has expired, you will get a 'Authentication failure' error. You will need to reacquire a token for your account. The Common Parameters for Resource URI diff --git a/docs/source/guides/admin-guides/references/man5/policy.5.rst b/docs/source/guides/admin-guides/references/man5/policy.5.rst index e9b53ba0c..7b41a78db 100644 --- a/docs/source/guides/admin-guides/references/man5/policy.5.rst +++ b/docs/source/guides/admin-guides/references/man5/policy.5.rst @@ -80,7 +80,7 @@ policy Attributes: \ **rule**\ - Specifies how this rule should be applied. Valid values are: allow, accept, trusted. Allow or accept will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time. + Specifies how this rule should be applied. Valid values are: allow, trusted. Allow will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time. diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index d4ea2ab7e..f9bc5383a 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -429,6 +429,8 @@ site Attributes: -------------------- XCAT DAEMON ATTRIBUTES -------------------- + expiretokendays: Number of days before REST API token will expire. The default is 1. + use 'never' if you want your token to never expire. useflowcontrol: (yes/1 or no/0). If yes, the postscript processing on each node contacts xcatd on the MN/SN using a lightweight UDP packet to wait until xcatd is ready to handle the requests associated with diff --git a/docs/source/guides/admin-guides/references/man5/token.5.rst b/docs/source/guides/admin-guides/references/man5/token.5.rst index f70bf9eaf..e91287888 100644 --- a/docs/source/guides/admin-guides/references/man5/token.5.rst +++ b/docs/source/guides/admin-guides/references/man5/token.5.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **token Attributes:**\ \ *tokenid*\ , \ *username*\ , \ *expire*\ , \ *comments*\ , \ *disable*\ +\ **token Attributes:**\ \ *tokenid*\ , \ *username*\ , \ *created*\ , \ *access*\ , \ *expire*\ , \ *comments*\ , \ *disable*\ *********** @@ -48,6 +48,18 @@ token Attributes: +\ **created**\ + + Creation time for this token. + + + +\ **access**\ + + Last access time for this token. + + + \ **expire**\ The expire time for this token. diff --git a/docs/source/guides/admin-guides/references/man7/policy.7.rst b/docs/source/guides/admin-guides/references/man7/policy.7.rst index 5c9709647..b920c052f 100644 --- a/docs/source/guides/admin-guides/references/man7/policy.7.rst +++ b/docs/source/guides/admin-guides/references/man7/policy.7.rst @@ -77,7 +77,7 @@ policy Attributes: \ **rule**\ (policy.rule) - Specifies how this rule should be applied. Valid values are: allow, accept, trusted. Allow or accept will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time. + Specifies how this rule should be applied. Valid values are: allow, trusted. Allow will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index ca97fd170..c475a6c02 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -890,7 +890,7 @@ passed as argument rather than by table value', noderange => 'The Noderange that this rule applies to. Default is "*" (all nodes). Not supported with the *def commands.', parameters => 'A regular expression that matches the command parameters (everything except the noderange) that this rule applies to. Default is "*" (all parameters). Not supported with the *def commands.', time => 'Time ranges that this command may be executed in. This is not supported.', - rule => 'Specifies how this rule should be applied. Valid values are: allow, accept, trusted. Allow or accept will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time.', + rule => 'Specifies how this rule should be applied. Valid values are: allow, trusted. Allow will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -1285,6 +1285,8 @@ passed as argument rather than by table value', " --------------------\n" . "XCAT DAEMON ATTRIBUTES\n" . " --------------------\n" . +" expiretokendays: Number of days before REST API token will expire. The default is 1.\n" . +" use 'never' if you want your token to never expire.\n" . " useflowcontrol: (yes/1 or no/0). If yes, the postscript processing on each node\n" . " contacts xcatd on the MN/SN using a lightweight UDP packet to wait\n" . " until xcatd is ready to handle the requests associated with\n" . From 648975c207eb92c55506f027acc42cad04a06352 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 10 Apr 2018 16:55:15 +0800 Subject: [PATCH 008/117] Use $installroot as needed --- .../autotest/testcase/cuda/rhel-cuda-diskless-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskless-install.sh b/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskless-install.sh index e8c9030b2..01718f42b 100755 --- a/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskless-install.sh +++ b/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskless-install.sh @@ -135,15 +135,15 @@ ${OSIMAGE_NAME}: EOF [ "$?" -ne "0" ] && echo "Make osimage definition failed." >&2 && exit 1 -mkdir -p "/install/custom/netboot/rh" +mkdir -p /install/custom/netboot/rh ( cat "/opt/xcat/share/xcat/netboot/rh/compute.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.postinstall" cat <<-EOF - cp /install/postscripts/cuda_power9_setup "${OSIMAGE_ROOTIMGDIR}/rootimg/tmp/cuda_power9_setup" - chroot "${OSIMAGE_ROOTIMGDIR}/rootimg" /tmp/cuda_power9_setup + cp /install/postscripts/cuda_power9_setup "\$installroot/tmp/cuda_power9_setup" + chroot "\$installroot" /tmp/cuda_power9_setup - rm -f "${OSIMAGE_ROOTIMGDIR}/rootimg/tmp/cuda_power9_setup" + rm -f "\$installroot/tmp/cuda_power9_setup" EOF ) >"/install/custom/netboot/rh/cudafull.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.postinstall" chmod 0755 "/install/custom/netboot/rh/cudafull.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.postinstall" From 4c8c68efb380f2488e6fdda41b1d8ef378c044e5 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 18 Apr 2018 14:45:01 -0400 Subject: [PATCH 009/117] Changes after review --- .../restapi/restapi_usage/restapi_usage.rst | 6 +- .../admin-guides/references/man5/site.5.rst | 2 +- .../admin-guides/references/man5/token.5.rst | 14 +- perl-xCAT/xCAT/Schema.pm | 6 +- perl-xCAT/xCAT/Utils.pm | 36 +++ xCAT-server/lib/perl/xCAT/xcatd.pm | 72 +++--- xCAT-server/sbin/xcatd | 7 +- .../autotest/testcase/restapi/node/case0 | 242 ------------------ 8 files changed, 94 insertions(+), 291 deletions(-) delete mode 100644 xCAT-test/autotest/testcase/restapi/node/case0 diff --git a/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst b/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst index 89729c2d2..53490eb13 100644 --- a/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst +++ b/docs/source/advanced/restapi/restapi_usage/restapi_usage.rst @@ -58,13 +58,13 @@ Then in the subsequent REST API access, the token can be used to replace the use curl -X GET -k -H X-Auth-Token:5cabd675-bc2e-4318-b1d6-831fd1f32f97 'https:///xcatws/? -The default validity of a token is 1 day. This default can be changed by the setting of `expiretokendays` attribute in `site` table. :: +The default validity of a token is 1 day. This default can be changed by the setting of `tokenexpiredays` attribute in `site` table. :: - chdef -t site clustersite expiretokendays= + chdef -t site clustersite tokenexpiredays= To make tokens valid forever use "never". :: - chdef -t site clustersite expiretokendays=never + chdef -t site clustersite tokenexpiredays=never If an old token has expired, you will get a 'Authentication failure' error. You will need to reacquire a token for your account. diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index f9bc5383a..ed5180374 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -429,7 +429,7 @@ site Attributes: -------------------- XCAT DAEMON ATTRIBUTES -------------------- - expiretokendays: Number of days before REST API token will expire. The default is 1. + tokenexpiredays: Number of days before REST API token will expire. The default is 1. use 'never' if you want your token to never expire. useflowcontrol: (yes/1 or no/0). If yes, the postscript processing on each node contacts xcatd on the MN/SN using a lightweight UDP packet to wait diff --git a/docs/source/guides/admin-guides/references/man5/token.5.rst b/docs/source/guides/admin-guides/references/man5/token.5.rst index e91287888..5089aa16b 100644 --- a/docs/source/guides/admin-guides/references/man5/token.5.rst +++ b/docs/source/guides/admin-guides/references/man5/token.5.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **token Attributes:**\ \ *tokenid*\ , \ *username*\ , \ *created*\ , \ *access*\ , \ *expire*\ , \ *comments*\ , \ *disable*\ +\ **token Attributes:**\ \ *tokenid*\ , \ *username*\ , \ *expire*\ , \ *created*\ , \ *access*\ , \ *comments*\ , \ *disable*\ *********** @@ -48,6 +48,12 @@ token Attributes: +\ **expire**\ + + The expire time for this token. + + + \ **created**\ Creation time for this token. @@ -60,12 +66,6 @@ token Attributes: -\ **expire**\ - - The expire time for this token. - - - \ **comments**\ Any user-provided notes. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index c475a6c02..e16dba65b 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1285,7 +1285,7 @@ passed as argument rather than by table value', " --------------------\n" . "XCAT DAEMON ATTRIBUTES\n" . " --------------------\n" . -" expiretokendays: Number of days before REST API token will expire. The default is 1.\n" . +" tokenexpiredays: Number of days before REST API token will expire. The default is 1.\n" . " use 'never' if you want your token to never expire.\n" . " useflowcontrol: (yes/1 or no/0). If yes, the postscript processing on each node\n" . " contacts xcatd on the MN/SN using a lightweight UDP packet to wait\n" . @@ -1804,15 +1804,15 @@ zvmivp => { }, }, token => { - cols => [qw(tokenid username created access expire comments disable)], + cols => [qw(tokenid username expire created access comments disable)], keys => [qw(tokenid)], table_desc => 'The token of users for authentication.', descriptions => { tokenid => 'It is a UUID as an unified identify for the user.', username => 'The user name.', + expire => 'The expire time for this token.', created => 'Creation time for this token.', access => 'Last access time for this token.', - expire => 'The expire time for this token.', comments => 'Any user-provided notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index cc03a05b5..4130b3397 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3894,6 +3894,42 @@ sub gettimezone #-------------------------------------------------------------------------------- +=head3 time2string + Return passed in time (in DateTime format) as a string in YYYY/MM/DD HH:MM:SS format + Arguments: + Unix DateTime as returned by time() for example + Optional Separator character for date, default is "/" + Returns: + String in YYYY/MM/DD HH:MM:SS format + Globals: + none + Error: + None + Example: + my $time_string = xCAT::Utils->time2string($time,"-"); + Comments: + none +=cut + +#-------------------------------------------------------------------------------- +sub time2string +{ + my $unixtime = shift; + my $date_separator; + if ($unixtime =~ /xCAT::Utils/) + { + $unixtime = shift; + $date_separator = shift // "/"; # Optional date separator, if not specified, default to "/" + } + my $time_separator = ":"; + + my ($sec, $min, $hour, $mday, $mon, $year) = localtime($unixtime); + $year += 1900; + $mon += 1; + return $year . $date_separator . $mon . $date_separator . $mday . " " . $hour . $time_separator . $min . $time_separator . $sec; +} +#-------------------------------------------------------------------------------- + =head3 specialservicemgr some special services cannot be processed in sysVinit, upstart and systemd framework, should be process here... Arguments: diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index 7e4c97c3f..e36e690e1 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -14,6 +14,7 @@ use xCAT::MsgUtils; use Data::Dumper; use xCAT::NodeRange; use xCAT::Utils; +use Scalar::Util qw/looks_like_number/; #-------------------------------------------------------------------------------- @@ -353,13 +354,14 @@ sub validate { return 0; } -#MG my $one_day = 86400; # one day in seconds my $days = 1; # default days for token expiration my $never_label = "never"; # this subroutine creates a new token in token table -# 1. clean up the expired token +# 1. If old style unix DateTime format token found in the token table +# if expired -> remove it +# if not expired -> replace unix DateTime expiration with new human readable format # 2. create a new token and add it to token table # # this subroutine is called after the account has been authorized @@ -374,21 +376,29 @@ sub gettoken { return undef; } my $tokens = $tokentb->getAllEntries; + + # Search for "old" style tokens containing unix DateTime format expiration date foreach my $token (@{$tokens}) { - # Clean the expired tokens - if (($token->{'expire'} ne $never_label) and (str2time($token->{'expire'}) < $current_time)) { - $tokentb->delEntries({ 'tokenid' => $token->{tokenid} }); + if ($token->{'expire'} and looks_like_number($token->{'expire'})) { + # Expiration field contains only digits -> this is a old style token with unix DateTime format + + if ($token->{'expire'} and ($token->{'expire'} < $current_time)) { + # Clean expired token with old unix DateTime format + $tokentb->delEntries({ tokenid => $token->{tokenid} }); + } else { + # Change non-expired old style token to new human readable format + $tokentb->setAttribs({ tokenid => $token->{tokenid}, username => $token->{'username'} }, {expire => xCAT::Utils->time2string($token->{'expire'}, "-")}); + } } } # create a new token id my $uuid = xCAT::Utils->genUUID(); # extract site table setting for number of days before token expires - my @entries = xCAT::TableUtils->get_site_attribute("expiretokendays"); - my $token_days = $entries[0]; + my $token_days = xCAT::TableUtils->get_site_attribute("tokenexpiredays"); my $expiretime = $current_time + $one_day; # default is one day - my $expire_time_string = timeToString($expiretime); + my $expire_time_string = xCAT::Utils->time2string($expiretime, "-"); if ($token_days and (uc($token_days) eq uc($never_label))) { # Tokens never expire $expiretime = $never_label; @@ -398,9 +408,9 @@ sub gettoken { # Use number of days from site table $days = $token_days; $expiretime = $current_time + $one_day * $days; - $expire_time_string = timeToString($expiretime); + $expire_time_string = xCAT::Utils->time2string($expiretime, "-"); } - my $access_time_string = timeToString($current_time); + my $access_time_string = xCAT::Utils->time2string($current_time, "-"); # create a new token and set its expiration and creation time $tokentb->setAttribs({ tokenid => $uuid, username => $user }, { expire => $expire_time_string, created => $access_time_string }); @@ -422,30 +432,32 @@ sub verifytoken { } my $token = $tokentb->getAttribs({ 'tokenid' => $tokenid }, ('username', 'expire')); if (defined($token) && defined($token->{'username'}) && defined($token->{'expire'})) { - # Clean the expired token and return - if (($token->{'expire'} ne $never_label) and (str2time($token->{'expire'}) < $current_time)) { - xCAT::MsgUtils->message("S", "MG (verify) Removing expired token " . $token->{tokenid}); - $tokentb->delEntries({ 'tokenid' => $token->{tokenid} }); - return undef; + + if ($token->{'expire'} and looks_like_number($token->{'expire'})) { + # Expiration field contains only digits -> this is a old style token with unix DateTime format + if ($token->{'expire'} and $token->{'expire'} < $current_time) { + # Clean expired token with old unix DateTime format + $tokentb->delEntries({ 'tokenid' => $token->{tokenid} }); + return undef; + } else { + # Change non-expired old style token to new human readable format + $tokentb->setAttribs({ tokenid => $tokenid, username => $token->{'username'} }, + {access => xCAT::Utils->time2string($current_time, "-"), + expire => xCAT::Utils->time2string($token->{'expire'}, "-")}); + return $token->{'username'}; + } } else { - # Store current access time - $tokentb->setAttribs({ tokenid => $tokenid, username => $token->{'username'} }, {access => timeToString($current_time)}); - return $token->{'username'}; + if ($token->{'expire'} and ($token->{'expire'} ne "never") and str2time($token->{'expire'}) < $current_time) { + # Expired new style token + return undef; + } else { + # Not expired new style token - update current access time + $tokentb->setAttribs({ tokenid => $tokenid, username => $token->{'username'} }, {access => xCAT::Utils->time2string($current_time, "-")}); + return $token->{'username'}; + } } } else { # Token entry was not found return undef; } -} - -# Return passed in time as a string in YYYY/MM/DD HH:MM:SS format -sub timeToString() { - my $unixtime = shift; - - my ($sec, $min, $hour, $mday, $mon, $year) = localtime($unixtime); - $year += 1900; - $mon += 1; - return "$year/$mon/$mday $hour:$min:$sec"; -} - 1; diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 859192801..16c896718 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -2832,11 +2832,8 @@ sub service_connection { # If token expiration time was set to "never", return that to the user. $htime = $exptime; } else { - # Token expiration is a datetime, convert to readable string - my ($sec, $min, $hour, $mday, $mon, $year) = localtime($exptime); - $year += 1900; - $mon += 1; - $htime = "$year-$mon-$mday $hour:$min:$sec"; + # Token expiration is a unix DateTime, convert to readable string + $htime = xCAT::Utils->time2string($exptime, "-"); } $resp = { data => [ { token => [ { id => $tokenid, expire => $htime } ] } ] }; } else { diff --git a/xCAT-test/autotest/testcase/restapi/node/case0 b/xCAT-test/autotest/testcase/restapi/node/case0 deleted file mode 100644 index a1308afe4..000000000 --- a/xCAT-test/autotest/testcase/restapi/node/case0 +++ /dev/null @@ -1,242 +0,0 @@ -start:node_post -description: node_post -cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -check:rc==201 -end - -start:node_post2 -description: node_post2 -cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -check:rc==403 -cmdcheck:restapitest -o '{"errorcode":"1"}' -O == -end - - -start:node_put -description: node_put -cmd:restapitest -m PUT -r /nodes/node1 -d '{"mgt":"hmc","netboot":"xnba"}' -check:rc==200 -end - - - -start:nodes_get -description: nodes_get -cmd:restapitest -m GET -r /nodes -check:rc==200 -cmdcheck:restapitest -o '["node1"]' -O == -end - -start:node_get -description: node_get -cmd:restapitest -m GET -r /nodes/node1 -check:rc==200 -cmdcheck:restapitest -o '{"node1":{"netboot":"xnba"}}' -O == -end - -start:node_delete -description: node_delete -cmd:restapitest -m DELETE -r /nodes/node1 -check:rc==200 -end - -start:nodes_get2 -description: nodes_get2 -cmd:restapitest -m GET -r /nodes -check:rc==200 -cmdcheck:restapitest -o '["node1"]' -O != -end - -start:node_get2 -description: node_get2 -cmd:restapitest -m GET -r /nodes/node1 -check:rc==403 -cmdcheck:restapitest -o '{"errorcode":"1"}' -O == -end - -start:node_post3_for_get_test -description: node_post3_for_get_test -cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -check:rc==201 -end - -start:node_attr_get -description: node_get2 -cmd:restapitest -m GET -r /nodes/node1/attrs/mgt,groups,netboot -check:rc==200 -cmdcheck:restapitest -o '{"node1":{"netboot":"yaboot"}}' -O == -end - -start:node_makehosts -description: node_makehosts -cmd:restapitest -m POST -r /nodes/node1/host -check:rc==201 -end - -start:node_makedns -description: node_makehosts -cmd:restapitest -m POST -r /nodes/node1/dns -check:rc==201 -end - - -start:node_delete_dns -description: node_delete_dns -cmd:restapitest -m DELETE -r /nodes/node1/dns -check:rc==200 -end - -start:node_put -description: node_put -cmd:restapitest -m PUT -r /nodes/node1 -d '{"mac":"00:1a:64:54:14:80"}' -check:rc==200 -end - -start:node_makedhcp -description: node_makedhcp -cmd:restapitest -m POST -r /nodes/node1/dhcp -check:rc==201 -end - -start:node_delete_dhcp -description: node_delete_dhcp -cmd:restapitest -m DELETE -r /nodes/node1/dhcp -check:rc==200 -end - -start:node_state -description: node_state -cmd:restapitest -m GET -r /nodes/node1/nodestat -check:rc==200 -cmdcheck:restapitest -o '{"node1":{"nodestat":"ANY"}}' -O == -end - - -#start:node_post4_for_scan_test -#description: node_post4_for_scan_test -#cmd:restapitest -m POST -r /nodes/e108m6hmc02 -d '{"groups":"all,hmc","mgt":"hmc","hwtype":"hmc","mtm":"7042CR4","serial":"1050FBB","nodetype":"ppc"}' -#check:rc==201 -#end - -start:node_scan -description: node_scan -cmd:restapitest -m GET -r /nodes/__GETNODEATTR($$CN,hcp)__ -check:rc==200 -cmdcheck:restapitest -o '{"__GETNODEATTR($$CN,hcp)__":"ANY"}' -O == -end - - -start:node_power_get -description: node_power_get -cmd:restapitest -m GET -r /nodes/$$CN/power -check:rc==200 -cmdcheck:restapitest -o '{"$$CN":{"power":"ANY"}}' -O == -end - -start:node_power_put -description: node_power_reset -cmd:restapitest -m PUT -r /nodes/$$CN/power -d '{"action":"reset"}' -check:rc==200 -end - -#start:node_energy_put -#description: node_energy_put -#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/energy -d '{"cappingstatus":"on"}' -#check:rc==200 -#end - -#start:node_energy_get -#description: node_energy_get -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"on"}}' -O == -#end - -#start:node_energy_get_attr -#description: node_energy_get_attr -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy/cappingmaxmin,cappingstatus -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"ANY"}}' -O == -#end - -#start:node_get_attr -#description: node_get_attr -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/sp/community -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"SP SNMP Community":"public"}}' -O == -#end - -#start:node_put_attr -#description: node_put_attr -#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/sp/community -d '{"value":"mycommunity"}'' -#check:rc==200 -#end - -#start:node_put_nextboot -#description: node_put_nextboot -#cmd:restapitest -m PUT -r /nodes/$$CN/nextboot -d '{"order":"net"}' -#check:rc==201 -#end - -#start:node_get_nextboot -#description: node_get_nextboot -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nextboot -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"nextboot":"net"}}' -O == -#end - -start:node_put_bootstate -description: node_put_bootstate -cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/bootstate -d '{"osimage":"rhels6.4-x86_64-install-compute"}' -check:rc==201 -end - -start:node_get_bootstate -description: node_get_bootstate -cmd:restapitest -m GET -r /nodes/$$CN/bootstate -check:rc==200 -cmdcheck:restapitest -o '{"$$CN":{"bootstat":"ANY"}}' -O == -end - -start:node_get_vitals -description: node_get_vitals -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/vitals -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"SysBrd Fault":"0"}}' -O == -end - -start:node_get_vitals_attr -description: node_get_vitals_attr -cmd:restapitest -m GET -r /nodes/$$CN/vitals/all -check:rc==200 -cmdcheck:restapitest -o '{"$$CN":{"System Temperature":"ANY"}}' -O == -end - -start:node_get_inventory -description: node_get_inventory -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/inventory -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"Power Supply 2 Board FRU Number":"94Y8105"}}' -O == -end - -start:node_get_inventory_attr -description: node_get_inventory_attr -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/inventory/model -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"System Description":"System x3650 M4"}}' -O == -end - -#start:node_get_eventlog -#description: node_get_eventlog -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/eventlog -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"eventlog":"ANY"}}' -O == -#end - -start:node_post_nodecopy -description: node_post_nodecopy -cmd:restapitest -m POST -r /nodes/$$CN/nodecopy -d '{"src":["/etc/hosts","/etc/resolv.conf"],"target":"/tmp"}' -check:rc==201 -end - - From 4f58fb8c0cced7b92994faae0378d97fadc365cb Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 19 Apr 2018 16:24:15 -0400 Subject: [PATCH 010/117] REST API node automated testcases --- .../references/man1/xcattest.1.rst | 3 +- .../autotest/testcase/restapi/node/cases0 | 244 ++++-------------- xCAT-test/pods/man1/xcattest.1.pod | 1 + xCAT-test/restapitest | 97 +++---- 4 files changed, 99 insertions(+), 246 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst index 5b07c71cc..53a022bdf 100644 --- a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst +++ b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst @@ -229,9 +229,10 @@ For example, to run rscan command against the hardware control point of compute .. code-block:: perl rscan __GETNODEATTR($$CN, hcp)__ -z - 3. B To get the value of column where keyname == key in specified table. +3. \ **GETTABLEVALUE(keyname, key, colname, table)**\ To get the value of column where keyname == key in specified table. + ***** FILES diff --git a/xCAT-test/autotest/testcase/restapi/node/cases0 b/xCAT-test/autotest/testcase/restapi/node/cases0 index a1308afe4..da8f29146 100644 --- a/xCAT-test/autotest/testcase/restapi/node/cases0 +++ b/xCAT-test/autotest/testcase/restapi/node/cases0 @@ -1,99 +1,82 @@ -start:node_post -description: node_post -cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' +start:create_node_rest +description: create a node with REST API +cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' check:rc==201 end -start:node_post2 -description: node_post2 -cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -check:rc==403 -cmdcheck:restapitest -o '{"errorcode":"1"}' -O == +start:create_node_rest2 +description: create a node with REST API failure +cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' +check:rc==147 +check:output=~'errorcode' => '1' end - -start:node_put -description: node_put -cmd:restapitest -m PUT -r /nodes/node1 -d '{"mgt":"hmc","netboot":"xnba"}' -check:rc==200 -end - - - -start:nodes_get -description: nodes_get +start:get_nodes_rest +description: get all nodes with REST API cmd:restapitest -m GET -r /nodes check:rc==200 -cmdcheck:restapitest -o '["node1"]' -O == +check:output=~'restnode' end -start:node_get -description: node_get -cmd:restapitest -m GET -r /nodes/node1 +start:get_node_rest +description: get single node with REST API +cmd:restapitest -m GET -r /nodes/restnode check:rc==200 -cmdcheck:restapitest -o '{"node1":{"netboot":"xnba"}}' -O == +check:output=~'restnode' end -start:node_delete -description: node_delete -cmd:restapitest -m DELETE -r /nodes/node1 +start:node_delete_rest +description: delete node with REST API +cmd:restapitest -m DELETE -r /nodes/restnode check:rc==200 end -start:nodes_get2 -description: nodes_get2 +start:get_nodes_rest2 +description: get all nodes with REST API cmd:restapitest -m GET -r /nodes check:rc==200 -cmdcheck:restapitest -o '["node1"]' -O != +check:output!~'restnode' end -start:node_get2 -description: node_get2 -cmd:restapitest -m GET -r /nodes/node1 -check:rc==403 -cmdcheck:restapitest -o '{"errorcode":"1"}' -O == +start:get_node_rest2 +description: get single node with REST API +cmd:restapitest -m GET -r /nodes/restnode +check:rc==147 +check:output=~'errorcode' => '1' end -start:node_post3_for_get_test -description: node_post3_for_get_test -cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' +start:create_node_token_rest +description: create a node with REST API using authentication token +cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -t check:rc==201 end -start:node_attr_get -description: node_get2 -cmd:restapitest -m GET -r /nodes/node1/attrs/mgt,groups,netboot -check:rc==200 -cmdcheck:restapitest -o '{"node1":{"netboot":"yaboot"}}' -O == -end - -start:node_makehosts -description: node_makehosts -cmd:restapitest -m POST -r /nodes/node1/host +start:node_makehosts_rest +description: makehosts for node with REST API +cmd:restapitest -m POST -r /nodes/restnode/host check:rc==201 end -start:node_makedns -description: node_makehosts -cmd:restapitest -m POST -r /nodes/node1/dns +start:node_makedns_rest +description: makehosts for node with REST API +cmd:restapitest -m POST -r /nodes/restnode/dns check:rc==201 end - -start:node_delete_dns -description: node_delete_dns -cmd:restapitest -m DELETE -r /nodes/node1/dns +start:node_delete_dns_rest +description: delete dns for node with REST API +cmd:restapitest -m DELETE -r /nodes/restnode/dns check:rc==200 end -start:node_put -description: node_put -cmd:restapitest -m PUT -r /nodes/node1 -d '{"mac":"00:1a:64:54:14:80"}' +start:node_change_attr_rest +description: change node attribute with REST API +cmd:restapitest -m PUT -r /nodes/restnode -d '{"mac":"00:1a:64:54:14:80"}' check:rc==200 end -start:node_makedhcp -description: node_makedhcp +start:node_makedhcp_rest +description: makedhcp for node with REST API cmd:restapitest -m POST -r /nodes/node1/dhcp check:rc==201 end @@ -104,139 +87,18 @@ cmd:restapitest -m DELETE -r /nodes/node1/dhcp check:rc==200 end -start:node_state -description: node_state -cmd:restapitest -m GET -r /nodes/node1/nodestat +start:node_state_rest +description: get node state with REST API +cmd:restapitest -m GET -r /nodes/restnode/nodestat check:rc==200 -cmdcheck:restapitest -o '{"node1":{"nodestat":"ANY"}}' -O == +check:output=~'restnode' +check:output=~'nodestat' end - -#start:node_post4_for_scan_test -#description: node_post4_for_scan_test -#cmd:restapitest -m POST -r /nodes/e108m6hmc02 -d '{"groups":"all,hmc","mgt":"hmc","hwtype":"hmc","mtm":"7042CR4","serial":"1050FBB","nodetype":"ppc"}' -#check:rc==201 -#end - -start:node_scan -description: node_scan -cmd:restapitest -m GET -r /nodes/__GETNODEATTR($$CN,hcp)__ +start:node_state_token_rest +description: get node state with REST API using authentication token +cmd:restapitest -m GET -r /nodes/restnode/nodestat -t check:rc==200 -cmdcheck:restapitest -o '{"__GETNODEATTR($$CN,hcp)__":"ANY"}' -O == +check:output=~'restnode' +check:output=~'nodestat' end - - -start:node_power_get -description: node_power_get -cmd:restapitest -m GET -r /nodes/$$CN/power -check:rc==200 -cmdcheck:restapitest -o '{"$$CN":{"power":"ANY"}}' -O == -end - -start:node_power_put -description: node_power_reset -cmd:restapitest -m PUT -r /nodes/$$CN/power -d '{"action":"reset"}' -check:rc==200 -end - -#start:node_energy_put -#description: node_energy_put -#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/energy -d '{"cappingstatus":"on"}' -#check:rc==200 -#end - -#start:node_energy_get -#description: node_energy_get -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"on"}}' -O == -#end - -#start:node_energy_get_attr -#description: node_energy_get_attr -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy/cappingmaxmin,cappingstatus -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"ANY"}}' -O == -#end - -#start:node_get_attr -#description: node_get_attr -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/sp/community -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"SP SNMP Community":"public"}}' -O == -#end - -#start:node_put_attr -#description: node_put_attr -#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/sp/community -d '{"value":"mycommunity"}'' -#check:rc==200 -#end - -#start:node_put_nextboot -#description: node_put_nextboot -#cmd:restapitest -m PUT -r /nodes/$$CN/nextboot -d '{"order":"net"}' -#check:rc==201 -#end - -#start:node_get_nextboot -#description: node_get_nextboot -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nextboot -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"nextboot":"net"}}' -O == -#end - -start:node_put_bootstate -description: node_put_bootstate -cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/bootstate -d '{"osimage":"rhels6.4-x86_64-install-compute"}' -check:rc==201 -end - -start:node_get_bootstate -description: node_get_bootstate -cmd:restapitest -m GET -r /nodes/$$CN/bootstate -check:rc==200 -cmdcheck:restapitest -o '{"$$CN":{"bootstat":"ANY"}}' -O == -end - -start:node_get_vitals -description: node_get_vitals -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/vitals -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"SysBrd Fault":"0"}}' -O == -end - -start:node_get_vitals_attr -description: node_get_vitals_attr -cmd:restapitest -m GET -r /nodes/$$CN/vitals/all -check:rc==200 -cmdcheck:restapitest -o '{"$$CN":{"System Temperature":"ANY"}}' -O == -end - -start:node_get_inventory -description: node_get_inventory -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/inventory -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"Power Supply 2 Board FRU Number":"94Y8105"}}' -O == -end - -start:node_get_inventory_attr -description: node_get_inventory_attr -cmd:restapitest -m GET -r /nodes/Vc68m5sn01/inventory/model -check:rc==200 -cmdcheck:restapitest -o '{"Vc68m5sn01":{"System Description":"System x3650 M4"}}' -O == -end - -#start:node_get_eventlog -#description: node_get_eventlog -#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/eventlog -#check:rc==200 -#cmdcheck:restapitest -o '{"Vc68m5sn01":{"eventlog":"ANY"}}' -O == -#end - -start:node_post_nodecopy -description: node_post_nodecopy -cmd:restapitest -m POST -r /nodes/$$CN/nodecopy -d '{"src":["/etc/hosts","/etc/resolv.conf"],"target":"/tmp"}' -check:rc==201 -end - - diff --git a/xCAT-test/pods/man1/xcattest.1.pod b/xCAT-test/pods/man1/xcattest.1.pod index 5dba9d902..f21804684 100644 --- a/xCAT-test/pods/man1/xcattest.1.pod +++ b/xCAT-test/pods/man1/xcattest.1.pod @@ -151,6 +151,7 @@ The xCAT-test testing framework provides some inline functions. The inline funct For example, to run rscan command against the hardware control point of compute node specified in the configuration file: rscan __GETNODEATTR($$CN, hcp)__ -z + 3. B To get the value of column where keyname == key in specified table. =head1 FILES diff --git a/xCAT-test/restapitest b/xCAT-test/restapitest index 83ba63c38..f5db2e79c 100755 --- a/xCAT-test/restapitest +++ b/xCAT-test/restapitest @@ -4,14 +4,14 @@ # Flags are used for test input: # -m method. Should be GET, POST, PUT, DELETE # -r resource -# -t token +# -t # -h host # -u user # -p passwd # -P port (BC) # -d data # -c cert -# -n hostname +# --debug # Flags are used for check output: # -o expected output # -O logical operator @@ -36,6 +36,7 @@ use strict; my $help; my $method; my $token; +my $usetoken; my $resource; my $host; my $user; @@ -43,7 +44,6 @@ my $passwd; my $port; my $data; my $cert; -my $hostname; my $output; my $loperator; my $debug; @@ -54,7 +54,7 @@ my $outputfile = "/tmp/testrestapiresult"; if ( !GetOptions("h|?" => \$help, "m=s" => \$method, - "t=s" => \$token, + "t" => \$usetoken, # use generated token instead of the user/pw "r=s" => \$resource, "h=s" => \$host, "u=s" => \$user, @@ -62,7 +62,6 @@ if ( "P=s" => \$port, "d=s" => \$data, "c=s" => \$cert, - "n=s" => \$hostname, "o=s" => \$output, "O=s" => \$loperator, "debug" => \$debug, @@ -131,52 +130,46 @@ while () { } } -# get token -my $defaultserver = $confhash{DefaultServer}; -my $defaultuser = $confhash{DefaultUser1}; -my $DefaultPasswd = $confhash{DefaultPasswd1}; -my $gettoken = `curl -X POST -k 'https://$defaultserver/xcatws/tokens?userName=$defaultuser&password=$DefaultPasswd' -H Content-Type:application/json --data '{"userName":"$defaultuser","password":"$DefaultPasswd"}' 2>/dev/null`; -my $reshash = parse_json($gettoken); -my $token1 = $$reshash{token}{id}; - -# get hostname -unless ($hostname) { - $hostname = `hostname`; - chomp($hostname); -} -unless ($defaultserver) { +# get hostname or default to local host if not specified +unless ($host) { $host = "127.0.0.1"; -} else { - $host = $defaultserver; } -# keey default test result for save -my $res = run_restapi($method, $resource, $data, "", $port, "$host", "$defaultuser", "$DefaultPasswd"); +unless ($user) { + $user = $confhash{DefaultUser1}; +} +unless ($passwd) { + $passwd = $confhash{DefaultPasswd1}; +} +my $DefaultPasswd = $confhash{DefaultPasswd1}; + +if ($usetoken) { +# get token + my $gettoken = `curl -X POST -k 'https://$host/xcatws/tokens' -H Content-Type:application/json --data '{"userName":"$user","userPW":"$passwd"}' 2>/dev/null`; + my $reshash = parse_json($gettoken); + $token = $$reshash{token}{id}; +} + +# debug and log info +log_debug(3, "User $user. \n"); +log_debug(3, "Password $passwd. \n"); +log_debug(3, "Host $host. \n"); +log_debug(3, "Got token $token. \n"); +log_debug(3, "get path of ca $confhash{Cert} \n"); + +my $res = run_restapi($method, $resource, $data, "", $port, "$host", "$user", "$passwd", "$token"); $defaulthash = parse_json($res); $defaulthttpresult = check_errcode(); -# debug and log info -log_debug(3, "get token $token1. \n"); -log_debug(3, "get first default user $confhash{DefaultUser1} \n"); -log_debug(3, "get first default user's passwd is $confhash{DefaultPasswd1} \n"); -log_debug(3, "get second default user $confhash{DefaultUser2} \n"); -log_debug(3, "get second default user's passwd is $confhash{DefaultPasswd2} \n"); -log_debug(3, "get path of ca $confhash{Cert} \n"); -log_debug(3, "get server $defaultserver from configuration file and it is $host\n"); -log_debug(3, "get hostname $hostname.\n"); -log_debug(3, "default result is $res. \n"); -log_debug(3, "default resulthash is: \n"); -log_debug(3, $defaulthash); -log_debug(3, "default errcode is $defaulthttpresult \n"); -log_debug(3, "**************begin to run more restapi test, stop when post***************"); - +print Dumper $defaulthash; +exit $defaulthttpresult; #################################################### # Begin to run test cases #################################################### my @users = ($confhash{DefaultUser1}, $confhash{DefaultUser2}, $user); my @passwds = ($confhash{DefaultPasswd1}, $confhash{DefaultPasswd2}, $passwd); -my @tokens = ("", $token1, $token); +my @tokens = ("", $token, $token); my @certs = ("", $confhash{Cert}, $cert); my $i = 0; unless ($method eq "POST") { # Should not post sevral times @@ -235,7 +228,7 @@ sub usage print " testrestapi [-?|-h]\n"; print " testrestapi [-m method] [-r resource] [-t tocken]\n"; print " [-h host] [-P port][-u user] [-p passwd]\n"; - print " [-d data] [-c cert] [-n hostname]\n"; + print " [-d data] [-c cert] \n"; print " [-o expect_output] [-O logical_operator] \n"; print " [--debug]\n"; print "\n"; @@ -287,18 +280,14 @@ sub run_restapi if ($t) { $cmd .= " -H X-Auth-Token:$t "; } - if ($t or $c) { - $cmd .= " 'https://$hostname"; - } else { - $cmd .= " 'https://$h"; - } + $cmd .= " 'https://$h"; if ($p) { $cmd .= ":$p"; } $cmd .= "/xcatws"; $cmd .= "$r?"; unless ($t) { - $cmd .= "userName=$u&password=$a'"; + $cmd .= "userName=$u&userPW=$a'"; } else { $cmd .= "'"; } @@ -331,7 +320,7 @@ sub parse_json # {"networks":[{"mgtifname":"eth1","mask":"255.255.255.0"},{"mgtifname":"eth1","mask":"255.255.255.0"}]} if ($input =~ /^\[(.*)\]$/s) { my $content = $1; - log_debug(2, "[:] content is $content \n"); + # log_debug(2, "[:] content is $content \n"); parse_json($content); } @@ -344,7 +333,7 @@ sub parse_json # record result foreach my $t (@contents) { - log_debug(2, ":{}, content is $t \n"); + #log_debug(2, ":{}, content is $t \n"); my $re = parse_json($t); push @reval, $re; } @@ -366,7 +355,7 @@ sub parse_json # record result foreach my $t (@contents) { - log_debug(2, "{},{}, content is $t \n"); + #log_debug(2, "{},{}, content is $t \n"); my $re = parse_json($t); push @reval, $re; } @@ -386,7 +375,7 @@ sub parse_json # {"clustersite":{"domain":"cluster.com","master":"192.168.1.15"}} elsif ($input =~ /^\s*{(.*)}\s*$/s) { my $content = $1; - log_debug(2, "{} content is $content \n"); + #log_debug(2, "{} content is $content \n"); parse_json($content); } elsif ($input =~ /],\"\S+\":/) { @@ -396,7 +385,7 @@ sub parse_json # record result foreach my $t (@contents) { - log_debug(2, "],:, content is $t \n"); + #log_debug(2, "],:, content is $t \n"); my $re = parse_json($t); push @reval, $re; } @@ -420,7 +409,7 @@ sub parse_json # record result foreach my $t (@contents) { - log_debug(2, ", content is $t \n"); + #log_debug(2, ", content is $t \n"); my $re = parse_json($t); push @reval, $re; } @@ -446,7 +435,7 @@ sub parse_json if ($value =~ /{/) { # "clustersite":{"domain":"cluster.com","master":"192.168.1.15"} - log_debug(2, "{ content is $value \n"); + #log_debug(2, "{ content is $value \n"); $hash{$key} = parse_json($value, $key); return \%hash; } else { @@ -464,7 +453,7 @@ sub parse_json else { if ($input =~ /^\[(.*)\]/s) { my $content = $1; - log_debug(2, "[] content is $content \n"); + #log_debug(2, "[] content is $content \n"); my @all = split /,/, $content; foreach my $n (@all) { $n =~ /\"(.*)\"/; From ce50cf9999edaafb9ee465fab4bc778a012a94ac Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Fri, 20 Apr 2018 09:47:24 +0800 Subject: [PATCH 011/117] Update Version --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index 123a39a8e..b70ae75a8 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.14 +2.14.1 From c8f27552969429de832b2d24502e4326f8666005 Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Fri, 20 Apr 2018 09:49:13 +0800 Subject: [PATCH 012/117] Update README.rst --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 31b6c2f5c..f813c12c5 100644 --- a/README.rst +++ b/README.rst @@ -8,6 +8,8 @@ Documentation Latest xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/ +`document for xCAT 2.14 `_ + `document for xCAT 2.13.11 `_ `document for xCAT 2.13.10 `_ From e076602ffa0da2c5c19d04580a1a00c97d076cc7 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 19 Apr 2018 22:02:03 -0400 Subject: [PATCH 013/117] modify bmcdiscover manpage for IP range --- .../guides/admin-guides/references/man1/bmcdiscover.1.rst | 2 +- xCAT-client/pods/man1/bmcdiscover.1.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst b/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst index b341c4d92..238924d21 100644 --- a/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst +++ b/docs/source/guides/admin-guides/references/man1/bmcdiscover.1.rst @@ -48,7 +48,7 @@ OPTIONS \ **-**\ **-range**\ - Specify one or more IP ranges acceptable to nmap. IP range can be hostnames, IP addresses, networks, etc. A single IP address (10.1.2.3) or an IP range (10.1.2.0/24) can be specified. If the range is very large, the \ **bmcdiscover**\ command may take a long time to return. + Specify one or more IP ranges acceptable to nmap. IP range can be hostnames, IP addresses, networks, etc. A single IP address (10.1.2.3), several IPs with commas (10.1.2.3,10.1.2.10), Ip range with "-" (10.1.2.0-100) or an IP range (10.1.2.0/24) can be specified. If the range is very large, the \ **bmcdiscover**\ command may take a long time to return. diff --git a/xCAT-client/pods/man1/bmcdiscover.1.pod b/xCAT-client/pods/man1/bmcdiscover.1.pod index 20ffd84b4..63d30b815 100644 --- a/xCAT-client/pods/man1/bmcdiscover.1.pod +++ b/xCAT-client/pods/man1/bmcdiscover.1.pod @@ -27,7 +27,7 @@ Note: The scan method currently support is B. =item B<--range> -Specify one or more IP ranges acceptable to nmap. IP range can be hostnames, IP addresses, networks, etc. A single IP address (10.1.2.3) or an IP range (10.1.2.0/24) can be specified. If the range is very large, the B command may take a long time to return. +Specify one or more IP ranges acceptable to nmap. IP range can be hostnames, IP addresses, networks, etc. A single IP address (10.1.2.3), several IPs with commas (10.1.2.3,10.1.2.10), Ip range with "-" (10.1.2.0-100) or an IP range (10.1.2.0/24) can be specified. If the range is very large, the B command may take a long time to return. =item B<--sn> From 98f436ef0db53eba85fb96c03f7c99b914e570eb Mon Sep 17 00:00:00 2001 From: XuWei Date: Fri, 20 Apr 2018 01:38:54 -0400 Subject: [PATCH 014/117] Add mac info in ouput of bmcdiscover when no mtms --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 7461133c0..e9af91e8d 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -756,7 +756,7 @@ sub format_stanza { my $node = shift; my $data = shift; my $mgt_type = shift; - my ($bmcip, $bmcmtm, $bmcserial, $bmcuser, $bmcpass, $nodetype, $hwtype, $sn, $conserver) = split(/,/, $data); + my ($bmcip, $bmcmtm, $bmcserial, $bmcuser, $bmcpass, $nodetype, $hwtype, $mac, $sn, $conserver) = split(/,/, $data); my $result; if (defined($bmcip)) { $result .= "$node:\n\tobjtype=node\n"; @@ -803,7 +803,7 @@ sub write_to_xcatdb { my $node = shift; my $data = shift; my $mgt_type = shift; - my ($bmcip, $bmcmtm, $bmcserial, $bmcuser, $bmcpass, $nodetype, $hwtype, $sn, $conserver) = split(/,/, $data); + my ($bmcip, $bmcmtm, $bmcserial, $bmcuser, $bmcpass, $nodetype, $hwtype, $mac, $sn, $conserver) = split(/,/, $data); my $request_command = shift; my $ret; @@ -1112,15 +1112,17 @@ sub bmcdiscovery_ipmi { } else { $node_data .= ",,"; } - $node_data .= ",mp,bmc,$::opt_SN,$::opt_SN"; + $node_data .= ",mp,bmc"; if ($mtm and $serial) { $mtms_node = "node-$mtm-$serial"; $mtms_node =~ s/(.*)/\L$1/g; $mtms_node =~ s/[\s:\._]/-/g; - } - if ($ipmac{$ip}) { + $node_data .= ","; + } elsif ($ipmac{$ip}) { $mac_node = "node-$ipmac{$ip}"; + $node_data .= ",$ipmac{$ip}"; } + $node_data .= ",$::opt_SN,$::opt_SN"; } elsif ($output =~ /error : unauthorized name/) { xCAT::MsgUtils->message("W", { data => ["BMC username is incorrect for $ip"] }, $::CALLBACK); return; @@ -1230,15 +1232,17 @@ sub bmcdiscovery_openbmc{ } else { $node_data .= ",,"; } - $node_data .= ",mp,bmc,$::opt_SN,$::opt_SN"; + $node_data .= ",mp,bmc"; if ($mtm and $serial) { $mtms_node = "node-$mtm-$serial"; $mtms_node =~ s/(.*)/\L$1/g; $mtms_node =~ s/[\s:\._]/-/g; - } - if ($ipmac{$ip}) { + $node_data .= ","; + } elsif ($ipmac{$ip}) { $mac_node = "node-$ipmac{$ip}"; + $node_data .= ",$ipmac{$ip}"; } + $node_data .= ",$::opt_SN,$::opt_SN"; } else { if ($login_response->status_line =~ /401 Unauthorized/) { xCAT::MsgUtils->message("W", { data => ["Invalid username or password for $ip"] }, $::CALLBACK); From 62414fcb8bf130a3ddb323ade74fd7bcd273930e Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 20 Apr 2018 04:25:10 -0400 Subject: [PATCH 015/117] update according to comments --- xCAT-test/autotest/testcase/rspconfig/cases1 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases1 b/xCAT-test/autotest/testcase/rspconfig/cases1 index b59471a36..6862c30ea 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases1 +++ b/xCAT-test/autotest/testcase/rspconfig/cases1 @@ -32,12 +32,11 @@ check:rc == 0 cmd:rspconfig $$CN dump -g|tee /tmp/dumpgenerate check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* success -end cmd:sleep 300 cmd:rspconfig $$CN dump -l check:output =~$$CN:\s*\[\d+\]\s* Generated: check:rc == 0 -cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`|rspconfig $$CN dump --clear $dumpnumber +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* clear cmd:rspconfig $$CN dump -l|tee /tmp/dumplistnew @@ -168,11 +167,13 @@ cmd:rspconfig $$CN powerrestorepolicy=always_on check:output =~$$CN:\s*BMC Setting BMC PowerRestorePolicy... check:rc == 0 cmd:rspconfig $$CN powerrestorepolicy +check:rc == 0 check:output =~$$CN:\s*BMC PowerRestorePolicy:\s*AlwaysOn cmd:rspconfig $$CN powerrestorepolicy=always_off check:output =~$$CN:\s*BMC Setting BMC PowerRestorePolicy... check:rc == 0 cmd:rspconfig $$CN powerrestorepolicy +check:rc == 0 check:output =~$$CN:\s*BMC PowerRestorePolicy:\s*AlwaysOff cmd:rspconfig $$CN powerrestorepolicy=restore check:output =~$$CN:\s*BMC Setting BMC PowerRestorePolicy... @@ -181,6 +182,7 @@ cmd:rspconfig $$CN powerrestorepolicy=abc check:output =~$$CN:\s*Error: Invalid value '\S*' for 'powerrestorepolicy', Valid values: restore,always_on,always_off check:rc != 0 cmd:rspconfig $$CN powerrestorepolicy +check:rc == 0 check:output =~$$CN:\s*BMC PowerRestorePolicy:\s*Restore cmd:policy=`cat /tmp/powerrestorepolicy | awk -F ":" '{print $3}'`;newpolicy=`echo $policy |tr 'A-Z' 'a-z'`;rspconfig $$CN powerrestorepolicy=$newpolicy check:rc == 0 @@ -197,12 +199,14 @@ check:rc == 0 cmd:rspconfig $$CN powersupplyredundancy=enabled check:output =~$$CN:\s*BMC Setting BMC PowerSupplyRedundancy... check:rc == 0 -cmd:rspconfig $$CN powersupplyredundancy +cmd:rspconfig $$CN powersupplyredundancy +check:rc == 0 check:output =~$$CN:\s*BMC PowerSupplyRedundancy:\s*Enabled cmd:rspconfig $$CN powersupplyredundancy=disabled check:output =~$$CN:\s*BMC Setting BMC PowerSupplyRedundancy... check:rc == 0 cmd:rspconfig $$CN powersupplyredundancy +check:rc == 0 check:output =~$$CN:\s*BMC PowerSupplyRedundancy:\s*Disabled cmd:rspconfig $$CN powersupplyredundancy=abc check:output =~$$CN:\s*Error: Invalid value \S* for 'powersupplyredundancy', Valid values: disabled,enabled @@ -223,11 +227,13 @@ cmd:rspconfig $$CN timesyncmethod=ntp check:output =~$$CN:\s*BMC Setting BMC TimeSyncMethod... check:rc == 0 cmd:rspconfig $$CN timesyncmethod +check:rc == 0 check:output =~$$CN:\s*BMC TimeSyncMethod:\s*NTP cmd:rspconfig $$CN timesyncmethod=manual check:output =~$$CN:\s*BMC Setting BMC TimeSyncMethod... check:rc == 0 cmd:rspconfig $$CN timesyncmethod +check:rc == 0 check:output =~$$CN:\s*BMC TimeSyncMethod:\s*Manual cmd:rspconfig $$CN timesyncmethod=abc check:output =~$$CN:\s*Error: Invalid value \S* for 'timesyncmethod', Valid values: ntp,manual @@ -247,17 +253,20 @@ check:rc == 0 cmd:rspconfig $$CN bootmode=regular check:output =~$$CN:\s*BMC Setting BMC BootMode... check:rc == 0 -cmd:rspconfig $$CN bootmode +cmd:rspconfig $$CN bootmode +check:rc == 0 check:output =~$$CN:\s*BMC BootMode:\s*Regular cmd:rspconfig $$CN bootmode=safe check:output =~$$CN:\s*BMC Setting BMC BootMode... check:rc == 0 cmd:rspconfig $$CN bootmode +check:rc == 0 check:output =~$$CN:\s*BMC BootMode:\s*Safe cmd:rspconfig $$CN bootmode=setup check:output =~$$CN:\s*BMC Setting BMC BootMode... check:rc == 0 cmd:rspconfig $$CN bootmode +check:rc == 0 check:output =~$$CN:\s*BMC BootMode:\s*Setup cmd:rspconfig $$CN bootmode=abc check:output =~$$CN:\s*Error: Invalid value \S* for 'bootmode', Valid values: regular,safe,setup @@ -278,11 +287,13 @@ cmd:rspconfig $$CN autoreboot=1 check:output =~$$CN:\s*BMC Setting BMC AutoReboot... check:rc == 0 cmd:rspconfig $$CN autoreboot +check:rc == 0 check:output =~$$CN:\s*BMC AutoReboot:\s*1 cmd:rspconfig $$CN autoreboot=0 check:output =~$$CN:\s*BMC Setting BMC AutoReboot... check:rc == 0 cmd:rspconfig $$CN autoreboot +check:rc == 0 check:output =~$$CN:\s*BMC AutoReboot:\s*0 cmd:rspconfig $$CN autoreboot=2 check:output =~$$CN:\s*Error: Invalid value \S* for 'autoreboot', Valid values: 0,1 From 318198b1f59323afb2737afd15878451cfe044ef Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Mon, 23 Apr 2018 17:51:53 +0800 Subject: [PATCH 016/117] chdef print warning when postscript is already included in the 'xcatdefaults' (#5112) --- perl-xCAT/xCAT/DBobjUtils.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index fc9e9b0fd..e9745510a 100755 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -1311,7 +1311,7 @@ sub setobjdefs if (grep(/^$tempps$/, @xcatdefps)) { my $rsp; $rsp->{data}->[0] = "$obj: postscripts \'$tempps\' is already included in the \'xcatdefaults\'."; - xCAT::MsgUtils->message("E", $rsp, $::callback); + xCAT::MsgUtils->message("W", $rsp, $::callback); } else { push @newps, $tempps; } @@ -1325,7 +1325,7 @@ sub setobjdefs if (grep(/^$temppbs$/, @xcatdefpbs)) { my $rsp; $rsp->{data}->[0] = "$obj: postbootscripts \'$temppbs\' is already included in the \'xcatdefaults\'."; - xCAT::MsgUtils->message("E", $rsp, $::callback); + xCAT::MsgUtils->message("W", $rsp, $::callback); } else { push @newpbs, $temppbs; } From 9fd4bcca457a798848f0057e00b52453a0743146 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Mon, 23 Apr 2018 08:42:09 -0400 Subject: [PATCH 017/117] Fix issue 5111: REST API does not respect the "host" setting in "policy" table --- xCAT-server/lib/perl/xCAT/xcatd.pm | 20 ++++++++++++++++++-- xCAT-server/xCAT-wsapi/xcatws.cgi | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index e36e690e1..b98e05752 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -73,6 +73,11 @@ sub validate { return 0; } + my $remote_host = undef; + if ($request->{'remote_client'} && defined($request->{'remote_client'}->[0])) { + $remote_host = $request->{'remote_client'}->[0]; + } + my $policies = $policytable->getAllEntries; $policytable->close; my $rule; @@ -114,9 +119,20 @@ sub validate { #TODO: time ranges } if ($rule->{host} and $rule->{host} ne '*') { - #TODO: more complex matching (lists, noderanges?, wildcards) - next unless ($peerhost eq $rule->{host}); + if (defined($remote_host) and $remote_host ne '') { + my @tmp_hosts = split(",",$remote_host); + my $found = 0; + foreach my $tmp_host (@tmp_hosts) { + if ($tmp_host eq $rule->{host}) { + $found = 1; + last; + } + } + next unless ($found); + } else { + next unless ($peerhost eq $rule->{host}); + } } if ($rule->{commands} and $rule->{commands} ne '*') { my @commands = split(",", $rule->{commands}); diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 84bd7c184..d08be512f 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1373,6 +1373,10 @@ my @path = split(/\//, $pathInfo); # The uri path like /nodes/node1/... my $pageContent = ''; # Global var containing the ouptut back to the rest client my %header_info; #Global var containing the extra info to the http header my $request = { clienttype => 'ws' }; # Global var that holds the request to send to xcatd +my $remote_host = $q->remote_host(); +my ($client_name, $client_aliases) = gethostbyaddr(inet_aton($remote_host), AF_INET); +$request->{remote_client}->[0]= $client_name.','.$client_aliases; + my $format = 'json'; # The output format for a request invoke my $xmlinstalled; # Global var to speicfy whether the xml modules have been loaded From a52c70c2bd0e33d1f51b606163d17d0b4118acbd Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 23 Apr 2018 13:24:28 -0400 Subject: [PATCH 018/117] Missing closing bracket --- xCAT-server/lib/perl/xCAT/xcatd.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index b98e05752..dd6a4a9f5 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -476,4 +476,5 @@ sub verifytoken { # Token entry was not found return undef; } +} 1; From fc04e3468a4cfd329d4fdd989f9125d174e1297f Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Tue, 24 Apr 2018 13:21:15 -0400 Subject: [PATCH 019/117] Simplify cuda_power9_setup --- xCAT/postscripts/cuda_power9_setup | 68 ++++-------------------------- 1 file changed, 8 insertions(+), 60 deletions(-) diff --git a/xCAT/postscripts/cuda_power9_setup b/xCAT/postscripts/cuda_power9_setup index 14bef7151..d448fefe2 100755 --- a/xCAT/postscripts/cuda_power9_setup +++ b/xCAT/postscripts/cuda_power9_setup @@ -5,6 +5,7 @@ # # # 2018-03-21 GONG Jie +# 2018-04-24 Matt Ezell # # This script is used for doing extra setup steps for NVIDIA POWER9 CUDA driver # on RHEL 7. Please refer document below for details. @@ -14,66 +15,13 @@ umask 0022 -grep '^#' /usr/lib/systemd/system/nvidia-persistenced.service >/tmp/nvidia-persistenced.service -cat >>/tmp/nvidia-persistenced.service <<-EOF +mkdir ${IMG_ROOTIMGDIR}/etc/systemd/system/nvidia-persistenced.service.d +printf '[Service]\nPIDFile=/var/run/nvidia-persistenced/nvidia-persistenced.pid\n' > ${IMG_ROOTIMGDIR}/etc/systemd/system/nvidia-persistenced.service.d/pidfile.conf +printf '[Service]\nRestart=always\n' > ${IMG_ROOTIMGDIR}/etc/systemd/system/nvidia-persistenced.service.d/restartalways.conf -[Unit] -Description=NVIDIA Persistence Daemon -Wants=syslog.target +[ ! -z "${IMG_ROOTIMGDIR}" ] && CHROOTCMD="chroot ${IMG_ROOTIMGDIR}" +$CHROOTCMD /bin/bash -c "systemctl enable nvidia-persistenced" -[Service] -Type=forking -PIDFile=/var/run/nvidia-persistenced/nvidia-persistenced.pid -Restart=always -ExecStart=/usr/bin/nvidia-persistenced --user root --verbose -ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced +rm -f ${IMG_ROOTIMGDIR}/lib/udev/rules.d/40-redhat.rules -[Install] -WantedBy=multi-user.target -EOF - -mv /tmp/nvidia-persistenced.service /usr/lib/systemd/system/nvidia-persistenced.service - -chown root.root /usr/lib/systemd/system/nvidia-persistenced.service -chmod 0644 /usr/lib/systemd/system/nvidia-persistenced.service - -systemctl enable nvidia-persistenced - -rm -f /lib/udev/rules.d/40-redhat.rules - -# -# Extra steps for passing parameters to kernel module nvidia -# -mkdir -p /usr/lib/dracut/modules.d/95nvidia -cat >/usr/lib/dracut/modules.d/95nvidia/module-setup.sh <\$initdir/etc/modprobe.d/nvidia.conf -} -EOF - -chmod 0755 /usr/lib/dracut/modules.d/95nvidia/module-setup.sh -echo 'add_dracutmodules+=" nvidia "' >/etc/dracut.conf.d/nvidia_patch.conf - -# Patch for the diskfull environment, or in case kernel module nvidia need to be reloaded -echo 'options nvidia NVreg_EnableStreamMemOPs=1 NVreg_RegistryDwords="PeerMappingOverride=1"' >/etc/modprobe.d/nvidia.conf - -# Redo the initrd image -kernel_version="$(for d in $(ls /lib/modules | sort -V) ; do : ; done && echo $d)" -mkinitrd -v -f "/boot/initramfs-${kernel_version}.img" "${kernel_version}" +echo 'options nvidia NVreg_EnableStreamMemOPs=1 NVreg_RegistryDwords="PeerMappingOverride=1"' >${IMG_ROOTIMGDIR}/usr/lib/modprobe.d/nvidia.conf From 4037b2dadecccb5f79b429d583bf663177802c0b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 24 Apr 2018 15:51:43 -0400 Subject: [PATCH 020/117] Improve xCAT uninstall documentation --- .../maintenance/uninstall_xcat.rst | 142 +++--------------- 1 file changed, 18 insertions(+), 124 deletions(-) diff --git a/docs/source/guides/install-guides/maintenance/uninstall_xcat.rst b/docs/source/guides/install-guides/maintenance/uninstall_xcat.rst index 6e343f834..f62a968f9 100644 --- a/docs/source/guides/install-guides/maintenance/uninstall_xcat.rst +++ b/docs/source/guides/install-guides/maintenance/uninstall_xcat.rst @@ -33,7 +33,7 @@ Stop xCAT Service service xcatd stop -2. Stop xCAT related services(Optional) +2. Stop xCAT related services (optional) XCAT uses various network services on the management node and service nodes, the network services setup by xCAT may need to be cleaned up on the management node and service nodes before uninstalling xCAT. @@ -48,128 +48,18 @@ Remove xCAT Files 1. Remove the xCAT RPMs - There is no easy way to distinct all the packages depending by xCAT. For packages shipped by xCAT, you can remove them by the commands below. + There is no easy way to identify all xCAT packages. For packages shipped by xCAT, you can remove them by using the commands below. [RHEL and SLES] :: - rpm -qa |grep -i xcat + yum remove '*xcat*' [Ubuntu] :: dpkg -l | awk '/xcat/ { print $2 }' - If you want to remove more cleanly, the list below maybe helpful. Listed are the packages of xcat installation tarball. Some RPMs may not to be installed in a specific environment. + To do an even more thorough cleanup, use links below to get a list of RPMs installed by xCAT. Some RPMs may not to be installed in a specific environment. - * XCAT Core Packages list (xcat-core): - - [RHEL and SLES] :: - - perl-xCAT - xCAT - xCAT-buildkit - xCAT-client - xCAT-confluent - xCAT-genesis-scripts-ppc64 - xCAT-genesis-scripts-x86_64 - xCAT-server - xCATsn - xCAT-SoftLayer - xCAT-test - xCAT-vlan - - [Ubuntu] :: - - perl-xcat - xcat - xcat-buildkit - xcat-client - xcat-confluent - xcat-genesis-scripts - xcat-server - xcatsn - xcat-test - xcat-vlan - - * XCAT Dependency Packages (xcat-dep): - - [RHEL and SLES] :: - - conserver-xcat - cpio - cpio-lang - elilo-xcat - esxboot-xcat - fping - ganglia-devel - ganglia-gmetad - ganglia-gmond - ganglia-gmond-modules-python - ganglia-web - grub2-xcat - ipmitool-xcat - libconfuse - libconfuse-devel - libganglia - lldpd - net-snmp-perl - perl-AppConfig - perl-Compress-Raw-Zlib - perl-Crypt-Blowfish - perl-Crypt-CBC - perl-Crypt-Rijndael - perl-Crypt-SSLeay - perl-DBD-DB2 - perl-DBD-DB2Lite - perl-DBD-Pg - perl-DBD-SQLite - perl-Expect - perl-HTML-Form - perl-IO-Compress-Base - perl-IO-Compress-Zlib - perl-IO-Socket-SSL - perl-IO-Stty - perl-IO-Tty - perl-JSON - perl-Net-DNS - perl-Net-Telnet - perl-SOAP-Lite - perl-Test-Manifest - perl-version - perl-XML-Simple - pyodbc - rrdtool - scsi-target-utils - stunnel - syslinux-xcat - systemconfigurator - systemimager-client - systemimager-common - systemimager-server - xCAT-genesis-base-ppc64 - xCAT-genesis-base-x86_64 - xCAT-genesis-x86_64 - xCAT-UI-deps - xnba-kvm - xnba-undi - yaboot-xcat - zhcp - - [Ubuntu] :: - - conserver-xcat - elilo-xcat - grub2-xcat - ipmitool-xcat - syslinux - syslinux-extlinux - syslinux-xcat - xcat-genesis-base-amd64 - xcat-genesis-base-ppc64 - xnba-undi - - Along with xCAT development, above lists maybe change, you can get the latest list through below links: - - * XCAT Core Packages List (xcat-core) [RHEL and SLES] :: @@ -178,31 +68,35 @@ Remove xCAT Files [Ubuntu] :: - http://xcat.org/files/xcat/repos/apt//xcat-core/ + http://xcat.org/files/xcat/repos/apt//xcat-core/pool/main * XCAT Dependency Packages (xcat-dep) - `RPM Packages List (RHEL and SLES) `_ - - `Debian Packages List (Ubuntu) `_ - + [RHEL and SLES] :: + + http://xcat.org/files/xcat/repos/yum/xcat-dep// - Generally, we use ``yum install xCAT`` to install xCAT, so these are some RPMs shipped by operating system are installed during xCAT installation. We don't have an easy way to find out all of them, but keep these RPMs are harmless. + [Ubuntu] :: + + http://xcat.org/files/xcat/repos/apt/xcat-dep/pool/main + + + When ``yum install xCAT`` is used to install xCAT, some RPMs shipped by operating system are installed. There is no easy way to find all of them, but keeping those RPMs is harmless. 2. Remove xCAT certificate file :: rm -rf /root/.xcat -3. Remove xCAT data file +3. Remove xCAT data files - By default, xCAT use SQLite, remove SQLite data file under ``/etc/xcat/``. :: + By default, xCAT uses SQLite, remove SQLite data files under ``/etc/xcat/``. :: rm -rf /etc/xcat -4. Remove xCAT related file(Optional) +4. Remove xCAT related files (optional) - XCAT has ever operated below directory when it was running. Do judgment by yourself before removing these directory, to avoid removing some directories used for other purpose in your environment. :: + XCAT might have also created additional files and directories below. Be careful removing these files, as they might be used for other purposes in your environment. :: /install /tftpboot From 7383a1805975a52bf05352423552d7a4713550d4 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 25 Apr 2018 02:13:28 -0400 Subject: [PATCH 021/117] update according to comments --- xCAT-test/autotest/testcase/rspconfig/cases1 | 23 +++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases1 b/xCAT-test/autotest/testcase/rspconfig/cases1 index 6862c30ea..5fde59d30 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases1 +++ b/xCAT-test/autotest/testcase/rspconfig/cases1 @@ -66,13 +66,8 @@ cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* success cmd:sleep 300 -cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate `; rspconfig $$CN dump -l|grep "\[$dumpnumber\] Generated" check:rc == 0 -check:output =~$$CN:\s*\[\d+\]\s* clear -cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate -check:rc == 0 -check:output =~$$CN:\s*\[\d+\]\s* success -cmd:sleep 300 cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* clear @@ -110,12 +105,20 @@ cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* success cmd:sleep 300 -cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump -d $dumpnumber +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump -d $dumpnumber |tee /tmp/dumpdown check:rc == 0 -check:output =~$$CN:\s*Downloaded dump \s*\d+\s* to /var/log/xcat/dump/ -cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --download $dumpnumber +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;grep "Downloaded dump $dumpnumber to /var/log/xcat/dump/" /tmp/dumpdown check:rc == 0 -check:output =~$$CN:\s*Downloaded dump \s*\d+\s* to /var/log/xcat/dump/ +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`rspconfig $$CN dump -l |grep "\[$dumpnumber\] Generated" |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize +cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate +check:rc == 0 +check:output =~$$CN:\s*\[\d+\]\s* success +cmd:sleep 300 +cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --download $dumpnumber |tee /tmp/dumpdown +check:rc == 0 +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;grep "Downloaded dump $dumpnumber to /var/log/xcat/dump/" /tmp/dumpdown +check:rc == 0 +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`rspconfig $$CN dump -l |grep "\[$dumpnumber\] Generated" |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize cmd:rspconfig $$CN dump -d all check:rc == 0 check:output =~Downloading all dumps From 9d5dede0d1a2190d7942db274d55a878bede8215 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 24 Apr 2018 03:47:45 -0400 Subject: [PATCH 022/117] update node status when enter shell/standby --- xCAT-genesis-scripts/usr/bin/doxcat | 7 ++++++- xCAT-server/lib/xcat/plugins/destiny.pm | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/xCAT-genesis-scripts/usr/bin/doxcat b/xCAT-genesis-scripts/usr/bin/doxcat index 1e909551d..e0ab88555 100755 --- a/xCAT-genesis-scripts/usr/bin/doxcat +++ b/xCAT-genesis-scripts/usr/bin/doxcat @@ -319,6 +319,11 @@ if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can a logger -s -t $log_label -p local4.info "Getting initial certificate --> $XCATMASTER:$XCATPORT" /bin/getcert $XCATMASTER:$XCATPORT fi +if [ "$destiny" ]; then + # run getdestiny to update node status + /bin/getdestiny $XCATMASTER:$XCATPORT >/dev/null 2>&1 +fi + while :; do grepconfigraid=`echo $destiny|grep "configraid"` @@ -389,7 +394,7 @@ while :; do tar xvf `basename $destparameter` ./runme.sh cd - - logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` dest=`echo $destiny|awk -F= '{print $1}'` logger -s -t $log_label -p local4.info "nextdestiny - Complete." diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 38f16ed1b..3cc38c86c 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -915,6 +915,16 @@ sub getdestiny { my %node_status = (); foreach $node (@$nodes) { unless ($chaintab) { #Without destiny, have the node wait with ssh hopefully open at least + my $stat = xCAT_monitoring::monitorctrl->getNodeStatusFromNodesetState("standby", "getdestiny"); + if ($stat) { + if (exists($node_status{$stat})) { + push @{ $node_status{$stat} }, $node; + } else { + $node_status{$stat} = [$node]; + } + xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%node_status, 1); + } + $callback->({ node => [ { name => [$node], data => ['standby'], destiny => ['standby'] } ] }); return; } @@ -928,10 +938,10 @@ sub getdestiny { #print "node=$node, stat=$stat\n"; if ($stat) { if (exists($node_status{$stat})) { - my $pa = $node_status{$stat}; - push(@$pa, $node); + push @{ $node_status{$stat} }, $node; + } else { + $node_status{$stat} = [$node]; } - else { $node_status{$stat} = [$node]; } } } @@ -979,10 +989,10 @@ sub getdestiny { #print "node=$node, stat=$stat\n"; if ($stat) { if (exists($node_status{$stat})) { - my $pa = $node_status{$stat}; - push(@$pa, $node); + push @{ $node_status{$stat} }, $node; + } else { + $node_status{$stat} = [$node]; } - else { $node_status{$stat} = [$node]; } } } From 4939fb00053e918b68bcec46627e3db77e8f2698 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 26 Apr 2018 05:08:52 -0400 Subject: [PATCH 023/117] refine some test cases --- xCAT-test/autotest/testcase/rspconfig/cases1 | 25 +++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases1 b/xCAT-test/autotest/testcase/rspconfig/cases1 index 5fde59d30..15aa23813 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases1 +++ b/xCAT-test/autotest/testcase/rspconfig/cases1 @@ -33,8 +33,7 @@ cmd:rspconfig $$CN dump -g|tee /tmp/dumpgenerate check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* success cmd:sleep 300 -cmd:rspconfig $$CN dump -l -check:output =~$$CN:\s*\[\d+\]\s* Generated: +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate `; rspconfig $$CN dump -l|grep "\[$dumpnumber\] Generated" check:rc == 0 cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber check:rc == 0 @@ -46,8 +45,7 @@ cmd:rspconfig $$CN dump --generate|tee /tmp/dumpgenerate check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* success cmd:sleep 300 -cmd:rspconfig $$CN dump -l -check:output =~$$CN:\s*\[\d+\]\s* Generated: +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate `; rspconfig $$CN dump -l|grep "\[$dumpnumber\] Generated" check:rc == 0 cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber check:rc == 0 @@ -68,7 +66,7 @@ check:output =~$$CN:\s*\[\d+\]\s* success cmd:sleep 300 cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate `; rspconfig $$CN dump -l|grep "\[$dumpnumber\] Generated" check:rc == 0 -cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --clear $dumpnumber +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;rspconfig $$CN dump --clear $dumpnumber check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* clear cmd:rspconfig $$CN dump -g @@ -95,6 +93,7 @@ check:rc == 0 check:output =~$$CN:\s*\[all\]\s* clear cmd:rspconfig $$CN dump -l check:output =~$$CN:\s*No attributes returned from the BMC. +cmd:rm -rf /tmp/dumpgenerate end start:rspconfig_dump_download @@ -105,37 +104,45 @@ cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* success cmd:sleep 300 -cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump -d $dumpnumber |tee /tmp/dumpdown +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;rspconfig $$CN dump -d $dumpnumber |tee /tmp/dumpdown check:rc == 0 cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;grep "Downloaded dump $dumpnumber to /var/log/xcat/dump/" /tmp/dumpdown check:rc == 0 cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`rspconfig $$CN dump -l |grep "\[$dumpnumber\] Generated" |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize +check:rc == 0 cmd:rspconfig $$CN dump -g |tee /tmp/dumpgenerate check:rc == 0 check:output =~$$CN:\s*\[\d+\]\s* success cmd:sleep 300 -cmd:dumpnumber=`cat /tmp/dumpgenerate |awk -F '[' '{ print $2 }' | awk -F ']' '{ print $1 }'`;rspconfig $$CN dump --download $dumpnumber |tee /tmp/dumpdown +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;rspconfig $$CN dump --download $dumpnumber |tee /tmp/dumpdown check:rc == 0 cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;grep "Downloaded dump $dumpnumber to /var/log/xcat/dump/" /tmp/dumpdown check:rc == 0 cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`rspconfig $$CN dump -l |grep "\[$dumpnumber\] Generated" |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize +check:rc == 0 cmd:rspconfig $$CN dump -d all check:rc == 0 check:output =~Downloading all dumps cmd:rspconfig $$CN dump --download all check:rc == 0 check:output =~Downloading all dumps -cmd:rm -rf /tmp/dumpgenerate +cmd:rm -rf /tmp/dumpgenerate /tmp/dumpdown end start:rspconfig_dump_no_option description: To test "rspconfig dump" os:Linux hcp:openbmc -cmd:rspconfig $$CN dump +cmd:rspconfig $$CN dump check:rc == 0 check:output =~$$CN:\s*Dump requested check:output =~$$CN:\s*Downloading dump +cmd:rspconfig $$CN dump -l |tail -n 1 |tee /tmp/dumpgenerate +check:rc == 0 +#cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`cat /tmp/dumpgenerate |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`rspconfig $$CN dump -l |grep "\[$dumpnumber\] Generated" |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize +check:rc == 0 +cmd:rm -rf /tmp/dumpgenerate end start:rspconfig_gard From ac9979301320ee79be3d3b84766900e54eb6fa46 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 26 Apr 2018 15:15:47 -0400 Subject: [PATCH 024/117] REST API for OpenBMC nodes --- xCAT-server/xCAT-wsapi/xcatws.cgi | 14 +++ xCAT-test/autotest/restapi.template | 7 ++ .../autotest/testcase/restapi/node/cases0 | 59 +++++++----- .../autotest/testcase/restapi/node/cases1 | 47 ++++++++++ xCAT-test/restapitest | 94 ++----------------- 5 files changed, 108 insertions(+), 113 deletions(-) create mode 100644 xCAT-test/autotest/restapi.template create mode 100644 xCAT-test/autotest/testcase/restapi/node/cases1 diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index d08be512f..bbb3d7d7d 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1943,6 +1943,20 @@ sub actionout { my $jsonnode; foreach my $d (@$data) { + if (defined($d->{info})) { + # OpenBMC format + if ($param->{'resourcename'} eq "eventlog") { + my ($node, $logentry) = split(/:/, $d->{info}->[0], 2); + $logentry =~ s/^\s+|\s+$//g; # trim whitespace from log entry + push @{ $jsonnode->{$node}->{ $param->{'resourcename'} } }, $logentry; + } else { + my ($node, $resourcename, $value) = split(/:/, $d->{info}->[0]); + $resourcename =~ s/^\s+|\s+$//g; # trim whitespace from resourcename + $value =~ s/^\s+|\s+$//g; # trim whitespace from value + $jsonnode->{ $node }->{ $resourcename } = $value; + } + next; + } unless (defined($d->{node}->[0]->{name})) { next; } diff --git a/xCAT-test/autotest/restapi.template b/xCAT-test/autotest/restapi.template new file mode 100644 index 000000000..ccaef754c --- /dev/null +++ b/xCAT-test/autotest/restapi.template @@ -0,0 +1,7 @@ +# The test for the REST API needs to specify +# the specific node and userid/password for REST API access + +[System] +username= +password= +CN= diff --git a/xCAT-test/autotest/testcase/restapi/node/cases0 b/xCAT-test/autotest/testcase/restapi/node/cases0 index da8f29146..ba33f5831 100644 --- a/xCAT-test/autotest/testcase/restapi/node/cases0 +++ b/xCAT-test/autotest/testcase/restapi/node/cases0 @@ -1,104 +1,111 @@ start:create_node_rest description: create a node with REST API -cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' +cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -u $$username -p $$password check:rc==201 end start:create_node_rest2 description: create a node with REST API failure -cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' +cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -u $$username -p $$password check:rc==147 -check:output=~'errorcode' => '1' +check:output=~"errorcode":"1" end start:get_nodes_rest description: get all nodes with REST API -cmd:restapitest -m GET -r /nodes +cmd:restapitest -m GET -r /nodes -u $$username -p $$password check:rc==200 -check:output=~'restnode' +check:output=~"restnode" end start:get_node_rest description: get single node with REST API -cmd:restapitest -m GET -r /nodes/restnode +cmd:restapitest -m GET -r /nodes/restnode -u $$username -p $$password check:rc==200 -check:output=~'restnode' +check:output=~"restnode" end start:node_delete_rest description: delete node with REST API -cmd:restapitest -m DELETE -r /nodes/restnode +cmd:restapitest -m DELETE -r /nodes/restnode -u $$username -p $$password check:rc==200 end start:get_nodes_rest2 description: get all nodes with REST API -cmd:restapitest -m GET -r /nodes +cmd:restapitest -m GET -r /nodes -u $$username -p $$password check:rc==200 -check:output!~'restnode' +check:output!~"restnode" end start:get_node_rest2 description: get single node with REST API -cmd:restapitest -m GET -r /nodes/restnode +cmd:restapitest -m GET -r /nodes/restnode -u $$username -p $$password check:rc==147 -check:output=~'errorcode' => '1' +check:output=~"errorcode":"1" end start:create_node_token_rest description: create a node with REST API using authentication token -cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -t +cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -u $$username -p $$password -t check:rc==201 end start:node_makehosts_rest description: makehosts for node with REST API -cmd:restapitest -m POST -r /nodes/restnode/host +cmd:restapitest -m POST -r /nodes/restnode/host -u $$username -p $$password check:rc==201 end start:node_makedns_rest description: makehosts for node with REST API -cmd:restapitest -m POST -r /nodes/restnode/dns +cmd:restapitest -m POST -r /nodes/restnode/dns -u $$username -p $$password check:rc==201 end start:node_delete_dns_rest description: delete dns for node with REST API -cmd:restapitest -m DELETE -r /nodes/restnode/dns +cmd:restapitest -m DELETE -r /nodes/restnode/dns -u $$username -p $$password check:rc==200 end start:node_change_attr_rest description: change node attribute with REST API -cmd:restapitest -m PUT -r /nodes/restnode -d '{"mac":"00:1a:64:54:14:80"}' +cmd:restapitest -m PUT -r /nodes/restnode -d '{"mac":"00:1a:64:54:14:80"}' -u $$username -p $$password check:rc==200 end start:node_makedhcp_rest description: makedhcp for node with REST API -cmd:restapitest -m POST -r /nodes/node1/dhcp +cmd:restapitest -m POST -r /nodes/restnode/dhcp -u $$username -p $$password check:rc==201 end -start:node_delete_dhcp +start:node_delete_dhcp_rest description: node_delete_dhcp -cmd:restapitest -m DELETE -r /nodes/node1/dhcp +cmd:restapitest -m DELETE -r /nodes/restnode/dhcp -u $$username -p $$password check:rc==200 end start:node_state_rest description: get node state with REST API -cmd:restapitest -m GET -r /nodes/restnode/nodestat +cmd:restapitest -m GET -r /nodes/$$CN/nodestat -u $$username -p $$password check:rc==200 -check:output=~'restnode' -check:output=~'nodestat' +check:output=~"$$CN" +check:output=~"nodestat" end start:node_state_token_rest description: get node state with REST API using authentication token -cmd:restapitest -m GET -r /nodes/restnode/nodestat -t +cmd:restapitest -m GET -r /nodes/$$CN/nodestat -u $$username -p $$password -t check:rc==200 -check:output=~'restnode' -check:output=~'nodestat' +check:output=~"$$CN" +check:output=~"nodestat" +end + +start:get_node_rest_error +description: get single node with REST API with invalid user or password +cmd:restapitest -m GET -r /nodes/restnode -u abc -p xyz +check:rc==145 +check:output=~"error":"Authentication failure" end diff --git a/xCAT-test/autotest/testcase/restapi/node/cases1 b/xCAT-test/autotest/testcase/restapi/node/cases1 new file mode 100644 index 000000000..0b03ce7b8 --- /dev/null +++ b/xCAT-test/autotest/testcase/restapi/node/cases1 @@ -0,0 +1,47 @@ +start:inventory_node_rest +description: get OpenBMC node inventory with REST API +hcp:openbmc +cmd:restapitest -m GET -r /nodes/$$CN/inventory -u $$username -p $$password +check:rc==200 +check:output =~ "CPU0 PrettyName":"PROCESSOR MODULE" +end + +start:inventory_node_rest2 +description: get IPMI node inventory with REST API +hcp:ipmi +cmd:restapitest -m GET -r /nodes/$$CN/inventory -u $$username -p $$password +check:rc==200 +check:output=~Board Serial Number +end + +start:vitals_node_rest +description: get OpenBMC node vitals with REST API +hcp:openbmc +cmd:restapitest -m GET -r /nodes/$$CN/vitals -u $$username -p $$password +check:rc==200 +check:output =~"LEDs Front Fault" +end + +start:vitals_node_rest2 +description: get IPMI node vitals with REST API +hcp:ipmi +cmd:restapitest -m GET -r /nodes/$$CN/vitals -u $$username -p $$password +check:rc==200 +check:output=~CPU Core Temp +end + +start:eventlog_node_rest +description: get OpenBMC node inventory with REST API +hcp:openbmc +cmd:restapitest -m GET -r /nodes/$$CN/eventlog -u $$username -p $$password +check:rc==200 +check:output=~"eventlog" +end + +start:eventlog_node_rest2 +description: get IPMI node eventlog with REST API +hcp:ipmi +cmd:restapitest -m GET -r /nodes/$$CN/eventlog -u $$username -p $$password +check:rc==200 +check:output=~eventlog +end diff --git a/xCAT-test/restapitest b/xCAT-test/restapitest index f5db2e79c..4ef87822f 100755 --- a/xCAT-test/restapitest +++ b/xCAT-test/restapitest @@ -97,52 +97,26 @@ if ($resource) { } } - -############################################################## -# ONLY check result,exit immediately -############################################################## -if ($output and !defined($method)) { - my $res = check_result($output, $loperator, $outputfile); - log_debug(2, "check result runs with $output and $loperator, result is $res\n"); - exit $res; -} - ############################################################## # Give default values for optional vars. ############################################################### my $rootdir = "$::XCATROOT/share/xcat/tools/autotest"; my $resultdir = "$rootdir/result"; my $logfile = "$rootdir/result/restapitest.log"; +#logfile: /opt/xcat/share/xcat/tools/autotest/result/restapitest.log -#/opt/xcat/share/xcat/tools/autotest/result/restapitest.log -my $confile = "$rootdir/default.conf"; +unless (($user) && ($passwd)) { - -# read configuration file -if (!open(CONF, "<$confile")) { - log_debug(1, "can't open configuration file $confile"); + # No user or passwd passed in, read configuration file, they might be there + print "Userid and password must be supplied\n"; exit 1; } -my %confhash; -while () { - if (/restapi-(\w+)=(\S+)/) { - $confhash{$1} = $2; - } -} # get hostname or default to local host if not specified unless ($host) { $host = "127.0.0.1"; } -unless ($user) { - $user = $confhash{DefaultUser1}; -} -unless ($passwd) { - $passwd = $confhash{DefaultPasswd1}; -} -my $DefaultPasswd = $confhash{DefaultPasswd1}; - if ($usetoken) { # get token my $gettoken = `curl -X POST -k 'https://$host/xcatws/tokens' -H Content-Type:application/json --data '{"userName":"$user","userPW":"$passwd"}' 2>/dev/null`; @@ -155,64 +129,11 @@ log_debug(3, "User $user. \n"); log_debug(3, "Password $passwd. \n"); log_debug(3, "Host $host. \n"); log_debug(3, "Got token $token. \n"); -log_debug(3, "get path of ca $confhash{Cert} \n"); my $res = run_restapi($method, $resource, $data, "", $port, "$host", "$user", "$passwd", "$token"); -$defaulthash = parse_json($res); $defaulthttpresult = check_errcode(); -print Dumper $defaulthash; -exit $defaulthttpresult; - -#################################################### -# Begin to run test cases -#################################################### -my @users = ($confhash{DefaultUser1}, $confhash{DefaultUser2}, $user); -my @passwds = ($confhash{DefaultPasswd1}, $confhash{DefaultPasswd2}, $passwd); -my @tokens = ("", $token, $token); -my @certs = ("", $confhash{Cert}, $cert); -my $i = 0; -unless ($method eq "POST") { # Should not post sevral times - for my $u (@users) { - next unless ($u); - my $p = $passwds[$i]; - $i++; - for my $t (@tokens) { - for my $c (@certs) { - - #if ($method eq "POST" and ($resource =~ /^\/nodes\/(\w+)$/)) { - # `/opt/xcat/bin/rmdef $1`; - # log_debug(2,"restapi test rmdef $1\n"); - #} - my $res = run_restapi($method, $resource, $data, $c, $port, $host, $u, $p, $t); - if ($res) { - my $reshash = parse_json($res); - log_debug(2, "parse curl result and got:\n"); - log_debug(2, $reshash); - if (%$reshash != %$defaulthash) { - log_debug(3, "restapi test cases run different result with $method, $resource, $data, $c, $port, $host, $u, $p, $t\n"); - exit 1; - } - } - my $errcode = check_errcode(); - log_debug(2, "get curl error code: $errcode\n"); - if ($errcode != $defaulthttpresult) { - log_debug(3, "restapi test cases run different error code with $method, $resource, $data, $c, $port, $host, $u, $p, $t\n"); - exit 1; - } - } - } - } -} -############################################################## -# check result -############################################################## -if ($output) { - my $res = check_result($output, $loperator, $res); - log_debug(2, "check result runs with $output and $loperator, result is $res\n"); - exit $res; -} - +print Dumper $res; exit $defaulthttpresult; ################################################ @@ -287,10 +208,9 @@ sub run_restapi $cmd .= "/xcatws"; $cmd .= "$r?"; unless ($t) { - $cmd .= "userName=$u&userPW=$a'"; - } else { - $cmd .= "'"; + $cmd .= "userName=$u&userPW=$a"; } + $cmd .= "&pretty=1'"; if ($d) { $cmd .= " -H Content-Type:application/json --data '$d'"; } From 63376fd0718e31b7eeb2de7195921cbf2e27c9a8 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 26 Apr 2018 16:13:53 -0400 Subject: [PATCH 025/117] Update mlnxofed_ib_install_v2_diskful.rst Update the diskful doc to reflect --force option to avoid installer prompting. --- .../networks/infiniband/mlnxofed_ib_install_v2_diskful.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskful.rst b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskful.rst index 96f263e4a..689c7d265 100644 --- a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskful.rst +++ b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskful.rst @@ -18,11 +18,11 @@ Diskful Installation chdef -t node -o \ -p postscripts="mlnxofed_ib_install -p /install//" - **[kernel mismatch issue]** The Mellanox OFED ISO is built against a series of specific kernel version. If the version of the linux kernel does not match any of the Mellanox offered pre-built kernel modules, you can pass the ``--add-kernel-support`` argument to the Mellanox installation script to build the kernel modules based on the version you are using. :: + **[kernel mismatch issue]** The Mellanox OFED ISO is built against a series of specific kernel version. If the version of the linux kernel does not match any of the Mellanox offered pre-built kernel modules, you can pass the ``--add-kernel-support --force`` argument to the Mellanox installation script to build the kernel modules based on the version you are using. :: chdef -t node -o \ -p postscripts="mlnxofed_ib_install -p /install// \ - -m --add-kernel-support -end-" + -m --add-kernel-support --force -end-" #. Provision the node :: From 7c85b0998dbcaea12012134bac82999d97b28227 Mon Sep 17 00:00:00 2001 From: yangsong Date: Fri, 27 Apr 2018 11:28:08 +0800 Subject: [PATCH 026/117] add support for syncfiles with scp (#5123) * add support for syncfiles with scp * refine logic of EXECTUTE support message non rsync filesync * refine syncfiles * add startsyncfile script for cumulus * refine format, fix updatenode without options causes command to crash #5142 --- .../references/man1/updatenode.1.rst | 12 +- perl-xCAT/xCAT/DSHCLI.pm | 66 +++++++---- perl-xCAT/xCAT/SSH.pm | 105 +++++++++++++----- perl-xCAT/xCAT/Usage.pm | 6 +- xCAT-client/bin/updatenode | 5 +- xCAT-client/pods/man1/updatenode.1.pod | 12 +- xCAT-server/lib/xcat/plugins/syncfiles.pm | 30 ++++- xCAT-server/lib/xcat/plugins/updatenode.pm | 57 ++++++++-- xCAT-server/lib/xcat/plugins/xdsh.pm | 14 ++- xCAT/postscripts/startsyncfiles | 48 ++++++++ xCAT/postscripts/startsyncfiles.awk | 4 + xCAT/postscripts/syncfiles | 19 ++-- 12 files changed, 302 insertions(+), 76 deletions(-) create mode 100755 xCAT/postscripts/startsyncfiles diff --git a/docs/source/guides/admin-guides/references/man1/updatenode.1.rst b/docs/source/guides/admin-guides/references/man1/updatenode.1.rst index cd9a37448..82499c50e 100644 --- a/docs/source/guides/admin-guides/references/man1/updatenode.1.rst +++ b/docs/source/guides/admin-guides/references/man1/updatenode.1.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **updatenode**\ \ *noderange*\ [\ **-V | -**\ **-verbose**\ ] [\ **-F | -**\ **-sync**\ ] [\ **-f | -**\ **-snsync**\ ] [\ **-S | -**\ **-sw**\ ] [\ **-l**\ \ *userID*\ ] [\ **-P | -**\ **-scripts**\ [\ *script1,script2...*\ ]] [\ **-s | -**\ **-sn**\ ] [\ **-A | -**\ **-updateallsw**\ ] [\ **-c | -**\ **-cmdlineonly**\ ] [\ **-d**\ \ *alt_source_dir*\ ] [\ **-**\ **-fanout**\ =\ *fanout_value*\ ] [\ **-t**\ \ *timeout*\ } [\ *attr=val*\ [\ *attr=val...*\ ]] [\ **-n | -**\ **-noverify**\ ] +\ **updatenode**\ \ *noderange*\ [\ **-V | -**\ **-verbose**\ ] [\ **-F | -**\ **-sync**\ ] [\ **-f | -**\ **-snsync**\ ] [\ **-r | -**\ **-node-rcp**\ [\ *full_path_to_remote_copy_command*\ ]] [\ **-S | -**\ **-sw**\ ] [\ **-l**\ \ *userID*\ ] [\ **-P | -**\ **-scripts**\ [\ *script1,script2...*\ ]] [\ **-s | -**\ **-sn**\ ] [\ **-A | -**\ **-updateallsw**\ ] [\ **-c | -**\ **-cmdlineonly**\ ] [\ **-d**\ \ *alt_source_dir*\ ] [\ **-**\ **-fanout**\ =\ *fanout_value*\ ] [\ **-t**\ \ *timeout*\ } [\ *attr=val*\ [\ *attr=val...*\ ]] [\ **-n | -**\ **-noverify**\ ] \ **updatenode**\ \ **noderange**\ [\ **-k | -**\ **-security**\ ] [\ **-t**\ \ *timeout*\ ] @@ -382,7 +382,7 @@ OPTIONS \ **-F|-**\ **-sync**\ Specifies that file synchronization should be - performed on the nodes. rsync and ssh must + performed on the nodes. rsync/scp and ssh must be installed and configured on the nodes. The function is not supported for NFS-based statelite installations. For NFS-based statelite installations to sync files, you should use the @@ -396,7 +396,7 @@ OPTIONS Specifies that file synchronization should be performed to the service nodes that service the nodes in the noderange. This updates the service - nodes with the data to sync to the nodes. rsync and ssh must + nodes with the data to sync to the nodes. rsync/scp and ssh must be installed and configured on the service nodes. For hierarchy, this optionally can be done before syncing the files to the nodes with the -F flag. If the -f flag is not used, then @@ -412,6 +412,12 @@ OPTIONS +[\ **-r | -**\ **-node-rcp**\ [\ *full_path_to_remote_copy_command*\ ]] + + Specifies the full path of the remote copy command used for syncing files to node targets, such as "/usr/bin/rsync" or "/usr/bin/scp". If not specified, rsync will be used by default. + + + \ **-g|-**\ **-genmypost**\ Will generate a new mypostscript file for the diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index c1f59fdea..85693ec22 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -22,6 +22,8 @@ use xCAT::MsgUtils; use xCAT::Utils; use xCAT::TableUtils; use xCAT::NodeRange; +use xCAT::DSHCLI; +use Data::Dumper; use lib '/opt/xcat/xdsh'; our @dsh_available_contexts = (); our @dsh_valid_contexts = (); @@ -922,6 +924,7 @@ sub fork_fanout_dcp $dsh_trace && (xCAT::MsgUtils->message("I", $rsp, $::CALLBACK)); + my @process_info = xCAT::DSHCore->fork_output($user_target, @dcp_command); vec($$outfh_targets{'bitmap'}, fileno($process_info[1]), 1) = 1; @@ -1329,7 +1332,7 @@ sub fork_fanout_dsh #print "Command=@dsh_command\n"; #@process_info = xCAT::DSHCore->fork_output($user_target, @dsh_command); - push(@commands, \@dsh_command); #print Dumper(\@commands); + push(@commands, \@dsh_command); @process_info = xCAT::DSHCore->fork_output_for_commands($user_target, @commands); if ($process_info[0] == -2) { @@ -4531,15 +4534,6 @@ sub parse_and_run_dcp } } - # invalid to put the -F with the -r flag - if ($options{'File'} && $options{'node-rcp'}) - { - my $rsp = {}; - $rsp->{error}->[0] = -"If -F option is use, then -r is invalid. The command will always the rsync using ssh."; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); - return; - } # invalid to put the -s without the -F flag if (!($options{'File'}) && $options{'rsyncSN'}) @@ -4566,22 +4560,31 @@ sub parse_and_run_dcp } } - elsif ($^O eq 'linux') + elsif (($^O eq 'linux') and !$options{'node-rcp'}) { $options{'node-rcp'} = '/usr/bin/rsync'; } } - my $remotecopycommand = $options{'node-rcp'}; - if ($options{'node-rcp'} - && (!-f $options{'node-rcp'} || !-x $options{'node-rcp'})) - { - my $rsp = {}; - $rsp->{error}->[0] = -"Remote command: $remotecopycommand does not exist or is not executable."; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); - return; - } + my $remotecopycommand = $options{'node-rcp'}; + if ($options{'node-rcp'}) { + if (!-f $options{'node-rcp'} || !-x $options{'node-rcp'}) + { + my $rsp = {}; + $rsp->{error}->[0] = + "Remote command: $remotecopycommand does not exist or is not executable."; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + return; + } + + if ($remotecopycommand !~ /\/(rcp|scp|rsync)$/){ + my $rsp = {}; + $rsp->{error}->[0] = + "Remote command: $remotecopycommand is invalid, the support remote commands: scp,rcp,rsync."; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + return; + } + } # # build list of nodes my @nodelist; @@ -4673,6 +4676,7 @@ sub parse_and_run_dcp { $::SYNCSN = 1; } + # the parsing of the file will fill in an array of postscripts # need to be run if the associated file is updated @@ -4726,6 +4730,7 @@ sub parse_and_run_dcp my $rsp = {}; $rsp->{error}->[0] = "Error parsing the rsync file:$syncfile."; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + $::FAILED_NODES=scalar @nodelist; return; } @@ -5067,6 +5072,7 @@ sub parse_rsync_input_file_on_MN my $addappendscript = 0; open(INPUTFILE, "< $input_file") || die "File $input_file does not exist\n"; + while (my $line = ) { chomp $line; @@ -5284,6 +5290,15 @@ sub parse_rsync_input_file_on_MN { $$options{'nodes'} = join ',', keys %{ $$options{'destDir_srcFile'} }; } + + my $remotecopycommand=$$options{'node-rcp'}; + if($remotecopycommand !~ /\/rsync$/ and @::postscripts){ + my $rsp = {}; + $rsp->{error}->[0] ="key word 'EXECUTE' is unavailable when the remote copy command specified by '-r|--node-rcp' is $remotecopycommand. Does 'EXECUTEALWAYS' work for you?"; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + return 1; + } + return 0; } @@ -5780,6 +5795,15 @@ sub parse_rsync_input_file_on_SN { $$options{'nodes'} = join ',', keys %{ $$options{'destDir_srcFile'} }; } + + my $remotecopycommand=$$options{'node-rcp'}; + if($remotecopycommand !~ /\/rsync$/ and @::postscripts){ + my $rsp = {}; + $rsp->{error}->[0] ="key word 'EXECUTE' is unavailable when the remote copy command specified by '-r|--node-rcp' is $remotecopycommand. Does 'EXECUTEALWAYS' work for you?"; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + return 1; + } + return 0; } diff --git a/perl-xCAT/xCAT/SSH.pm b/perl-xCAT/xCAT/SSH.pm index 182671abb..0f6d0b30e 100644 --- a/perl-xCAT/xCAT/SSH.pm +++ b/perl-xCAT/xCAT/SSH.pm @@ -5,7 +5,6 @@ package xCAT::SSH; # cannot use strict use base xCAT::DSHRemoteShell; - # Determine if OS is AIX or Linux # Configure standard locations of commands based on OS @@ -136,33 +135,87 @@ sub remote_copy_command { my @src_files = (); my @dest_file = (); - my @src_file_list = split $::__DCP_DELIM, $$config{'src-file'}; + if ($$config{'destDir_srcFile'}){ + my $dest_dir_list = join ' ', keys %{ $$config{'destDir_srcFile'} }; + my $dest_user_host = $$config{'dest-host'}; + if ($::SYNCSN == 1) + { # syncing service node + #todo + $scpfile = "/tmp/scp_$$config{'dest-host'}"; + } + else + { + $scpfile = "/tmp/scp_$$config{'dest-host'}"; + } + + open SCPCMDFILE, "> $scpfile" + or die "Can not open file $scpfile"; + if ($$config{'dest-user'}) + { + $dest_user_host = + "$$config{'dest-user'}@" . "$$config{'dest-host'}"; + } + if ($$config{'trace'}) { + print SCPCMDFILE "#!/bin/sh -x\n"; + } else { + print SCPCMDFILE "#!/bin/sh\n"; + } - foreach $src_file (@src_file_list) { - my @src_path = (); - $$config{'src-user'} && push @src_path, "$$config{'src-user'}@"; - $$config{'src-host'} && push @src_path, "$$config{'src-host'}:"; - $$config{'src-file'} && push @src_path, $src_file; - push @src_files, (join '', @src_path); + print SCPCMDFILE + "/usr/bin/ssh $dest_user_host '/bin/mkdir -p $dest_dir_list'\n"; + + foreach my $dest_dir (keys %{ $$config{'destDir_srcFile'} }){ + if($$config{'destDir_srcFile'}{$dest_dir}{'same_dest_name'}){ + my @src_file = + @{ $$config{'destDir_srcFile'}{$dest_dir}{'same_dest_name'} }; + my $src_file_list = join ' ', @src_file; + print SCPCMDFILE + "$exec_path -p -r $src_file_list $dest_user_host:$dest_dir\n"; + } + + if($$config{'destDir_srcFile'}{$dest_dir}{'diff_dest_name'}){ + my %diff_dest_hash = + %{ $$config{'destDir_srcFile'}{$dest_dir}{'diff_dest_name'} }; + foreach my $src_file_diff_dest (keys %diff_dest_hash) + { + my $diff_basename = $diff_dest_hash{$src_file_diff_dest}; + print SCPCMDFILE + "$exec_path -p -r $src_file_diff_dest $dest_user_host:$dest_dir/$diff_basename\n"; + } + } + } + + close SCPCMDFILE; + chmod 0755, $scpfile; + @command = ('/bin/sh', '-c', $scpfile); + }else{ + my @src_file_list = split $::__DCP_DELIM, $$config{'src-file'}; + + foreach $src_file (@src_file_list) { + my @src_path = (); + $$config{'src-user'} && push @src_path, "$$config{'src-user'}@"; + $$config{'src-host'} && push @src_path, "$$config{'src-host'}:"; + $$config{'src-file'} && push @src_path, $src_file; + push @src_files, (join '', @src_path); + } + + $$config{'dest-user'} && push @dest_file, "$$config{'dest-user'}@"; + $$config{'dest-host'} && push @dest_file, "$$config{'dest-host'}:"; + $$config{'dest-file'} && push @dest_file, $$config{'dest-file'}; + + push @command, $exec_path; + $$config{'preserve'} && push @command, '-p'; + $$config{'recursive'} && push @command, '-r'; + + if ($$config{'options'}) { + my @options = split ' ', $$config{'options'}; + push @command, @options; + } + + ($ssh_version eq 'OpenSSH') && push @command, '-B'; + push @command, @src_files; + push @command, (join '', @dest_file); } - - $$config{'dest-user'} && push @dest_file, "$$config{'dest-user'}@"; - $$config{'dest-host'} && push @dest_file, "$$config{'dest-host'}:"; - $$config{'dest-file'} && push @dest_file, $$config{'dest-file'}; - - push @command, $exec_path; - $$config{'preserve'} && push @command, '-p'; - $$config{'recursive'} && push @command, '-r'; - - if ($$config{'options'}) { - my @options = split ' ', $$config{'options'}; - push @command, @options; - } - - ($ssh_version eq 'OpenSSH') && push @command, '-B'; - push @command, @src_files; - push @command, (join '', @dest_file); - return @command; } diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index aeb8cdfe2..3abcf53b2 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -500,7 +500,7 @@ my %usage = ( or updatenode [-V|--verbose] [-k|--security] [-s|--sn] [-t ] or - updatenode [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw] [-t ] + updatenode [-V|--verbose] [-F|--sync | -f|--snsync] [-r|--node-rcp ] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw] [-t ] [-P|--scripts [script1,script2,...]] [-s|--sn] [-A|--updateallsw] [-c|--cmdlineonly] [-d alt_source_dir] [attr=val [attr=val...]] @@ -520,7 +520,9 @@ Options: [-f|--snsync] Performs File Syncing to the service nodes that service the nodes in the noderange. - + + [-r|--node-rcp] Specifies the full path of the remote copy command used for sync files to node targets, such as /usr/bin/rsync and /usr/bin/scp + [-g|--genmypost] Will generate a new mypostscript file for the the nodes in the noderange, if site precreatemypostscripts is 1 or YES. diff --git a/xCAT-client/bin/updatenode b/xCAT-client/bin/updatenode index ebfe392e2..f4dd1a79b 100755 --- a/xCAT-client/bin/updatenode +++ b/xCAT-client/bin/updatenode @@ -56,7 +56,7 @@ if (!($tmp =~ / (--help|-h|-v|--version)/)) { my $arg = shift(@ARGV); # Set the noderange - if ($arg !~ /^-/) { + if ($arg and $arg !~ /^-/) { my @tempnr = (); foreach my $nr (split(/,/, $arg)) { if ($nr =~ /^\^(.*)$/) { @@ -82,7 +82,7 @@ if (!($tmp =~ / (--help|-h|-v|--version)/)) { push(@{ $cmdref->{arg} }, @ARGV); # check the syntax -my ($ALLSW, $CMDLINE, $ALTSRC, $HELP, $VERSION, $VERBOSE, $FILESYNC, $GENMYPOST, $USER, $SNFILESYNC, $SWMAINTENANCE, $SETSERVER, $RERUNPS, $SECURITY, $OS, $fanout, $timeout, $NOVERIFY); +my ($ALLSW, $CMDLINE, $ALTSRC, $HELP, $VERSION, $VERBOSE, $FILESYNC, $GENMYPOST, $USER, $SNFILESYNC, $SWMAINTENANCE, $SETSERVER, $RERUNPS, $SECURITY, $OS, $fanout, $timeout, $NOVERIFY,$RCP); if ( !GetOptions( 'A|updateallsw' => \$ALLSW, @@ -103,6 +103,7 @@ if ( 'fanout=i' => \$fanout, 't|timetout=i' => \$timeout, 'n|noverify' => \$NOVERIFY, + 'r|node-rcp' => \$RCP, ) ) { &updatenode_usage(); diff --git a/xCAT-client/pods/man1/updatenode.1.pod b/xCAT-client/pods/man1/updatenode.1.pod index 582a9da26..3fc86a737 100644 --- a/xCAT-client/pods/man1/updatenode.1.pod +++ b/xCAT-client/pods/man1/updatenode.1.pod @@ -4,7 +4,7 @@ B - Update nodes in an xCAT cluster environment. =head1 SYNOPSIS -B I [B<-V>|B<--verbose>] [B<-F>|B<--sync>] [B<-f>|B<--snsync>] [B<-S>|B<--sw>] [B<-l> I] [B<-P>|B<--scripts> [I]] [B<-s>|B<--sn>] [B<-A>|B<--updateallsw>] [B<-c>|B<--cmdlineonly>] [B<-d> I] [B<--fanout>=I] [B<-t> I} [I [I]] [B<-n>|B<--noverify>] +B I [B<-V>|B<--verbose>] [B<-F>|B<--sync>] [B<-f>|B<--snsync>] [B<-r>|B<--node-rcp> [I]] [B<-S>|B<--sw>] [B<-l> I] [B<-P>|B<--scripts> [I]] [B<-s>|B<--sn>] [B<-A>|B<--updateallsw>] [B<-c>|B<--cmdlineonly>] [B<-d> I] [B<--fanout>=I] [B<-t> I} [I [I]] [B<-n>|B<--noverify>] B B [B<-k>|B<--security>] [B<-t> I] @@ -289,7 +289,7 @@ Used to specify a source directory other than the standard lpp_source directory =item B<-F|--sync> Specifies that file synchronization should be -performed on the nodes. rsync and ssh must +performed on the nodes. rsync/scp and ssh must be installed and configured on the nodes. The function is not supported for NFS-based statelite installations. For NFS-based statelite installations to sync files, you should use the @@ -302,7 +302,7 @@ litefile table with source location specified in the litetree table. Specifies that file synchronization should be performed to the service nodes that service the nodes in the noderange. This updates the service -nodes with the data to sync to the nodes. rsync and ssh must +nodes with the data to sync to the nodes. rsync/scp and ssh must be installed and configured on the service nodes. For hierarchy, this optionally can be done before syncing the files to the nodes with the -F flag. If the -f flag is not used, then @@ -316,6 +316,12 @@ For statelite installations to sync files, you should use the read-only option for files/directories listed in litefile table with source location specified in the litetree table. + +=item [B<-r>|B<--node-rcp> [I]] + +Specifies the full path of the remote copy command used for syncing files to node targets, such as "/usr/bin/rsync" or "/usr/bin/scp". If not specified, rsync will be used by default. + + =item B<-g|--genmypost> Will generate a new mypostscript file for the diff --git a/xCAT-server/lib/xcat/plugins/syncfiles.pm b/xCAT-server/lib/xcat/plugins/syncfiles.pm index 8a50c3810..9114fbbde 100644 --- a/xCAT-server/lib/xcat/plugins/syncfiles.pm +++ b/xCAT-server/lib/xcat/plugins/syncfiles.pm @@ -12,7 +12,8 @@ use xCAT::Utils; use xCAT::MsgUtils; use xCAT::SvrUtils; use xCAT::NodeRange; - +use Data::Dumper; +use Getopt::Long; 1; #------------------------------------------------------- @@ -46,11 +47,32 @@ sub process_request my $callback = shift; my $subreq = shift; + my $args= $request->{arg}; # argument + @ARGV = @{$args}; my $client; if ($request->{'_xcat_clienthost'}) { $client = $request->{'_xcat_clienthost'}->[0]; } + + my %options = (); + Getopt::Long::Configure("posix_default"); + Getopt::Long::Configure("no_gnu_compat"); + Getopt::Long::Configure("bundling"); + if ( + !GetOptions( + 'r|c|node-rcp=s' => \$options{'node-rcp'}, + ) + ) + { + xCAT::MsgUtils->message("S", "Received syncfiles from $client, with invalid options @ARGV"); + return; + } + + if ($options{'node-rcp'}){ + $::RCP=$options{'node-rcp'}; + } + if ($client) { ($client) = noderange($client) } unless ($client) { #Not able to do identify the host in question xCAT::MsgUtils->message("S", "Received syncfiles from $client, which couldn't be correlated to a node (domain mismatch?)"); @@ -101,7 +123,11 @@ sub syncfiles { foreach my $synclistfile (@sl) { # call the xdcp plugin to handle the syncfile operation - my $args = [ "-F", "$synclistfile" ]; + my $args = [ "-F", "$synclistfile"]; + if($::RCP){ + push @$args,"-r"; + push @$args, "$::RCP"; + } my $env = ["DSH_RSYNC_FILE=$synclistfile"]; $subreq->({ command => ['xdcp'], node => [$node], arg => $args, env => $env }, $callback); } diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 8b4559179..7df23f482 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -11,7 +11,6 @@ use lib "$::XCATROOT/lib/perl"; use xCAT::Table; use xCAT::Schema; -use Data::Dumper; use xCAT::Utils; use xCAT::SvrUtils; use xCAT::Scope; @@ -30,6 +29,7 @@ use File::Basename; use xCAT::GlobalDef; use xCAT_monitoring::monitorctrl; use Socket; +use Data::Dumper; use strict; my $CALLBACK; @@ -209,7 +209,7 @@ sub preprocess_updatenode } # parse the options - my ($ALLSW, $CMDLINE, $ALTSRC, $HELP, $VERSION, $VERBOSE, $FILESYNC, $GENMYPOST, $USER, $SNFILESYNC, $SWMAINTENANCE, $SETSERVER, $RERUNPS, $SECURITY, $OS, $fanout, $timeout, $NOVERIFY); + my ($ALLSW, $CMDLINE, $ALTSRC, $HELP, $VERSION, $VERBOSE, $FILESYNC, $GENMYPOST, $USER, $SNFILESYNC, $SWMAINTENANCE, $SETSERVER, $RERUNPS, $SECURITY, $OS, $fanout, $timeout, $NOVERIFY, $RCP); Getopt::Long::Configure("bundling"); Getopt::Long::Configure("no_pass_through"); if ( @@ -232,6 +232,7 @@ sub preprocess_updatenode 'fanout=i' => \$fanout, 't|timetout=i' => \$timeout, 'n|noverify' => \$NOVERIFY, + 'r|node-rcp=s' =>\$RCP, ) ) @@ -289,6 +290,11 @@ sub preprocess_updatenode } else { undef $::OS; } + if (defined($RCP)) { + $::RCP = $RCP; + } else { + undef $::RCP; + } # display the usage if -h or --help is specified if ($HELP) @@ -428,6 +434,15 @@ sub preprocess_updatenode return; } + if (($RCP) and (!$FILESYNC) and (!$SNFILESYNC)){ + my $rsp = {}; + $rsp->{data}->[0] = "-r|--node-rcp option is valid when option -f or -F is specified"; + $rsp->{errorcode}->[0] = 1; + $callback->($rsp); + return; + } + + # -f must not be with any other flag, this updates service nodes syncfiles if ($SNFILESYNC && ($SWMAINTENANCE || $RERUNPS || defined($RERUNPS) || $SECURITY || $FILESYNC)) { @@ -658,7 +673,11 @@ sub preprocess_updatenode { $request->{SNFileSyncing}->[0] = "yes"; } - + + if ($RCP){ + $request->{rcp}->[0]=$RCP; + } + # If -F or -f then, call CFMUtils to check if any PCM CFM data is to be # built for the node. This will also create the synclists attribute in # the osimage for each node in the noderange @@ -685,6 +704,7 @@ sub preprocess_updatenode } + # - need to consider the mixed cluster case # - can't depend on the os of the MN - need to split out the AIX nodes my ($rc, $AIXnodes, $Linuxnodes) = xCAT::InstUtils->getOSnodes($nodes); @@ -752,6 +772,7 @@ sub preprocess_updatenode # process the -F or -f flags if (($FILESYNC) || ($SNFILESYNC)) { + # If it is only -F or -f in the command, which are always run on the MN, # then run it now and you are # finished. @@ -821,6 +842,7 @@ sub preprocess_updatenode } + # # if hierarchy, then build the request for the service nodes # @@ -1078,7 +1100,6 @@ sub updatenode @::SUCCESSFULLNODES = (); @::FAILEDNODES = (); - #print Dumper($request); my $nodes = $request->{node}; #$request->{status}= "yes"; # for testing @@ -1135,7 +1156,7 @@ sub updatenode chomp $nimprime; # parse the options - my ($ALLSW, $CMDLINE, $ALTSRC, $HELP, $VERSION, $VERBOSE, $FILESYNC, $GENMYPOST, $USER, $SNFILESYNC, $SWMAINTENANCE, $SETSERVER, $RERUNPS, $SECURITY, $OS, $fanout, $timeout, $NOVERIFY); + my ($ALLSW, $CMDLINE, $ALTSRC, $HELP, $VERSION, $VERBOSE, $FILESYNC, $GENMYPOST, $USER, $SNFILESYNC, $SWMAINTENANCE, $SETSERVER, $RERUNPS, $SECURITY, $OS, $fanout, $timeout, $NOVERIFY, $RCP); Getopt::Long::Configure("bundling"); Getopt::Long::Configure("no_pass_through"); if ( @@ -1158,6 +1179,7 @@ sub updatenode 'fanout=i' => \$fanout, 't|timetout=i' => \$timeout, 'n|noverify' => \$NOVERIFY, + 'r|node-rcp=s' => \$RCP, ) ) { @@ -1211,6 +1233,11 @@ sub updatenode } else { undef $::OS; } + if (defined($RCP)) { + $::RCP = $RCP; + } else { + undef $::RCP; + } # # process @ARGV @@ -1712,6 +1739,7 @@ sub updatenodesyncfiles my %syncfile_node = (); my %syncfile_rootimage = (); + # $::NOSYNCFILE default value is 0 # if there is no syncfiles, set $::NOSYNCFILE=1 $::NOSYNCFILE = 0; @@ -1828,6 +1856,10 @@ sub updatenodesyncfiles $CALLBACK = $callback; + if($::RCP){ + push @$args, "--node-rcp"; + push @$args, "$::RCP"; + } $output = xCAT::Utils->runxcmd( { @@ -1841,21 +1873,32 @@ sub updatenodesyncfiles # build the list of good and bad nodes &buildnodestatus(\@$output, $callback); + if($::RUNCMD_RC and !@::FAILEDNODES){ + push @::FAILEDNODES,@{$syncfile_node{$synclist}}; + } } if ($request->{SNFileSyncing}->[0] eq "yes") { my $rsp = {}; - $rsp->{data}->[0] = "File synchronization has completed for service nodes."; + if(@::SUCCESSFULLNODES){ + $rsp->{data}->[0] = "File synchronization has completed for service nodes: \"".join(',',@::SUCCESSFULLNODES)."\""; + } if (@::FAILEDNODES) { $rsp->{errorcode}->[0] = 1; + $rsp->{data}->[0] = "File synchronization failed for service nodes: \"".join(',',@::FAILEDNODES)."\""; } $callback->($rsp); } + if ($request->{FileSyncing}->[0] eq "yes") { my $rsp = {}; - $rsp->{data}->[0] = "File synchronization has completed for nodes."; + if(@::SUCCESSFULLNODES){ + $rsp->{data}->[0] = "File synchronization has completed for nodes: \"".join(',',@::SUCCESSFULLNODES)."\""; + } + if (@::FAILEDNODES) { $rsp->{errorcode}->[0] = 1; + $rsp->{data}->[0] = "File synchronization failed for nodes: \"".join(',',@::FAILEDNODES)."\""; } $callback->($rsp); } diff --git a/xCAT-server/lib/xcat/plugins/xdsh.pm b/xCAT-server/lib/xcat/plugins/xdsh.pm index 50ae19bb3..2b295d144 100644 --- a/xCAT-server/lib/xcat/plugins/xdsh.pm +++ b/xCAT-server/lib/xcat/plugins/xdsh.pm @@ -17,13 +17,15 @@ use File::Basename; use File::Path; use POSIX; require xCAT::Table; - +use Data::Dumper; require xCAT::Utils; require xCAT::Zone; require xCAT::TableUtils; require xCAT::ServiceNodeUtils; require xCAT::MsgUtils; use Getopt::Long; + + require xCAT::DSHCLI; 1; @@ -63,6 +65,7 @@ sub preprocess_request my $sn; my $rc = 0; + #if already preprocessed, go straight to request if ((defined($req->{_xcatpreprocessed})) && ($req->{_xcatpreprocessed}->[0] == 1)) @@ -331,6 +334,11 @@ sub parse_xdcp_cmd } my $changedfile = 0; + if ($options{'node-rcp'}){ + $::RCP=$options{'node-rcp'}; + } + + # check to see if -F option and if there is, is the # input file fully defined path my $newfile; @@ -658,6 +666,10 @@ sub process_servicenodes_xdcp $addreq->{command}->[0] = $cmd; $addreq->{cwd}->[0] = $req->{cwd}->[0]; $addreq->{env} = $req->{env}; + if($::RCP){ + push(@{ $addreq->{arg} }, "-r"); + push(@{ $addreq->{arg} }, "$::RCP"); + } &process_request($addreq, $callback, $sub_req); if ($::FAILED_NODES == 0) diff --git a/xCAT/postscripts/startsyncfiles b/xCAT/postscripts/startsyncfiles new file mode 100755 index 000000000..1f1be4fc2 --- /dev/null +++ b/xCAT/postscripts/startsyncfiles @@ -0,0 +1,48 @@ +#!/bin/bash +log_label="xcat" +#mkdir -p /etc/xcat +#mkdir -p /etc/pki/tls +#if [ ! -f /etc/xcat/privkey.pem ]; then +# echo "[ req ] +#distinguished_name = nodedn + +#[ nodedn ]" > /etc/pki/tls/openssl.cnf +# logger -s -t $log_label -p local4.info "Generating private key..." +# openssl genrsa -out /etc/xcat/privkey.pem 1024 >& /dev/null +# logger -s -t $log_label -p local4.info "Done" +#fi + +#PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout 2> /dev/null|grep -v "PUBLIC KEY"` +#PUBKEY=`echo $PUBKEY|sed -e 's/ //g'` +#export PUBKEY + + + +REQUEST="" +REQUEST=${REQUEST}"syncfiles" +#REQUEST=${REQUEST}"$PUBKEY" +#REQUEST=${REQUEST}"" + +if [ -n "$RCP" ]; then + REQUEST=${REQUEST}"-r" + REQUEST=${REQUEST}""${RCP}"" +fi + +REQUEST=${REQUEST}"" +RETCODE=0 + +while read LINE;do + echo $LINE + if echo $LINE| grep '' >/dev/null 2>&1; then + rm -rf $RESPFILE + exit $RETCODE + fi + if echo $LINE|grep '' >/dev/null 2>&1; then + RET=${LINE#*>} + RET=${RET%<*} + [ "$RET" != "0" ] && RETCODE=1 + fi +done < <(openssl s_client -no_ssl3 -no_ssl2 -connect $MASTER_IP:$XCATDPORT -ign_eof -quiet <<<$REQUEST) + +rm -rf $RESPFILE +exit $RETCODE diff --git a/xCAT/postscripts/startsyncfiles.awk b/xCAT/postscripts/startsyncfiles.awk index a7975410d..88f5a9e4a 100755 --- a/xCAT/postscripts/startsyncfiles.awk +++ b/xCAT/postscripts/startsyncfiles.awk @@ -11,6 +11,10 @@ BEGIN { print "" |& server print " syncfiles" |& server + if(RCP){ + print " -r" |& server + print " "RCP"" |& server + } print "" |& server while (server |& getline) { diff --git a/xCAT/postscripts/syncfiles b/xCAT/postscripts/syncfiles index 1074fe389..0816e14e6 100755 --- a/xCAT/postscripts/syncfiles +++ b/xCAT/postscripts/syncfiles @@ -14,13 +14,6 @@ if [ -d /.statelite ]; then exit 0 fi -if [ -f /etc/os-release ] && cat /etc/os-release |grep -i -e "^NAME=[ \"']*Cumulus Linux[ \"']*$" >/dev/null 2>&1 ; then - #TODO - echo "Cumulus OS is not supported yet, nothing to do..." - logger -t xcat -p local4.info "Cumulus OS is not supported yet, nothing to do..." - exit 0 -fi - # do nothing when UPDATENODE=1 because it is done from the top down if [ -n "$UPDATENODE" ] && [ $UPDATENODE -eq 1 ]; then #echo " Did not sync any files. Use updatenode -F to sync the files." @@ -36,6 +29,11 @@ if [ -n "$NOSYNCFILES" ] && [ $NOSYNCFILES -eq 1 ]; then exit 0 fi +RCP= +if [ ! -e "/usr/bin/rsync" ]; then + [ -e "/usr/bin/scp" ] && RCP="/usr/bin/scp" +fi + logger -t xcat -p local4.info "Performing syncfiles postscript" osname=`uname` @@ -47,9 +45,12 @@ quit="no" count=5 returncode=0 while [ $quit = "no" ]; do - if [ $osname = "Linux" ] + if cat /etc/os-release |grep -i cumulus >/dev/null 2>&1; then + RCP=$RCP $xcatpostdir/startsyncfiles + returncode=$? + elif [ $osname = "Linux" ] then - `$xcatpostdir/startsyncfiles.awk` + `$xcatpostdir/startsyncfiles.awk -v RCP=$RCP` returncode=$? elif [ $osname = "AIX" ] then From 1121c8529de33b2c2ab160683603041efc1d71f0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 27 Apr 2018 10:56:07 -0400 Subject: [PATCH 027/117] Changed due to review --- .../guides/install-guides/maintenance/uninstall_xcat.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/install-guides/maintenance/uninstall_xcat.rst b/docs/source/guides/install-guides/maintenance/uninstall_xcat.rst index f62a968f9..be28e918a 100644 --- a/docs/source/guides/install-guides/maintenance/uninstall_xcat.rst +++ b/docs/source/guides/install-guides/maintenance/uninstall_xcat.rst @@ -53,6 +53,7 @@ Remove xCAT Files [RHEL and SLES] :: yum remove '*xcat*' + yum remove '*xCAT*' [Ubuntu] :: @@ -81,7 +82,7 @@ Remove xCAT Files http://xcat.org/files/xcat/repos/apt/xcat-dep/pool/main - When ``yum install xCAT`` is used to install xCAT, some RPMs shipped by operating system are installed. There is no easy way to find all of them, but keeping those RPMs is harmless. + When ``yum install xCAT`` is used to install xCAT, dependency RPMs provided by the Operating System will be installed. Keeping those rpms installed on the system is harmless. 2. Remove xCAT certificate file :: @@ -96,7 +97,7 @@ Remove xCAT Files 4. Remove xCAT related files (optional) - XCAT might have also created additional files and directories below. Be careful removing these files, as they might be used for other purposes in your environment. :: + XCAT might have also created additional files and directories below. Take caution when removing these files as they may be used for other purposes in your environment. :: /install /tftpboot From dc9420296a92557434bcaa75c3e6491f7237780f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 30 Apr 2018 13:06:05 -0400 Subject: [PATCH 028/117] Handle invalid tables in REST API --- .../restapi_resource/restapi_reference.rst | 12 ++++++------ xCAT-server/xCAT-wsapi/xcatws.cgi | 16 ++++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst b/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst index b641252be..15c5ca823 100644 --- a/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst +++ b/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst @@ -2107,7 +2107,7 @@ Get OS and ARCH attributes from nodetype table for node1 and node2. :: [URI:/tables/{tablelist}/rows] - The non-node table resource ------------------------------------------------------------ -Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, polciy, etc. +Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, policy, etc. GET - Get all rows from non-node tables. ```````````````````````````````````````` @@ -2144,7 +2144,7 @@ Get all rows from networks table. :: [URI:/tables/{tablelist}/rows/{keys}] - The non-node table rows resource ------------------------------------------------------------------------ -Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, polciy, etc. +Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, policy, etc. {keys} should be the name=value pairs which are used to search table. e.g. {keys} should be [net=192.168.1.0,mask=255.255.255.0] for networks table query since the net and mask are the keys of networks table. @@ -2157,7 +2157,7 @@ GET - Get attributes for rows from non-node tables. **Example:** -Get row which net=192.168.1.0,mask=255.255.255.0 from networks table. :: +Get rows from networks table where net=192.168.1.0,mask=255.255.255.0. :: curl -X GET -k 'https://127.0.0.1/xcatws/tables/networks/rows/net=192.168.1.0,mask=255.255.255.0?userName=root&userPW=cluster&pretty=1' @@ -2201,14 +2201,14 @@ DELETE - Delete rows from a non-node table that have the attribute values specif **Example:** -Delete a route row which routename=privnet in the routes table. :: +Delete rows from routes table where routename=privnet. :: curl -X DELETE -k 'https://127.0.0.1/xcatws/tables/routes/rows/routename=privnet?userName=root&userPW=cluster&pretty=1' [URI:/tables/{tablelist}/rows/{keys}/{attrlist}] - The non-node table attributes resource ----------------------------------------------------------------------------------------- -Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, polciy, etc. +Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, policy, etc. GET - Get specific attributes for rows from non-node tables. ```````````````````````````````````````````````````````````` @@ -2219,7 +2219,7 @@ GET - Get specific attributes for rows from non-node tables. **Example:** -Get attributes mgtifname and tftpserver which net=192.168.1.0,mask=255.255.255.0 from networks table. :: +Get attributes mgtifname and tftpserver from networks table for each row where net=192.168.1.0,mask=255.255.255.0. :: curl -X GET -k 'https://127.0.0.1/xcatws/tables/networks/rows/net=192.168.1.0,mask=255.255.255.0/mgtifname,tftpserver?userName=root&userPW=cluster&pretty=1' diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index d08be512f..3f0e79530 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1192,7 +1192,7 @@ my %URIdef = ( }, table_all_rows => { desc => "[URI:/tables/{tablelist}/rows] - The non-node table resource", - desc1 => "Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, polciy, etc.", + desc1 => "Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, policy, etc.", matcher => '^/tables/[^/]+/rows$', GET => { desc => "Get all rows from non-node tables.", @@ -1204,13 +1204,13 @@ my %URIdef = ( }, table_rows => { desc => "[URI:/tables/{tablelist}/rows/{keys}] - The non-node table rows resource", - desc1 => "Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, polciy, etc.", + desc1 => "Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, policy, etc.", desc2 => "{keys} should be the name=value pairs which are used to search table. e.g. {keys} should be [net=192.168.1.0,mask=255.255.255.0] for networks table query since the net and mask are the keys of networks table.", matcher => '^/tables/[^/]+/rows/[^/]+$', GET => { desc => "Get attributes for rows from non-node tables.", usage => "||An object containing each table. Within each table object is an array of row objects containing the attributes.|", - example => qq(|Get row which net=192.168.1.0,mask=255.255.255.0 from networks table.|GET|/tables/networks/rows/net=192.168.1.0,mask=255.255.255.0|{\n \"networks\":[\n {\n \"mgtifname\":\"eth0\",\n \"netname\":\"192_168_1_0-255_255_255_0\",\n \"tftpserver\":\"192.168.1.15\",\n \"gateway\":\"192.168.1.100\",\n \"staticrangeincrement\":\"1\",\n \"net\":\"192.168.1.0\",\n \"mask\":\"255.255.255.0\"\n }\n ]\n}|), + example => qq(|Get rows from networks table where net=192.168.1.0,mask=255.255.255.0.|GET|/tables/networks/rows/net=192.168.1.0,mask=255.255.255.0|{\n \"networks\":[\n {\n \"mgtifname\":\"eth0\",\n \"netname\":\"192_168_1_0-255_255_255_0\",\n \"tftpserver\":\"192.168.1.15\",\n \"gateway\":\"192.168.1.100\",\n \"staticrangeincrement\":\"1\",\n \"net\":\"192.168.1.0\",\n \"mask\":\"255.255.255.0\"\n }\n ]\n}|), fhandler => \&tablerowhdl, outhdler => \&tableout, }, @@ -1224,19 +1224,19 @@ my %URIdef = ( DELETE => { desc => "Delete rows from a non-node table that have the attribute values specified in {keys}.", usage => "||$usagemsg{non_getreturn}|", - example => '|Delete a route row which routename=privnet in the routes table.|DELETE|/tables/routes/rows/routename=privnet||', + example => '|Delete rows from routes table where routename=privnet.|DELETE|/tables/routes/rows/routename=privnet||', fhandler => \&tablerowdelhdl, outhdler => \&noout, }, }, table_rows_attrs => { desc => "[URI:/tables/{tablelist}/rows/{keys}/{attrlist}] - The non-node table attributes resource", - desc1 => "Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, polciy, etc.", + desc1 => "Use this for tables that don't have node name as the key of the table, for example: passwd, site, networks, policy, etc.", matcher => '^/tables/[^/]+/rows/[^/]+/[^/]+$', GET => { desc => "Get specific attributes for rows from non-node tables.", usage => "||An object containing each table. Within each table object is an array of row objects containing the attributes.|", - example => qq(|Get attributes mgtifname and tftpserver which net=192.168.1.0,mask=255.255.255.0 from networks table.|GET|/tables/networks/rows/net=192.168.1.0,mask=255.255.255.0/mgtifname,tftpserver|{\n \"networks\":[\n {\n \"mgtifname\":\"eth0\",\n \"tftpserver\":\"192.168.1.15\"\n }\n ]\n}|), + example => qq(|Get attributes mgtifname and tftpserver from networks table for each row where net=192.168.1.0,mask=255.255.255.0.|GET|/tables/networks/rows/net=192.168.1.0,mask=255.255.255.0/mgtifname,tftpserver|{\n \"networks\":[\n {\n \"mgtifname\":\"eth0\",\n \"tftpserver\":\"192.168.1.15\"\n }\n ]\n}|), fhandler => \&tablerowhdl, outhdler => \&tableout, }, @@ -2853,6 +2853,10 @@ sub tablerowhdl { # out of the node hash and make it the key my $responses = sendRequest($req, { SuppressEmpty => undef, ForceArray => 0, KeyAttr => [] }); + if (@$responses[0]->{error}) { + # Error returned, most likely invalid table, substitute a better error msg + @$responses[0]->{error} = "No such table: @tables"; + } return $responses; } From 81545ed9fcce7a63465d337f0454ba8a1e0f11c2 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 30 Apr 2018 14:37:42 -0400 Subject: [PATCH 029/117] REST API table access testcases --- .../autotest/testcase/restapi/table/cases0 | 117 +++++------------- 1 file changed, 30 insertions(+), 87 deletions(-) diff --git a/xCAT-test/autotest/testcase/restapi/table/cases0 b/xCAT-test/autotest/testcase/restapi/table/cases0 index 8fd8a3955..16f9fd640 100644 --- a/xCAT-test/autotest/testcase/restapi/table/cases0 +++ b/xCAT-test/autotest/testcase/restapi/table/cases0 @@ -1,101 +1,44 @@ -start:node_post_for_table_get -description: node_for_table_get -cmd:restapitest -m POST -r /nodes/tnode1 -d '{"groups":"all","mgt":"dfm","netboot":"xnba","provmethod":"rhels6.4-x86_64-install-compute","profile":"compute","arch":"x86_64","os":"rhels6.4"}' -check:rc==201 -end - -start:node_post_for_table_get -description: node_for_table_get -cmd:restapitest -m POST -r /nodes/tnode2 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot","provmethod":"rhels6.4-ppc64-install-compute","profile":"compute","arch":"ppc64","os":"rhels6.4"}' -check:rc==201 -end - -start:table_get -description: table_get -cmd:restapitest -m GET -r /tables/nodetype/nodes/tnode1,tnode2 +start:get_networks_table_rest +description: get all networks table entries with REST API +cmd:restapitest -m GET -r /tables/networks/rows -u $$username -p $$password check:rc==200 -cmdcheck:restapitest -o '{"nodetype":[{"arch":"ppc64"}]}' -O == +check:output=~netname end -start:table_get2 -description: table_get2 -cmd:restapitest -m GET -r /tables/nodetype,noderes/nodes/tnode1,tnode2 +start:get_network_table_rest +description: get all entries from invalid table name with REST API +cmd:restapitest -m GET -r /tables/network/rows -u $$username -p $$password +check:rc==147 +check:output=~No such table +end + +start:get_network_table_with_attr_selection_rest +description: get all attribute matching networks table entries with REST API +cmd:restapitest -m GET -r /tables/networks/rows/mask=255.0.0.0 -u $$username -p $$password check:rc==200 -cmdcheck:restapitest -o '{"nodetype":[{"arch":"ppc64"}]}' -O == +check:output=~"mask":"255.0.0.0" end -start:table_put -description: table_put -cmd:restapitest -m PUT -r /tables/nodetype,noderes/nodes/tnode1,tnode2 -d '{"nodetype":{"arch":"x86_64"},"noderes":{"netboot":"xnba"}}' +start:get_network_table_with_attr_selection_rest2 +description: get attribute matching networks table attributes with REST API +cmd:restapitest -m GET -r /tables/networks/rows/mask=255.0.0.0/gateway -u $$username -p $$password check:rc==200 +check:output=~"gateway":" end -start:table_get3 -description: table_get3 -cmd:restapitest -m GET -r /tables/nodetype,noderes/nodes/tnode1,tnode2 +start:set_network_table_attr_with_attr_selection_rest2 +description: set attribute for network table for attr seleection with REST API +cmd:restapitest -m PUT -r /tables/networks/rows/mask=255.0.0.0 -d '{"comments":"REST API TEST"}' -u $$username -p $$password check:rc==200 -cmdcheck:restapitest -o '{"nodetype":[{"arch":"x86_64"}]}' -O == +cmd:lsdef -l -t network +check:output=~REST API TEST end -start:table_get_attr -description: table_get_attr -cmd:restapitest -m GET -r /tables/nodetype,noderes/nodes/tnode1,tnode2 +start:delete_network_rest +description: create a network and delele network with REST API +cmd: restapitest -m POST -r /networks/network_rest -d '{"gateway":"10.1.0.1","mask":"255.255.0.0","net":"199.168.0.0"}' -u $$username -p $$password +cmd: restapitest -m DELETE -r /tables/networks/rows/net=199.168.0.0 -u $$username -p $$password check:rc==200 -cmdcheck:restapitest -o '{"nodetype":[{"arch":"x86_64"}]}' -O == +cmd: lsdef -t network network_rest +check:output=~Error: Could not find an object named 'network_rest' of type 'network'. end - -start:table_get_row -description: table_get_row -cmd:restapitest -m GET -r /tables/networks/rows -check:rc==200 -cmdcheck:restapitest -o '{"networks":[{"netname":"ANY"}]}' -O == -end - -start:table_get_row_key -description: table_get_row_key -cmd:restapitest -m GET -r /tables/networks/rows/net=9.114.154.64,mask=255.255.255.192 -check:rc==200 -cmdcheck:restapitest -o '{"networks":[{"mask":"255.255.255.192"}]}' -O == -end - -start:table_put -description: table_put -cmd:restapitest -m PUT -r /tables/routes/rows/routename=privnet -d '{"net":"10.0.1.0","mask":"255.255.255.0","gateway":"10.0.1.254","ifname":"eth1"}' -check:rc==200 -end - -start:table_get_row1 -description: table_get_row1 -cmd:restapitest -m GET -r /tables/routes/privnet -check:rc==200 -cmdcheck:restapitest -o '{"routes":[{"gateway":"10.0.1.254"}]}' -O == -end - -start:table_get_row_key1 -description: table_get_row_key1 -cmd:restapitest -m GET -r /tables/routes/rows/routename=privnet -check:rc==200 -cmdcheck:restapitest -o '{"networks":[{"ifname":"eth1"}]}' -O == -end - -start:table_delete_row -description: table_delete_row -cmd:restapitest -m DELETE -r /tables/routes/rows/routename=privnet -check:rc==200 -cmdcheck:restapitest -o '{"networks":[{"ifname":"eth1"}]}' -O == -end - -start:table_get_row_for_delete -description: table_get_row_for_delete -cmd:restapitest -m GET -r /tables/routes/privnet -check:rc==200 -cmdcheck:restapitest -o '{"routes":[{"gateway":"10.0.1.254"}]}' -O !== -end - -start:table_get_special_key -description: table_get_special_key -cmd:restapitest -m GET -r /tables/networks/rows/net=192.168.1.0,mask=255.255.255.0/mgtifname,tftpserver -check:rc==200 -cmdcheck:restapitest -o '{"networks":[{"mgtifname":"eth0"}]}' -O !== -end - From 915ef295f18f24b62fa8e5bd3032917b79119bd7 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 1 May 2018 23:27:00 -0400 Subject: [PATCH 030/117] update test case 'xcatd_start' for issue 5152 --- xCAT-test/autotest/testcase/xcatd/case0 | 47 ++++++++++++++++--------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcatd/case0 b/xCAT-test/autotest/testcase/xcatd/case0 index e9947e1b9..bec49085a 100644 --- a/xCAT-test/autotest/testcase/xcatd/case0 +++ b/xCAT-test/autotest/testcase/xcatd/case0 @@ -1,31 +1,46 @@ start:xcatd_start description:stop then start xcatd daemon, and check all the 6 processes are running os:linux +cmd:if [ -d "/tmp/xcatd_start" ]; then mv /tmp/xcatd_start /tmp/xcatd_start.org; fi; mkdir -p /tmp/xcatd_start +check:rc==0 cmd:service xcatd status check:rc==0 -check:output=~xcatd service is running +check:output=~Active: active \(running\)|xcatd service is running +cmd:ps axjf |grep -v grep |grep "xcatd:" | tee /tmp/xcatd_start/original_xcatd_processes_status +check:rc==0 +cmd:cat /tmp/xcatd_start/original_xcatd_processes_status |wc -l +check:output=~6 cmd:service xcatd stop check:rc==0 cmd:sleep 3 +cmd:ps axjf |grep -v grep |grep "xcatd:" | tee /tmp/xcatd_start/after_stop_xcatd_processes_status +check:rc==0 +cmd:cat /tmp/xcatd_start/after_stop_xcatd_processes_status|wc -l +check:output=~0 cmd:service xcatd start check:rc==0 -check:output=~Starting xcatd -check:output=~[ OK ] +cmd:sleep 3 cmd:service xcatd status check:rc==0 -check:output=~xcatd service is running -cmd:result=`ps -ef | grep "xcatd: SSL listener" | grep -v grep | wc -l`; if [ $result -eq 1 ]; then echo "only one process"; fi -check:output=~only one process -cmd:result=`ps -ef | grep "xcatd: DB Access" | grep -v grep | wc -l`; if [ $result -eq 1 ]; then echo "only one process"; fi -check:output=~only one process -cmd:result=`ps -ef | grep "xcatd: UDP listener" | grep -v grep | wc -l`; if [ $result -eq 1 ]; then echo "only one process"; fi -check:output=~only one process -cmd:result=`ps -ef | grep "xcatd: install monitor" | grep -v grep | wc -l`; if [ $result -eq 1 ]; then echo "only one process"; fi -check:output=~only one process -cmd:result=`ps -ef | grep "xcatd: Discovery worke" | grep -v grep | wc -l`; if [ $result -eq 1 ]; then echo "only one process"; fi -check:output=~only one process -cmd:result=`ps -ef | grep "xcatd: Command log writer" | grep -v grep | wc -l`; if [ $result -eq 1 ]; then echo "only one process"; fi -check:output=~only one process +check:output=~Active: active \(running\)|xcatd service is running +cmd:ps axjf |grep -v grep |grep "xcatd:" | tee /tmp/xcatd_start/after_start_xcatd_processes_status +check:rc==0 +cmd:cat /tmp/xcatd_start/after_start_xcatd_processes_status|wc -l +check:output=~6 +cmd:grep "xcatd: SSL listener" /tmp/xcatd_start/after_start_xcatd_processes_status|wc -l +check:output=~1 +cmd:grep "xcatd: DB Access" /tmp/xcatd_start/after_start_xcatd_processes_status|wc -l +check:output=~1 +cmd:grep "xcatd: UDP listener" /tmp/xcatd_start/after_start_xcatd_processes_status|wc -l +check:output=~1 +cmd:grep "xcatd: Discovery worker" /tmp/xcatd_start/after_start_xcatd_processes_status|wc -l +check:output=~1 +cmd:grep "xcatd: install monitor" /tmp/xcatd_start/after_start_xcatd_processes_status|wc -l +check:output=~1 +cmd:grep "xcatd: Command log writer" /tmp/xcatd_start/after_start_xcatd_processes_status|wc -l +check:output=~1 +cmd: rm -rf /tmp/xcatd_start; if [ -d "/tmp/xcatd_start.org" ]; then mv /tmp/xcatd_start.org /tmp/xcatd_start; fi +check:rc==0 end start:xcatd_start_systemd From 36cc903f36a0ea6d47ba43b008a9cbeb00c15db8 Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 2 May 2018 02:05:33 -0400 Subject: [PATCH 031/117] enhance chdef testcase for postscripts --- xCAT-test/autotest/testcase/chdef/cases0 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xCAT-test/autotest/testcase/chdef/cases0 b/xCAT-test/autotest/testcase/chdef/cases0 index 8b4e6d4ee..c301f2ff4 100644 --- a/xCAT-test/autotest/testcase/chdef/cases0 +++ b/xCAT-test/autotest/testcase/chdef/cases0 @@ -18,6 +18,16 @@ check:rc==0 cmd:lsdef -t node -l testnode check:rc==0 check:output=~groups=linux +cmd:chdef -t node -o testnode postscripts="syslog,remoteshell,syncfiles" +check:rc==0 +check:output!~Error +check:output=~Warning: testnode: postscripts 'syslog' is already included +check:output=~Warning: testnode: postscripts 'remoteshell' is already included +check:output=~Warning: testnode: postscripts 'syncfiles' is already included +cmd:chdef -t node -o testnode postbootscripts=otherpkgs +check:rc==0 +check:output!~Error +check:output=~Warning: testnode: postbootscripts 'otherpkgs' is already included cmd:rmdef -t node testnode check:rc==0 end From c837babad678125a4d82b4b3afc638129d5679cf Mon Sep 17 00:00:00 2001 From: cxhong Date: Wed, 2 May 2018 20:27:40 -0400 Subject: [PATCH 032/117] Support copycds command to create cumulus osimage (#5122) * Support copycds command to create cumulus osimage * Add Error handler * fix a typo * Add VERBOSE * Modify a error message * modify per yangSong's comment * Add '-i' and '-o' flag * remove nooverwrite when checking pkgdir --- xCAT-server/lib/xcat/plugins/copycds.pm | 27 +++ xCAT-server/lib/xcat/plugins/onie.pm | 301 ++++++++++++++++++++++++ 2 files changed, 328 insertions(+) create mode 100644 xCAT-server/lib/xcat/plugins/onie.pm diff --git a/xCAT-server/lib/xcat/plugins/copycds.pm b/xCAT-server/lib/xcat/plugins/copycds.pm index 90a20c151..191334786 100644 --- a/xCAT-server/lib/xcat/plugins/copycds.pm +++ b/xCAT-server/lib/xcat/plugins/copycds.pm @@ -14,6 +14,7 @@ use Cwd; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); +my $xcatdebugmode = 0; my $processed = 0; my $callback; @@ -75,6 +76,9 @@ sub process_request { $callback->({ error => "copycds needs at least one full path to ISO currently.", errorcode => [1] }); return; } + + if ($::XCATSITEVALS{xcatdebugmode}) { $xcatdebugmode = $::XCATSITEVALS{xcatdebugmode} } + my $file; foreach (@args) { $identified = 0; @@ -111,6 +115,29 @@ sub process_request { return; } + if (grep /$file: data/, @filestat) { + if ($xcatdebugmode) { + $callback->({ info => "run copydata for data file = $file" }); + } + my $newreq = dclone($request); + $newreq->{command} = ['copydata']; #Note the singular, it's different + $newreq->{arg} = [ "-f", $file ]; + if ($inspection) + { + push @{ $newreq->{arg} }, ("-i"); + } + if ($nonoverwrite) + { + push @{ $newreq->{arg} }, ("-w"); + } + if ($noosimage) + { + push @{ $newreq->{arg} }, ("-o"); + } + + $doreq->($newreq, $callback); + return; + } } my $mntopts = "-t udf,iso9660"; #Prefer udf formate to iso when media supports both, like MS media diff --git a/xCAT-server/lib/xcat/plugins/onie.pm b/xCAT-server/lib/xcat/plugins/onie.pm new file mode 100644 index 000000000..833f7e5f0 --- /dev/null +++ b/xCAT-server/lib/xcat/plugins/onie.pm @@ -0,0 +1,301 @@ +#!/usr/bin/env perl +## IBM(c) 20013 EPL license http://www.eclipse.org/legal/epl-v10.html +# +# This plugin is used to handle the command requests for cumulus OS support +# + + +package xCAT_plugin::onie; + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + +use strict; +use Getopt::Long; +use File::Path; +use File::Basename; + +use xCAT::Utils; +use xCAT::MsgUtils; +use xCAT::TableUtils; +use xCAT::SvrUtils; +use xCAT::Table; + +my $xcatdebugmode = 0; +$::VERBOSE = 0; + +sub handled_commands { + return { + nodeset => 'nodehm:mgt=switch', + copydata => 'onie', + } +} + +my $CALLBACK; # used to hanel the output from xdsh + +sub preprocess_request { + my $request = shift; + my $callback = shift; + + if ($request->{command}->[0] eq 'copydata') + { + return [$request]; + } + + # if already preprocessed, go straight to request + if ((defined($request->{_xcatpreprocessed}->[0])) + && ($request->{_xcatpreprocessed}->[0] == 1)) { + return [$request]; + } + + my $nodes = $request->{node}; + my $command = $request->{command}->[0]; + my $extraargs = $request->{arg}; + + if ($extraargs) { + @ARGV = @{$extraargs}; + my ($verbose, $help, $ver); + GetOptions("V" => \$verbose, 'h|help' => \$help, 'v|version' => \$ver); + if ($help) { + my $usage_string = xCAT::Usage->getUsage($command); + my $rsp; + push @{ $rsp->{data} }, $usage_string; + xCAT::MsgUtils->message("I", $rsp, $callback); + return (); + } + if ($ver) { + my $ver_string = xCAT::Usage->getVersion($command); + my $rsp; + push @{ $rsp->{data} }, $ver_string; + xCAT::MsgUtils->message("I", $rsp, $callback); + return (); + } + + if ($verbose) { + $::VERBOSE = 1; + } + } + + return [$request]; +} + +sub process_request { + my $request = shift; + my $callback = shift; + my $subreq = shift; + + my $nodes = $request->{node}; + my $command = $request->{command}->[0]; + my $args = $request->{arg}; + + my %hosts; + + if ($::XCATSITEVALS{xcatdebugmode} != 0) { $::VERBOSE = 1} + + if ($command eq "copydata") { + copydata($request, $callback); + } elsif ($command eq "nodeset") { + nodeset($request, $callback, $subreq, \%hosts); + } + +} + +# build cumulus OS image +sub copydata { + my $request = shift; + my $callback = shift; + my $file; + my $inspection = undef; + my $noosimage = undef; + my $nooverwrite = undef; + + # get arguments + my $args = $request->{arg}; + if ($args) { + @ARGV = @{$args}; + GetOptions( + 'w' => \$nooverwrite, + 'o' => \$noosimage, + 'i' => \$inspection, + 'f=s' => \$file + ); + } + + if (!(-x $file)) { + xCAT::MsgUtils->message("E", { error => ["$file is not executable, will not process"], errorcode => ["1"] }, $callback); + return; + } + + #get install dir + my $installroot = "/install"; + my $sitetab = xCAT::Table->new('site'); + my @ents = xCAT::TableUtils->get_site_attribute("installdir"); + my $site_ent = $ents[0]; + if (defined($site_ent)) + { + $installroot = $site_ent; + } + + my $arch; + my $desc; + my $release; + my $osname; + my $filename = basename($file); + my $output = `$file`; + if ($inspection) { + $callback->({ data => "file output: $output" }); + return; + } + foreach my $line (split /[\r\n]+/, $output) { + if ($line =~ /^Architecture/) { + ($desc, $arch) = split /: /, $line ; + chomp $arch; + } + if ($line =~ /^Release/) { + ($desc, $release) = split /: /, $line ; + chomp $release; + } + if ($line =~ /cumulus/) { + $osname = "cumulus" ; + } + } + unless ($osname) { + $osname="image"; + } + + my $distname = $osname . $release; + my $imagename = $distname . "-" . $arch; + my $defaultpath = "$installroot/$distname/$arch"; + + #check if file exists + if ( (-e "$defaultpath/$filename") && ($nooverwrite)){ + $callback->({ data => "$defaultpath/$filename is already exists, will not overwrite" }); + } else { + $callback->({ data => "Copying media to $defaultpath" }); + mkpath ("$defaultpath"); + system("cp $file $defaultpath"); + $callback->({ data => "Media copy operation successful" }); + } + + if ($noosimage) { + $callback->({ data => "Option noosimage is specified, will not create osimage definition" }); + return; + } + + # generate the image objects + my $oitab = xCAT::Table->new('osimage'); + unless ($oitab) { + xCAT::MsgUtils->message("E", { error => ["Error: Cannot open table osimage."], errorcode => ["1"] }, $callback); + return 1; + } + my $litab = xCAT::Table->new('linuximage'); + unless ($litab) { + xCAT::MsgUtils->message("E", { error => ["Error: Cannot open table linuximage."], errorcode => ["1"] }, $callback); + return 1; + } + my $pkgdir = "$defaultpath/$filename"; + my $imgdir = $litab->getAttribs({ 'imagename' => $imagename }, 'pkgdir'); + + if ($::VERBOSE) { + $callback->({ data => "creating image $imagename with osarch=$arch, osvers=$distname" }); + } + + my %values; + $values{'imagetype'} = "linux"; + $values{'provmethod'} = "install"; + $values{'description'} = "Cumulus Linux"; + $values{'osname'} = "$osname"; + $values{'osvers'} = "$distname"; + $values{'osarch'} = "$arch"; + + $oitab->setAttribs({ 'imagename' => $imagename }, \%values); + + # set a default package list + $litab->setAttribs({ 'imagename' => $imagename }, { 'pkgdir' => $pkgdir }); + if ($::VERBOSE) { + $callback->({ data => "setting pkgdir=$pkgdir for image $imagename" }); + } + + #Need to update osdistro table? + my @ret = xCAT::SvrUtils->update_osdistro_table($distname, $arch, $defaultpath, $imagename); + if ($ret[0] != 0) { + xCAT::MsgUtils->message("E", { error => ["Error when updating the osdistro tables."], errorcode => ["1"] }, $callback); + } + + xCAT::MsgUtils->message("I", { data => ["The image $imagename is created."] }, $callback); +} + + +# run the nodeset to updatenode provmethod +sub nodeset { + my $request = shift; + my $callback = shift; + my $subreq = shift; + + my $switches = $request->{'node'}; + my $args = $request->{arg}; + my $provmethod; + my $image_pkgdir; + + my $setosimg; + foreach (@$args) { + if (/osimage=(.*)/) { + $setosimg = $1; + } + } + + my $switchestab = xCAT::Table->new('switches'); + my $switcheshash = $switchestab->getNodesAttribs($switches, ['switchtype']); + + my $nodetab = xCAT::Table->new('nodetype'); + my $nodehash = $nodetab->getNodesAttribs($switches, [ 'provmethod' ]); + + foreach my $switch (@$switches) { + if ($switcheshash->{$switch}->[0]->{switchtype} ne "onie") { + xCAT::MsgUtils->message("E", { error => ["nodeset command is not processed for $switch, only supports switchtype=onie"], errorcode => ["1"] }, $callback); + next; + } + if ($setosimg) { + $provmethod = $setosimg; + $nodetab->setAttribs({ 'node' => $switch }, {'provmethod' => $setosimg}); + } else { + $provmethod = $nodehash->{$switch}->[0]->{provmethod}; + } + if ($::VERBOSE) { + xCAT::MsgUtils->message("I", { data => ["$switch has provmethod=$provmethod"] }, $callback); + } + #get pkgdir from osimage + my $linuximagetab = xCAT::Table->new('linuximage'); + my $imagetab = $linuximagetab->getAttribs({ imagename => $provmethod }, 'pkgdir'); + $image_pkgdir = $imagetab->{'pkgdir'}; + + #validate the image pkgdir + my $flag=0; + if (-r $image_pkgdir) { + my @filestat = `file $image_pkgdir`; + if (grep /$image_pkgdir: data/, @filestat) { + $flag=1; + } + } + unless ($flag) { + xCAT::MsgUtils->message("E", { error => ["The image '$image_pkgdir' is invalid"], errorcode => ["1"] }, $callback); + next; + } + if ($::VERBOSE) { + xCAT::MsgUtils->message("I", { data => ["osimage=$provmethod, pkgdir=$image_pkgdir"] }, $callback); + } + + #updateing DHCP entries + my $ret = xCAT::Utils->runxcmd({ command => ["makedhcp"], node => [$switch] }, $subreq, 0, 1); + if ($::RUNCMD_RC) { + xCAT::MsgUtils->message("E", { error => ["Failed to run 'makedhcp' command"], errorcode => ["$::RUNCMD_RC"] }, $callback); + } + + xCAT::MsgUtils->message("I", { data => ["$switch: install $provmethod"] }, $callback); + } + return; +} +1; From 7bbf1cacecce02eea18db02168cab97f6cdfbea1 Mon Sep 17 00:00:00 2001 From: cxhong Date: Wed, 2 May 2018 22:47:17 -0400 Subject: [PATCH 033/117] Support nodeset osimage command for cumulus switch (#5144) * Support nodeset osimage command for cumulus switch * Add logical checking for provemethod and pkgdir * fix conflict --- xCAT-server/lib/xcat/plugins/dhcp.pm | 26 +++++++++++++++++++++++++- xCAT-server/lib/xcat/plugins/onie.pm | 4 +--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 0eb224ba7..1ca4bd68a 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -693,7 +693,31 @@ sub addnode } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'petitboot') { $lstatements = 'option conf-file \"http://' . $nxtsrv . '/tftpboot/petitboot/' . $node . '\";' . $lstatements; } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'onie') { - $lstatements = 'if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { option www-server = \"http://' . $nxtsrv . $ntent->{provmethod} . '\";}' . $lstatements; + my $provmethod = $ntent->{provmethod}; + if ($provmethod) { + my $linuximagetab = xCAT::Table->new('linuximage'); + my $imagetab = $linuximagetab->getAttribs({ imagename => $provmethod }, 'pkgdir'); + if ($imagetab) { + my $image_pkgdir = $imagetab->{'pkgdir'}; + my @pkgdirs = split(/,/,$image_pkgdir); + my $validpkgdir; + foreach my $mypkgdir (@pkgdirs){ + if (-f $mypkgdir) { + $lstatements = 'if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { option www-server = \"http://' . $nxtsrv . $mypkgdir . '\";}' . $lstatements; + $validpkgdir = 1; + last; + } + } + unless ($validpkgdir) { + $callback->({ warning => ["osimage $provmethod pkgdir doesn't exists"]}); + } + } else { + $callback->({ warning => ["osimage $provmethod is not defined in the osimage table"]}); + } + } else { + $callback->({ warning => ["provmethod is not defined for $node"]}); + } + } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'nimol') { $lstatements = 'supersede server.filename=\"/vios/nodes/' . $node . '\";' . $lstatements; } diff --git a/xCAT-server/lib/xcat/plugins/onie.pm b/xCAT-server/lib/xcat/plugins/onie.pm index 833f7e5f0..b26214ec8 100644 --- a/xCAT-server/lib/xcat/plugins/onie.pm +++ b/xCAT-server/lib/xcat/plugins/onie.pm @@ -91,14 +91,12 @@ sub process_request { my $command = $request->{command}->[0]; my $args = $request->{arg}; - my %hosts; - if ($::XCATSITEVALS{xcatdebugmode} != 0) { $::VERBOSE = 1} if ($command eq "copydata") { copydata($request, $callback); } elsif ($command eq "nodeset") { - nodeset($request, $callback, $subreq, \%hosts); + nodeset($request, $callback, $subreq); } } From ef432cd610d708cdb2aa64b609d12db1c4826295 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 2 May 2018 23:08:18 -0400 Subject: [PATCH 034/117] add a case for issue 4770 Should --delete option be used for the firmware in active(*) state --- xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 index a0f2d8fd0..f562c43e1 100644 --- a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 +++ b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 @@ -479,3 +479,15 @@ check:output =~ image_id.+--delete check:rc == 0 end +start:rflash_delete_no_active +description:this case is to check if --delete is not allowed to be used for the active state firmware. This case is for issue 4770. +os:Linux +hcp:openbmc +cmd:activenum=`rflash $$CN -l |grep -w "Host\s*Active(\*)" |awk '{print $2}'`;rflash $$CN $activenum --delete +check:rc != 0 +check:output =~$$CN\s*:\s*Error: Deleting currently active firmware on powered on host is not supported +cmd:activenum=`rflash $$CN -l |grep -w "BMC\s*Active(\*)" |awk '{print $2}'`;rflash $$CN $activenum --delete +check:rc != 0 +check:output =~~$$CN\s*:\s*Error: Deleting currently active BMC firmware is not supported +end + From 9874c11063d153a79da890f93ff18144238e7958 Mon Sep 17 00:00:00 2001 From: yangsong Date: Thu, 3 May 2018 17:03:54 +0800 Subject: [PATCH 035/117] check the existance of osimage; set os and arch of node to be the relevant attribute in osimage during nodeset (#5162) --- xCAT-server/lib/xcat/plugins/onie.pm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/onie.pm b/xCAT-server/lib/xcat/plugins/onie.pm index b26214ec8..01ed8edd5 100644 --- a/xCAT-server/lib/xcat/plugins/onie.pm +++ b/xCAT-server/lib/xcat/plugins/onie.pm @@ -23,7 +23,6 @@ use xCAT::MsgUtils; use xCAT::TableUtils; use xCAT::SvrUtils; use xCAT::Table; - my $xcatdebugmode = 0; $::VERBOSE = 0; @@ -256,18 +255,30 @@ sub nodeset { xCAT::MsgUtils->message("E", { error => ["nodeset command is not processed for $switch, only supports switchtype=onie"], errorcode => ["1"] }, $callback); next; } + + if ($setosimg) { $provmethod = $setosimg; - $nodetab->setAttribs({ 'node' => $switch }, {'provmethod' => $setosimg}); } else { $provmethod = $nodehash->{$switch}->[0]->{provmethod}; } if ($::VERBOSE) { xCAT::MsgUtils->message("I", { data => ["$switch has provmethod=$provmethod"] }, $callback); } + #get pkgdir from osimage my $linuximagetab = xCAT::Table->new('linuximage'); - my $imagetab = $linuximagetab->getAttribs({ imagename => $provmethod }, 'pkgdir'); + my $osimagetab = xCAT::Table->new('osimage'); + my $imagetab = $linuximagetab->getAttribs({ imagename => $provmethod },'pkgdir'); + my $osimghash = $osimagetab->getAttribs({ imagename => $provmethod },'osvers','osarch'); + unless($imagetab and $osimghash){ + xCAT::MsgUtils->message("E", { error => ["cannot find osimage \"$provmethod\" for $switch, please make sure the osimage specified in command line or node.provmethod exists!"], errorcode => ["1"] }, $callback); + next; + } + + + my %attribs=('provmethod' => $provmethod,'os'=>$osimghash->{'osvers'},'arch'=>$osimghash->{'osarch'} ); + $nodetab->setAttribs({ 'node' => $switch }, \%attribs); $image_pkgdir = $imagetab->{'pkgdir'}; #validate the image pkgdir From 75cdcd7b4a997d901322b26aab7e3068a11516e8 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 3 May 2018 07:11:44 -0400 Subject: [PATCH 036/117] fix typo of test case export_import_single_ppc_by_json --- xCAT-test/autotest/testcase/xcat-inventory/cases.node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.node b/xCAT-test/autotest/testcase/xcat-inventory/cases.node index 7489a031a..8c4455008 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.node +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.node @@ -1,4 +1,4 @@ -star:texport_import_single_ppc_by_json +start:export_import_single_ppc_by_json description:This case is used to test xcat-inventory export and import one ppc definition by json between 2 exact same MNs. This case can cover hmc,lpar. Before running this case, make sure these two MNs have been installed same exactly, and the current MN can connect the other MN by ssh without password. This case also can be run in one MN, this is, export from currnet node then import back to currnet node, in this case, just need to set $$DSTMN= Attribute: $$DSTMN - the ip of MN which is used to run import operation. cmd:mkdir -p /tmp/export_import_single_ppc_by_json From f4f173f9ab3063d812257f54b84040a537b4db0c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 3 May 2018 11:10:01 -0400 Subject: [PATCH 037/117] TravisCI wording and JSON format check --- travis.pl | 99 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 43 deletions(-) diff --git a/travis.pl b/travis.pl index 6fb7708f4..d27e92fc2 100644 --- a/travis.pl +++ b/travis.pl @@ -27,8 +27,8 @@ my $last_func_start = timelocal(localtime()); #-------------------------------------------------------- # Fuction name: runcmd # Description: run a command after 'cmd' label in one case -# Atrributes: -# Retrun code: +# Attributes: +# Return code: # $::RUNCMD_RC : the return code of command # @$outref : the output of command #-------------------------------------------------------- @@ -53,12 +53,12 @@ sub runcmd #-------------------------------------------------------- # Fuction name: get_files_recursive # Description: Search all file in one directory recursively -# Atrributes: +# Attributes: # $dir (input attribute) # The target scan directory # $files_path_ref (output attribute) # the reference of array where save all vaild files under $dir -# Retrun code: +# Return code: #-------------------------------------------------------- sub get_files_recursive { @@ -91,13 +91,17 @@ sub get_files_recursive #-------------------------------------------------------- # Fuction name: check_pr_format # Description: -# Atrributes: -# Retrun code: +# Attributes: +# Return code: #-------------------------------------------------------- sub check_pr_format{ if($ENV{'TRAVIS_EVENT_TYPE'} eq "pull_request"){ my $pr_url = "https://api.github.com/repos/$ENV{'TRAVIS_REPO_SLUG'}/pulls/$ENV{'TRAVIS_PULL_REQUEST'}"; my $pr_url_resp = get($pr_url); + unless ($pr_url_resp) { + print "[check_pr_format] Not able to get response from $pr_url \n"; + return 1; + } my $pr_content = decode_json($pr_url_resp); my $pr_title = $pr_content->{title}; my $pr_body = $pr_content->{body}; @@ -111,18 +115,18 @@ sub check_pr_format{ my $checkrst=""; if(! $pr_title){ - $checkrst.="Miss title."; + $checkrst.="Missing title."; } if(! $pr_body){ - $checkrst.="Miss description."; + $checkrst.="Missing description."; } if(! $pr_milestone){ - $checkrst.="Miss milestone."; + $checkrst.="Missing milestone."; } if(! $pr_labels_len){ - $checkrst.="Miss labels."; + $checkrst.="Missing labels."; } if(length($checkrst) == 0){ @@ -143,10 +147,10 @@ sub check_pr_format{ } #-------------------------------------------------------- -# Fuction name: check_pr_format +# Fuction name: send_back_comment # Description: -# Atrributes: -# Retrun code: +# Attributes: +# Return code: #-------------------------------------------------------- sub send_back_comment{ my $message = shift; @@ -154,8 +158,17 @@ sub send_back_comment{ my $comment_url = "https://api.github.com/repos/$ENV{'TRAVIS_REPO_SLUG'}/issues/$ENV{'TRAVIS_PULL_REQUEST'}/comments"; my $comment_url_resp = get($comment_url); my $json = new JSON; - my $comment_content = $json->decode($comment_url_resp); - my $comment_len = @$comment_content; + my $comment_len = 0; + my $comment_content; + if ($comment_url_resp) { + print "\n\n>>>>>Dumper comment_url_resp:\n"; + print Dumper $comment_url_resp; + + $comment_content = $json->decode($comment_url_resp); + $comment_len = @$comment_content; + } else { + print "[send_back_comment] Not able to get response from $comment_url \n"; + } #print "\n\n>>>>>Dumper comment_content: $comment_len\n"; #print Dumper $comment_content; @@ -178,15 +191,15 @@ sub send_back_comment{ #-------------------------------------------------------- # Fuction name: build_xcat_core # Description: -# Atrributes: -# Retrun code: +# Attributes: +# Return code: #-------------------------------------------------------- sub build_xcat_core{ my @output; my @cmds = ("gpg --list-keys", "sed -i '/SignWith: yes/d' $ENV{'PWD'}/build-ubunturepo"); foreach my $cmd (@cmds){ - print "[build_xcat_core] to run $cmd\n"; + print "[build_xcat_core] running $cmd\n"; @output = runcmd("$cmd"); if($::RUNCMD_RC){ print "[build_xcat_core] $cmd ....[Failed]\n"; @@ -226,8 +239,8 @@ sub build_xcat_core{ #-------------------------------------------------------- # Fuction name: install_xcat # Description: -# Atrributes: -# Retrun code: +# Attributes: +# Return code: #-------------------------------------------------------- sub install_xcat{ @@ -239,7 +252,7 @@ sub install_xcat{ "sudo apt-get -qq update"); my @output; foreach my $cmd (@cmds){ - print "[install_xcat] to run $cmd\n"; + print "[install_xcat] running $cmd\n"; @output = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[install_xcat] $cmd. ...[Failed]\n"; @@ -267,7 +280,7 @@ sub install_xcat{ }else{ print "[install_xcat] $cmd ....[Pass]\n"; - print "\n------To config xcat and check if xcat work correctly-----\n"; + print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f travis", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=travis policy.rule=allow", ". /etc/profile.d/xcat.sh && tabdump policy", @@ -277,7 +290,7 @@ sub install_xcat{ "service xcatd status"); my $ret = 0; foreach my $cmd (@cmds){ - print "\n[install_xcat] To run $cmd.....\n"; + print "\n[install_xcat] running $cmd.....\n"; @output = runcmd("$cmd"); print Dumper \@output; if($::RUNCMD_RC){ @@ -303,8 +316,8 @@ sub install_xcat{ #-------------------------------------------------------- # Fuction name: check_syntax # Description: -# Atrributes: -# Retrun code: +# Attributes: +# Return code: #-------------------------------------------------------- sub check_syntax{ my @output; @@ -356,8 +369,8 @@ sub check_syntax{ #-------------------------------------------------------- # Fuction name: run_fast_regression_test # Description: -# Atrributes: -# Retrun code: +# Attributes: +# Return code: #-------------------------------------------------------- sub run_fast_regression_test{ my $cmd = "sudo apt-get install xcat-test --force-yes"; @@ -428,11 +441,11 @@ sub run_fast_regression_test{ if($failnum){ my $log_str = join (",", @failcase ); - $check_result_str .= "> **FAST REGRESSION TEST Failed**: Totalcase $casenum Pass $passnum failed $failnum FailedCases: $log_str. Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + $check_result_str .= "> **FAST REGRESSION TEST Failed**: Totalcase $casenum Passed $passnum Failed $failnum FailedCases: $log_str. Please click ``Details`` label in ``Merge pull request`` box for detailed information"; send_back_comment("$check_result_str"); return 1; }else{ - $check_result_str .= "> **FAST REGRESSION TEST Successful**: Totalcase $casenum Pass $passnum failed $failnum"; + $check_result_str .= "> **FAST REGRESSION TEST Successful**: Totalcase $casenum Passed $passnum Failed $failnum"; send_back_comment("$check_result_str"); } @@ -440,10 +453,10 @@ sub run_fast_regression_test{ } #-------------------------------------------------------- -# Fuction name: run_fast_regression_test +# Fuction name: mark_time # Description: -# Atrributes: -# Retrun code: +# Attributes: +# Return code: #-------------------------------------------------------- sub mark_time{ my $func_name=shift; @@ -457,7 +470,7 @@ sub mark_time{ #===============Main Process============================= #Dumper Travis Environment Attribute -print GREEN "\n------Dumper Travis Environment Attribute------\n"; +print GREEN "\n------ Travis Environment Attributes ------\n"; my @travis_env_attr = ("TRAVIS_REPO_SLUG", "TRAVIS_BRANCH", "TRAVIS_EVENT_TYPE", @@ -492,47 +505,47 @@ print Dumper \@disk; #Start to check the format of pull request $last_func_start = timelocal(localtime()); -print GREEN "\n------To Check Pull Request Format------\n"; +print GREEN "\n------ Checking Pull Request Format ------\n"; $rst = check_pr_format(); if($rst){ - print RED "Check pull request format failed\n"; + print RED "Check of pull request format failed\n"; exit $rst; } mark_time("check_pr_format"); #Start to build xcat core -print GREEN "\n------To Build xCAT core package------\n"; +print GREEN "\n------ Building xCAT core package ------\n"; $rst = build_xcat_core(); if($rst){ - print RED "Build xCAT core package failed\n"; + print RED "Build of xCAT core package failed\n"; exit $rst; } mark_time("build_xcat_core"); #Start to install xcat -print GREEN "\n------To install xcat------\n"; +print GREEN "\n------Installing xCAT ------\n"; $rst = install_xcat(); if($rst){ - print RED "Install xcat failed\n"; + print RED "Install of xCAT failed\n"; exit $rst; } mark_time("install_xcat"); #Check the syntax of changing code -print GREEN "\n------To check the syntax of changing code------\n"; +print GREEN "\n------ Checking the syntax of changed code------\n"; $rst = check_syntax(); if($rst){ - print RED "check the syntax of changing code failed\n"; + print RED "Check syntax of changed code failed\n"; exit $rst; } mark_time("check_syntax"); #run fast regression -print GREEN "\n------To run fast regression test------\n"; +print GREEN "\n------Running fast regression test ------\n"; $rst = run_fast_regression_test(); if($rst){ - print RED "Run fast regression test failed\n"; + print RED "Run of fast regression test failed\n"; exit $rst; } mark_time("run_fast_regression_test"); From c07cfc535439134a5e79cc0ff60a8d1c286a1009 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 3 May 2018 22:42:40 -0400 Subject: [PATCH 038/117] update to remove comment line --- xCAT-test/autotest/testcase/rspconfig/cases1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases1 b/xCAT-test/autotest/testcase/rspconfig/cases1 index 15aa23813..a71397392 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases1 +++ b/xCAT-test/autotest/testcase/rspconfig/cases1 @@ -139,8 +139,7 @@ check:output =~$$CN:\s*Dump requested check:output =~$$CN:\s*Downloading dump cmd:rspconfig $$CN dump -l |tail -n 1 |tee /tmp/dumpgenerate check:rc == 0 -#cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`cat /tmp/dumpgenerate |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize -cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`rspconfig $$CN dump -l |grep "\[$dumpnumber\] Generated" |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize +cmd:dumpnumber=`sed -r 's/.+\[(.+)\].+/\1/g' /tmp/dumpgenerate`;dumpsize=`grep "\[$dumpnumber\] Generated" /tmp/dumpgenerate |cut -d : -f 6`;ls -l /var/log/xcat/dump/*_$$CN_dump_$dumpnumber.tar.xz|grep $dumpsize check:rc == 0 cmd:rm -rf /tmp/dumpgenerate end From a9825f32605725269e21ab5f5e75facd5ffdef7f Mon Sep 17 00:00:00 2001 From: xuweibj Date: Fri, 4 May 2018 15:43:51 +0800 Subject: [PATCH 039/117] Add some logs for bmcdiscover (#5163) * Add some logs for bmcdiscover --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 26 +++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index e9af91e8d..2d840dc70 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -34,6 +34,7 @@ use HTTP::Cookies; use HTTP::Response; use JSON; +my $log_label = "bmcdiscover:"; my $nmap_path; my %ipmac = (); @@ -595,6 +596,7 @@ sub scan_process { $bcmd = join(" ", $nmap_path, " -sn -n $range"); } + xCAT::MsgUtils->trace(0, "I", "$log_label Try to scan live IPs by command $bcmd ..."); $ip_info_list = xCAT::Utils->runcmd("$bcmd", -1); if ($::RUNCMD_RC != 0) { my $rsp = {}; @@ -617,7 +619,7 @@ sub scan_process { my $live_mac = split_comma_delim_str($mac_list); my %pipe_map; if (scalar(@{$live_ip}) > 0) { - + xCAT::MsgUtils->trace(0, "I", "$log_label Scaned live IPs " . scalar(@{$live_ip}) . " with mac " . scalar(@{$live_mac})); foreach (@{$live_ip}) { my $new_mac = lc(shift @{$live_mac}); $new_mac =~ s/\://g; @@ -696,7 +698,11 @@ sub scan_process { my $is_openbmc = 0; foreach my $mc_cmd (@mc_cmds) { $mc_info = xCAT::Utils->runcmd($mc_cmd, -1); + if ($::RUNCMD_RC != 0) { + next; + } if ($mc_info =~ /Manufacturer ID\s*:\s*(\d+)\s*Manufacturer Name.+\s*Product ID\s*:\s*(\d+)/) { + xCAT::MsgUtils->trace(0, "D", "$log_label Found ${$live_ip}[$i] Manufacturer ID: $1 Product ID: $2"); if ($1 eq $::P9_WITHERSPOON_MFG_ID and $2 eq $::P9_WITHERSPOON_PRODUCT_ID) { bmcdiscovery_openbmc(${$live_ip}[$i], $opz, $opw, $request_command,$parent_fd); $is_openbmc = 1; @@ -1044,6 +1050,9 @@ sub bmcdiscovery_ipmi { $bmcpassword = "-P $bmc_pass"; } + my $log_info = "$ip: Detected ipmi, attempting to obtain system information..."; + xCAT::MsgUtils->trace(0, "D", "$log_label $log_info"); + my $mtms_node = ""; my $mac_node = ""; @@ -1160,7 +1169,10 @@ sub bmcdiscovery_openbmc{ my $mac_node = ""; store_fd({data=>1}, $fd); - print "$ip: Detected openbmc, attempting to obtain system information...\n"; + my $log_info = "$ip: Detected openbmc, attempting to obtain system information..."; + print "$log_info\n"; + xCAT::MsgUtils->trace(0, "D", "$log_label $log_info"); + my $http_protocol="https"; my $openbmc_project_url = "xyz/openbmc_project"; my $login_endpoint = "login"; @@ -1244,8 +1256,14 @@ sub bmcdiscovery_openbmc{ } $node_data .= ",$::opt_SN,$::opt_SN"; } else { - if ($login_response->status_line =~ /401 Unauthorized/) { - xCAT::MsgUtils->message("W", { data => ["Invalid username or password for $ip"] }, $::CALLBACK); + my $login_status; + eval { $login_status = $login_response->status_line }; + if ($@) { + xCAT::MsgUtils->message("W", { data => ["Login failed for $ip and no status received from response"] }, $::CALLBACK); + return; + } + if ($login_status =~ /401 Unauthorized/) { + xCAT::MsgUtils->message("W", { data => ["Invalid username or password for $ip"] }, $::CALLBACK); } else { xCAT::MsgUtils->message("W", { data => ["Received response " . $login_response->status_line . " for $ip"] }, $::CALLBACK); } From a38ffa18f71e48d0e42c63c8f2af20002e69c9a0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 4 May 2018 11:21:20 -0400 Subject: [PATCH 040/117] Auditlog table doc improvement --- .../admin-guides/references/man5/auditlog.5.rst | 4 ++-- .../guides/admin-guides/references/man5/site.5.rst | 5 ++--- .../admin-guides/references/man7/auditlog.7.rst | 4 ++-- perl-xCAT/xCAT/Schema.pm | 12 ++++++------ 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man5/auditlog.5.rst b/docs/source/guides/admin-guides/references/man5/auditlog.5.rst index d177660f8..a89b681aa 100644 --- a/docs/source/guides/admin-guides/references/man5/auditlog.5.rst +++ b/docs/source/guides/admin-guides/references/man5/auditlog.5.rst @@ -62,13 +62,13 @@ auditlog Attributes: \ **clienttype**\ - Type of command: cli,java,webui,other. + Type of command: cli, java, webui, other. \ **command**\ - Command executed. + Command executed. See auditskipcmds site table attribute to control which commands get logged. diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index ed5180374..b43e6a12f 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -60,7 +60,7 @@ site Attributes: DATABASE ATTRIBUTES ----------------- auditnosyslog: If set to 1, then commands will only be written to the auditlog table. - This attribute set to 1 and auditskipcmds=ALL means no logging of commands. + If this attribute is set to 1 and auditskipcmds=ALL means no logging of commands. Default is to write to both the auditlog table and syslog. auditskipcmds: List of commands and/or client types that will not be written to the auditlog table and syslog. See auditnosyslog. @@ -68,8 +68,7 @@ site Attributes: commands will be written. clienttype:web would skip all commands from the web client For example: tabdump,nodels,clienttype:web - will not log tabdump,nodels and any web client commands. - + will not log tabdump, nodels or any web client commands. databaseloc: Directory where we create the db instance directory. Default is /var/lib. Only DB2 is currently supported. Do not use the directory in the site.installloc or diff --git a/docs/source/guides/admin-guides/references/man7/auditlog.7.rst b/docs/source/guides/admin-guides/references/man7/auditlog.7.rst index 16d26347f..e6e270384 100644 --- a/docs/source/guides/admin-guides/references/man7/auditlog.7.rst +++ b/docs/source/guides/admin-guides/references/man7/auditlog.7.rst @@ -59,13 +59,13 @@ auditlog Attributes: \ **clienttype**\ (auditlog.clienttype) - Type of command: cli,java,webui,other. + Type of command: cli, java, webui, other. \ **command**\ (auditlog.command) - Command executed. + Command executed. See auditskipcmds site table attribute to control which commands get logged. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index e16dba65b..3c1fe110f 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -998,15 +998,15 @@ passed as argument rather than by table value', "DATABASE ATTRIBUTES\n" . " -----------------\n" . " auditnosyslog: If set to 1, then commands will only be written to the auditlog table.\n" . -" This attribute set to 1 and auditskipcmds=ALL means no logging of commands.\n" . +" If this attribute is set to 1 and auditskipcmds=ALL means no logging of commands.\n" . " Default is to write to both the auditlog table and syslog.\n" . " auditskipcmds: List of commands and/or client types that will not be\n" . " written to the auditlog table and syslog. See auditnosyslog.\n" . " 'ALL' means all cmds will be skipped. If attribute is null, all\n" . - " commands will be written.\n" . +" commands will be written.\n" . " clienttype:web would skip all commands from the web client\n" . - " For example: tabdump,nodels,clienttype:web \n" . -" will not log tabdump,nodels and any web client commands.\n\n" . +" For example: tabdump,nodels,clienttype:web \n" . +" will not log tabdump, nodels or any web client commands.\n" . " databaseloc: Directory where we create the db instance directory.\n" . " Default is /var/lib. Only DB2 is currently supported.\n" . " Do not use the directory in the site.installloc or\n" . @@ -1450,8 +1450,8 @@ passed as argument rather than by table value', audittime => 'The timestamp for the audit entry.', userid => 'The user running the command.', clientname => 'The client machine, where the command originated.', - clienttype => 'Type of command: cli,java,webui,other.', - command => 'Command executed.', + clienttype => 'Type of command: cli, java, webui, other.', + command => 'Command executed. See auditskipcmds site table attribute to control which commands get logged.', noderange => 'The noderange on which the command was run.', args => 'The command argument list.', status => 'Allowed or Denied.', From 8e5812227854c1bc4e8b65ccaeca6a0412d91012 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 7 May 2018 11:28:21 -0400 Subject: [PATCH 041/117] Add REST API beacon status function --- .../restapi_resource/restapi_reference.rst | 30 ++++++++++++++----- xCAT-server/xCAT-wsapi/xcatws.cgi | 19 +++++++----- .../autotest/testcase/restapi/node/cases1 | 24 +++++++++++++++ 3 files changed, 59 insertions(+), 14 deletions(-) diff --git a/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst b/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst index 15c5ca823..1d5c37fb5 100644 --- a/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst +++ b/docs/source/advanced/restapi/restapi_resource/restapi_reference.rst @@ -755,6 +755,29 @@ Delete all the event log for node1. :: [URI:/nodes/{noderange}/beacon] - The beacon resource for the node {noderange} ------------------------------------------------------------------------------ +GET - Get the beacon status for the node {noderange}. +````````````````````````````````````````````````````` + +Refer to the man page: :doc:`rbeacon ` + +**Returns:** + +* Json format: An object which includes multiple ' : {att:value, attr:value ...}' pairs. + +**Example:** + +Get beacon for node1. :: + + + curl -X GET -k 'https://127.0.0.1/xcatws/nodes/node1/beacon?userName=root&userPW=cluster&pretty=1' + { + "node1":{ + "beacon":[ + "Front:Blink Rear:Blink" + ] + } + } + PUT - Change the beacon status for the node {noderange}. ```````````````````````````````````````````````````````` @@ -774,13 +797,6 @@ Turn on the beacon. :: curl -X PUT -k 'https://127.0.0.1/xcatws/nodes/node1/beacon?userName=root&userPW=cluster&pretty=1' -H Content-Type:application/json --data '{"action":"on"}' - [ - { - "name":"node1", - "beacon":"on" - } - ] - [URI:/nodes/{noderange}/updating] - The updating resource for the node {noderange} ---------------------------------------------------------------------------------- diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 86bf86e9a..bc7250505 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -431,15 +431,18 @@ my %URIdef = ( beacon => { desc => "[URI:/nodes/{noderange}/beacon] - The beacon resource for the node {noderange}", matcher => '^/nodes/[^/]*/beacon$', - GET_backup => { + GET => { desc => "Get the beacon status for the node {noderange}.", + usage => "||$usagemsg{objreturn}|", + example => "|Get beacon for node1.|GET|/nodes/node1/beacon|{\n \"node1\":{\n \"beacon\":[\n \"Front:Blink Rear:Blink\"\n ]\n }\n}|", cmd => "rbeacon", - fhandler => \&common, + fhandler => \&actionhdl, + outhdler => \&actionout, }, PUT => { desc => "Change the beacon status for the node {noderange}.", usage => "|$usagemsg{objchparam} DataBody: {action:on/off/blink}.|$usagemsg{non_getreturn}|", - example => "|Turn on the beacon.|PUT|/nodes/node1/beacon {\"action\":\"on\"}|[\n {\n \"name\":\"node1\",\n \"beacon\":\"on\"\n }\n]|", + example => "|Turn on the beacon.|PUT|/nodes/node1/beacon {\"action\":\"on\"}||", cmd => "rbeacon", fhandler => \&actionhdl, outhdler => \&noout, @@ -1563,12 +1566,12 @@ if (defined($URIdef{$uriLayer1})) { } else { # not matches to any resource group. Check the 'resource group' to improve the performance - error("Unspported resource.", $STATUS_NOT_FOUND); + error("Unsupported resource.", $STATUS_NOT_FOUND); } # the URI cannot match to any resources which are defined in %URIdef unless ($handled) { - error("Unspported resource.", $STATUS_NOT_FOUND); + error("Unsupported resource.", $STATUS_NOT_FOUND); } @@ -1945,7 +1948,7 @@ sub actionout { foreach my $d (@$data) { if (defined($d->{info})) { # OpenBMC format - if ($param->{'resourcename'} eq "eventlog") { + if ($param->{'resourcename'} =~ /(^eventlog$|^beacon$)/) { my ($node, $logentry) = split(/:/, $d->{info}->[0], 2); $logentry =~ s/^\s+|\s+$//g; # trim whitespace from log entry push @{ $jsonnode->{$node}->{ $param->{'resourcename'} } }, $logentry; @@ -2213,7 +2216,9 @@ sub actionhdl { push @args, 'clear'; } } elsif ($params->{'resourcename'} eq "beacon") { - if (isPut()) { + if (isGET()) { + push @args, 'stat'; + } elsif (isPut()) { push @args, $paramhash->{'action'}; } } elsif ($params->{'resourcename'} eq "filesyncing") { diff --git a/xCAT-test/autotest/testcase/restapi/node/cases1 b/xCAT-test/autotest/testcase/restapi/node/cases1 index 0b03ce7b8..db848f1f2 100644 --- a/xCAT-test/autotest/testcase/restapi/node/cases1 +++ b/xCAT-test/autotest/testcase/restapi/node/cases1 @@ -45,3 +45,27 @@ cmd:restapitest -m GET -r /nodes/$$CN/eventlog -u $$username -p $$password check:rc==200 check:output=~eventlog end + +start:beacon_node_rest +description: get OpenBMC node beacon with REST API +hcp:openbmc +cmd:restapitest -m GET -r /nodes/$$CN/beacon -u $$username -p $$password +check:rc==200 +check:output=~Front +check:output=~Rear +end + +start:beacon_set_node_rest +description: set OpenBMC node beacon with REST API +hcp:openbmc +cmd:restapitest -m PUT -r /nodes/$$CN/beacon -d '{"action":"on"}' -u $$username -p $$password +check:rc==200 +end + +start:beacon_set_node_rest2 +description: set IPMI node beacon with REST API +hcp:ipmi +cmd:restapitest -m PUT -r /nodes/$$CN/beacon -d '{"action":"on"}' -u $$username -p $$password +check:rc==200 +end + From ecc403b13606e0134e85f6d3b39514f798cc1e3f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 7 May 2018 16:12:19 -0400 Subject: [PATCH 042/117] REST API handle no key match for tables --- xCAT-server/xCAT-wsapi/xcatws.cgi | 6 ++++++ xCAT-test/autotest/testcase/restapi/table/cases0 | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 86bf86e9a..4fa3bcd58 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -2871,6 +2871,12 @@ sub tablerowhdl { # Error returned, most likely invalid table, substitute a better error msg @$responses[0]->{error} = "No such table: @tables"; } + # Check if there is any real data in response + # One key ('xcatdsource' => '') is always returned. + # If no other keys in response - no matches on key or attribute were returned from xcatd + if (keys @$responses[0] <= 1) { + @$responses[0]->{error} = "No table rows matched specified keys or attributes"; + } return $responses; } diff --git a/xCAT-test/autotest/testcase/restapi/table/cases0 b/xCAT-test/autotest/testcase/restapi/table/cases0 index 16f9fd640..e424ad8f4 100644 --- a/xCAT-test/autotest/testcase/restapi/table/cases0 +++ b/xCAT-test/autotest/testcase/restapi/table/cases0 @@ -19,6 +19,20 @@ check:rc==200 check:output=~"mask":"255.0.0.0" end +start:get_network_table_with_attr_selection_error_rest +description: get all attribute matching networks table entries with REST API, invalid attribute name +cmd:restapitest -m GET -r /tables/networks/rows/abc=255.0.0.0 -u $$username -p $$password +check:rc==147 +check:output=~No table rows +end + +start:get_network_table_with_attr_selection_error_rest2 +description: get all attribute matching networks table entries with REST API, no match +cmd:restapitest -m GET -r /tables/networks/rows/mask=a.b.c.d -u $$username -p $$password +check:rc==147 +check:output=~No table rows +end + start:get_network_table_with_attr_selection_rest2 description: get attribute matching networks table attributes with REST API cmd:restapitest -m GET -r /tables/networks/rows/mask=255.0.0.0/gateway -u $$username -p $$password From d480f8760abfb3800745396232395ad0b7ba8e03 Mon Sep 17 00:00:00 2001 From: cxhong Date: Tue, 8 May 2018 01:44:25 -0400 Subject: [PATCH 043/117] Add Copycds/nodeset/syncfiles support to onie switches support (#5173) --- .../onie_switches/os_cumulus/install.rst | 29 +++++++++++++------ .../onie_switches/os_cumulus/manage.rst | 18 ++++++++++++ .../onie_switches/os_cumulus/prepare.rst | 24 +++++++++++++++ 3 files changed, 62 insertions(+), 9 deletions(-) diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst index b10dd9a79..bd1be9f69 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst @@ -41,16 +41,27 @@ xCAT provides support for detecting and installing the Cumulus Linux OS into ONI switchdiscover --range -#. Set the ``provmethod`` attribute of the target switch(es) to the Cumulus Linux install image: :: +#. Run the ``nodeset`` command to set the ``provmethod`` attribute of the target switch(es) to the Cumulus Linux install image and prepare the DHCP/BOOTP lease information for the switch: :: - chdef frame[01-04]sw1 \ - provmethod="/install/custom/sw_os/cumulus/cumulus-linux-3.1.0-bcm-armel.bin" + # nodeset frame01sw1 osimage=cumulus3.5.2-armel + # lsdef frame01sw1 + Object name: frame01sw1 + arch=armv7l + groups=switch,edge_switch + ip=172.21.208.03 + mac=8C:EA:1B:E8:78:C0 + mgt=switch + netboot=onie + nodetype=switch + postbootscripts=otherpkgs + postscripts=syslog,remoteshell + provmethod=cumulus3.5.2-armel + switch=mid08 + switchport=3 + switchtype=onie + usercomment=Edgecore Networks Switch -#. Run ``makedhcp`` to prepare the DHCP/BOOTP lease information for the switch: :: - - makedhcp -a frame[01-04]sw1 - - Executing the ``makedhcp`` command will kick off the network install of the ONIE enabled switch. If there is no OS pre-loaded on the switch, the switch continues to send a DHCPREQUEST out to the network. After ``makedhcp`` is run against the switch, an entry is added to the leases file that will respond to the request with the Cumulus Linux installer file. :: + ``nodeset`` will executing the ``makedhcp`` command and kick off the network install of the ONIE enabled switch. If there is no OS pre-loaded on the switch, the switch continues to send a DHCPREQUEST out to the network. After ``makedhcp`` is run against the switch, an entry is added to the leases file that will respond to the request with the Cumulus Linux installer file. :: host frame1sw1 { dynamic; @@ -59,7 +70,7 @@ xCAT provides support for detecting and installing the Cumulus Linux OS into ONI supersede server.ddns-hostname = "frame1sw1"; supersede host-name = "frame1sw1"; if substring (option vendor-class-identifier, 0, 11) = "onie_vendor" { - supersede www-server = "http://192.168.27.1/install/custom/sw_os/cumulus/cumulus-linux-3.1.0-bcm-armel.bin"; + supersede www-server = "http://192.168.27.1/install/cumulus3.5.2/armel/cumulus-linux-3.5.2-bcm-armel.bin"; } } diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst index b2976f56a..31986c698 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst @@ -1,6 +1,24 @@ Switch Management ================= +Sync File support +------------------ + +xCAT supports synchronize of configuration files for cumulus switches. + +#. Use instructions in doc: :ref:`The_synclist_file` to set up syncfile. +#. Add syncfile to cumulus osimage. :: + + # chdef -t osimage cumulus3.5.2-armel synclists=/tmp/synclists + 1 object definitions have been created or modified. + +#. run ``updatenode`` to sync the files to cumulus switches. :: + + # updatenode mid08tor03 -F + File synchronization has completed for nodes: "mid08tor03" + + + Switch Port and VLAN Configuration ---------------------------------- diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/prepare.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/prepare.rst index e68fd0895..8fbdc1073 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/prepare.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/prepare.rst @@ -17,3 +17,27 @@ Prepare the Cumulus Linux files on the xCAT Management Node. cp cumulus-linux-3.1.0-bcm-armel.bin /install/custom/sw_os/cumulus/ +Cumulus osimage +--------------- + +xCAT can able to create a cumulus osimage defintion via ``copycds`` command. ``copycds`` will copy cumulus installer to a destination directory, and create several relevant osimage definitions. **cumulus-** is the default osimage name. :: + + #run copycds command + # copycds cumulus-linux-3.5.2-bcm-armel.bin + +The ``pkgdir`` attribute will contain full path of cumulus installer as **/install/cumulus//**. :: + + # lsdef -t osimage cumulus3.5.2-armel + Object name: cumulus3.5.2-armel + description=Cumulus Linux + imagetype=linux + osarch=armel + osname=cumulus + osvers=cumulus3.5.2 + pkgdir=/install/cumulus3.5.2/armel/cumulus-linux-3.5.2-bcm-armel.bin + provmethod=install + + + + + From cde37a25de21c603b579f90238df01ef60505be9 Mon Sep 17 00:00:00 2001 From: robin2008 Date: Tue, 8 May 2018 17:27:43 +0800 Subject: [PATCH 044/117] add rsyslog configration files to xcatsnap --- xCAT-server/sbin/xcatsnap | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/sbin/xcatsnap b/xCAT-server/sbin/xcatsnap index 93a316bdd..3b3d1318b 100755 --- a/xCAT-server/sbin/xcatsnap +++ b/xCAT-server/sbin/xcatsnap @@ -195,7 +195,8 @@ sub snap_it { "/etc/hosts", "/etc/conserver.cf", "/var/log/conserver", "/etc/db_file.cr", "/etc/dhcpsd.cnf", "/var/adm/ras/nimlog", -"/etc/resolv.conf", "/etc/named.conf", "/var/log/messages", "/var/log/xcat/*"); + "/etc/resolv.conf", "/etc/named.conf", + "/var/log/messages", "/var/log/xcat/*"); } elsif ($OSname eq "Linux") { @@ -205,6 +206,7 @@ sub snap_it { "$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*", "$INSTALLDIR/custom/*", "/tftpboot/*", "/var/log/consoles/*", "/etc/*-release", "/etc/dhcpd.conf", + "/etc/rsyslog.conf", "/etc/rsyslog.d/*", "/var/lib/dhcpd/dhcpd.leases", "/etc/hosts", "/etc/resolv.conf", "/etc/named.conf", "/etc/conserver.cf", "/var/log/conserver", "/etc/nsswitch.conf", "/var/log/messages", "/var/log/xcat/*"); @@ -382,6 +384,7 @@ chop($hostname = `hostname -s`); my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); $mon = $mon + 1; +$year += 1900; my @date_array = ($mon, $mday, $hour, $min); foreach my $item (@date_array) { @@ -390,8 +393,8 @@ foreach my $item (@date_array) { $item =~ tr/ /0/; } my $logdate = $date_array[0] . $date_array[1] . $date_array[2] . $date_array[3]; -$LogFile = $logDirectory . "/xcatsnap." . $hostname . "." . $logdate . ".log"; -$TarFile = $logDirectory . "/xcatsnap." . $hostname . "." . $logdate . ".tar"; +$LogFile = $logDirectory . "/xcatsnap." . $hostname . "." . $year . "-" . $logdate . ".log"; +$TarFile = $logDirectory . "/xcatsnap." . $hostname . "." . $year . "-" . $logdate . ".tar"; open(STDOUT, "| tee $LogFile"); print "Time Stamp:" . `date`; @@ -408,6 +411,7 @@ print "Compiling Information...\n"; print "Information compiled...\n"; `chmod 400 $LogFile`; # Processing the log file print "Send $LogFile to IBM Support.\n"; +print "Compressing $TarFile ...\n"; my $donotdelete = 0; if (`which gunzip` == 0) { # Compressing the tar file `gzip -f $TarFile`; From 61096e21e96a23543d8cd8294e994d61f6d7bb63 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 8 May 2018 05:32:53 -0400 Subject: [PATCH 045/117] add test case for xcatprobe detect_dhcpd command --- .../autotest/testcase/probe/detect_dhcpd | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 xCAT-test/autotest/testcase/probe/detect_dhcpd diff --git a/xCAT-test/autotest/testcase/probe/detect_dhcpd b/xCAT-test/autotest/testcase/probe/detect_dhcpd new file mode 100644 index 000000000..9a3097f57 --- /dev/null +++ b/xCAT-test/autotest/testcase/probe/detect_dhcpd @@ -0,0 +1,30 @@ +start:detect_dhcpd_work +description:To test if xcatprobe detect_dhcpd works. This case must run in xcat mn +cmd:if [ -d "/tmp/detect_dhcpd_work" ]; then mv /tmp/detect_dhcpd_work /tmp/detect_dhcpd_work.bak; fi; mkdir -p /tmp/detect_dhcpd_work +#cmd:makedhcp -n +#check:rc == 0 +#cmd:makedhcp $$CN +#check:rc == 0 +#cmd:#!/bin/bash +#if [ -e "/etc/redhat-release" ]; then +# rpm -qa |grep tcpdump +# if [ "$?" != "0" ] ;then +# yum install -y tcpdump +# fi +#elif [ -e "/etc/SuSE-release" ]; then +# rpm -qa |grep tcpdump +# if [ "$?" != "0" ] ;then +# zypper -n install tcpdump +# fi +#elif [ -e "/etc/lsb-release" ]; then +# dpkg -l|grep tcpdump +# if [ "$?" != "0" ] ;then +# apt-get install -y +# fi +#fi +cmd:declare -a array=(`lsdef $$CN -i mac -c|awk -F"=" '{print $2}'|sed 's/|/ /g'`);for i in "${array[@]}"; do if ! echo $i|grep -q NOIP;then echo "$i" > /tmp/detect_dhcpd_work/mac;break;fi;done; +cmd:mac=`cat /tmp/detect_dhcpd_work/mac`; mn=`lsdef -t site -i master -c|awk -F"=" '{print $2}'`;nic=`ip -4 -o a|grep $mn|awk -F" " '{print $2}'`;xcatprobe detect_dhcpd -i $nic -m $mac +check:output !~ There are 0 servers replied to dhcp discover +check:output =~ The next server is +#cmd:rm -rf /tmp/detect_dhcpd_work; if [ -d "/tmp/detect_dhcpd_work.bak" ]; then mv /tmp/detect_dhcpd_work.bak /tmp/detect_dhcpd_work;fi +end From 2361cda1f2e41f0e074e8fca709004623298dd42 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 8 May 2018 13:27:41 -0400 Subject: [PATCH 046/117] Man and usage updates for chtab and tabch commands --- .../guides/admin-guides/references/man8/chtab.8.rst | 10 +++++----- .../guides/admin-guides/references/man8/tabch.8.rst | 8 ++++---- xCAT-client/pods/man8/chtab.8.pod | 10 +++++----- xCAT-client/pods/man8/tabch.8.pod | 8 ++++---- xCAT-server/lib/xcat/plugins/tabutils.pm | 7 ++----- xCAT-server/sbin/chtab | 4 ++-- 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man8/chtab.8.rst b/docs/source/guides/admin-guides/references/man8/chtab.8.rst index 64e90e0b1..8e38a5abe 100644 --- a/docs/source/guides/admin-guides/references/man8/chtab.8.rst +++ b/docs/source/guides/admin-guides/references/man8/chtab.8.rst @@ -23,11 +23,11 @@ SYNOPSIS \ **chtab**\ [\ **-v**\ | \ **-**\ **-version**\ ] -\ **chtab**\ [\ *keycolname=keyvalue*\ ] [\ *tablename.colname=newvalue*\ ] +\ **chtab**\ \ *keycolname=keyvalue*\ [,\ *keycolname=keyvalue*\ ,...] \ *tablename.colname=newvalue*\ [\ *tablename.colname=newvalue*\ ...] -\ **chtab**\ [\ *keycolname=keyvalue*\ ] [\ *tablename.colname+=newvalue*\ ] +\ **chtab**\ \ *keycolname=keyvalue*\ [,\ *keycolname=keyvalue*\ ,...] \ *tablename.colname+=newvalue*\ [\ *tablename.colname+=newvalue*\ ...] -\ **chtab -d**\ [\ *keycolname=keyvalue*\ ] [\ *tablename.colname=newvalue*\ ] +\ **chtab -d**\ \ *keycolname=keyvalue*\ [,\ *keycolname=keyvalue*\ ,...] \ *tablename*\ [\ *tabname*\ ...] *********** @@ -35,9 +35,9 @@ DESCRIPTION *********** -The chtab command adds, deletes or updates the attribute value in the specified table.column for the specified keyvalue. Normally, the given value will completely replace the current attribute value. But if "+=" is used instead of "=", the specified value will be appended to the coma separated list of the attribute, if it is not already there. +The \ **chtab**\ command adds, deletes or updates the attribute values in the specified table.column for the specified \ *keyvalue*\ . Normally, the given value will completely replace the current attribute value. But if "+=" is used instead of "=", the specified value will be appended to the comma separated list of attributes, if it is not already there. -The chtab is designed to work without passing xcatd, so it's out of control of policy mechanism. +The \ **chtab**\ does not pass through xcatd, so it is not controlled by the policy mechanism. ******* diff --git a/docs/source/guides/admin-guides/references/man8/tabch.8.rst b/docs/source/guides/admin-guides/references/man8/tabch.8.rst index 58761d426..de11ce5ad 100644 --- a/docs/source/guides/admin-guides/references/man8/tabch.8.rst +++ b/docs/source/guides/admin-guides/references/man8/tabch.8.rst @@ -23,11 +23,11 @@ SYNOPSIS \ **tabch**\ [\ **-v**\ | \ **-**\ **-version**\ ] -\ **tabch**\ [\ *keycolname=keyvalue*\ ] [\ *tablename.colname=newvalue*\ ] +\ **tabch**\ \ *keycolname=keyvalue*\ [,\ *keycolname=keyvalue*\ ,...] \ *tablename.colname=newvalue*\ [\ *tablename.colname=newvalue*\ ...] -\ **tabch**\ [\ *keycolname=keyvalue*\ ] [\ *tablename.colname+=newvalue*\ ] +\ **tabch**\ \ *keycolname=keyvalue*\ [,\ *keycolname=keyvalue*\ ,...] \ *tablename.colname+=newvalue*\ [\ *tablename.colname+=newvalue*\ ...] -\ **tabch -d**\ [\ *keycolname=keyvalue*\ ] [\ *tablename.colname=newvalue*\ ] +\ **tabch -d**\ \ *keycolname=keyvalue*\ [,\ *keycolname=keyvalue*\ ,...] \ *tablename*\ [\ *tablename*\ ...] *********** @@ -35,7 +35,7 @@ DESCRIPTION *********** -The tabch command adds, deletes or updates the attribute value in the specified table.column for the specified keyvalue. The difference between tabch and chtab is tabch runs as a plugin under the xcatd daemon. This give the additional security of being authorized by the daemon. Normally, the given value will completely replace the current attribute value. But if "+=" is used instead of "=", the specified value will be appended to the coma separated list of the attribute, if it is not already there. +The \ **tabch**\ command adds, deletes or updates the attribute values in the specified table.column for the specified keyvalue. The difference between \ **tabch**\ and \ **chtab**\ is \ **tabch**\ runs as a plugin under the xcatd daemon. This give the additional security of being authorized by the daemon. Normally, the given value will completely replace the current attribute value. But if "+=" is used instead of "=", the specified value will be appended to the comma separated list of attributes, if it is not already there. ******* diff --git a/xCAT-client/pods/man8/chtab.8.pod b/xCAT-client/pods/man8/chtab.8.pod index ddb906906..eeb51824f 100644 --- a/xCAT-client/pods/man8/chtab.8.pod +++ b/xCAT-client/pods/man8/chtab.8.pod @@ -8,17 +8,17 @@ B [B<-h> | B<--help>] B [B<-v> | B<--version>] -B [I] [I] +B I[,I,...] I [I ...] -B [I] [I] +B I[,I,...] I [I ...] -B [I] [I] +B I[,I,...] I [I ...] =head1 DESCRIPTION -The chtab command adds, deletes or updates the attribute value in the specified table.column for the specified keyvalue. Normally, the given value will completely replace the current attribute value. But if "+=" is used instead of "=", the specified value will be appended to the coma separated list of the attribute, if it is not already there. +The B command adds, deletes or updates the attribute values in the specified table.column for the specified I. Normally, the given value will completely replace the current attribute value. But if "+=" is used instead of "=", the specified value will be appended to the comma separated list of attributes, if it is not already there. -The chtab is designed to work without passing xcatd, so it's out of control of policy mechanism. +The B does not pass through xcatd, so it is not controlled by the policy mechanism. =head1 OPTIONS diff --git a/xCAT-client/pods/man8/tabch.8.pod b/xCAT-client/pods/man8/tabch.8.pod index 66a6b365d..86cdaf97d 100644 --- a/xCAT-client/pods/man8/tabch.8.pod +++ b/xCAT-client/pods/man8/tabch.8.pod @@ -8,15 +8,15 @@ B [B<-h> | B<--help>] B [B<-v> | B<--version>] -B [I] [I] +B I[,I,...] I [I ...] -B [I] [I] +B I[,I,...] I [I ...] -B [I] [I] +B I[,I,...] I [I ...] =head1 DESCRIPTION -The tabch command adds, deletes or updates the attribute value in the specified table.column for the specified keyvalue. The difference between tabch and chtab is tabch runs as a plugin under the xcatd daemon. This give the additional security of being authorized by the daemon. Normally, the given value will completely replace the current attribute value. But if "+=" is used instead of "=", the specified value will be appended to the coma separated list of the attribute, if it is not already there. +The B command adds, deletes or updates the attribute values in the specified table.column for the specified keyvalue. The difference between B and B is B runs as a plugin under the xcatd daemon. This give the additional security of being authorized by the daemon. Normally, the given value will completely replace the current attribute value. But if "+=" is used instead of "=", the specified value will be appended to the comma separated list of attributes, if it is not already there. =head1 OPTIONS diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 2606d11c5..c850a5814 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -2225,14 +2225,11 @@ sub tabch { my %rsp; push @{ $rsp{data} }, "Usage: tabch"; push @{ $rsp{data} }, " To add or update rows for tables:"; - push @{ $rsp{data} }, " tabch [keycolname=keyvalue[,keycolname=keyvalue...]] [tablename.colname=newvalue] [tablename.colname=newvalue]..."; + push @{ $rsp{data} }, " tabch keycolname=keyvalue[,keycolname=keyvalue...] tablename.colname=newvalue [tablename.colname=newvalue...]"; push @{ $rsp{data} }, " To delete rows from tables:"; - push @{ $rsp{data} }, " tabch -d|--delete keycolname=keyvalue[,keycolname=keyvalue...] tablename [tablename]..."; + push @{ $rsp{data} }, " tabch -d|--delete keycolname=keyvalue[,keycolname=keyvalue...] tablename [tablename...]"; push @{ $rsp{data} }, " keycolname=keyvalue a column name-and-value pair "; push @{ $rsp{data} }, " that identifies the rows in a table to be changed."; - push @{ $rsp{data} }, " a column name-and-value pair that identifies "; - push @{ $rsp{data} }, " the rows in a table to be changed."; - push @{ $rsp{data} }, " that identifies the rows in a table to be changed."; push @{ $rsp{data} }, " tablename.colname=newvalue "; push @{ $rsp{data} }, " the new value for the specified row and column of the table."; push @{ $rsp{data} }, " tabch [-h|--help]"; diff --git a/xCAT-server/sbin/chtab b/xCAT-server/sbin/chtab index 816174c61..e6a6d0a99 100755 --- a/xCAT-server/sbin/chtab +++ b/xCAT-server/sbin/chtab @@ -18,9 +18,9 @@ use strict; sub usage { print "Usage:\n"; print " To add or update rows for tables: - chtab [keycolname=keyvalue[,keycolname=keyvalue...]] [tablename.colname=newvalue] [tablename.colname=newvalue]...\n"; + chtab keycolname=keyvalue[,keycolname=keyvalue...] tablename.colname=newvalue [tablename.colname=newvalue...]\n"; print " To delete rows from tables: - chtab -d|--delete keycolname=keyvalue[,keycolname=keyvalue...] tablename [tablename]...\n"; + chtab -d|--delete keycolname=keyvalue[,keycolname=keyvalue...] tablename [tablename...]\n"; print " To display usage and other information: chtab [-h|--help|-v|--Version]\n\n"; print " -d|--delete Delete the rows from a list of tables. From ff8202a13b5395872020f3857e26fdf5f0b6bfe5 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 8 May 2018 21:33:10 -0400 Subject: [PATCH 047/117] add test case for xcatprobe detect_dhcpd command --- .../autotest/testcase/probe/detect_dhcpd | 65 ++++++++++++------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/xCAT-test/autotest/testcase/probe/detect_dhcpd b/xCAT-test/autotest/testcase/probe/detect_dhcpd index 9a3097f57..b3eccc0fd 100644 --- a/xCAT-test/autotest/testcase/probe/detect_dhcpd +++ b/xCAT-test/autotest/testcase/probe/detect_dhcpd @@ -1,30 +1,45 @@ start:detect_dhcpd_work description:To test if xcatprobe detect_dhcpd works. This case must run in xcat mn cmd:if [ -d "/tmp/detect_dhcpd_work" ]; then mv /tmp/detect_dhcpd_work /tmp/detect_dhcpd_work.bak; fi; mkdir -p /tmp/detect_dhcpd_work -#cmd:makedhcp -n -#check:rc == 0 -#cmd:makedhcp $$CN -#check:rc == 0 -#cmd:#!/bin/bash -#if [ -e "/etc/redhat-release" ]; then -# rpm -qa |grep tcpdump -# if [ "$?" != "0" ] ;then -# yum install -y tcpdump -# fi -#elif [ -e "/etc/SuSE-release" ]; then -# rpm -qa |grep tcpdump -# if [ "$?" != "0" ] ;then -# zypper -n install tcpdump -# fi -#elif [ -e "/etc/lsb-release" ]; then -# dpkg -l|grep tcpdump -# if [ "$?" != "0" ] ;then -# apt-get install -y -# fi -#fi -cmd:declare -a array=(`lsdef $$CN -i mac -c|awk -F"=" '{print $2}'|sed 's/|/ /g'`);for i in "${array[@]}"; do if ! echo $i|grep -q NOIP;then echo "$i" > /tmp/detect_dhcpd_work/mac;break;fi;done; -cmd:mac=`cat /tmp/detect_dhcpd_work/mac`; mn=`lsdef -t site -i master -c|awk -F"=" '{print $2}'`;nic=`ip -4 -o a|grep $mn|awk -F" " '{print $2}'`;xcatprobe detect_dhcpd -i $nic -m $mac +cmd:makedhcp -n +check:rc == 0 +cmd:makedhcp $$CN +check:rc == 0 +cmd:#!/bin/bash +if [ -e "/etc/redhat-release" ]; then + rpm -qa |grep tcpdump + if [ "$?" != "0" ] ;then + yum install -y tcpdump + fi +elif [ -e "/etc/SuSE-release" ]; then + rpm -qa |grep tcpdump + if [ "$?" != "0" ] ;then + zypper -n install tcpdump + fi +elif [ -e "/etc/lsb-release" ]; then + dpkg -l|grep tcpdump + if [ "$?" != "0" ] ;then + apt-get install -y + fi +fi +cmd:echo "$$CN" |tee /tmp/detect_dhcpd_work/cn +cmd: #!/bin/bash +cn=`cat /tmp/detect_dhcpd_work/cn` +mac="" +nic="" +declare -a array=(`lsdef $cn -i mac -c|awk -F"=" '{print $2}'|sed 's/|/ /g'`) +for i in "${array[@]}" +do + if ! echo $i|grep -q NOIP + then + mac=$i + break + fi +done +mn=`lsdef -t site -i master -c|awk -F"=" '{print $2}'` +nic=`ip -4 -o a|grep $mn|awk -F" " '{print $2}'` +xcatprobe -w detect_dhcpd -i $nic -m $mac check:output !~ There are 0 servers replied to dhcp discover -check:output =~ The next server is -#cmd:rm -rf /tmp/detect_dhcpd_work; if [ -d "/tmp/detect_dhcpd_work.bak" ]; then mv /tmp/detect_dhcpd_work.bak /tmp/detect_dhcpd_work;fi +check:output =~ Server:__GETTABLEVALUE(key,master,value,site)__ assign IP .+__GETNODEATTR($$CN,ip)__ +cmd:rm -rf /tmp/detect_dhcpd_work; if [ -d "/tmp/detect_dhcpd_work.bak" ]; then mv /tmp/detect_dhcpd_work.bak /tmp/detect_dhcpd_work;fi end From 21a138502a14efbc9debd8ab591fadc315ca0160 Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Wed, 9 May 2018 14:07:21 +0800 Subject: [PATCH 048/117] add test for issue 922 (#5179) --- .../reg_linux_diskfull_installation_flat | 10 ++++++++++ .../reg_linux_diskfull_installation_hierarchy | 10 ++++++++++ .../reg_linux_diskless_installation_flat | 10 ++++++++++ .../reg_linux_diskless_installation_hierarchy | 10 ++++++++++ .../reg_linux_statelite_installation_flat | 20 +++++++++++++++++++ ...ux_statelite_installation_hierarchy_by_nfs | 10 ++++++++++ ...tatelite_installation_hierarchy_by_ramdisk | 10 ++++++++++ 7 files changed, 80 insertions(+) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index be95f5d86..a7efa1b19 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -71,6 +71,16 @@ check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /test.synclist" check:rc==0 +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /tmp/test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists= end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index a21b71002..c9b3a9a45 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -68,6 +68,16 @@ check:rc==0 cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /test.synclist" check:rc==0 +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists= end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index 6fde471d5..1dc6fdc8a 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -72,6 +72,16 @@ check:rc==0 cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /test.synclist" check:rc==0 +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index d846fca5a..585a76a21 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -73,6 +73,16 @@ cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,ar check:rc==0 cmd:xdsh $$CN "cat /test.synclist" check:rc==0 +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index de1331b54..a3d62e710 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -81,6 +81,16 @@ check:output=~$$CN: $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" check:rc!=0 +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 @@ -121,6 +131,16 @@ cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:rm -rf /tmp/image;mkdir /tmp/image check:rc==0 cmd:imgexport __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute /tmp/image/image.tgz diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 802491f64..27e0b4439 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -101,6 +101,16 @@ check:output=~$$CN: $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" check:rc!=0 +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index c61e15ac2..8c335a5c9 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -93,6 +93,16 @@ cmd:xdsh $$CN hostname check:rc==0 check:output=~$$CN: $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 end From 68cc0c3d65c6553bd97a8153832b002733fa6851 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 9 May 2018 02:30:02 -0400 Subject: [PATCH 049/117] modify incorrect sentence --- xCAT-test/autotest/testcase/probe/detect_dhcpd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/probe/detect_dhcpd b/xCAT-test/autotest/testcase/probe/detect_dhcpd index b3eccc0fd..f88141463 100644 --- a/xCAT-test/autotest/testcase/probe/detect_dhcpd +++ b/xCAT-test/autotest/testcase/probe/detect_dhcpd @@ -19,7 +19,7 @@ elif [ -e "/etc/SuSE-release" ]; then elif [ -e "/etc/lsb-release" ]; then dpkg -l|grep tcpdump if [ "$?" != "0" ] ;then - apt-get install -y + apt-get install -y tcpdump fi fi cmd:echo "$$CN" |tee /tmp/detect_dhcpd_work/cn From 270434e88491db929ea3115fa062060c209cd016 Mon Sep 17 00:00:00 2001 From: xuweibj Date: Wed, 9 May 2018 16:52:13 +0800 Subject: [PATCH 050/117] Add log service and log record in xcatprobe xcatmn (#5157) * Add log service and log record in xcatprobe xcatmn --- xCAT-probe/lib/perl/probe_utils.pm | 39 +++++++++++ xCAT-probe/subcmds/xcatmn | 101 +++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index 4b3835a71..d9e93a84c 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -553,6 +553,45 @@ sub is_ntp_ready{ #------------------------------------------ +=head3 + Description: + Test if rsyslog service is ready to use in current operating system + Arguments: + errormsg_ref: if there is something wrong for ntp service, this attribute save the possible reason. + Returns: + 1 : yes + 0 : no +=cut + +#------------------------------------------ +sub is_rsyslog_ready { + my $errormsg_ref = shift; + $errormsg_ref= shift if (($errormsg_ref) && ($errormsg_ref =~ /probe_utils/)); + + my $is_active = 1; + my $tmp = `pidof systemd`; + chomp($tmp); + if ($tmp) { + `systemctl is-active --quiet rsyslog 2>&1`; + if ($?) { + $is_active = 0; + } + } else { + my $output = `service rsyslog status 2>&1 | grep "Active: active (running)"`; + if (!$output) { + $is_active = 0; + } + } + + if (!$is_active) { + $$errormsg_ref = "rsyslog service is not running! Please check on current node"; + return 0; + } + return 1; +} + +#------------------------------------------ + =head3 Description: Convert second to time diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 49b159ad9..acc3a5409 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -119,6 +119,11 @@ sub do_main_job { print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; + #check rsyslog service + $rst = check_rsyslog_service(\$checkpoint, \@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + #Below are the 'warning` level check points #check if firewall is close @@ -135,6 +140,11 @@ sub do_main_job { #some sepecific check points in MN if (!$is_sn) { + #check if log can be recorded in log file + $rst = check_log_record(\$checkpoint, \@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; + #check if server ip is a static ip in MN $rst = check_server_ip_static($installnicip,\$checkpoint, \@error); print_check_result($checkpoint, "w", $rst, \@error); @@ -699,6 +709,97 @@ sub check_tftp_service { return $rst; } +sub check_rsyslog_service { + my $checkpoint_ref = shift; + my $error_ref = shift; + my $rst = 0; + + $$checkpoint_ref = "Checking rsyslog service is configured..."; + @$error_ref = (); + + my $error; + if (!probe_utils->is_rsyslog_ready(\$error)) { + push @$error_ref, "$error"; + $rst = 1; + } + return $rst; +} + +sub check_log_record { + my $checkpoint_ref = shift; + my $error_ref = shift; + my $rst = 0; + + my $log_file = "/var/log/xcat/cluster.log"; + $$checkpoint_ref = "Checking xCAT log is stored in $log_file..."; + @$error_ref = (); + + unless (-e $log_file) { + my $os_ver = `cat /etc/*release* 2>&1`; + if ($os_ver =~ /suse/i and $os_ver =~ /VERSION=\"11.*\"/) { + return 2; + } else { + push @$error_ref, "No log file $log_file found"; + return 1; + } + } + + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + my $service_nodes = join(",", @snlist); + + my $start_time = time(); + my $log_msg = "xcatprobe rsyslog checking $start_time"; + my @valid_nodes; + + `logger -p local4.info -t xcat $log_msg on MN 2>&1`; + if ($?) { + push @$error_ref, "Failed to run command 'logger' on MN"; + $rst = 1; + return $rst; + } + sleep(5); + + my @mn_grep_logs = `grep "$log_msg on MN" $log_file`; + unless (@mn_grep_logs) { + push @$error_ref, "Failed to store MN logs to $log_file"; + $rst = 1; + return $rst; + } + + my @invld_nodes = (); + my @output = `xdsh $service_nodes -s "logger -p local4.info -t xcat $log_msg on SN && echo OKAY" 2>&1`; + + foreach my $line (@output) { + chomp($line); + if ($line =~ /(\w+): OKAY/) { + push @valid_nodes, $1; + } elsif ($line =~ /(\w+): ssh: connect to host .+ No route to host/) { + push @invld_nodes, $1; + } + } + sleep(5); + + my @grep_logs = `grep "$log_msg on SN" $log_file | grep -v "Allowing" | grep -v "dispatch"`; + foreach my $grep_log (@grep_logs) { + if ($grep_log =~ /.+ \d+:\d+:\d+ (\w+) xcat: $log_msg on SN/) { + push @checked_nodes, $1; + } + } + + my %hash_pass = map{$_=>1} @checked_nodes; + my @error_nodes = grep {!$hash_pass{$_}} @valid_nodes; + if (@error_nodes) { + push @$error_ref, "Failed to store logs come from " . join(",", @error_nodes) . " to $log_file on MN"; + $rst = 1; + } + if (@invld_nodes) { + push @$error_ref, "Failed to connect SN " . join(",", @invld_nodes); + $rst = 1; + } + + return $rst; +} + sub check_ntp_service{ my $checkpoint_ref = shift; my $error_ref = shift; From 9d6a8fa42036fabbd5425e5ab96f8394997e9d11 Mon Sep 17 00:00:00 2001 From: robin2008 Date: Wed, 9 May 2018 17:47:55 +0800 Subject: [PATCH 051/117] make store_fd does not thow exception and the client could be closed. --- perl-xCAT/xCAT/Table.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index b61786685..e9db41dd0 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -351,7 +351,7 @@ sub init_dbworker { xCAT::MsgUtils->message("S", "xcatd: possible BUG encountered by xCAT DB worker " . $err); if ($currcon) { eval { #avoid hang by allowin client to die too - store_fd("*XCATBUGDETECTED*:$err:*XCATBUGDETECTED*\n", $currcon); + store_fd(["*XCATBUGDETECTED*:$err:*XCATBUGDETECTED*\n"], $currcon); $clientset->remove($currcon); close($currcon); }; From a06e3cc850ae7165dbe767e03bbe22c114e685b8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 9 May 2018 10:56:49 -0400 Subject: [PATCH 052/117] OpenBMC rinv more specific REST calls --- .../agent/hwctl/executor/openbmc_flash.py | 2 +- .../agent/hwctl/executor/openbmc_inventory.py | 2 +- .../lib/python/agent/hwctl/openbmc_client.py | 30 ++++++++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py index bdb8c96cc..43be329ea 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_flash.py @@ -528,7 +528,7 @@ class OpenBMCFlashTask(ParallelNodesCommand): try: obmc.login() # Before uploading file, check CPU DD version - inventory_info_dict = obmc.get_inventory_info() + inventory_info_dict = obmc.get_inventory_info('cpu') cpu_info = inventory_info_dict["CPU"] for info in cpu_info: if info.startswith("CPU0 Version : 20"): diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py index a59bd14a6..aa863951b 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py @@ -83,7 +83,7 @@ class OpenBMCInventoryTask(ParallelNodesCommand): inventory_info = [] try: obmc.login() - inventory_info_dict = obmc.get_inventory_info() + inventory_info_dict = obmc.get_inventory_info(inventory_type) if inventory_type == 'all' or not inventory_type: keys = inventory_info_dict.keys() diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py b/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py index 0401928b3..f4f559186 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py @@ -49,7 +49,13 @@ DUMP_URLS = { GARD_CLEAR_URL = "/org/open_power/control/gard/action/Reset" -INVENTORY_URL = "/inventory/enumerate" +INVENTORY_URLS = { + "all" : "/inventory/enumerate", + "model" : "/inventory/system", + "serial" : "/inventory/system", + "cpu" : "/inventory/system/chassis/motherboard/enumerate", + "dimm" : "/inventory/system/chassis/motherboard/enumerate", +} LEDS_URL = "/led/physical/enumerate" @@ -546,11 +552,19 @@ class OpenBMCRest(object): error = 'Received wrong format response: %s' % sensor_data raise SelfServerException(error) - def get_inventory_info(self): + def get_inventory_info(self, inventory_type): - inventory_data = self.request('GET', INVENTORY_URL, cmd='get_inventory_info') + inventory_data = self.request('GET', INVENTORY_URLS[inventory_type], cmd='get_inventory_info') try: - inverntory_dict = {} + inventory_dict = {} + if inventory_type == 'model' or inventory_type == 'serial': + # The format of returned data for model and serial a different from other inventory types + inventory_dict['SYSTEM'] = [] + for key, value in inventory_data.items(): + inventory_dict['SYSTEM'].append('%s %s : %s' % ("SYSTEM", key, value)) + + return inventory_dict + for key, value in inventory_data.items(): if 'Present' not in value: logger.debug('Not "Present" for %s' % key) @@ -572,13 +586,13 @@ class OpenBMCRest(object): else: source = key_id - if key_type not in inverntory_dict: - inverntory_dict[key_type] = [] + if key_type not in inventory_dict: + inventory_dict[key_type] = [] for (sub_key, v) in value.items(): - inverntory_dict[key_type].append('%s %s : %s' % (source.upper(), sub_key, v)) + inventory_dict[key_type].append('%s %s : %s' % (source.upper(), sub_key, v)) - return inverntory_dict + return inventory_dict except KeyError: error = 'Received wrong format response: %s' % inventory_data raise SelfServerException(error) From 023f1cad69b45a674c08f0dfaf997bb547b9eb49 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 9 May 2018 13:38:32 -0400 Subject: [PATCH 053/117] Tagging Notes and Warnings with admonitions to render nicer on RTD --- docs/source/advanced/chain/chain_tasks.rst | 2 +- .../confluent/server/confluent_server.rst | 2 +- .../advanced/docker/docker_registry.rst | 2 +- .../dockerized_xcat/setup_docker_host.rst | 5 +--- .../advanced/docker/lifecycle_management.rst | 10 ++++++- .../domain_name_resolution.rst | 10 +++---- .../source/advanced/gpu/nvidia/management.rst | 4 +-- .../setup_ha_mgmt_node_with_shared_data.rst | 26 +++++++++---------- .../hierarchy/provision/diskful_sn.rst | 13 +++------- .../hierarchy/provision/diskless_sn.rst | 10 +++---- docs/source/advanced/migration/migration.rst | 2 +- .../common/deployment/cfg_partition.rst | 5 ++-- 12 files changed, 44 insertions(+), 47 deletions(-) diff --git a/docs/source/advanced/chain/chain_tasks.rst b/docs/source/advanced/chain/chain_tasks.rst index dc979ee71..4c840ef5f 100644 --- a/docs/source/advanced/chain/chain_tasks.rst +++ b/docs/source/advanced/chain/chain_tasks.rst @@ -11,7 +11,7 @@ Currently only the ``bmcsetup`` command is officially supplied by xCAT to run to runcmd=bmcsetup -**Note**: the command ``mknb `` is needed before reboot the node. +.. note:: The command ``mknb `` is needed before reboot the node. * runimage :: diff --git a/docs/source/advanced/confluent/server/confluent_server.rst b/docs/source/advanced/confluent/server/confluent_server.rst index 6bdecb832..8591055ee 100644 --- a/docs/source/advanced/confluent/server/confluent_server.rst +++ b/docs/source/advanced/confluent/server/confluent_server.rst @@ -56,7 +56,7 @@ The following example describes the steps for **rhels7.1** on **ppc64le**:: cd confluent-dep-rh7-ppc64le/ ./mklocalrepo.sh -**Note:** If the OS/architecture you are looking for is not provided under confluent-dep, send an email to the xcat-user mailing list: xcat-user@lists.sourceforge.net +.. note:: If the OS/architecture you are looking for is not provided under confluent-dep, send an email to the xcat-user mailing list: xcat-user@lists.sourceforge.net Install diff --git a/docs/source/advanced/docker/docker_registry.rst b/docs/source/advanced/docker/docker_registry.rst index 920629dc8..591f20d49 100644 --- a/docs/source/advanced/docker/docker_registry.rst +++ b/docs/source/advanced/docker/docker_registry.rst @@ -5,7 +5,7 @@ Docker Registry is a stateless, highly scalable server side application that sto This document describes how to set up a local private docker registry on Ubuntu 15.04 on x86_64. -**Note:** Ensure that docker registry is not already set up on this docker host. +.. note:: Ensure that docker registry is not already set up on this docker host. Setting Up Docker Host ---------------------- diff --git a/docs/source/advanced/docker/dockerized_xcat/setup_docker_host.rst b/docs/source/advanced/docker/dockerized_xcat/setup_docker_host.rst index 6ba2218cb..9ce4aa4e1 100644 --- a/docs/source/advanced/docker/dockerized_xcat/setup_docker_host.rst +++ b/docs/source/advanced/docker/dockerized_xcat/setup_docker_host.rst @@ -6,10 +6,7 @@ Install Docker Engine The Docker host to run xCAT Docker image should be a baremental or virtual server with Docker v1.10 or above installed. For the details on system requirements and Docker installation, refer to `Docker Installation Docs `_. -**Note:** - -1. **Docker image** can only run on **Docker host** with the same architecture. Since xCAT currently only ships x86_64 and ppc64le Docker images, running xCAT in Docker requires x86_64 or ppc64le **Docker hosts**. - +.. note:: Docker images can only run on Docker hosts with the same architecture. Since xCAT only ships x86_64 and ppc64le Docker images, running xCAT in Docker requires x86_64 or ppc64 Docker Hosts. Shutdown the SELinux/Apparmor on Docker host -------------------------------------------- diff --git a/docs/source/advanced/docker/lifecycle_management.rst b/docs/source/advanced/docker/lifecycle_management.rst index 869b57da9..9f7b8db7c 100644 --- a/docs/source/advanced/docker/lifecycle_management.rst +++ b/docs/source/advanced/docker/lifecycle_management.rst @@ -5,7 +5,15 @@ The Docker linux container technology is currently very popular. xCAT can help m This document describes how to use xCAT for docker management, from Docker Host setup to docker container operations. -**Note:** The document was verified with **Docker Version 1.10, 1.11** and **Docker API version 1.22.** The Docker Host was verified on **ubuntu14.04.3 x86_64**, **ubuntu15.10 x86_64**, **ubuntu16.04 x86_64** and **ubuntu16.04 ppc64el**. +.. note:: This document was verified with: + * Docker Version 1.10, 1.11 + * Docker API version 1.22 + + Docker Host has been verified on the following OS/ARCH combinations: + * Ubuntu 14.04.3,x86_64 + * Ubuntu 15.10,x86_64 + * Ubuntu 16.04,x86_64 + * Ubuntu 16.04,ppc64el Setting up Docker Host diff --git a/docs/source/advanced/domain_name_resolution/domain_name_resolution.rst b/docs/source/advanced/domain_name_resolution/domain_name_resolution.rst index 7311f53ae..6009eb083 100644 --- a/docs/source/advanced/domain_name_resolution/domain_name_resolution.rst +++ b/docs/source/advanced/domain_name_resolution/domain_name_resolution.rst @@ -30,7 +30,7 @@ Use the ``mkdef`` command to add additional networks to the xCAT database. (See mkdef -t network clusternet net=11.0.0.0 mask=255.255.0.0 gateway=11.0.0.254 domain=app.cluster.com -Note: The ``makedns`` command (mentioned below) will only add nodes into the DNS configuration if the network for the node is defined. +.. note:: The ``makedns`` command (mentioned below) will only add nodes into the DNS configuration if the network for the node is defined. If you want to use a different hostname domain or a different set of nameservers for nodes that are on a particular network, set those attributes in the corresponding network object: :: @@ -71,7 +71,7 @@ and the following entries will be added to **/etc/hosts**: :: This information is used by the ``makehosts`` command to add the additional interface hostnames etc. to the **/etc/hosts** file. It is also used by xCAT adapter configuration postscripts to automatically configure the additional network interfaces on the node. See the section (refer to :ref:`specifying_additional_network_interfaces_for_cluster_nodes` ). -Note that it is a convention of xCAT that for Linux systems the short hostname is the primary hostname for the node, and the long hostname is an alias. To have the long hostname be the primary hostname, you can use the -l option on the makehosts command. +.. note:: It is a convention of xCAT that for Linux systems the short hostname is the primary hostname for the node, and the long hostname is an alias. To have the long hostname be the primary hostname, you can use the -l option on the ``makehosts`` command. Preparing for Using a DNS ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -207,7 +207,7 @@ For example: :: The **** keyword will be interpreted as the value of the **** attribute of the node definition. The **** value for a node is the name of it's server as known by the node. This would be either the cluster-facing name of the service node or the cluster-facing name of the management node. -Note: for Linux, the site **nameservers** value must be set to **** before you run ``makedhcp``. +.. note:: The site **nameservers** value must be set to **** before you run ``makedhcp``. Make sure that the DNS service on the service nodes will be set up by xCAT. @@ -293,7 +293,7 @@ Setting individual nic attribute values The nic attribute values may be set using the ``chdef`` or ``mkdef`` commands. You can specify the nic* values when creating an xCAT node definition with ``mkdef`` or you can update an existing node definition using ``chdef``. -Note: ``chdef`` does not support using the "-m" and "-p" options to modify the nic* attributes. +.. note:: ``chdef`` does not support using the "-m" and "-p" options to modify the nic* attributes. nicips example: :: @@ -311,7 +311,7 @@ This value indicates that the hostname for **"eth1"** should be **"compute02-eth The suffixes provided may be any string that will conform to the DNS naming rules. -Important Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-), and period (.). When you are specifying **"nichostnamesuffixes"** or **"nicaliases"** make sure the resulting hostnames will conform to this naming convention. +.. warning:: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-), and period (.). When you are specifying **"nichostnamesuffixes"** or **"nicaliases"** make sure the resulting hostnames will conform to this naming convention. nictypes example: :: diff --git a/docs/source/advanced/gpu/nvidia/management.rst b/docs/source/advanced/gpu/nvidia/management.rst index 38f28df0b..057c625e7 100644 --- a/docs/source/advanced/gpu/nvidia/management.rst +++ b/docs/source/advanced/gpu/nvidia/management.rst @@ -9,9 +9,7 @@ Example: :: node01: Tesla K80, 0322415075970, GPU-b4f79b83-c282-4409-a0e8-0da3e06a13c3 ... - - -**Note: The following commands are provided as convenience.** *Always consult the nvidia-smi manpage for the latest supported functions.* +.. warning:: The following commands are provided as convenience. Always consult the ``nvidia-smi`` manpage for the latest supported functions. Management ---------- diff --git a/docs/source/advanced/hamn/setup_ha_mgmt_node_with_shared_data.rst b/docs/source/advanced/hamn/setup_ha_mgmt_node_with_shared_data.rst index 5a2d7ae3f..a694ad0d6 100644 --- a/docs/source/advanced/hamn/setup_ha_mgmt_node_with_shared_data.rst +++ b/docs/source/advanced/hamn/setup_ha_mgmt_node_with_shared_data.rst @@ -46,7 +46,7 @@ You need to substitute the hostnames and ip address with your own values when se Configuring Shared Data ======================= -``Note``: Shared data itself needs high availability also, the shared data should not become a single point of failure. +.. note:: Shared data itself needs high availability also, the shared data should not become a single point of failure. The configuration procedure will be quite different based on the shared data mechanism that will be used. Configuring these shared data mechanisms is beyond the scope of this documentation. After the shared data mechanism is configured, the following xCAT directory structure should be on the shared data, if this is done before xCAT is installed, you need to create the directories manually; if this is done after xCAT is installed, the directories need to be copied to the shared data. :: @@ -57,7 +57,10 @@ The configuration procedure will be quite different based on the shared data mec /tftpboot -``Note``:For MySQL, the database directory is ``/var/lib/mysql``; for PostGreSQL, the database directory is ``/var/lib/pgsql``; for DB2, the database directory is specified with the site attribute databaseloc; for sqlite, the database directory is /etc/xcat, already listed above. +.. note:: * For MySQL, the database directory is ``/var/lib/mysql`` + * For PostGreSQL, the database directory is ``/var/lib/pgsql`` + * For DB2, the database directory is specified with the site attribute ``databaseloc`` + * For SQLite, the database directory is ``/etc/xcat`` Here is an example of how to make directories be shared data through NFS: :: @@ -67,7 +70,6 @@ Here is an example of how to make directories be shared data through NFS: :: mount -o rw :/dir4 / mount -o rw :/dir5 /tftpboot -``Note``: if you need to setup high availability for some other applications, like the HPC software stack, between the two xCAT management nodes, the applications data should be on the shared data. Setup xCAT on the Primary Management Node ========================================= @@ -260,9 +262,7 @@ Besides the files mentioned above, there may be some additional customization fi /etc/inittab (and more) -``Note``: -If the IBM HPC software stack is configured in your environment, execute additional steps required to copy additional data or configuration files for HAMN setup. -The dhcpsd.cnf should be synchronized between the primary management node and standby management node only when the DHCP configuration on the two management nodes are exactly the same. +.. note:: If the IBM HPC software stack is configured in your environment, execute additional steps required to copy additional data or configuration files for HAMN setup. The ``dhcpsd.cnf`` should be synchronized between the primary management node and standby management node only when the DHCP configuration on the two management nodes are exactly the same. Cluster Maintenance Considerations ================================== @@ -275,7 +275,7 @@ The standby management node should be taken into account when doing any maintena #. Reboot management nodes - In the primary management node needs to be rebooted, since the daemons are set to not auto start at boot time, and the shared data will not be mounted automatically, you should mount the shared data and start the daemons manually. -``Note``: after software upgrade, some services that were set to not autostart on boot might be started by the software upgrade process, or even set to autostart on boot, the admin should check the services on both primary and standby management node, if any of the services are set to autostart on boot, turn it off; if any of the services are started on the backup management node, stop the service. +.. note:: After software upgrade, some services that were set to not autostart on boot might be started by the software upgrade process, or even set to autostart on boot, the admin should check the services on both primary and standby management node, if any of the services are set to autostart on boot, turn it off; if any of the services are started on the backup management node, stop the service. At this point, the HA MN Setup is complete, and customer workloads and system administration can continue on the primary management node until a failure occurs. The xcatdb and files on the standby management node will continue to be synchronized until such a failure occurs. @@ -306,7 +306,7 @@ Here is an example of how to use this script: :: /opt/xcat/share/xcat/hamn/deactivate-mn -i eth1:2 -v 9.114.47.97 -**Notes**: This script will be over-written after xCAT is upgraded. If this script is customized, make sure backup it before upgrading xCAT. +.. warning:: This script will be over-written after xCAT is upgraded. If this script is customized, make sure to back it up before upgrading xCAT. On the current primary management node: @@ -317,13 +317,13 @@ If the management node is still available and running the cluster, perform the f rmhwconn cec,frame rmhwconn cec,frame -T fnm -#. Stop the xCAT daemon. - - ``Note``: xCAT must be stopped on all Service Nodes also, and LL if using the database. :: +#. Stop the xCAT daemon. :: service xcatd stop service dhcpd stop + .. note:: xCAT must be stopped on all Service Nodes as well. + #. unexport the xCAT NFS directories The exported xCAT NFS directories will prevent the shared data partitions from being unmounted, so the exported xCAT NFS directories should be unmounted before failover: :: @@ -372,7 +372,7 @@ Here is an example of how to use this script to make the machine be a primary ma /opt/xcat/share/xcat/hamn/activate-mn -i eth1:2 -v 9.114.47.97 -m 255.255.255.0 -**Notes**: This script will be over-written after xCAT is upgraded. If this script is customized, make sure backup it before upgrading xCAT. +.. warning:: This script will be over-written after xCAT is upgraded. If this script is customized, make sure to back it up before upgrading xCAT. On the new primary management node: @@ -509,7 +509,7 @@ The operating system is installed on the internal disks. If you place entries for the disk in ``/etc/fstab``, which is not required, ensure that the entries do not have the system automatically mount the disk. - ``Note``: Since the file systems will not be mounted automatically during system reboot, it implies that you need to manually mount the file systems after the primary management node reboot. Before mounting the file systems, stop xcat daemon first; after the file systems are mounted, start xcat daemon. + .. note:: Since the file systems will not be mounted automatically during system reboot this must be manually done and xCAT should be started **after** the filesystem is mounted. #. Verify the file systems on the primary management node. diff --git a/docs/source/advanced/hierarchy/provision/diskful_sn.rst b/docs/source/advanced/hierarchy/provision/diskful_sn.rst index e882a50b1..552d0f39a 100644 --- a/docs/source/advanced/hierarchy/provision/diskful_sn.rst +++ b/docs/source/advanced/hierarchy/provision/diskful_sn.rst @@ -6,7 +6,7 @@ Diskful (Stateful) Installation Any cluster using statelite compute nodes must use a stateful (diskful) Service Nodes. -**Note:** All xCAT Service Nodes must be at the exact same xCAT version as the xCAT Management Node. +.. note:: All xCAT Service Nodes must be at the exact same xCAT version as the xCAT Management Node. Configure ``otherpkgdir`` and ``otherpkglist`` for service node osimage ----------------------------------------------------------------------- @@ -50,7 +50,7 @@ Configure ``otherpkgdir`` and ``otherpkglist`` for service node osimage xcat/xcat-dep/rh7/x86_64/perl-Net-Telnet xcat/xcat-dep/rh7/x86_64/perl-Expect -**Note:** you will be installing the xCAT Service Node rpm xCATsn meta-package on the Service Node, not the xCAT Management Node meta-package. Do not install both. +.. note:: You will be installing the xCAT Service Node RPM ``xCATsn`` on the Service Node, not the xCAT Management Node RPM. Do not install both. Update the rhels6 RPM repository (rhels6 only) ---------------------------------------------- @@ -87,7 +87,7 @@ Update the rhels6 RPM repository (rhels6 only) createrepo \ -g repodata /98462d05248098ef1724eddb2c0a127954aade64d4bb7d4e693cff32ab1e463c-comps-rhel6-Server.xml -**Note:** you should use ``comps-rhel6-Server.xml`` with its key as the group file. +.. note:: You should use ``comps-rhel6-Server.xml`` with its key as the group file. Install Service Nodes --------------------- @@ -109,12 +109,7 @@ Watch the installation progress using either wcons or rcons: :: rcons tail -f /var/log/messages -Note: We have experienced one problem while trying to install RHEL6 diskful -Service Node working with SAS disks. The Service Node cannot reboots from SAS -disk after the RHEL6 operating system has been installed. We are waiting for -the build with fixes from RHEL6 team, once meet this problem, you need to -manually select the SAS disk to be the first boot device and boots from the -SAS disk. +.. note:: We have experienced one problem while trying to install RHEL6 diskful Service Node working with SAS disks. The Service Node cannot reboots from SAS disk after the RHEL6 operating system has been installed. We are waiting for the build with fixes from RHEL6 team, once meet this problem, you need to manually select the SAS disk to be the first boot device and boots from the SAS disk. Update Service Node Diskful Image --------------------------------- diff --git a/docs/source/advanced/hierarchy/provision/diskless_sn.rst b/docs/source/advanced/hierarchy/provision/diskless_sn.rst index 95abb79e6..8825a1ad1 100644 --- a/docs/source/advanced/hierarchy/provision/diskless_sn.rst +++ b/docs/source/advanced/hierarchy/provision/diskless_sn.rst @@ -3,7 +3,7 @@ Diskless (Stateless) Installation ================================= -**Note: The stateless Service Node is not supported in ubuntu hierarchy cluster. For ubuntu, skip this section.** +.. note:: The stateless Service Node is not supported in Ubunti hierarchy cluster. For Ubunti, skip this section. If you want, your Service Nodes can be stateless (diskless). The Service Node must contain not only the OS, but also the xCAT software and its dependencies. @@ -56,7 +56,7 @@ When you run ``copycds``, xCAT will only create a Service Node stateful osimage postinstall rootimgdir - 1, Create the exlist, pkglist and otherpkglist file. +#. Create the exlist, pkglist and otherpkglist file. xCAT ships a basic requirements lists that will create a fully functional Service Node. However, you may want to customize your service node by adding additional operating system packages or modifying the files excluded by the exclude list. Check the below files to see if it meets your needs. :: @@ -95,9 +95,9 @@ When you run ``copycds``, xCAT will only create a Service Node stateful osimage xcat/xcat-dep/rh7/ppc64le/perl-Net-Telnet xcat/xcat-dep/rh7/ppc64le/perl-Expect - **Note:** you will be installing the xCAT Service Node rpm xCATsn meta-package on the Service Node, not the xCAT Management Node meta-package. Do not install both. +.. note:: You will be installing the xCAT Service Node RPM ``xCATsn`` on the Service Node, not the xCAT Management Node RPM. Do not install both. - 2, Create the postinstall script. +#. Create the postinstall script. xCAT ships a default postinstall script for stateless Service Node. You may also choose to create an appropriate /etc/fstab file in your Service Node image. : @@ -116,7 +116,7 @@ When you run ``copycds``, xCAT will only create a Service Node stateful osimage none /tmp tmpfs defaults,size=10m 0 2 none /var/tmp tmpfs defaults,size=10m 0 2 - 3, Modify the Service Node osimage definition with given attributes. +#. Modify the Service Node osimage definition with given attributes. :: diff --git a/docs/source/advanced/migration/migration.rst b/docs/source/advanced/migration/migration.rst index c93902f58..46d84c6af 100644 --- a/docs/source/advanced/migration/migration.rst +++ b/docs/source/advanced/migration/migration.rst @@ -26,7 +26,7 @@ Backup xCAT management node data to backup server: ~/.xcat /etc/xcat - **Notes**: backing up ``~/.xcat`` is for all users who have xCAT client certs. + .. note:: Backing up ``~/.xcat`` is for all users who have xCAT client certs. #. If there are customized files and directories for ``otherpkgdir``, ``pkgdir``, ``pkglist`` or ``template`` in some `osimage` definitions, backup these files and directories. for example: :: diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_partition.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_partition.rst index 39f523947..0efb5d793 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_partition.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_partition.rst @@ -3,10 +3,9 @@ By default, xCAT will install the operating system on the first disk and with default partitions layout in the node. However, you may choose to customize the disk partitioning during the install process and define a specific disk layout. You can do this in one of two ways: '**partition definition file**' or '**partition definition script**'. **Notes** +.. note:: ``partition definition file`` can be used for RedHat, SLES, and Ubuntu. Because disk configuraiton for Ubuntu is different from RedHat, there may be some special sections required for Ubuntu. -- 'Partition definition file' way can be used for RedHat, SLES and Ubuntu. -- 'partition definition script' way was tested only for RedHat and Ubuntu, use this feature on SLES at your own risk. -- Because disk configuration for ubuntu is different from RedHat, there maybe some section special for ubuntu. +.. warning:: ``partition definition script`` has only been tested on RedHat and Ubuntu, use at your own risk for SLES. .. END_Overview From 15493a4d0b72d24a4b75a234599980a5481686c2 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 9 May 2018 14:21:30 -0400 Subject: [PATCH 054/117] remove ipv6 section as there's no content in it --- docs/source/advanced/networks/index.rst | 1 - docs/source/advanced/networks/ipv6/index.rst | 7 ------- docs/source/advanced/networks/ipv6/ipv6_support.rst | 2 -- 3 files changed, 10 deletions(-) delete mode 100644 docs/source/advanced/networks/ipv6/index.rst delete mode 100644 docs/source/advanced/networks/ipv6/ipv6_support.rst diff --git a/docs/source/advanced/networks/index.rst b/docs/source/advanced/networks/index.rst index 83fe4c232..e75893567 100644 --- a/docs/source/advanced/networks/index.rst +++ b/docs/source/advanced/networks/index.rst @@ -8,4 +8,3 @@ Networking onie_switches/index.rst switchdiscover/index.rst infiniband/index.rst - ipv6/index.rst diff --git a/docs/source/advanced/networks/ipv6/index.rst b/docs/source/advanced/networks/ipv6/index.rst deleted file mode 100644 index 6e4c286a0..000000000 --- a/docs/source/advanced/networks/ipv6/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -IPv6 -==== - -.. toctree:: - :maxdepth: 2 - - ipv6_support.rst diff --git a/docs/source/advanced/networks/ipv6/ipv6_support.rst b/docs/source/advanced/networks/ipv6/ipv6_support.rst deleted file mode 100644 index dcd805c1f..000000000 --- a/docs/source/advanced/networks/ipv6/ipv6_support.rst +++ /dev/null @@ -1,2 +0,0 @@ -Configuring IPv6 -================ From 9d7354c03cba62973d753a513928a5fc4af154f0 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 9 May 2018 14:22:35 -0400 Subject: [PATCH 055/117] Add Admonitions tags for the Network advanced sections --- .../ethernet_switches/ethernet_switches.rst | 4 ++-- .../networks/infiniband/firmware_updates.rst | 8 ++++++-- .../infiniband/mlnxofed_ib_install_v2_diskless.rst | 13 ++++++++----- .../networks/infiniband/switch_configuration.rst | 13 +------------ .../networks/onie_switches/os_cumulus/install.rst | 2 +- .../networks/onie_switches/os_cumulus/manage.rst | 4 ++-- .../networks/onie_switches/os_cumulus/upgrade.rst | 4 ++-- docs/source/advanced/networks/vlan/vlan.rst | 4 ++-- 8 files changed, 24 insertions(+), 28 deletions(-) diff --git a/docs/source/advanced/networks/ethernet_switches/ethernet_switches.rst b/docs/source/advanced/networks/ethernet_switches/ethernet_switches.rst index 946a02362..905baba92 100644 --- a/docs/source/advanced/networks/ethernet_switches/ethernet_switches.rst +++ b/docs/source/advanced/networks/ethernet_switches/ethernet_switches.rst @@ -71,7 +71,7 @@ Running Remote Commands in Parallel You can use xdsh to run parallel commands on Ethernet switches. The following shows how to configure xCAT to run xdsh on the switches: -**[Note]**:Configure the switch to allow **ssh** or **telnet**. This varies for switch to switch. Refer to the switch command references to find out how to do it. +.. note:: For this to work, configure the switch to allow **ssh** or **telnet**. The procedure varies from switch to switch, consult the reference guides for your switch to find out how to do this. Add the switch in xCAT DB. Refer to the "Discovering Switches" section if you want xCAT to discover and define the switches for you. :: @@ -97,7 +97,7 @@ Set the ssh or telnet username an d password. :: xdsh bntc125 --devicetype EthSwitch::BNT "enable;configure terminal;vlan 3;end;show vlan" -Note that you can run multiple switch commands, they are separated by comma. +.. note:: You can run multiple switch commands, each command is comma separated. Also note that --devicetype is used here. xCAT supports the following switch types out of the box: :: diff --git a/docs/source/advanced/networks/infiniband/firmware_updates.rst b/docs/source/advanced/networks/infiniband/firmware_updates.rst index e3d5f6c59..aaec19b64 100644 --- a/docs/source/advanced/networks/infiniband/firmware_updates.rst +++ b/docs/source/advanced/networks/infiniband/firmware_updates.rst @@ -21,7 +21,11 @@ Burn new firmware on each ibaX: :: mstflint -d 0002:01:00.0 -i b -Note: if this is a PureFlex MezzanineP adapter then you must select the correct image for each ibaX device. Note the difference in the firmware image at end of filename: _0.bin (iba0/iba2) & _1.bin (iba1/iba3) +.. note:: If this is a PureFlex MezzanineP adapter, you must select the correct image for each ibaX device. + + The difference in the firmware image at the end of the file name: + * _0.bin (iba0/iba2) + * _1.bin (iba1/iba3) Verify download successful: :: @@ -31,7 +35,7 @@ Activate the new firmware: :: reboot the image -Note: the above 0002:01:00.0 device location was used as an example only. it is not meant to imply that there is only one device location or that your device will have the same device location. +.. note:: The above ``0002:01:00.0`` device location is used as an example only. Validate your device location using the ``lspci`` command. Mellanox Switch Firmware Upgrade -------------------------------- diff --git a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst index 06b1064d7..0db52fb4e 100644 --- a/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst +++ b/docs/source/advanced/networks/infiniband/mlnxofed_ib_install_v2_diskless.rst @@ -26,13 +26,16 @@ Diskless Installation /install/postscripts/mlnxofed_ib_install \ -p /install// -i $1 -n genimage - *Note: The $1 is a argument that is passed to the the postinstall script at runtime.* + .. note:: The ``$1`` is a argument that is passed to the the postinstall script at runtime. - **[kernel mismatch issue]** The Mellanox OFED ISO is built against a series of specific kernel version. If the version of the linux kernel does not match any of the Mellanox offered pre-built kernel modules, you can pass the ``--add-kernel-support --without-32bit --without-fw-update --force`` arguments to the Mellanox installation script to build the kernel modules based on the version you are using. :: + .. tip:: **Kernel Mismatch** + + The Mellanox OFED ISO is built against a series of specific kernel version. If the version of the linux kernel being used does not match any of the pre-built kernels, pass ``--add-kernel-support --without-32bit --without-fw-update --force`` to the Mellanox installation script to build the kernel modules based on the kernel you are using. Example: :: + + /install/postscripts/mlnxofed_ib_install \ + -p /install// -m --add-kernel-support --without-32bit --without-fw-update --force -end- \ + -i $1 -n genimage - /install/postscripts/mlnxofed_ib_install \ - -p /install// -m --add-kernel-support --without-32bit --without-fw-update --force -end- \ - -i $1 -n genimage #. Generate the diskless image diff --git a/docs/source/advanced/networks/infiniband/switch_configuration.rst b/docs/source/advanced/networks/infiniband/switch_configuration.rst index ab6bdf5ae..bdb647741 100644 --- a/docs/source/advanced/networks/infiniband/switch_configuration.rst +++ b/docs/source/advanced/networks/infiniband/switch_configuration.rst @@ -50,18 +50,7 @@ Then run the following: :: rspconfig mswitch sshcfg=enable -**[Note]** For Mellanox switch in manufacturing defaults status, the user need to answer 'no' for the initial configuration wizard prompt as follows before run 'rspconfig'. :: - - [s1mn][/](/)> ssh -l admin mswitch - Mellanox MLNX-OS Switch Management - Password: - Last login: Wed Feb 20 20:09:50 2013 from 1.2.3.4 - Mellanox Switch - Mellanox configuration wizard - Do you want to use the wizard for initial configuration? **no** - To return to the wizard from the CLI, enter the "configuration jump-start" - command from configure mode. Launching CLI... - switch-xxxxxx [standalone: unknown] > exit +.. warning:: For Mellanox switch in manufacturing defaults, the user may need to log in once and answer **no** to the configuration wizard as ``rspconfig`` will fail when prompted against the wizard. Setup syslog on the Switch -------------------------- diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst index bd1be9f69..8e40e0007 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/install.rst @@ -4,7 +4,7 @@ Installation and Configuration Cumulus OS Installtion ---------------------- -**Note:** *The following assumes that the physical switches have power and have obtained a DHCP IP address from the xCAT open range.* +.. important:: The following assumes that the physical switches have power and have obtained a DHCP IP address from the xCAT open range. xCAT provides support for detecting and installing the Cumulus Linux OS into ONIE enabled switches by utilizing DHCP to detect "**onie_vendor**" from the ``vendor-class-identifier`` string and then send it the Cumulus Linux OS installer. diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst index 31986c698..232cbe9bf 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst @@ -32,7 +32,7 @@ xCAT will look for files in the above directory in the following order: 2. file name that matches the switch group name 3. file name that has the word 'default' - Note: If the postscript cannot find a configuration file on the MN, it will set all ports on the switch to be part of VLAN 1. + .. note:: If the postscript cannot find a configuration file on the MN, it will set all ports on the switch to be part of VLAN 1. Execute the script using the following command: :: @@ -44,7 +44,7 @@ Re-install OS There may be occasions where a re-install of the Cumulus Linux OS is required. The following commands can be used to invoke the install: -**Note:** Assumption that the Cumulus Linux files are on the xCAT MN in the correct place. +.. important:: This assumes that the Cumulus Linux files are on the xCAT MN in the correct place. * **Using xCAT**, ``xdsh`` can invoke the reinstall of the OS: :: diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/upgrade.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/upgrade.rst index ff125998e..fdbae9844 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/upgrade.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/upgrade.rst @@ -8,7 +8,7 @@ Full Install Perform a full install from the ``.bin`` file of the new Cumulus Linux OS version, using ONIE. -**Note:** Make sure you back up all your data and configuration files as the binary install will erase all previous configuration. +.. important:: Make sure you back up all your data and configuration files as the binary install will erase all previous configuration. #. Place the binary image under ``/install`` on the xCAT MN node. @@ -22,7 +22,7 @@ Perform a full install from the ``.bin`` file of the new Cumulus Linux OS versio xdsh switch1 "/usr/cumulus/bin/onie-install -a -f -i \ http://172.21.253.37/install/onie/cumulus-linux-3.4.1.bin && reboot" - **Note:** The full upgrade process may run 30 minutes or longer. + .. attention:: The full upgrade process may run 30 minutes or longer. #. After upgrading, the license should be installed, see :ref:`Activate the License ` for details. diff --git a/docs/source/advanced/networks/vlan/vlan.rst b/docs/source/advanced/networks/vlan/vlan.rst index 813f2fc60..927d5d177 100644 --- a/docs/source/advanced/networks/vlan/vlan.rst +++ b/docs/source/advanced/networks/vlan/vlan.rst @@ -53,7 +53,7 @@ For example: :: This means port 42 of switch1 is connected to port 50 of switch2. And switch1 can be accessed using SNMP version 3 and switch 2 can be accessed using SNMP version 2. -Note: The **username** and the **password** on the switches table are NOT the same as SSH user name and password. You have to configure SNMP on the switch for these parameters and then fill up this table. Use **tabdump switches -d** command to find out the meaning of each column. +.. note:: The **username** and the **password** on the switches table are NOT the same as SSH user name and password. You have to configure SNMP on the switch for these parameters and then fill up this table. Use **tabdump switches -d** command to find out the meaning of each column. **2. Populate the switch table** @@ -148,7 +148,7 @@ For xCAT-vlan 2.7.5 and later versions, you can create vlans for other networks. A tagged vlan will be created for the network that is on eth1 for node1, node2 and node3. For KVM clients, -i specifies the interface name on the KVM host that the vlan will be tagged on. If -i is omitted, the management networks will be assumed. -Note: After the vlan is created, the nodes can still be accessed by the mn using the management network. You can use **lsvan** command to list all the vlans. +.. note:: After the vlan is created, the nodes can still be accessed by the mn using the management network. You can use **lsvan** command to list all the vlans. For example: :: From 54207c982b17eee969dfcca78f738804e19e68bf Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 10 May 2018 01:22:46 -0400 Subject: [PATCH 056/117] add a case to support regex for makehosts --- xCAT-test/autotest/testcase/makehosts/cases0 | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xCAT-test/autotest/testcase/makehosts/cases0 b/xCAT-test/autotest/testcase/makehosts/cases0 index 3a2a504ac..94520062e 100644 --- a/xCAT-test/autotest/testcase/makehosts/cases0 +++ b/xCAT-test/autotest/testcase/makehosts/cases0 @@ -171,3 +171,27 @@ cmd:if [ -e /tmp/s01r1b01.standa ]; then rmdef s01r1b01; cat /tmp/s01r1b01.stand check:rc==0 cmd:mv -f /etc/hosts.xcatbakautotest /etc/hosts end + +start:makehosts_regex +description:this case is to test if makehosts support regex. This case is for bug 2578. +cmd:cp /etc/hosts /etc/hosts.bak +cmd:if lsdef -z sn4b;then lsdef -z sn4b|tee /tmp/sn4bdef;noderm sn4b;fi +cmd:if lsdef -t group -z regextest;then lsdef -t group -z regextest |tee /tmp/regextestdef;rmdef -t group -o regextest;fi +cmd:if grep sn4b /etc/hosts;then sed -i '/sn4b/d' /etc/hosts;fi +check:rc==0 +cmd:mkdef -t node sn4b groups=compute +check:rc==0 +cmd:mkdef -t group regextest ip="|\D+(\d+)\D+|20.80.1.($1*2+103)|" members=sn4b nichostnamesuffixes.eth0=-eth0 nicips.eth0="|\D+(\d+)\D+|10.80.1.($1*2+103)|" nicnetworks.eth0=10_0_0_0-255_0_0_0 +check:rc==0 +cmd:lsdef -t group regex +check:rc==0 +cmd:makehosts sn4b +check:rc==0 +cmd:sn4bip=`lsdef sn4b |grep -w ip|awk -F= '{print $2}'`;grep $sn4bip /etc/hosts +check:rc==0 +cmd:sn4beth0ip=`lsdef sn4b |grep -w nicips.eth0|awk -F= '{print $2}'`;grep $sn4beth0ip /etc/hosts +check:rc==0 +cmd:cp -f /etc/hosts.bak /etc/hosts +cmd:noderm sn4b;if [ -e /tmp/sn4bdef ]; then cat /tmp/sn4bdef |mkdef -z;fi +cmd:rmdef -t group -o regextest;if [ -e /tmp/regextestdef ]; then cat /tmp/regextestdef |mkdef -z;fi +end From cea795309d0c7acecd6a0f79ac855ff28627a5b2 Mon Sep 17 00:00:00 2001 From: yangsbj Date: Thu, 10 May 2018 02:10:37 -0400 Subject: [PATCH 057/117] add iputils into compute.sles11.pkglist --- xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist index 8787c0177..dbc8d638d 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist @@ -20,3 +20,4 @@ ntp gzip tar xz +iputils From 582168e31eb6cc1d0488ae9d247a0ebb9e63faf6 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 10 May 2018 01:59:05 -0400 Subject: [PATCH 058/117] modify ipmi rsp check to support openbmc ipmi interface --- xCAT-server/lib/perl/xCAT/IPMI.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index 4b444ac48..51367fce2 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -679,9 +679,14 @@ sub handle_ipmi_packet { if ($rsp[5] & 0b10000000) { $encrypted = 1; } + +#------------------------modified to support openbmc ipmi command---------------- unless ($rsp[5] & 0b01000000) { - return 3; #we refuse to examine unauthenticated packets in this context + if ($self->{max_privilege} != 0) { + return 3; #we refuse to examine unauthenticated packets in this context + } } + splice(@rsp, 0, 4); #ditch the rmcp header my @authcode = splice(@rsp, -12); #strip away authcode and remember it my @expectedcode = unpack("C*", hmac_sha1(pack("C*", @rsp), $self->{k1})); @@ -763,10 +768,13 @@ sub got_rmcp_response { return 9; } $byte = shift @data; - unless ($byte >= 4) { + + # add $byte == 0 to support openbmc ipmi command + unless ($byte >= 4 or $byte == 0) { $self->{onlogon}->("ERROR: Cannot acquire sufficient privilege", $self->{onlogon_args}); return 9; } + $self->{max_privilege} = $byte if ($byte == 0); splice @data, 0, 5; $self->{pendingsessionid} = [ splice @data, 0, 4 ]; From 2bf5dc57f9da2b72e80106026dd13f71774ff476 Mon Sep 17 00:00:00 2001 From: yangsong Date: Thu, 10 May 2018 16:26:42 +0800 Subject: [PATCH 059/117] [CUSTOMER] Ping not working for non root users on Diskless PowerKVM guests (rhels7.2) #922: use tar as the default archive method instead of cpio (#5187) --- docs/source/guides/admin-guides/references/man1/packimage.1.rst | 2 +- xCAT-client/pods/man1/packimage.1.pod | 2 +- xCAT-server/lib/xcat/plugins/packimage.pm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index f7f1ff332..c01796d46 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -53,7 +53,7 @@ OPTIONS \ **-v**\ Command Version. -\ **-m| -**\ **-method**\ Archive Method (cpio,tar,squashfs, default is cpio) +\ **-m| -**\ **-method**\ Archive Method (cpio,tar,squashfs, default is tar) \ **-c| -**\ **-compress**\ Compress Method (pigz,gzip,xz, default is pigz/gzip) diff --git a/xCAT-client/pods/man1/packimage.1.pod b/xCAT-client/pods/man1/packimage.1.pod index 5b2b2a837..36b0f8f1f 100644 --- a/xCAT-client/pods/man1/packimage.1.pod +++ b/xCAT-client/pods/man1/packimage.1.pod @@ -27,7 +27,7 @@ B<-h> Display usage message. B<-v> Command Version. -B<-m| --method> Archive Method (cpio,tar,squashfs, default is cpio) +B<-m| --method> Archive Method (cpio,tar,squashfs, default is tar) B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index f12bda2cf..db5d157dc 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -89,7 +89,7 @@ sub process_request { my $osver; my $arch; my $profile; - my $method = 'cpio'; + my $method = 'tar'; my $compress; my $exlistloc; my $syncfile; From 5db248d14eaf77f1205cdec6c921ad11104e4fa0 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 10 May 2018 04:34:09 -0400 Subject: [PATCH 060/117] Force chain to be standby if only runcmd/ondiscover is specified for chain attribute --- xCAT-server/lib/xcat/plugins/destiny.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 3cc38c86c..6890a63bc 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -848,6 +848,10 @@ sub nextdestiny { } unless ($ref->{currchain}) { #If no current chain, copy the default $ref->{currchain} = $ref->{chain}; + } else { + if ($ref->{currstate} and ($ref->{currstate} eq $ref->{currchain})) { + $ref->{currchain} = 'standby'; + } } my @chain = split /[,;]/, $ref->{currchain}; From 326144f92e1e29e6633063e52bac3b1f46c1b3f2 Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Thu, 10 May 2018 17:30:00 +0800 Subject: [PATCH 061/117] Further modification for adding test case for 922 (#5193) --- .../installation/reg_linux_statelite_installation_flat | 6 ++---- .../reg_linux_statelite_installation_hierarchy_by_nfs | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index a3d62e710..54d600128 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -51,6 +51,8 @@ check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 +cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser +check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 @@ -85,12 +87,8 @@ check:rc!=0 cmd:xdsh $$CN "ls -l /bin/ping" cmd:xdsh $$CN "ping -c 1 127.0.0.1" check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 27e0b4439..90d929feb 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -69,6 +69,8 @@ check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 +cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser +check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:prsync /install $$SN:/ @@ -105,12 +107,8 @@ check:rc!=0 cmd:xdsh $$CN "ls -l /bin/ping" cmd:xdsh $$CN "ping -c 1 127.0.0.1" check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 From a545ff791a2f932b0da17badeca02b73f56412f5 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 10 May 2018 09:53:34 -0400 Subject: [PATCH 062/117] Update performance.rst Updated rspconfig and reventlog support in 2.14 --- .../coral/cluster_mgmt/scalability/python/performance.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/references/coral/cluster_mgmt/scalability/python/performance.rst b/docs/source/references/coral/cluster_mgmt/scalability/python/performance.rst index bb76a413a..35a01be28 100644 --- a/docs/source/references/coral/cluster_mgmt/scalability/python/performance.rst +++ b/docs/source/references/coral/cluster_mgmt/scalability/python/performance.rst @@ -15,7 +15,7 @@ The following commands are currently supported: +----------------+-----------+-------------+----------------------------------+ | rbeacon | Yes | 2.13.11 | | +----------------+-----------+-------------+----------------------------------+ -| rspconfig | No | | | +| rspconfig | No | 2.14 | | +----------------+-----------+-------------+----------------------------------+ | rsetboot | Yes | 2.13.11 | | +----------------+-----------+-------------+----------------------------------+ @@ -23,7 +23,7 @@ The following commands are currently supported: +----------------+-----------+-------------+----------------------------------+ | rflash | No | | | +----------------+-----------+-------------+----------------------------------+ -| reventlog | No | | | +| reventlog | No | 2.14 | | +----------------+-----------+-------------+----------------------------------+ From 1f401f395238431bcd81544e1515e4d8bfb7dd4c Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 11 May 2018 03:50:25 -0400 Subject: [PATCH 063/117] Refine the PR in case ondiscover=xxx can not be fully set to currstate --- xCAT-server/lib/xcat/plugins/destiny.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 6890a63bc..69c233ebf 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -848,9 +848,10 @@ sub nextdestiny { } unless ($ref->{currchain}) { #If no current chain, copy the default $ref->{currchain} = $ref->{chain}; - } else { - if ($ref->{currstate} and ($ref->{currstate} eq $ref->{currchain})) { + } elsif ($ref->{currchain} !~ /[,;]/){ + if ($ref->{currstate} and ($ref->{currchain} =~ /$ref->{currstate}/)) { $ref->{currchain} = 'standby'; + $callnodeset = 0; } } my @chain = split /[,;]/, $ref->{currchain}; From b7a9b74bbc2064b7fbda5eb2c0b3530bb3e69685 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 11 May 2018 04:59:43 -0400 Subject: [PATCH 064/117] fix a typo --- xCAT-test/autotest/testcase/makehosts/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/makehosts/cases0 b/xCAT-test/autotest/testcase/makehosts/cases0 index 94520062e..b0387aedd 100644 --- a/xCAT-test/autotest/testcase/makehosts/cases0 +++ b/xCAT-test/autotest/testcase/makehosts/cases0 @@ -183,7 +183,7 @@ cmd:mkdef -t node sn4b groups=compute check:rc==0 cmd:mkdef -t group regextest ip="|\D+(\d+)\D+|20.80.1.($1*2+103)|" members=sn4b nichostnamesuffixes.eth0=-eth0 nicips.eth0="|\D+(\d+)\D+|10.80.1.($1*2+103)|" nicnetworks.eth0=10_0_0_0-255_0_0_0 check:rc==0 -cmd:lsdef -t group regex +cmd:lsdef -t group regextest check:rc==0 cmd:makehosts sn4b check:rc==0 From c1f7362ecf68e1b105e485b95e2e62348d0e9ac3 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Fri, 11 May 2018 18:18:42 +0800 Subject: [PATCH 065/117] Fix 5178, update document for performance tunning (#5199) --- .../source/advanced/performance_tuning/linux_os_tuning.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/advanced/performance_tuning/linux_os_tuning.rst b/docs/source/advanced/performance_tuning/linux_os_tuning.rst index 315c83e36..331d140c0 100644 --- a/docs/source/advanced/performance_tuning/linux_os_tuning.rst +++ b/docs/source/advanced/performance_tuning/linux_os_tuning.rst @@ -9,13 +9,13 @@ Adjusting Operating System tunables can improve large scale cluster performance, The open file limits are important to high concurrence network services, such as ``xcatd``. For a large cluster, it is required to increase the number of open file limit to avoid **Too many open files** error. The default value is *1024* in most OS distributions, to add below configuration in ``/etc/security/limits.conf`` to increase to *14096*. :: - * soft nofiles 14096 - * hard nofiles 14096 + * soft nofile 14096 + * hard nofile 14096 #. Tuning Network kernel parameters: - There might be hundreds of hosts in a big network for large cluster, tuning the network kernel parameters for optimum throughput and latency could improve the performance of distributed application. For example, adding below configuration in ``/etc/sysctl.conf`` to increase the buffer. + There might be hundreds of hosts in a big network for large cluster, tuning the network kernel parameters for optimum throughput and latency could improve the performance of distributed application. For example, adding below configuration in ``/etc/sysctl.conf`` to increase the buffer size and queue length of **xCAT SSL listener** service access point ( port **3001** ). :: @@ -23,6 +23,7 @@ Adjusting Operating System tunables can improve large scale cluster performance, net.core.wmem_max = 33554432 net.core.rmem_default = 65536 net.core.wmem_default = 65536 + net.core.somaxconn = 8192 net.ipv4.tcp_rmem = 4096 33554432 33554432 net.ipv4.tcp_wmem = 4096 33554432 33554432 From 69695baf540bf536285b4d6077fd71d22d5507a9 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 11 May 2018 10:15:07 -0400 Subject: [PATCH 066/117] OpenBMC rinv multiple options --- .../agent/hwctl/executor/openbmc_inventory.py | 64 +++++++++++++++---- .../lib/python/agent/hwctl/inventory.py | 4 +- .../lib/python/agent/xcatagent/openbmc.py | 38 ++++++++--- xCAT-server/lib/xcat/plugins/openbmc2.pm | 17 +++-- 4 files changed, 97 insertions(+), 26 deletions(-) diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py index aa863951b..3061a4814 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_inventory.py @@ -74,18 +74,47 @@ class OpenBMCInventoryTask(ParallelNodesCommand): return firm_info - def get_info(self, inventory_type, **kw): + def get_info(self, inventory_types, **kw): node = kw['node'] obmc = openbmc.OpenBMCRest(name=node, nodeinfo=kw['nodeinfo'], messager=self.callback, debugmode=self.debugmode, verbose=self.verbose) inventory_info = [] + + # inventory_types contains an array of different inventories to get + # Go through the array and set flags to optimize invnetory calls + model_or_serial = 0 + cpu_or_dimm = 0 + all = 0 + inventory_type = 'all' + for type in inventory_types: + if type == 'model' or type == 'serial': + # For model and serial we can make a single call + model_or_serial = 1 + if type == 'cpu' or type == 'dimm': + # For cpu and dimm we can make a single call + cpu_or_dimm = 1 + if type == 'all': + all = 1 + if all == 1: + inventory_type = 'all' + elif model_or_serial == 1 and cpu_or_dimm == 1: + # Both model_or_serial and cpu_or_dimm were set, might as well ask for all + inventory_type = 'all' + elif model_or_serial == 1: + inventory_type = 'model' + elif cpu_or_dimm == 1: + inventory_type = 'cpu' + try: obmc.login() + # Extract the data from the BMC inventory_info_dict = obmc.get_inventory_info(inventory_type) - if inventory_type == 'all' or not inventory_type: + # Process returned inventory_info_dict depending on the inventory requested + if all == 1: + # Everything gets displayed, even firmware keys = inventory_info_dict.keys() keys.sort() for key in keys: @@ -95,17 +124,28 @@ class OpenBMCInventoryTask(ParallelNodesCommand): firm_info = self._get_firm_info(firm_dict_list) inventory_info += firm_info - elif inventory_type == 'model' or inventory_type == 'serial': - key = 'Model' if inventory_type == 'model' else 'SerialNumber' - if 'SYSTEM' in inventory_info_dict: - for system_info in inventory_info_dict['SYSTEM']: - if key in system_info: - inventory_info = [system_info] - break else: - key = inventory_type.upper() - if key in inventory_info_dict: - inventory_info = utils.sort_string_with_numbers(inventory_info_dict[key]) + if model_or_serial == 1: + # Model or serial was requested + for one_inventory_type in inventory_types: + if one_inventory_type == 'model': + key = 'Model' + elif one_inventory_type == 'serial': + key = 'SerialNumber' + else: + continue + + if 'SYSTEM' in inventory_info_dict: + for system_info in inventory_info_dict['SYSTEM']: + if key in system_info: + inventory_info += [system_info] + break + if cpu_or_dimm: + # cpu or dimm was requested + for one_inventory_type in inventory_types: + key = one_inventory_type.upper() + if key in inventory_info_dict: + inventory_info += utils.sort_string_with_numbers(inventory_info_dict[key]) if not inventory_info: inventory_info = ['No attributes returned from the BMC.'] diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/inventory.py b/xCAT-openbmc-py/lib/python/agent/hwctl/inventory.py index 9709f1659..041c29b93 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/inventory.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/inventory.py @@ -10,10 +10,10 @@ class InventoryInterface(object): interface_type = 'inventory' version = '1.0' - def get_inventory_info(self, task, inventory_type=None): + def get_inventory_info(self, task, inventory_type=[]): """Return the inventory info of the task's nodes. - :param inventory_type: type of inventory info want to get. + :param inventory_type: array of type of inventory info want to get. :param task: a Task instance containing the nodes to act on. :return inventory info list """ diff --git a/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py b/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py index 850e0b8b2..c6a64288f 100644 --- a/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py +++ b/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py @@ -223,9 +223,16 @@ class OpenBMCManager(base.BaseManager): if not args or (len(args) == 1 and args[0] in ['-V', '--verbose']): args.append('all') + # We are not using a standard Python options (with - or --) because + # of that, we need to specify multiple identical choices. If only + # one optional choice is specified - [all|cpu|dimm|firm|model|serial] + # only one option at a time is allowed. + # If specified - [all][cpu][dimm][firm][model][serial], then multiple + # options are accepted, but they are required to be ordered, + # e.g "cpu dimm" will work, but not "dimm cpu" rinv_usage = """ Usage: - rinv [-V|--verbose] [all|cpu|dimm|firm|model|serial] + rinv [-V|--verbose] [all|cpu|dimm|firm|model|serial] [all|cpu|dimm|firm|model|serial] [all|cpu|dimm|firm|model|serial] [all|cpu|dimm|firm|model|serial] [all|cpu|dimm|firm|model|serial] Options: -V --verbose rinv verbose mode. @@ -235,22 +242,37 @@ class OpenBMCManager(base.BaseManager): opts = docopt(rinv_usage, argv=args) self.verbose = opts.pop('--verbose') - action = [k for k,v in opts.items() if v][0] + actions = [k for k,v in opts.items() if v] except Exception as e: self.messager.error("Failed to parse arguments for rinv: %s" % args) return # 2, validate the args - if action not in INVENTORY_OPTIONS: - self.messager.error("Not supported subcommand for rinv: %s" % action) - return + run_firmware_inventory = 0 + run_other_inventory = 0 + for action in actions: + # Check if each action is valid + if action not in INVENTORY_OPTIONS: + self.messager.error("Not supported subcommand for rinv: %s" % action) + return + else: + # Valid action, set flags for which calls to make later + if action == 'all': + run_firmware_inventory = 0 + run_other_inventory = 1 + break # get all inventory, nothing else matters + elif action == 'firm': + run_firmware_inventory = 1 + else: + run_other_inventory = 1 # 3, run the subcommands runner = OpenBMCInventoryTask(nodesinfo, callback=self.messager, debugmode=self.debugmode, verbose=self.verbose) - if action == 'firm': + if run_firmware_inventory == 1: DefaultInventoryManager().get_firm_info(runner) - else: - DefaultInventoryManager().get_inventory_info(runner, action) + actions.remove('firm') # Remove element from actions array + if run_other_inventory == 1: + DefaultInventoryManager().get_inventory_info(runner, actions) def rpower(self, nodesinfo, args): diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index 84b952049..4326d485b 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -177,7 +177,7 @@ sub parse_args { return ([ 1, "Error parsing arguments." ]); } - if (scalar(@ARGV) >= 2 and ($command =~ /rbeacon|rinv|rpower|rvitals/)) { + if (scalar(@ARGV) >= 2 and ($command =~ /rbeacon|rpower|rvitals/)) { return ([ 1, "Only one option is supported at the same time for $command" ]); } elsif (scalar(@ARGV) == 0 and $command =~ /rbeacon|rspconfig|rpower|rflash/) { return ([ 1, "No option specified for $command" ]); @@ -238,9 +238,18 @@ sub parse_args { return ([ 1, "Invalid option specified with '-l|--list'."]) if (@ARGV); } } elsif ($command eq "rinv") { - $subcommand = "all" if (!defined($ARGV[0])); - unless ($subcommand =~ /^all$|^cpu$|^dimm$|^firm$|^model$|^serial$/) { - return ([ 1, "Unsupported command: $command $subcommand" ]); + if (!defined($ARGV[0])) { + $subcommand = "all"; + } else { + foreach my $each_subcommand (@ARGV) { + # Check if each passed subcommand is valid + if ($each_subcommand =~ /^all$|^cpu$|^dimm$|^firm$|^model$|^serial$/) { + $subcommand .= $each_subcommand . " "; + } else { + # Exit once we find an invalid subcommand + return ([ 1, "Unsupported command: $command $each_subcommand" ]); + } + } } } elsif ($command eq "rpower") { unless ($subcommand =~ /^on$|^off$|^softoff$|^reset$|^boot$|^bmcreboot$|^bmcstate$|^status$|^stat$|^state$/) { From 566142a02d53f091a892438c18520c4d9cb53061 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 11 May 2018 10:40:07 -0400 Subject: [PATCH 067/117] Doc changes for OpenBMC rinv multiple options --- docs/source/guides/admin-guides/references/man1/rinv.1.rst | 2 +- perl-xCAT/xCAT/Usage.pm | 2 +- xCAT-client/pods/man1/rinv.1.pod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rinv.1.rst b/docs/source/guides/admin-guides/references/man1/rinv.1.rst index d760fc576..4f28900ab 100644 --- a/docs/source/guides/admin-guides/references/man1/rinv.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rinv.1.rst @@ -39,7 +39,7 @@ OpenPOWER (OpenBMC) server specific: ==================================== -\ **rinv**\ \ *noderange*\ [\ **model | serial | firm | cpu | dimm | all**\ ] [\ **-V | -**\ **-verbose**\ ] +\ **rinv**\ \ *noderange*\ [\ **model**\ ][\ **serial**\ ][\ **firm**\ ][\ **cpu**\ ][\ **dimm**\ ][\ **all**\ ] [\ **-V | -**\ **-verbose**\ ] PPC (with HMC) specific: diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 3abcf53b2..f6105b63b 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -136,7 +136,7 @@ my %usage = ( ", "rinv.openbmc" => "OpenPOWER (OpenBMC) server specific: - rinv [model|serial|firm|cpu|dimm|all] [-V|--verbose] + rinv [model][serial][firm][cpu][dimm][all] [-V|--verbose] ", "rinv.end" => "PPC specific(with HMC): diff --git a/xCAT-client/pods/man1/rinv.1.pod b/xCAT-client/pods/man1/rinv.1.pod index 52ed22ccc..661f067f5 100644 --- a/xCAT-client/pods/man1/rinv.1.pod +++ b/xCAT-client/pods/man1/rinv.1.pod @@ -16,7 +16,7 @@ B I [B|B|B|B|B|B|B I [B|B|B|B|B|B] [B<-V>|B<--verbose>] +B I [B][B][B][B][B][B] [B<-V>|B<--verbose>] =head2 PPC (with HMC) specific: From a103115064eca772c3d74b0a79f1cecafe5b24ca Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 14 May 2018 04:14:02 -0400 Subject: [PATCH 068/117] update cases for issue 5198 --- xCAT-test/autotest/testcase/packimg/cases0 | 8 ++++---- xCAT-test/autotest/testcase/rmimage/case0 | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index d8f8f7c2d..22463b2c4 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -20,18 +20,18 @@ end start:packimage_imagename os:Linux -description: +description:check if packimage could work fine with image name cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /rootimg.tar.gz.bak;fi cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute;ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz check:rc==0 -cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg diff --git a/xCAT-test/autotest/testcase/rmimage/case0 b/xCAT-test/autotest/testcase/rmimage/case0 index a5f1ea566..1b0e7ebf2 100644 --- a/xCAT-test/autotest/testcase/rmimage/case0 +++ b/xCAT-test/autotest/testcase/rmimage/case0 @@ -7,7 +7,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:cp -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/;cp -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz check:rc==0 cmd:rmimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -15,7 +15,7 @@ check:output=~Removing directory /install/netboot/__GETNODEATTR($$CN,os)__/__GET check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/kernel check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/initrd-stateless.gz check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/initrd-statelite.gz -check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz check:output=~Removing directory /tftpboot/xcat/osimage/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:output=~Image files have been removed successfully from this management node. From c1d3636f6b7ca7f5d0eec41c04cd7f6ca360dcfd Mon Sep 17 00:00:00 2001 From: root Date: Mon, 14 May 2018 21:50:34 -0400 Subject: [PATCH 069/117] Modify case bmcdiscover_range_w to cover boston server --- xCAT-test/autotest/testcase/bmcdiscover/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/bmcdiscover/cases0 b/xCAT-test/autotest/testcase/bmcdiscover/cases0 index da035e3d1..277956211 100644 --- a/xCAT-test/autotest/testcase/bmcdiscover/cases0 +++ b/xCAT-test/autotest/testcase/bmcdiscover/cases0 @@ -64,7 +64,7 @@ start:bmcdiscover_range_w cmd:bmcdiscover --range $$bmcrange -u $$bmcusername -p $$bmcpasswd -w check:rc==0 check:output=~Writing node -check:output=~$$bmcrange,\w*,\w*,$$bmcusername,$$bmcpasswd +check:output=~$$bmcrange,.+,.+,$$bmcusername,$$bmcpasswd end start:bmcdiscover_range_z From 6bc2d8d51eff1dc9d926cd3a815f76adbd08ab8b Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 14 May 2018 22:30:42 -0400 Subject: [PATCH 070/117] Fix ERR message when running ondiscover in the chain table --- xCAT-server/lib/xcat/plugins/destiny.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 69c233ebf..5381e98d7 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -185,6 +185,11 @@ sub setdestiny { $state = $stents{$_}->[0]->{currstate}; $state =~ s/ .*//; + #skip the node if state=ondiscover + if ($state eq 'ondiscover') { + next; + } + #get the osimagename if nodetype.provmethod has osimage specified #use it for both sninit and genesis operating if (($state eq 'install') || ($state eq 'netboot') || ($state eq 'statelite')) { From e5a9580766fa0c3633b65dcf7fefd2e33f867c1a Mon Sep 17 00:00:00 2001 From: huweihua Date: Mon, 14 May 2018 22:32:02 -0400 Subject: [PATCH 071/117] test change commit user name, please ignore --- xCAT-test/autotest/testcase/bmcdiscover/cases0 | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/bmcdiscover/cases0 b/xCAT-test/autotest/testcase/bmcdiscover/cases0 index 277956211..2e47ca3b6 100644 --- a/xCAT-test/autotest/testcase/bmcdiscover/cases0 +++ b/xCAT-test/autotest/testcase/bmcdiscover/cases0 @@ -67,6 +67,7 @@ check:output=~Writing node check:output=~$$bmcrange,.+,.+,$$bmcusername,$$bmcpasswd end + start:bmcdiscover_range_z cmd:bmcdiscover --range $$bmcrange -u $$bmcusername -p $$bmcpasswd -z check:rc==0 From d6dcd640fc9ab7f81db3efdf3d321f46f4bf68eb Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 14 May 2018 23:32:23 -0400 Subject: [PATCH 072/117] update according to comments --- xCAT-test/autotest/testcase/packimg/cases0 | 4 +++- xCAT-test/autotest/testcase/rmimage/case0 | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index 22463b2c4..7655d5733 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -29,7 +29,9 @@ cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/c check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute;ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz check:rc==0 cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz diff --git a/xCAT-test/autotest/testcase/rmimage/case0 b/xCAT-test/autotest/testcase/rmimage/case0 index 1b0e7ebf2..47c455aaa 100644 --- a/xCAT-test/autotest/testcase/rmimage/case0 +++ b/xCAT-test/autotest/testcase/rmimage/case0 @@ -7,7 +7,9 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/;cp -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/ +check:rc==0 +cmd:cp -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz check:rc==0 cmd:rmimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 From c5342b7fc6053c3a58172620bb607f04d24bbd55 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 15 May 2018 02:37:28 -0400 Subject: [PATCH 073/117] Prefer HWE netboot where available in Ubuntu (#5195) --- xCAT-server/lib/xcat/plugins/debian.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index eb0281b4e..7fde6382a 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -786,6 +786,11 @@ sub mkinstall { ( ($arch =~ /x86/ and ( + (-r "$pkgdir/install/hwe-netboot/ubuntu-installer/$darch/linux" + and $kernpath = "$pkgdir/hwe-install/netboot/ubuntu-installer/$darch/linux" + and -r "$pkgdir/install/hwe-netboot/ubuntu-installer/$darch/initrd.gz" + and $initrdpath = "$pkgdir/install/hwe-netboot/ubuntu-installer/$darch/initrd.gz" + ) or (-r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux" and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux" and -r "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz" From 0fb441b820ab51a49226171eaa047fa30402ccf8 Mon Sep 17 00:00:00 2001 From: xuweibj Date: Tue, 15 May 2018 18:12:35 +0800 Subject: [PATCH 074/117] fix issue for using waitpid for openbmc perl (#5208) --- xCAT-server/lib/xcat/plugins/openbmc.pm | 42 +++++++++++++++---------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index d33fa192e..e6cdb8533 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -953,8 +953,8 @@ sub process_request { while (1) { last if ($child_num == 0 and !@nodes_login); - my $cpid; - while (($cpid = waitpid(-1, WNOHANG)) > 0) { + my $cpid = waitpid(-1, WNOHANG); + if ($cpid > 0) { if ($login_pid_node{$cpid}) { $child_num--; my $node = $login_pid_node{$cpid}; @@ -964,7 +964,12 @@ sub process_request { } delete $login_pid_node{$cpid}; } + } elsif ($cpid == 0) { + select(undef, undef, undef, 0.01); + } elsif ($cpid < 0 and !@nodes_login) { + last; } + if (@nodes_login) { if ($child_num < $max_child_num) { my $node = shift @nodes_login; @@ -1073,23 +1078,26 @@ rmdir \"/tmp/\$userid\" \n"; while (my ($response, $handle_id) = $async->wait_for_next_response) { deal_with_response($handle_id, $response); } - while ((my $cpid = waitpid(-1, WNOHANG)) > 0) { - if ($child_node_map{$cpid}) { - my $node = $child_node_map{$cpid}; - my $rc = $? >> 8; - if ($rc != 0) { - $wait_node_num--; - } else { - if ($status_info{ $node_info{$node}{cur_status} }->{process}) { - $status_info{ $node_info{$node}{cur_status} }->{process}->($node, undef); - } else { - xCAT::SvrUtils::sendmsg([1,"Internal error, check the process handler for current status " - .$node_info{$node}{cur_status}."."], $callback, $node); - $wait_node_num--; - } + if (%child_node_map) { + while ((my $cpid = waitpid(-1, WNOHANG)) > 0) { + if ($child_node_map{$cpid}) { + my $node = $child_node_map{$cpid}; + my $rc = $? >> 8; + if ($rc != 0) { + $wait_node_num--; + } else { + if ($status_info{ $node_info{$node}{cur_status} }->{process}) { + $status_info{ $node_info{$node}{cur_status} }->{process}->($node, undef); + } else { + xCAT::SvrUtils::sendmsg([1,"Internal error, check the process handler for current status " + .$node_info{$node}{cur_status}."."], $callback, $node); + $wait_node_num--; + } + + } + delete $child_node_map{$cpid}; } - delete $child_node_map{$cpid}; } } my @del; From f0f4929e6be172f7fee08623add3b72d8b80b96d Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 15 May 2018 15:20:59 -0400 Subject: [PATCH 075/117] Display only OpenBMC usage --- perl-xCAT/xCAT/Usage.pm | 3 --- xCAT-server/lib/xcat/plugins/openbmc2.pm | 8 +++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 3abcf53b2..608f8db77 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -618,7 +618,6 @@ $usage{"rspconfig.openbmc"} = $usage{"rspconfig.common"} . $usage{"rinv"} = $usage{"rinv.common"} . $usage{"rinv.begin"} . $usage{"rinv.openbmc"} . - " " . $usage{"rinv.end"}; $usage{"rinv.openbmc"} = $usage{"rinv.common"} . @@ -634,7 +633,6 @@ $usage{"rbeacon.openbmc"} = $usage{"rbeacon.common"} . $usage{"rvitals"} = $usage{"rvitals.common"} . $usage{"rvitals.begin"} . $usage{"rvitals.openbmc"} . - " " . $usage{"rvitals.end"}; $usage{"rvitals.openbmc"} = $usage{"rvitals.common"} . @@ -652,7 +650,6 @@ $usage{"rflash.openbmc"} = $usage{"rflash.common"} . $usage{"rpower"} = $usage{"rpower.common"} . $usage{"rpower.begin"} . $usage{"rpower.openbmc"} . - " " . $usage{"rpower.end"}; $usage{"rpower.openbmc"} = $usage{"rpower.common"} . diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index 84b952049..4525c0acb 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -73,8 +73,14 @@ sub preprocess_request { if (ref($extrargs)) { @exargs = @$extrargs; } - my $usage_string = xCAT::Usage->parseCommand($command, @exargs); + # Request usage for openbmc sections only + my $usage_string = xCAT::Usage->parseCommand($command . ".openbmc", @exargs); + if ($usage_string) { + if ($usage_string =~ /cannot be found/) { + # Could not find usage for openbmc section, try getting usage for all sections + $usage_string = xCAT::Usage->parseCommand($command, @exargs); + } $callback->({ data => [$usage_string] }); $request = {}; return; From 3ed1ad70f923d70f6f7f442a8013da930bc4d7b9 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 16 May 2018 02:26:19 -0400 Subject: [PATCH 076/117] update case for issue 4855, to compare the output of perl vs python for bmcstate when bmc reboots --- .../testcase/UT_openbmc/scripts/bmcreboot.sh | 62 +++++++++++++++++++ xCAT-test/autotest/testcase/rpower/cases0 | 32 ++++++++++ 2 files changed, 94 insertions(+) create mode 100755 xCAT-test/autotest/testcase/UT_openbmc/scripts/bmcreboot.sh diff --git a/xCAT-test/autotest/testcase/UT_openbmc/scripts/bmcreboot.sh b/xCAT-test/autotest/testcase/UT_openbmc/scripts/bmcreboot.sh new file mode 100755 index 000000000..214aae1ed --- /dev/null +++ b/xCAT-test/autotest/testcase/UT_openbmc/scripts/bmcreboot.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +if [[ -z ${1} ]]; then + echo "Provide the name of the node as the first argument of this script" + exit 1 +fi +NODE=${1} + +if [[ -z ${2} ]]; then + echo "Provide the name of the log file as the second argument of this script" + exit 1 +fi +LOGFILE=$2 + +if [[ -z ${3} ]]; then + echo "Provide either PERL or PYTHON as the third argument of this script" + exit 1 +fi + +if [[ ${3} == "PERL" ]]; then + echo "Running the test in PERL" + unset XCAT_OPENBMC_PYTHON +elif [[ ${3} == "PYTHON" ]]; then + echo "Running the test in PYTHON" + export XCAT_OPENBMC_PYTHON=YES +else + echo "UNKNOWN SELECTED!" + exit 1 +fi + +ITERATIONS=20 +SLEEP_TIME=2 + +# Turn off debug mode.... +# +chdef -t site clustersite xcatdebugmode= + +# Create a new log file +date > $LOGFILE + +rpower $NODE bmcstate + +# Reboot the bmc +rpower $NODE bmcreboot | tee -a $LOGFILE 2>&1 + +counter=1 +ready_cnt=0 +while [[ $counter -le $ITERATIONS ]]; do + sleep $SLEEP_TIME + RC=`rpower $NODE bmcstate >> $LOGFILE 2>&1 ; echo $?` + echo "Count: $counter, RC: $RC" + ((counter++)) + if [[ $RC == 0 ]]; then + ((ready_cnt++)) + if [[ $ready_cnd > 2 ]]; then + echo "Leaving loop...." + break + fi + fi +done + +echo "All done!" diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index 19ec464ae..e0fd45c74 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -180,3 +180,35 @@ cmd:rpower $$CN ddd check:output=~Error: Unsupported command: rpower ddd check:rc==1 end + +start:rpower_bmcreboot_perl_python_output +description:record the output for rpower bmcreboot and compare the output for perl and python version. +hcp:openbmc +cmd: /opt/xcat/share/xcat/tools/autotest/testcase/UT_openbmc/scripts/bmcreboot.sh $$CN /tmp/xcattest.rpower.bmcstate.perl.out PERL +check:rc==0 +cmd: grep "Login to BMC failed: 500" /tmp/xcattest.rpower.bmcstate.perl.out | sort | uniq | wc -l +check:output=~3 +cmd: grep "timeout" /tmp/xcattest.rpower.bmcstate.perl.out | sort | uniq | wc -l +check:output=~1 +cmd: grep "No route to host" /tmp/xcattest.rpower.bmcstate.perl.out | sort | uniq | wc -l +check:output=~1 +cmd: grep "BMC NotReady" /tmp/xcattest.rpower.bmcstate.perl.out | sort | uniq | wc -l +check:output=~1 +cmd: grep "BMC Ready" /tmp/xcattest.rpower.bmcstate.perl.out | sort | uniq | wc -l +check:output=~1 +cmd: cat /tmp/xcattest.rpower.bmcstate.perl.out +cmd: /opt/xcat/share/xcat/tools/autotest/testcase/UT_openbmc/scripts/bmcreboot.sh $$CN /tmp/xcattest.rpower.bmcstate.python.out PYTHON +check:rc==0 +cmd: grep "Login to BMC failed: 500" /tmp/xcattest.rpower.bmcstate.python.out | sort | uniq | wc -l +check:output=~3 +cmd: grep "timeout" /tmp/xcattest.rpower.bmcstate.python.out | sort | uniq | wc -l +check:output=~1 +cmd: grep "No route to host" /tmp/xcattest.rpower.bmcstate.python.out | sort | uniq | wc -l +check:output=~1 +cmd: grep "BMC NotReady" /tmp/xcattest.rpower.bmcstate.python.out | sort | uniq | wc -l +check:output=~1 +cmd: grep "BMC Ready" /tmp/xcattest.rpower.bmcstate.python.out | sort | uniq | wc -l +check:output=~1 +cmd: cat /tmp/xcattest.rpower.bmcstate.python.out +cmd:rm -rf /tmp/xcattest.rpower.bmcstate.perl.out /tmp/xcattest.rpower.bmcstate.python.out +end From 63d523e3f5afe2fc363f0ccf8d2a1a7c0548abeb Mon Sep 17 00:00:00 2001 From: huweihua Date: Wed, 16 May 2018 03:15:07 -0400 Subject: [PATCH 077/117] remove non-root user test from statlite provision --- .../reg_linux_statelite_installation_flat | 32 +++++++++---------- ...ux_statelite_installation_hierarchy_by_nfs | 14 ++++---- ...tatelite_installation_hierarchy_by_ramdisk | 18 +++++------ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index 54d600128..80253c043 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -51,8 +51,8 @@ check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser -check:rc==0 +#cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser +#check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 @@ -84,11 +84,11 @@ cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" check:rc!=0 #add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 +#cmd:xdsh $$CN "ls -l /bin/ping" +#cmd:xdsh $$CN "ping -c 1 127.0.0.1" +#check:rc==0 +#cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +#check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 @@ -130,15 +130,15 @@ check:rc==0 check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" #add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 +#cmd:xdsh $$CN "ls -l /bin/ping" +#cmd:xdsh $$CN "ping -c 1 127.0.0.1" +#check:rc==0 +#cmd:xdsh $$CN "useradd -m xcatuser" +#check:rc==0 +#cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +#check:rc==0 +#cmd:xdsh $$CN "userdel xcatuser" +#check:rc==0 cmd:rm -rf /tmp/image;mkdir /tmp/image check:rc==0 cmd:imgexport __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute /tmp/image/image.tgz diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 90d929feb..41b49728d 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -69,8 +69,8 @@ check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser -check:rc==0 +#cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser +##check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:prsync /install $$SN:/ @@ -104,11 +104,11 @@ cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" check:rc!=0 #add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 +#cmd:xdsh $$CN "ls -l /bin/ping" +#cmd:xdsh $$CN "ping -c 1 127.0.0.1" +#check:rc==0 +#cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +#check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index 8c335a5c9..ccf4d48f5 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -94,15 +94,15 @@ check:rc==0 check:output=~$$CN: $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" #add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 +#cmd:xdsh $$CN "ls -l /bin/ping" +#cmd:xdsh $$CN "ping -c 1 127.0.0.1" +#check:rc==0 +#cmd:xdsh $$CN "useradd -m xcatuser" +#check:rc==0 +#cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +#check:rc==0 +#cmd:xdsh $$CN "userdel xcatuser" +#check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 end From c656f7f7fcf5a7cc6de090c37875cabcdf1f9c24 Mon Sep 17 00:00:00 2001 From: tingtli Date: Wed, 16 May 2018 15:52:21 +0800 Subject: [PATCH 078/117] update a case for cumulus switch osimage support (#5168) * update a case for cumulus switch osimage support * update according to comments * fix a typo --- xCAT-test/autotest/testcase/nodeset/cases0 | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index ef8f97e6b..9ff89525c 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -450,3 +450,26 @@ cmd:rmdef -t osimage -o "rhels7.99-ppc64le-install-compute" cmd:rm -rf /install/rhels7.99 cmd:xdsh $$SN 'rm -rf /install/rhels7.99' end + +start:nodeset_switch_osimage +description: This case is to verify if xcat supports nodeset osimage command for cumulus switch. This case is for bug 5126. +os:Linux +cmd:copycds $$CUMULUSOS |tee /tmp/cumulusimage +check:rc==0 +cmd:grep "The image" /tmp/cumulusimage |sed -r 's/.*\image(.*)\is.*/\1/' |tee /tmp/imagename +check:rc==0 +cmd:imagename=`cat /tmp/imagename`;lsdef -t osimage -o $imagename +check:rc==0 +check:output=~description=Cumulus Linux +check:output=~osarch=armel +check:output=~osname=cumulus +cmd:imagename=`cat /tmp/imagename`;pkgfile=`lsdef -t osimage -o $imagename |grep pkgdir|awk -F= '{print $2}'`;ls -l $pkgfile +check:rc==0 +cmd:echo "/etc/resolv.conf /etc/nsswitch.conf -> ($$CN) /tmp/\n /etc/rsyslog.conf -> /tmp/aa\n /etc/rsyslog.d/ -> /tmp/bb/\n /tmp/post1 -> /tmp/\n\n EXECUTEALWAYS:\n/tmp/post1\n" >> /tmp/synclists;echo "#!/bin/sh\n\nmv /tmp/aa /tmp/mm" >> /tmp/posts1;imagename=`cat /tmp/imagename`; chdef -t osimage -o $imagename synclists=/tmp/synclists +check:rc==0 +cmd:imagename=`cat /tmp/imagename`;nodeset $$CN osimage=$imagename +check:rc==0 +check:output=~$$CN:\s*install +cmd:imagename=`cat /tmp/imagename`;osversion=`lsdef -t osimage -o $imagename |grep osvers|awk -F= '{print $2}'`;versionnum=`echo $osversion |sed 's:[a-zA-Z]::g'`;grep -w -A10 "$$CN" /var/lib/dhcpd/dhcpd.leases | grep "/install/$osversion/armel/cumulus-linux-$versionnum-bcm-armel.bin" +check:rc==0 +end From c7af2c30c8cd3cc89e2b774b4d1704f713d6f96e Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 16 May 2018 14:43:25 -0400 Subject: [PATCH 079/117] the error message of *def command is disordered when running internally --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 44 ++++++++++++-------- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 4 +- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index e590a779a..75ebbdf7b 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -4555,17 +4555,19 @@ sub defmk_usage $rsp->{data}->[3] = " [-o object-names] [-z|--stanza ]"; $rsp->{data}->[4] = " [-d | --dynamic] [-w attr==val [-w attr=~val] ...]"; $rsp->{data}->[5] = " [-f | --force] [noderange] [attr=val [attr=val...]]"; - $rsp->{data}->[6] = "\nThe following data object types are supported by xCAT.\n"; - my $n = 6; + $rsp->{data}->[6] = "\nThe following data object types are supported by xCAT:\n"; + my $n = 7; + my $dataobj; foreach my $t (sort(keys %{xCAT::Schema::defspec})) { - $rsp->{data}->[$n] = "$t"; - $n++; + $dataobj = $dataobj . ' ' . $t; } + $rsp->{data}->[$n] = "$dataobj\n"; + $n++; $rsp->{data}->[$n] = "\nUse the \'-h\' option together with the \'-t\' option to"; $n++; - $rsp->{data}->[$n] = "get a list of valid attribute names for each object type.\n"; + $rsp->{data}->[$n] = " get a list of valid attribute names for each object type.\n"; xCAT::MsgUtils->message("I", $rsp, $::callback); return 0; } @@ -4596,17 +4598,19 @@ sub defch_usage $rsp->{data}->[3] = " chdef [-V | --verbose] [-t object-types] [-o object-names] [-d | --dynamic]"; $rsp->{data}->[4] = " [-z | --stanza] [-m | --minus] [-p | --plus]"; $rsp->{data}->[5] = " [-w attr==val [-w attr=~val] ... ] [noderange] [attr=val [attr=val...]]\n"; - $rsp->{data}->[6] = "\nThe following data object types are supported by xCAT.\n"; + $rsp->{data}->[6] = "\nThe following data object types are supported by xCAT:\n"; my $n = 7; + my $dataobj; foreach my $t (sort(keys %{xCAT::Schema::defspec})) { - $rsp->{data}->[$n] = "$t"; - $n++; + $dataobj = $dataobj . ' ' . $t; } + $rsp->{data}->[$n] = "$dataobj\n"; + $n++; $rsp->{data}->[$n] = "\nUse the \'-h\' option together with the \'-t\' option to"; $n++; - $rsp->{data}->[$n] = "get a list of valid attribute names for each object type.\n"; + $rsp->{data}->[$n] = " get a list of valid attribute names for each object type.\n"; xCAT::MsgUtils->message("I", $rsp, $::callback); return 0; } @@ -4638,17 +4642,19 @@ sub defls_usage $rsp->{data}->[4] = " lsdef [-V | --verbose] [-t object-types] [-o object-names]"; $rsp->{data}->[5] = " [ -l | --long] [-s | --short] [-a | --all] [-z | --stanza ] [-S]"; $rsp->{data}->[6] = " [-i attr-list] [-w attr==val [-w attr=~val] ...] [noderange]\n"; - $rsp->{data}->[7] = "\nThe following data object types are supported by xCAT.\n"; - my $n = 6; + $rsp->{data}->[7] = "\nThe following data object types are supported by xCAT:\n"; + my $n = 8; + my $dataobj; foreach my $t (sort(keys %{xCAT::Schema::defspec})) { - $rsp->{data}->[$n] = "$t"; - $n++; + $dataobj = $dataobj . ' ' . $t; } + $rsp->{data}->[$n] = "$dataobj\n"; + $n++; $rsp->{data}->[$n] = "\nUse the \'-h\' option together with the \'-t\' option to"; $n++; - $rsp->{data}->[$n] = "get a list of valid attribute names for each object type.\n"; + $rsp->{data}->[$n] = " get a list of valid attribute names for each object type.\n"; xCAT::MsgUtils->message("I", $rsp, $::callback); return 0; } @@ -4677,17 +4683,19 @@ sub defrm_usage $rsp->{data}->[1] = " rmdef [-h | --help ] [-t object-types]\n"; $rsp->{data}->[2] = " rmdef [-V | --verbose] [-t object-types] [-a | --all] [-f | --force]"; $rsp->{data}->[3] = " [-o object-names] [-C | --cleanup] [noderange]\n"; - $rsp->{data}->[4] = "\nThe following data object types are supported by xCAT.\n"; + $rsp->{data}->[4] = "\nThe following data object types are supported by xCAT:\n"; my $n = 5; + my $dataobj; foreach my $t (sort(keys %{xCAT::Schema::defspec})) { - $rsp->{data}->[$n] = "$t"; - $n++; + $dataobj = $dataobj . ' ' . $t; } + $rsp->{data}->[$n] = "$dataobj\n"; + $n++; $rsp->{data}->[$n] = "\nUse the \'-h\' option together with the \'-t\' option to"; $n++; - $rsp->{data}->[$n] = "get a list of valid attribute names for each object type.\n"; + $rsp->{data}->[$n] = " get a list of valid attribute names for each object type.\n"; xCAT::MsgUtils->message("I", $rsp, $::callback); return 0; } diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 2d840dc70..d4ebeedb6 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -819,10 +819,10 @@ sub write_to_xcatdb { "bmcusername=$bmcuser", "bmcpassword=$bmcpass", "nodetype=$nodetype", "servicenode=$sn", "conserver=$conserver", "hwtype=$hwtype", "groups=all" ] }, - $request_command, 0, 1); + $request_command, -1, 1); if ($::RUNCMD_RC != 0) { my $rsp = {}; - push @{ $rsp->{data} }, "create or modify node is failed.\n"; + push @{ $rsp->{data} }, "Failed to run chdef command for node=$node\n"; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); return 2; } From 6064ed46193a2fbe1b93d728695dfe77e4cc57d7 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Thu, 17 May 2018 10:28:15 +0800 Subject: [PATCH 080/117] fix 5200 do not restart_ib_driver_service by default (#5219) * do not restart openibd by default * polished --- xCAT/postscripts/configib | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index f714ec478..d21046d66 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -94,17 +94,28 @@ else ib_driver="openibd" fi +restart_ib_driver=0 #make changes to the confiuration file if [ $PLTFRM == "Linux" ] then if [ -f "/etc/rdma/rdma.conf" ] then + md5f1=$(md5sum /etc/rdma/rdma.conf |cut -d' ' -f1) TMP1=`sed "s/SDP_LOAD=yes/SDP_LOAD=no/g" /etc/rdma/rdma.conf` echo "$TMP1" > /etc/rdma/rdma.conf + md5f2=$(md5sum /etc/rdma/rdma.conf |cut -d' ' -f1) + if [ "$md5f2" != "$md5f1" ]; then + restart_ib_driver=1 + fi elif [ -f "/etc/infiniband/openib.conf" ] then + md5f1=$(md5sum /etc/infiniband/openib.conf |cut -d' ' -f1) TMP1=`sed "s/SDP_LOAD=yes/SDP_LOAD=no/g" /etc/infiniband/openib.conf` echo "$TMP1" > /etc/infiniband/openib.conf + md5f2=$(md5sum /etc/infiniband/openib.conf |cut -d' ' -f1) + if [ "$md5f2" != "$md5f1" ]; then + restart_ib_driver=1 + fi fi if [ -f "/etc/modprobe.conf" ] @@ -667,7 +678,11 @@ done # end for nic if [ $PLTFRM == "Linux" ] then #/sbin/service $ib_driver restart - restartservice $ib_driver + if [ "$restart_ib_driver" = "1" ]; then + echo "restart $ib_driver service" + logger -p local4.info -t xcat "restart $ib_driver service" + restartservice $ib_driver + fi for nic in `echo "$goodnics" | tr "," "\n"|sort -u` do sleep 5 From df8ae5bd9adb4a78bd678cdf9f2173afefc389d6 Mon Sep 17 00:00:00 2001 From: huweihua Date: Wed, 16 May 2018 23:11:04 -0400 Subject: [PATCH 081/117] Revert "Further modification for adding test case for 922 (#5193)" This reverts commit 326144f92e1e29e6633063e52bac3b1f46c1b3f2. --- .../installation/reg_linux_statelite_installation_flat | 6 ++++-- .../reg_linux_statelite_installation_hierarchy_by_nfs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index 54d600128..a3d62e710 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -51,8 +51,6 @@ check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser -check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 @@ -87,8 +85,12 @@ check:rc!=0 cmd:xdsh $$CN "ls -l /bin/ping" cmd:xdsh $$CN "ping -c 1 127.0.0.1" check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 90d929feb..27e0b4439 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -69,8 +69,6 @@ check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser -check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:prsync /install $$SN:/ @@ -107,8 +105,12 @@ check:rc!=0 cmd:xdsh $$CN "ls -l /bin/ping" cmd:xdsh $$CN "ping -c 1 127.0.0.1" check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 From 4763f1b6b27112f1477890167fe364f38d31ffc9 Mon Sep 17 00:00:00 2001 From: huweihua Date: Wed, 16 May 2018 23:11:26 -0400 Subject: [PATCH 082/117] Revert "add test for issue 922 (#5179)" This reverts commit 21a138502a14efbc9debd8ab591fadc315ca0160. --- .../reg_linux_diskfull_installation_flat | 10 ---------- .../reg_linux_diskfull_installation_hierarchy | 10 ---------- .../reg_linux_diskless_installation_flat | 10 ---------- .../reg_linux_diskless_installation_hierarchy | 10 ---------- .../reg_linux_statelite_installation_flat | 20 ------------------- ...ux_statelite_installation_hierarchy_by_nfs | 10 ---------- ...tatelite_installation_hierarchy_by_ramdisk | 10 ---------- 7 files changed, 80 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index a7efa1b19..be95f5d86 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -71,16 +71,6 @@ check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /test.synclist" check:rc==0 -#add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /tmp/test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists= end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index c9b3a9a45..a21b71002 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -68,16 +68,6 @@ check:rc==0 cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /test.synclist" check:rc==0 -#add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists= end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index 1dc6fdc8a..6fde471d5 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -72,16 +72,6 @@ check:rc==0 cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /test.synclist" check:rc==0 -#add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index 585a76a21..d846fca5a 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -73,16 +73,6 @@ cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,ar check:rc==0 cmd:xdsh $$CN "cat /test.synclist" check:rc==0 -#add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index a3d62e710..de1331b54 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -81,16 +81,6 @@ check:output=~$$CN: $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" check:rc!=0 -#add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 @@ -131,16 +121,6 @@ cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" -#add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:rm -rf /tmp/image;mkdir /tmp/image check:rc==0 cmd:imgexport __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute /tmp/image/image.tgz diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 27e0b4439..802491f64 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -101,16 +101,6 @@ check:output=~$$CN: $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" check:rc!=0 -#add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index 8c335a5c9..c61e15ac2 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -93,16 +93,6 @@ cmd:xdsh $$CN hostname check:rc==0 check:output=~$$CN: $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" -#add test for issue922 -cmd:xdsh $$CN "ls -l /bin/ping" -cmd:xdsh $$CN "ping -c 1 127.0.0.1" -check:rc==0 -cmd:xdsh $$CN "useradd -m xcatuser" -check:rc==0 -cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -check:rc==0 -cmd:xdsh $$CN "userdel xcatuser" -check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 end From 18232f39175d923c5c22fd05841aeefe5884f0ed Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Thu, 17 May 2018 11:20:39 +0800 Subject: [PATCH 083/117] Revert "Remove non-root user test from statelite provision" (#5222) --- .../reg_linux_statelite_installation_flat | 32 +++++++++---------- ...ux_statelite_installation_hierarchy_by_nfs | 14 ++++---- ...tatelite_installation_hierarchy_by_ramdisk | 18 +++++------ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index 80253c043..54d600128 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -51,8 +51,8 @@ check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -#cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser -#check:rc==0 +cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser +check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 @@ -84,11 +84,11 @@ cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" check:rc!=0 #add test for issue922 -#cmd:xdsh $$CN "ls -l /bin/ping" -#cmd:xdsh $$CN "ping -c 1 127.0.0.1" -#check:rc==0 -#cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -#check:rc==0 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 @@ -130,15 +130,15 @@ check:rc==0 check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" #add test for issue922 -#cmd:xdsh $$CN "ls -l /bin/ping" -#cmd:xdsh $$CN "ping -c 1 127.0.0.1" -#check:rc==0 -#cmd:xdsh $$CN "useradd -m xcatuser" -#check:rc==0 -#cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -#check:rc==0 -#cmd:xdsh $$CN "userdel xcatuser" -#check:rc==0 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:rm -rf /tmp/image;mkdir /tmp/image check:rc==0 cmd:imgexport __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute /tmp/image/image.tgz diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 41b49728d..90d929feb 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -69,8 +69,8 @@ check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -#cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser -##check:rc==0 +cmd:rootimagedir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -i rootimgdir -c|awk -F"=" '{print $2}'`; chroot $rootimagedir/rootimg useradd xcatuser +check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:prsync /install $$SN:/ @@ -104,11 +104,11 @@ cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" check:rc!=0 #add test for issue922 -#cmd:xdsh $$CN "ls -l /bin/ping" -#cmd:xdsh $$CN "ping -c 1 127.0.0.1" -#check:rc==0 -#cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -#check:rc==0 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index ccf4d48f5..8c335a5c9 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -94,15 +94,15 @@ check:rc==0 check:output=~$$CN: $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" #add test for issue922 -#cmd:xdsh $$CN "ls -l /bin/ping" -#cmd:xdsh $$CN "ping -c 1 127.0.0.1" -#check:rc==0 -#cmd:xdsh $$CN "useradd -m xcatuser" -#check:rc==0 -#cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" -#check:rc==0 -#cmd:xdsh $$CN "userdel xcatuser" -#check:rc==0 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 end From 668a00bd71724e30990307b3e87ee5c4596f1a24 Mon Sep 17 00:00:00 2001 From: yangsong Date: Thu, 17 May 2018 11:20:55 +0800 Subject: [PATCH 084/117] Revert "[CUSTOMER] Ping not working for non root users on Diskless PowerKVM guests (rhels7.2) #922: use tar as the default archive method instead of cpio (#5187)" (#5221) This reverts commit 2bf5dc57f9da2b72e80106026dd13f71774ff476. --- docs/source/guides/admin-guides/references/man1/packimage.1.rst | 2 +- xCAT-client/pods/man1/packimage.1.pod | 2 +- xCAT-server/lib/xcat/plugins/packimage.pm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index c01796d46..f7f1ff332 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -53,7 +53,7 @@ OPTIONS \ **-v**\ Command Version. -\ **-m| -**\ **-method**\ Archive Method (cpio,tar,squashfs, default is tar) +\ **-m| -**\ **-method**\ Archive Method (cpio,tar,squashfs, default is cpio) \ **-c| -**\ **-compress**\ Compress Method (pigz,gzip,xz, default is pigz/gzip) diff --git a/xCAT-client/pods/man1/packimage.1.pod b/xCAT-client/pods/man1/packimage.1.pod index 36b0f8f1f..5b2b2a837 100644 --- a/xCAT-client/pods/man1/packimage.1.pod +++ b/xCAT-client/pods/man1/packimage.1.pod @@ -27,7 +27,7 @@ B<-h> Display usage message. B<-v> Command Version. -B<-m| --method> Archive Method (cpio,tar,squashfs, default is tar) +B<-m| --method> Archive Method (cpio,tar,squashfs, default is cpio) B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index db5d157dc..f12bda2cf 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -89,7 +89,7 @@ sub process_request { my $osver; my $arch; my $profile; - my $method = 'tar'; + my $method = 'cpio'; my $compress; my $exlistloc; my $syncfile; From cff503cc820fc06f462577ddb425ace448cce9bf Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Thu, 17 May 2018 14:22:55 +0800 Subject: [PATCH 085/117] Revert "update cases for issue 5198" --- xCAT-test/autotest/testcase/packimg/cases0 | 10 ++++------ xCAT-test/autotest/testcase/rmimage/case0 | 6 ++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index 7655d5733..d8f8f7c2d 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -20,20 +20,18 @@ end start:packimage_imagename os:Linux -description:check if packimage could work fine with image name +description: cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /rootimg.tar.gz.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz -check:rc==0 -cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg diff --git a/xCAT-test/autotest/testcase/rmimage/case0 b/xCAT-test/autotest/testcase/rmimage/case0 index 47c455aaa..a5f1ea566 100644 --- a/xCAT-test/autotest/testcase/rmimage/case0 +++ b/xCAT-test/autotest/testcase/rmimage/case0 @@ -7,9 +7,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/ -check:rc==0 -cmd:cp -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:cp -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz check:rc==0 cmd:rmimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -17,7 +15,7 @@ check:output=~Removing directory /install/netboot/__GETNODEATTR($$CN,os)__/__GET check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/kernel check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/initrd-stateless.gz check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/initrd-statelite.gz -check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz check:output=~Removing file /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz check:output=~Removing directory /tftpboot/xcat/osimage/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:output=~Image files have been removed successfully from this management node. From eaa784e1e40aba954f263e3a19a87d5de6ff3822 Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Thu, 17 May 2018 16:38:32 +0800 Subject: [PATCH 086/117] Add non-root user check for diskless provision (#5225) --- xCAT-test/autotest/testcase/packimg/cases0 | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index d8f8f7c2d..5aa73c626 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -214,6 +214,16 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 check:output=~on / type tmpfs +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz @@ -254,6 +264,16 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 check:output=~on / type tmpfs +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz @@ -294,6 +314,16 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 check:output=~on / type tmpfs +#add test for issue922 +cmd:xdsh $$CN "ls -l /bin/ping" +cmd:xdsh $$CN "ping -c 1 127.0.0.1" +check:rc==0 +cmd:xdsh $$CN "useradd -m xcatuser" +check:rc==0 +cmd:xdsh $$CN "su - xcatuser sh -c \"ping -c 1 127.0.0.1\"" +check:rc==0 +cmd:xdsh $$CN "userdel xcatuser" +check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz From 55581cb2db3cc8b518bb255ecbda0af3ca89c08e Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 17 May 2018 15:04:53 -0400 Subject: [PATCH 087/117] Modify output message for PDU outlet state --- xCAT-server/lib/xcat/plugins/openbmc.pm | 8 +++++++ xCAT-server/lib/xcat/plugins/openbmc2.pm | 8 +++++++ xCAT-server/lib/xcat/plugins/pdu.pm | 27 ++++++++++++++++++------ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index e6cdb8533..7841afcde 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -803,6 +803,14 @@ sub preprocess_request { return; } + #pdu commands will be handled in the pdu plugin + if ($command eq "rpower") { + my $subcmd = $exargs[0]; + if(($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat') || ($subcmd eq 'pdureset')){ + return; + } + } + my $parse_result = parse_args($command, $extrargs, $noderange); if (ref($parse_result) eq 'ARRAY') { my $error_data; diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index cae8d1363..524c0b634 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -86,6 +86,14 @@ sub preprocess_request { return; } + #pdu commands will be handled in the pdu plugin + if ($command eq "rpower") { + my $subcmd = $exargs[0]; + if(($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat') || ($subcmd eq 'pdureset')){ + return; + } + } + my $parse_result = parse_args($command, $extrargs, $noderange); if (ref($parse_result) eq 'ARRAY') { my $error_data; diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 5d7857991..e5d0798bf 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -404,7 +404,7 @@ sub powerpduoutlet { if ($session->{ErrorStr}) { $callback->({ errorcode => [1],error => "$node: $pdu outlet $outlet has error = $session->{ErrorStr}"}); } else { - $output = "$pdu outlet $outlet is $statstr"; + $output = "$pdu operational state for outlet $outlet is $statstr"; xCAT::SvrUtils::sendmsg($output, $callback, $node, %allerrornodes); } } @@ -508,7 +508,7 @@ sub powerstat { for (my $outlet =1; $outlet <= $count; $outlet++) { my $statstr = outletstat($session, $outlet); - my $msg = " outlet $outlet is $statstr"; + my $msg = " operational state for the outlet $outlet is $statstr"; xCAT::SvrUtils::sendmsg($msg, $callback, $pdu, %allerrornodes); } } @@ -519,6 +519,13 @@ sub powerstat { =head3 outletstat Process command to query status of one pdu outlet + ibmPduOutletState defined from mib file + off(0) + on(1) + cycling(2) + delaySwitch10(3) + delaySwitch30(4) + delaySwitch60(5) =cut @@ -535,12 +542,20 @@ sub outletstat { } $output = $session->get("$oid.$outlet"); - if ($output eq 1) { - $statstr = "on"; - } elsif ($output eq 0) { + if ($output eq 0) { $statstr = "off"; + } elsif ($output eq 1) { + $statstr = "on"; + } elsif ($output eq 2) { + $statstr = "cycling"; + } elsif ($output eq 3) { + $statstr = "delaySwitch10"; + } elsif ($output eq 4) { + $statstr = "delaySwitch30"; + } elsif ($output eq 5) { + $statstr = "delaySwitch60"; } else { - return; + $statstr = "$output(unknown state)" ; } return $statstr; } From 7eec13c1c88c9527eed91eec3c3f5cdfc24acd07 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Fri, 18 May 2018 10:19:15 +0800 Subject: [PATCH 088/117] add litefile notes for non-root user (#5203) * add litefile notes for non-root user * polished --- .../manage_clusters/ppc64le/statelite/config_statelite.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst index 0e66ab76d..1d70c52fd 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/statelite/config_statelite.rst @@ -33,7 +33,7 @@ The litefile table specifies the directories and files on the statelite nodes th Currently, xCAT does not handle the relative links very well. The relative links are commonly used by the system libraries, for example, under ``/lib/`` directory, there will be one relative link matching one ``.so`` file. So, when you add one relative link to the litefile table (Not recommend), make sure the real file also be included, or put its directory name into the litefile table. -**Note**: It is recommended that you specify at least the entries listed below in the litefile table, because most of these files need to be writeable for the node to boot up successfully. When any changes are made to their options, make sure they won't affect the whole system. +.. Note:: It is recommended that you specify at least the entries listed below in the litefile table, because most of these files need to be writeable for the node to boot up successfully. When any changes are made to their options, make sure they won't affect the whole system. If you want to run a command like ``/bin/ping`` using non-root users, add this command into ``litefile``, then root user have privilege to authorize the command for non-root users. Sample Data for Redhat statelite setup `````````````````````````````````````` From 4ab66ee7173e33d7e241247347606ecac7229a52 Mon Sep 17 00:00:00 2001 From: robin2008 Date: Wed, 16 May 2018 14:12:22 +0800 Subject: [PATCH 089/117] Fix the issue #5153: there are several xcatd SSL process remaining - make sure $pid_UDP is set to zero when UDP process quit in CHLD handler - disable the signal handler for CHLD in the end of SSL lister, and make itself to handle reaper via `wait` --- xCAT-server/sbin/xcatd | 75 ++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 25 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 16c896718..fb05f544e 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -1003,11 +1003,16 @@ my %immediatechildren; sub generic_reaper { local ($!); + #print "generic_reaper in $$..."; while (($CHILDPID = waitpid(-1, WNOHANG)) > 0) { - if (($CHILDPID == $pid_UDP) && ($udpctl)) { - - # got here because UDP child is gone - close($udpctl); $udpctl = 0; + #print "reaper for $CHILDPID...\n"; + if ($CHILDPID == $pid_UDP) { + if ($udpctl) { + # got here because UDP child is gone + close($udpctl); + $udpctl = 0; + } + $pid_UDP = 0; } yield; } @@ -1017,16 +1022,20 @@ sub generic_reaper { sub ssl_reaper { local ($!); my $numdone = 0; + #print "ssl_reaper in $$..."; while (($CHILDPID = waitpid(-1, WNOHANG)) > 0) { + #print "reaper for $CHILDPID...\n"; if ($immediatechildren{$CHILDPID}) { delete $immediatechildren{$CHILDPID}; $sslclients--; $numdone--; } - if (($CHILDPID == $pid_UDP) && ($udpctl)) { - - # got here because UDP child is gone - close($udpctl); $udpctl = 0; + if ($CHILDPID == $pid_UDP) { + if ($udpctl) { + # got here because UDP child is gone + close($udpctl); + $udpctl = 0; + } $pid_UDP = 0; } if ($CHILDPID == $cmdlog_svrpid) { @@ -1041,32 +1050,36 @@ sub ssl_reaper { sub dispatch_reaper { local ($!); + #print "dispatch_reaper in $$..."; while (($CHILDPID = waitpid(-1, WNOHANG)) > 0) { + #print "reaper for $CHILDPID...\n"; if ($dispatched_children{$CHILDPID}) { delete $dispatched_children{$CHILDPID}; $dispatch_children--; } - if (($CHILDPID == $pid_UDP) && ($udpctl)) { - - # got here because UDP child is gone - close($udpctl); $udpctl = 0; - } + #if (($CHILDPID == $pid_UDP) && ($udpctl)) { + # + # # got here because UDP child is gone + # close($udpctl); $udpctl = 0; + #} } $SIG{CHLD} = \&dispatch_reaper; } sub plugin_reaper { local ($!); + #print "plugin_reaper in $$..."; while (($CHILDPID = waitpid(-1, WNOHANG)) > 0) { + #print "reaper for $CHILDPID...\n"; if ($plugin_children{$CHILDPID}) { delete $plugin_children{$CHILDPID}; $plugin_numchildren--; } - if (($CHILDPID == $pid_UDP) && ($udpctl)) { - - # got here because UDP child is gone - close($udpctl); $udpctl = 0; - } + #if (($CHILDPID == $pid_UDP) && ($udpctl)) { + # + # # got here because UDP child is gone + # close($udpctl); $udpctl = 0; + #} } $SIG{CHLD} = \&plugin_reaper; } @@ -1162,6 +1175,7 @@ if (!defined $pid_MON) { } unless ($pid_MON) { $$progname = "xcatd: install monitor"; + $pid_UDP = 0; close($udpctl); $udpctl = 0; do_installm_service; xexit(0); @@ -1510,7 +1524,7 @@ until ($quit) { } if ($child == 0) { - close($udpctl); $udpctl = 0; + close($udpctl); $udpctl = 0; $pid_UDP=0; $SIG{TERM} = $SIG{INT} = 'DEFAULT'; $SIG{CHLD} = \&generic_reaper; # THROTTLE $listener->close; @@ -1614,16 +1628,27 @@ if (open($mainpidfile, "<", "/var/run/xcat/mainservice.pid")) { close($mainpidfile); } if ($listener) { $listener->close; } -my $lastpid; -while (keys %immediatechildren || $pid_UDP || $cmdlog_svrpid || $pid_MON) { - $lastpid = wait(); + +$SIG{CHLD} = "DEFAULT"; # Disable the signal handler and let wait to cover the children quit + +my $remains = keys %immediatechildren; +xCAT::MsgUtils->trace(0, 'I', "xcatd is going to stop, waiting for $remains plugins to quit..."); +while ($remains || $pid_UDP || $cmdlog_svrpid || $pid_MON) { + my $lastpid = wait(); + last if ($lastpid < 0); + + # Found an valid child process if ($immediatechildren{$lastpid}) { delete $immediatechildren{$lastpid}; - } elsif ($lastpid == $pid_UDP) { + $remains = keys %immediatechildren; + } + elsif ($lastpid == $pid_UDP) { $pid_UDP = 0; - } elsif ($lastpid == $cmdlog_svrpid) { + } + elsif ($lastpid == $cmdlog_svrpid) { $cmdlog_svrpid = 0; - } elsif ($lastpid == $pid_MON) { + } + elsif ($lastpid == $pid_MON) { $pid_MON = 0; } } From dad1f72fdc1cb31efd59ec497b631b1b5ed76fc9 Mon Sep 17 00:00:00 2001 From: yangsbj Date: Mon, 21 May 2018 00:51:32 -0400 Subject: [PATCH 090/117] fix issue Non-root user can not run ping on ubuntu 14.4.4 diskless #5227 --- xCAT-server/lib/xcat/plugins/packimage.pm | 2 +- xCAT-server/share/xcat/netboot/ubuntu/genimage | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index f12bda2cf..9d326c0b0 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -500,7 +500,7 @@ sub process_request { my $checkoption2 = `tar --selinux 2>&1`; my $option; if ($checkoption1 !~ /unrecognized/) { - $option .= "--xattrs-include='*' "; + $option .= " --xattrs --xattrs-include='*' "; } if ($checkoption2 !~ /unrecognized/) { $option .= "--selinux "; diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index f6c3ee2db..e3e565038 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -1501,9 +1501,9 @@ EOMS print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; - print $inifile " /bin/tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz\n"; + print $inifile " /bin/tar --selinux --xattrs --xattrs-include='*' -zxf /rootimg.tar.gz\n"; print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; - print $inifile " /bin/tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz\n"; + print $inifile " /bin/tar --selinux --xattrs --xattrs-include='*' -Jxf /rootimg.tar.xz\n"; print $inifile " fi\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n"; print $inifile " echo Done\n"; From eca6613c433db39acbe669461acc59f1b58b054e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=E1=B4=8F=C9=B4=C9=A2=20Jie?= Date: Mon, 21 May 2018 15:44:04 +0800 Subject: [PATCH 091/117] Thinker xCAT/postscripts/cuda_power9_setup, (#5231) * Fix the 40-redhat.rules udev rule * Remake initrd image for diskfull compute node --- xCAT/postscripts/cuda_power9_setup | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/cuda_power9_setup b/xCAT/postscripts/cuda_power9_setup index d448fefe2..977cf1520 100755 --- a/xCAT/postscripts/cuda_power9_setup +++ b/xCAT/postscripts/cuda_power9_setup @@ -22,6 +22,15 @@ printf '[Service]\nRestart=always\n' > ${IMG_ROOTIMGDIR}/etc/systemd/system/nvid [ ! -z "${IMG_ROOTIMGDIR}" ] && CHROOTCMD="chroot ${IMG_ROOTIMGDIR}" $CHROOTCMD /bin/bash -c "systemctl enable nvidia-persistenced" -rm -f ${IMG_ROOTIMGDIR}/lib/udev/rules.d/40-redhat.rules +if [ -f ${IMG_ROOTIMGDIR}/lib/udev/rules.d/40-redhat.rules ] +then + sed -i /SUBSYSTEM==\"memory\"/d ${IMG_ROOTIMGDIR}/lib/udev/rules.d/40-redhat.rules +fi echo 'options nvidia NVreg_EnableStreamMemOPs=1 NVreg_RegistryDwords="PeerMappingOverride=1"' >${IMG_ROOTIMGDIR}/usr/lib/modprobe.d/nvidia.conf + +if [ -z "${IMG_ROOTIMGDIR}" ] +then + kernel_version="$(for d in $(ls /lib/modules | sort -V) ; do : ; done && echo $d)" + mkinitrd -v -f "/boot/initramfs-${kernel_version}.img" "${kernel_version}" +fi From 66cbeeeee98ecaabd01353ed6435be93710f532c Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 21 May 2018 09:21:50 -0400 Subject: [PATCH 092/117] Use comma separate list --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 75ebbdf7b..1bb2901a5 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -4604,7 +4604,11 @@ sub defch_usage foreach my $t (sort(keys %{xCAT::Schema::defspec})) { - $dataobj = $dataobj . ' ' . $t; + if ($dataobj) { + $dataobj = $dataobj . ',' . $t; + } else { + $dataobj = $t; + } } $rsp->{data}->[$n] = "$dataobj\n"; $n++; From 123dd66610b15639619bd757a93a0b720b5a5b5c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 15 May 2018 17:03:23 -0400 Subject: [PATCH 093/117] Verify commit owner id --- travis.pl | 109 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 92 insertions(+), 17 deletions(-) diff --git a/travis.pl b/travis.pl index d27e92fc2..d35f0a8ad 100644 --- a/travis.pl +++ b/travis.pl @@ -21,8 +21,10 @@ $Term::ANSIColor::AUTORESET = 1; #---Global attributes--- my $rst = 0; +my $retries = 5; # Try this many times to get response my $check_result_str="``CI CHECK RESULT`` : "; my $last_func_start = timelocal(localtime()); +my $GITHUB_API = "https://api.github.com"; #-------------------------------------------------------- # Fuction name: runcmd @@ -96,10 +98,22 @@ sub get_files_recursive #-------------------------------------------------------- sub check_pr_format{ if($ENV{'TRAVIS_EVENT_TYPE'} eq "pull_request"){ - my $pr_url = "https://api.github.com/repos/$ENV{'TRAVIS_REPO_SLUG'}/pulls/$ENV{'TRAVIS_PULL_REQUEST'}"; - my $pr_url_resp = get($pr_url); + my $pr_url = "$GITHUB_API/repos/$ENV{'TRAVIS_REPO_SLUG'}/pulls/$ENV{'TRAVIS_PULL_REQUEST'}"; + my $pr_url_resp; + my $counter = 1; + while($counter <= $retries) { + $pr_url_resp = get($pr_url); + if ($pr_url_resp) { + last; # Got response, no more retries + } else { + sleep($counter*2); # Sleep and try again + print "[check_pr_format] $counter Did not get response, sleeping ". $counter*2 . "\n"; + $counter++; + } + } unless ($pr_url_resp) { - print "[check_pr_format] Not able to get response from $pr_url \n"; + print "[check_pr_format] After $retries retries, not able to get response from $pr_url \n"; + # Failed after trying a few times, return error return 1; } my $pr_content = decode_json($pr_url_resp); @@ -129,6 +143,9 @@ sub check_pr_format{ $checkrst.="Missing labels."; } + # Guard against root user making commits + $checkrst.=check_commit_owner('root'); + if(length($checkrst) == 0){ $check_result_str .= "> **PR FORMAT CORRECT**"; send_back_comment("$check_result_str"); @@ -146,32 +163,90 @@ sub check_pr_format{ return 0; } +#-------------------------------------------------------- +# Fuction name: check_commit_owner +# Description: Verify commits are not done by specified user +# Attributes: user login to reject +# Return: +# Error string -User rejected, +# Empty string -User not rejected +#-------------------------------------------------------- +sub check_commit_owner{ + my $invalid_user = shift; + if($ENV{'TRAVIS_EVENT_TYPE'} eq "pull_request"){ + my $commits_content; + my $commits_len = 0; + my $json = new JSON; + my $commits_url = "$GITHUB_API/repos/$ENV{'TRAVIS_REPO_SLUG'}/pulls/$ENV{'TRAVIS_PULL_REQUEST'}/commits"; + my $commits_url_resp; + my $counter = 1; + while($counter <= $retries) { + $commits_url_resp = get($commits_url); + if ($commits_url_resp) { + last; # Got response, no more retries + } else { + sleep($counter*2); # Sleep and try again + print "[check_commit_owner] $counter Did not get response, sleeping ". $counter*2 . "\n"; + $counter++; + } + } + if ($commits_url_resp) { + $commits_content = $json->decode($commits_url_resp); + $commits_len = @$commits_content; + } else { + print "[check_commit_owner] After $retries retries, not able to get response from $commits_url \n"; + return "Unable to verify login of committer."; + } + + if($commits_len > 0) { + foreach my $commit (@{$commits_content}){ + my $committer = $commit->{committer}; + my $committer_login = $committer->{login}; + print "[check_commit_owner] Committer login $committer_login \n"; + if($committer_login =~ /^$invalid_user$/) { + # Committer logins matches + return "Commits by $invalid_user not allowed"; + } + } + } + } + return ""; +} #-------------------------------------------------------- # Fuction name: send_back_comment -# Description: -# Attributes: +# Description: Append to comment of the PR passed $message +# Attributes: Message to append to PR # Return code: #-------------------------------------------------------- sub send_back_comment{ my $message = shift; - my $comment_url = "https://api.github.com/repos/$ENV{'TRAVIS_REPO_SLUG'}/issues/$ENV{'TRAVIS_PULL_REQUEST'}/comments"; - my $comment_url_resp = get($comment_url); + my $comment_url = "$GITHUB_API/repos/$ENV{'TRAVIS_REPO_SLUG'}/issues/$ENV{'TRAVIS_PULL_REQUEST'}/comments"; my $json = new JSON; my $comment_len = 0; my $comment_content; - if ($comment_url_resp) { - print "\n\n>>>>>Dumper comment_url_resp:\n"; - print Dumper $comment_url_resp; - - $comment_content = $json->decode($comment_url_resp); - $comment_len = @$comment_content; - } else { - print "[send_back_comment] Not able to get response from $comment_url \n"; + my $comment_url_resp; + my $counter = 1; + while($counter <= $retries) { + $comment_url_resp = get($comment_url); + if ($comment_url_resp) { + last; # Got response, no more retries + } else { + sleep($counter*2); # Sleep and try again + print "[send_back_comment] $counter Did not get response, sleeping ". $counter*2 . "\n"; + $counter++; + } } + unless ($comment_url_resp) { + print "[send_back_comment] After $retries retries, not able to get response from $comment_url \n"; + # Failed after trying a few times, return + return; + } + print "\n\n>>>>>Dumper comment_url_resp:\n"; + print Dumper $comment_url_resp; - #print "\n\n>>>>>Dumper comment_content: $comment_len\n"; - #print Dumper $comment_content; + $comment_content = $json->decode($comment_url_resp); + $comment_len = @$comment_content; my $post_url = $comment_url; my $post_method = "POST"; From 91230a6dd343bf0cc0c54d231b0e434d2496b8dc Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 21 May 2018 11:58:59 -0400 Subject: [PATCH 094/117] Adding a osimage check probe command to validate some properties of an xCAT osimage --- xCAT-probe/subcmds/osimagecheck | 77 ++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 6 deletions(-) diff --git a/xCAT-probe/subcmds/osimagecheck b/xCAT-probe/subcmds/osimagecheck index 071a6d3ef..fb894d926 100755 --- a/xCAT-probe/subcmds/osimagecheck +++ b/xCAT-probe/subcmds/osimagecheck @@ -16,6 +16,8 @@ my $program_name = basename("$0"); my $help; my $noderange = ""; my $test; +my $osimage; +my $osimagecmd = ""; my $output = "stdout"; my $verbose = 0; my $rst = 0; @@ -30,6 +32,7 @@ Description: Options: -h : Get usage information of $program_name -V : To print additional debug information. + --osimage=: Provide the osimage name to run the probe against "; #------------------------------------- @@ -38,6 +41,7 @@ Options: if ( !GetOptions("--help|h" => \$help, "T" => \$test, + "osimage=s" => \$osimage, "V|verbose" => \$VERBOSE)) { probe_utils->send_msg("$output", "f", "Invalid parameter for $program_name"); @@ -68,18 +72,15 @@ if (scalar(@ARGV) >= 1) { exit 1; } -# Run all osinage probe checks one after another -check_for_duplicate_rootimgdir(); -check_for_valid_osimage_attributes(); - # Check for osimage definitions with duplicate values for rootimgdir sub check_for_duplicate_rootimgdir { + probe_utils->send_msg("$output", "i", "==> Checking for duplicate usage of the rootimgdir in diskless images..."); my $na = "N/A"; my %rootimgdir_osimage_hash; my $any_dups = 0; - my $all_osimages_rootimgdir = `lsdef -t osimage -i rootimgdir -c 2> /dev/null`; + my $all_osimages_rootimgdir = `lsdef -t osimage $osimagecmd -i rootimgdir -c 2> /dev/null`; chomp($all_osimages_rootimgdir); my @all_osimages_rootimgdir_lines = split("[\n\r]", $all_osimages_rootimgdir); @@ -137,6 +138,7 @@ sub check_for_duplicate_rootimgdir { # Check attributes in osimage definitions for valid format sub check_for_valid_osimage_attributes { + probe_utils->send_msg("$output", "i", "==> Checking for valid osimage template attribute ... "); my $na = "N/A"; my $rc = 0; @@ -145,7 +147,7 @@ sub check_for_valid_osimage_attributes { my $any_dups = 0; # Check if any osimage object has "template" attribute set to service.tmpl or compute.tmpl - my $all_osimages_template = `lsdef -t osimage -i template -c 2> /dev/null`; + my $all_osimages_template = `lsdef -t osimage $osimagecmd -i template -c 2> /dev/null`; chomp($all_osimages_template); my @all_osimages_template_lines = split("[\n\r]", $all_osimages_template); @@ -176,3 +178,66 @@ sub check_for_valid_osimage_attributes { return $rc; } + +sub check_valid_files_defined { + probe_utils->send_msg("$output", "i", "==> Checking that valid files are specified in osimage attributes ..."); + my $rc = 0; + my $osimage_list = `lsdef -t osimage $osimagecmd -s 2> /dev/null`; + chomp($osimage_list); + my @all_osimage_lists = split("[\n]", $osimage_list); + + foreach (@all_osimage_lists) { + # loop over the osimage name + my ($osimage_name, $junk) = split " ", $_; + probe_utils->send_msg("$output", "d", "Inspecting osimage=$osimage_name") if ($VERBOSE); + + my @attributes = qw ( otherpkglist pkglist template ); + foreach (@attributes) { + # loop over the attributes to check + probe_utils->send_msg("$output", "d", "Checking attribute=$_ ...") if ($VERBOSE); + + my $osimage_attribute = `lsdef -t osimage -o $osimage_name -i $_ -c 2> /dev/null`; + chomp($osimage_attribute); + my ($junk, $file) = split "=", $osimage_attribute; + if ($file eq "") { + # if no file is defined, skip + next; + } + + if ($file =~ /\,/) { + my @files = split /,/, $file; + foreach my $f (@files) { + probe_utils->send_msg("$output", "d", "Defined in $_, checking for file: $f") if ($VERBOSE); + if (! -e $f) { + probe_utils->send_msg("$output", "f", "In $_, NON-EXISTANT FILE: $f"); + $rc = 1; + } + } + } + } + } + if ($rc == 0) { + probe_utils->send_msg("$output", "o", "Files specified in the osimage attributes seem to be valid."); + } +} +# +# MAIN +# +# Run all osimage probe checks one after another + +if ($osimage) { + $osimagecmd = "-o $osimage"; + probe_utils->send_msg("$output", "d", "[osimagecheck] osimage passed in: $osimage") if ($VERBOSE); + # verify a valid osimage name was passed in + my $osimage_output = `lsdef -t osimage $osimagecmd 2>&1`; + if ($osimage_output =~ /Error: Could not find/) { + probe_utils->send_msg("$output", "f", "Invalid osimage name passed in: $osimage"); + exit 1; + } +} else { + probe_utils->send_msg("$output", "d", "[osimagecheck] No osimage passed in, checking all osimages ...") if ($VERBOSE); +} +check_for_duplicate_rootimgdir(); +check_for_valid_osimage_attributes(); +check_valid_files_defined(); + From 7a69c9b7790f5ee982cc3fb99b09759964a9a2a4 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Tue, 22 May 2018 12:47:37 +0800 Subject: [PATCH 095/117] using --nosyncfiles to bypass syncing files to root image directory (#5229) --- .../references/man1/packimage.1.rst | 12 ++++++++++- xCAT-client/pods/man1/packimage.1.pod | 8 ++++++- xCAT-server/lib/xcat/plugins/packimage.pm | 21 ++++++++++++------- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index f7f1ff332..7105513fd 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -23,7 +23,7 @@ SYNOPSIS \ **packimage [-v| -**\ **-version]**\ -\ **packimage**\ [\ **-m | -**\ **-method**\ \ *cpio|tar*\ ] [\ **-c | -**\ **-compress**\ \ *gzip|pigz|xz*\ ] \ *imagename*\ +\ **packimage**\ [\ **-m | -**\ **-method**\ \ *cpio|tar*\ ] [\ **-c | -**\ **-compress**\ \ *gzip|pigz|xz*\ ] [\ **--nosyncfiles**\ ] \ *imagename*\ *********** @@ -57,6 +57,8 @@ OPTIONS \ **-c| -**\ **-compress**\ Compress Method (pigz,gzip,xz, default is pigz/gzip) +\ **--nosyncfiles**\ Bypass of syncfiles requested, will not sync files to root image directory + ************ RETURN VALUE @@ -89,6 +91,14 @@ EXAMPLES packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute +3. To pack the osimage 'rhels7.1-x86_64-netboot-compute' without syncing files: + + +.. code-block:: perl + + packimage --nosyncfiles rhels7.1-x86_64-netboot-compute + + ***** FILES diff --git a/xCAT-client/pods/man1/packimage.1.pod b/xCAT-client/pods/man1/packimage.1.pod index 5b2b2a837..05f2cdeff 100644 --- a/xCAT-client/pods/man1/packimage.1.pod +++ b/xCAT-client/pods/man1/packimage.1.pod @@ -8,7 +8,7 @@ B B -B [B<-m>|B<--method> I] [B<-c>|B<--compress> I] I +B [B<-m>|B<--method> I] [B<-c>|B<--compress> I] [B<--nosyncfiles>] I =head1 DESCRIPTION @@ -31,6 +31,8 @@ B<-m| --method> Archive Method (cpio,tar,squashfs, default is cpio) B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip) +B<--nosyncfiles> Bypass of syncfiles requested, will not sync files to root image directory + =head1 RETURN VALUE @@ -48,6 +50,10 @@ B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip) packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute +3. To pack the osimage 'rhels7.1-x86_64-netboot-compute' without syncing files: + + packimage --nosyncfiles rhels7.1-x86_64-netboot-compute + =head1 FILES /opt/xcat/sbin/packimage diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 9d326c0b0..709a04b31 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -82,7 +82,7 @@ sub process_request { @ARGV = @{$args}; } if (scalar(@ARGV) == 0) { - $callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] \n packimage [-h| --help]\n packimage [-v| --version]"] }); + $callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] [--nosyncfiles] \n packimage [-h| --help]\n packimage [-v| --version]"] }); return 0; } @@ -95,6 +95,7 @@ sub process_request { my $syncfile; my $rootimg_dir; my $destdir; + my $nosyncfiles; my $imagename; my $dotorrent; my $provmethod; @@ -109,6 +110,7 @@ sub process_request { "method|m=s" => \$method, "compress|c=s" => \$compress, "tracker=s" => \$dotorrent, + 'nosyncfiles' => \$nosyncfiles, "help|h" => \$help, "version|v" => \$version ); @@ -122,7 +124,7 @@ sub process_request { return 0; } if ($help) { - $callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] \n packimage [-h| --help]\n packimage [-v| --version]"] }); + $callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] [--nosyncfiles] \n packimage [-h| --help]\n packimage [-v| --version]"] }); return 0; } @@ -412,12 +414,15 @@ sub process_request { close($shadow); umask($oldmask); - # sync fils configured in the synclist to the rootimage - $syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot", $imagename); - if (defined($syncfile) && -f $syncfile - && -d $rootimg_dir) { - print "sync files from $syncfile to the $rootimg_dir\n"; - system("$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile"); + if (not $nosyncfiles) { + # sync fils configured in the synclist to the rootimage + $syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot", $imagename); + if ( defined($syncfile) && -f $syncfile && -d $rootimg_dir) { + print "Syncing files from $syncfile to root image dir: $rootimg_dir\n"; + system("$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile"); + } + } else { + print "Bypass of syncfiles requested, will not sync files to root image directory.\n"; } my $temppath; From f0311c195b5d3c39736e243989b9b9b554b5f959 Mon Sep 17 00:00:00 2001 From: yangsbj Date: Tue, 22 May 2018 02:55:39 -0400 Subject: [PATCH 096/117] refine xcat-inventory test case according to new output message in 0.1.2 --- xCAT-test/autotest/testcase/xcat-inventory/cases.common | 4 ++-- xCAT-test/autotest/testcase/xcat-inventory/cases.node | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.common b/xCAT-test/autotest/testcase/xcat-inventory/cases.common index cf257d6a3..018d74d05 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.common +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.common @@ -32,7 +32,7 @@ end start:xcat_inventory_invalid_subcmd description:This case is used to test xcat-inventory export subcommand to handle invalid subcommand. The vaild subcommand are export and import. cmd:xcat-inventory aaa -check:output=~ xcat-inventory: error: argument : invalid choice: +check:output=~ Error: not a valid subcommand to run check:output=~ usage: check:rc!=0 end @@ -67,7 +67,7 @@ cmd:mkdir -p /tmp/xcat_inventory_import_option_f_invalid_file check:rc==0 #to handle a non-existed file cmd:xcat-inventory import -f aaa -check:output=~The specified path does not exist +check:output=~The specified inventory file does not exist check:output !~Traceback check:rc!=0 #To handle a invalid json file diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.node b/xCAT-test/autotest/testcase/xcat-inventory/cases.node index 8c4455008..a52540879 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.node +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.node @@ -730,7 +730,7 @@ check:rc==0 cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza ;rmdef bogusnode;fi check:rc==0 cmd: xcat-inventory export --format=json -t node -o bogusnode -check:output=~Error: cannot find objects: bogusnode! +check:output=~Error: cannot find node objects: bogusnode! check:rc!=0 cmd: xcat-inventory export --format=yaml -t node -o bogusnode check:output=~Error: cannot find objects: bogusnode! From 111a6c77cf043c10f0a4db84a73c133cb43b133d Mon Sep 17 00:00:00 2001 From: yangsbj Date: Tue, 22 May 2018 03:00:31 -0400 Subject: [PATCH 097/117] update cases.osimage.validation : the role attribute of osimage can be blank --- xCAT-test/autotest/testcase/xcat-inventory/cases.node | 6 +++--- .../testcase/xcat-inventory/cases.osimage.validation | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.node b/xCAT-test/autotest/testcase/xcat-inventory/cases.node index a52540879..16d4880a9 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.node +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.node @@ -733,7 +733,7 @@ cmd: xcat-inventory export --format=json -t node -o bogusnode check:output=~Error: cannot find node objects: bogusnode! check:rc!=0 cmd: xcat-inventory export --format=yaml -t node -o bogusnode -check:output=~Error: cannot find objects: bogusnode! +check:output=~Error: cannot find node objects: bogusnode! check:rc!=0 cmd:if [[ -e /tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza | mkdef -z;fi check:rc==0 @@ -752,12 +752,12 @@ check:rc==0 cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/xcat_inventory_try_to_import_nonexisted_node/json check:rc==0 cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_nonexisted_node/json -t node -o bogusnode1 -check:output=~Error: cannot find objects: bogusnode1! +check:output=~Error: cannot find node objects: bogusnode1! check:rc!=0 cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/xcat_inventory_try_to_import_nonexisted_node/yaml check:rc==0 cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_nonexisted_node/yaml -t node -o bogusnode1 -check:output=~Error: cannot find objects: bogusnode1! +check:output=~Error: cannot find node objects: bogusnode1! check:rc!=0 cmd:rmdef bogusnode check:rc==0 diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.validation b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.validation index b52057c3f..998fb2c0f 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.validation +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.validation @@ -14,7 +14,7 @@ check: rc==0 cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "osimage" "testosimage1" "role" "invalid" "/tmp/xcat_inventory_import_validation_osimage/trash/" check: rc!=0 cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "osimage" "testosimage1" "role" "" "/tmp/xcat_inventory_import_validation_osimage/trash/" -check: rc!=0 +check: rc==0 cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "osimage" "testosimage1" "imagetype" "windows" "/tmp/xcat_inventory_import_validation_osimage/trash/" check: rc==0 From 74e57623a63c05a791460b46ec03c330ba435912 Mon Sep 17 00:00:00 2001 From: yangsbj Date: Tue, 22 May 2018 04:11:53 -0400 Subject: [PATCH 098/117] update documentation on synclist for issue With "updatenode -F -r /usr/bin/scp", failed to replace regular file with directory #5214 and With "updatenode -F -r /usr/bin/scp", failed to replace directory with regular file #5217 --- .../deployment/syncfile/syncfile_synclist_file.rst | 4 ++-- .../admin-guides/references/man1/updatenode.1.rst | 8 ++++++++ xCAT-client/pods/man1/updatenode.1.pod | 10 +++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/syncfile/syncfile_synclist_file.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/syncfile/syncfile_synclist_file.rst index 9af8e913f..4cd8e81e4 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/syncfile/syncfile_synclist_file.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/syncfile/syncfile_synclist_file.rst @@ -17,9 +17,9 @@ The basic entry format looks like following: :: The path_of_src_file* should be the full path of the source file on the Management Node. -The path_of_dst_file* should be the full path of the destination file on target node. +The path_of_dst_file* should be the full path of the destination file on target node. Please make sure path_of_dst_file* is not a existing directory on target node, otherwise, the file sync with ``updatenode -r /usr/bin/scp`` or ``xdcp -r /usr/bin/scp`` will fail. -The path_of_dst_directory should be the full path of the destination directory. +The path_of_dst_directory should be the full path of the destination directory. Please make sure *eth_of_dst_directory is not a existing file on target node, otherwise, the file sync with ``updatenode -r /usr/bin/scp`` or ``xdcp -r /usr/bin/scp`` will fail. Since the synclist file is for common purpose, the target node need not be configured in it. diff --git a/docs/source/guides/admin-guides/references/man1/updatenode.1.rst b/docs/source/guides/admin-guides/references/man1/updatenode.1.rst index 82499c50e..20de04dd5 100644 --- a/docs/source/guides/admin-guides/references/man1/updatenode.1.rst +++ b/docs/source/guides/admin-guides/references/man1/updatenode.1.rst @@ -416,6 +416,14 @@ OPTIONS Specifies the full path of the remote copy command used for syncing files to node targets, such as "/usr/bin/rsync" or "/usr/bin/scp". If not specified, rsync will be used by default. + Notice: The synclist for "-r /usr/bin/scp" has some differences with "-r /usr/bin/rsync": + + 1) the ``EXECUTE`` clause is not supported in "-r /usr/bin/scp" + + 2) if the destination directory specified in synclist is an existing file on target node, "updatenode -r /usr/bin/scp" will fail with ``scp: : Not a directory`` + + 3) if the destination file specified in synclist is an existing directory on target node, "updatenode -r /usr/bin/scp" will fail with ``scp: : Is a directory`` + \ **-g|-**\ **-genmypost**\ diff --git a/xCAT-client/pods/man1/updatenode.1.pod b/xCAT-client/pods/man1/updatenode.1.pod index 3fc86a737..45a11dde2 100644 --- a/xCAT-client/pods/man1/updatenode.1.pod +++ b/xCAT-client/pods/man1/updatenode.1.pod @@ -319,7 +319,15 @@ litefile table with source location specified in the litetree table. =item [B<-r>|B<--node-rcp> [I]] -Specifies the full path of the remote copy command used for syncing files to node targets, such as "/usr/bin/rsync" or "/usr/bin/scp". If not specified, rsync will be used by default. +Specifies the full path of the remote copy command used for syncing files to node targets, such as "/usr/bin/rsync" or "/usr/bin/scp". If not specified, rsync will be used by default. + +Notice: The synclist for "-r /usr/bin/scp" has some differences with "-r /usr/bin/rsync": + +1) the ``EXECUTE`` clause is not supported in "-r /usr/bin/scp" + +2) if the destination directory specified in synclist is an existing file on target node, "updatenode -r /usr/bin/scp" will fail with ``scp: : Not a directory`` + +3) if the destination file specified in synclist is an existing directory on target node, "updatenode -r /usr/bin/scp" will fail with ``scp: : Is a directory`` =item B<-g|--genmypost> From fee7f2c3742139de46264dacbd3ab4f742e90a9a Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 23 May 2018 03:07:49 -0400 Subject: [PATCH 099/117] update xcat inventory osimage export and import cases --- .../testcase/xcat-inventory/cases.osimage | 183 ++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage index a957435f8..7699a59e8 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage @@ -913,4 +913,187 @@ cmd:rm -rf /tmp/export_single_osimage_then_modify_yaml_then_import check:rc==0 end +start:export_import_single_osimage_by_dir +description:This case is used to test xcat-inventory export and import one linux osimage definition by files. +cmd:if [ -e /tmp/otherpkglist ]; then cp -f /tmp/otherpkglist /tmp/otherpkglist.bak; fi +cmd:echo "test" >> /tmp/otherpkglist +cmd:if [ -e /tmp/synclists ]; then cp -f /tmp/synclists /tmp/synclists.bak; fi +cmd:echo "test" >> /tmp/synclists +cmd:if [ -e /tmp/postinstall ]; then cp -f /tmp/postinstall /tmp/postinstall.bak; fi +cmd:echo "test" >> /tmp/postinstall +cmd:if [ -e /tmp/exlist ]; then cp -f /tmp/exlist /tmp/exlist.bak; fi +cmd:echo "test" >> /tmp/exlist +cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/test_myimage.stanza ;rmdef -t osimage -o test_myimage;fi +check:rc==0 +#cmd:ssh $$DSTMN 'lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/test_myimage.stanza ;rmdef -t osimage -o test_myimage;fi' +#check:rc==0 +cmd:chdef -t osimage -o test_myimage imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist +check:rc==0 +cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage/ /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi +cmd:xcat-inventory export -t osimage -o test_myimage --format yaml -d //opt/inventory/site/osimage/ +check:rc==0 +check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage/ +cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage/$otherpkglist +check:rc==0 +cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage/$synclists +check:rc==0 +cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage/$postinstall +check:rc==0 +cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage/$exlist +check:rc==0 +cmd:pkglist=`lsdef -t osimage -o test_myimage |grep pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage/$pkglist +check:rc!=0 +cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage/$template +check:rc!=0 +cmd: rmdef -t osimage -o test_myimage +check:rc==0 +cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist +cmd:xcat-inventory import -t osimage -o test_myimage -d /opt/inventory/site/osimage/ +check:rc==0 +check:output=~The object test_myimage has been imported +cmd:lsdef -t osimage -o test_myimage +check:rc==0 +cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage/$otherpkglist +check:rc==0 +cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage/$otherpkglist +check:rc==0 +cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage/$synclists +check:rc==0 +cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage/$postinstall +check:rc==0 +cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage/$exlist +check:rc==0 +cmd:pkglist=`lsdef -t osimage -o test_myimage |grep pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist"]; then return 0; else return 1; fi +check:rc==0 +cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl"]; then return 0; else return 1; fi +check:rc==0 +cmd: rmdef -t osimage -o test_myimage +check:rc==0 +cmd: if [ -e /tmp/test_myimage.stanza]; then cat /tmp/test_myimage.stanza |mkdef -z;fi +cmd: if [ -e /opt/inventory/site/osimage/]; then rm -rf /opt/inventory/site/osimage/;fi +cmd: if [ -e /opt/inventory/site/osimage.bak]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi +cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi +cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi +cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi +cmd:if [ -e /tmp/exlist.bak ]; then mv -f /tmp/exlist.bak /tmp/exlist; fi +end +start:export_import_multiple_osimages_by_dir +description:This case is used to test xcat-inventory export and import several linux osimages definition by dir. +cmd:if [ -e /tmp/otherpkglist ]; then cp -f /tmp/otherpkglist /tmp/otherpkglist.bak; fi +cmd:echo "test" >> /tmp/otherpkglist +cmd:if [ -e /tmp/synclists ]; then cp -f /tmp/synclists /tmp/synclists.bak; fi +cmd:echo "test" >> /tmp/synclists +cmd:if [ -e /tmp/postinstall ]; then cp -f /tmp/postinstall /tmp/postinstall.bak; fi +cmd:echo "test" >> /tmp/postinstall +cmd:if [ -e /tmp/exlist ]; then cp -f /tmp/exlist /tmp/exlist.bak; fi +cmd:echo "test" >> /tmp/exlist +cmd:if [ -e /tmp/pkglist ]; then cp -f /tmp/pkglist /tmp/pkglist.bak; fi +cmd:echo "test" >> /tmp/pkglist +cmd:if [ -e /tmp/template ]; then cp -f /tmp/template /tmp/pkglist.bak; fi +cmd:echo "test" >> /tmp/template +cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/otherpkglist /opt/xcat/share/xcat/install/rh/otherpkglist.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/otherpkglist +cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists ]; then cp -f /opt/xcat/share/xcat/install/rh/synclists /opt/xcat/share/xcat/install/rh/synclists.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/synclists +cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists ]; then cp -f /opt/xcat/share/xcat/install/rh/synclists /opt/xcat/share/xcat/install/rh/synclists.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/synclists +cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall ]; then cp -f /opt/xcat/share/xcat/install/rh/postinstall /opt/xcat/share/xcat/install/rh/postinstall.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/postinstall +cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist ]; then cp -f /opt/xcat/share/xcat/install/rh/exlist /opt/xcat/share/xcat/install/rh/exlist.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/exlist +cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/pkglist /opt/xcat/share/xcat/install/rh/pkglist.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/pkglist +cmd:if [ -e /opt/xcat/share/xcat/install/rh/template ]; then cp -f /opt/xcat/share/xcat/install/rh/template /opt/xcat/share/xcat/install/rh/template.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/template +cmd:lsdef -t osimage -o test_myimage1 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage1 -z >/tmp/test_myimage1.stanza ;rmdef -t osimage -o test_myimage1;fi +`check:rc==0 +cmd:lsdef -t osimage -o test_myimage2 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage2 -z >/tmp/test_myimage2.stanza ;rmdef -t osimage -o test_myimage2;fi +check:rc==0 +cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist +check:rc==0 +cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist +check:rc==0 +cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage/ /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi +cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format yaml -d //opt/inventory/site/osimage/ +check:rc==0 +check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage/ +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1/$otherpkglist +check:rc==0 +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1/$synclists +check:rc==0 +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1/$postinstall +check:rc==0 +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1/$exlist +check:rc==0 +cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$pkglist +check:rc!=0 +cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$template +check:rc!=0 +cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$otherpkglist +check:rc!=0 +cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$synclists +check:rc!=0 +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$postinstall +check:rc!=0 +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$postinstall +check:rc!=0 +cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$exlist +check:rc!=0 +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2/$pkglist +check:rc==0 +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2/$template +check:rc==0 +cmd: rmdef -t osimage -o test_myimage1,test_myimage2 +check:rc==0 +cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/pkglist /tmp/template +cmd:xcat-inventory import -t osimage -o test_myimage1,test_myimage2 -d /opt/inventory/site/osimage/ +check:rc==0 +check:output=~The object test_myimage1 has been imported +check:output=~The object test_myimage2 has been imported +cmd:lsdef -t osimage -o test_myimage1,test_myimage2 +check:rc==0 +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1/$otherpkglist +check:rc==0 +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1/$synclists +check:rc==0 +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1/$postinstall +check:rc==0 +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1/$exlist +check:rc==0 +cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist"]; then return 0; else return 1; fi +check:rc==0 +cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl"]; then return 0; else return 1; fi +check:rc==0 +cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist"]; then return 0; else return 1; fi +check:rc==0 +cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists"]; then return 0; else return 1; fi +check:rc==0 +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall"]; then return 0; else return 1; fi +check:rc==0 +cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist"]; then return 0; else return 1; fi +check:rc==0 +cmd:pkglist=`lsdef -t osimage -o test_myimage |grep pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2/$pkglist +check:rc==0 +cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2/$template +check:rc==0 +cmd: rmdef -t osimage -o test_myimage1,test_myimage2 +check:rc==0 +cmd: rmdef -t osimage -o test_myimage1,test_myimage2 +check:rc==0 +cmd: if [ -e /tmp/test_myimage1.stanza]; then cat /tmp/test_myimage1.stanza |mkdef -z;fi +cmd: if [ -e /tmp/test_myimage2.stanza]; then cat /tmp/test_myimage2.stanza |mkdef -z;fi +cmd: if [ -e /opt/inventory/site/osimage/]; then rm -rf /opt/inventory/site/osimage/;fi +cmd: if [ -e /opt/inventory/site/osimage.bak]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi +cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi +cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi +cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi +cmd:if [ -e /tmp/exlist.bak ]; then mv -f /tmp/exlist.bak /tmp/exlist; fi +cmd:if [ -e /tmp/pkglist.bak ]; then mv -f /tmp/pkglist.bak /tmp/pkglist fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/otherpkglist.bak /opt/xcat/share/xcat/install/rh/otherpkglist; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/synclists.bak /opt/xcat/share/xcat/install/rh/synclists; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/postinstall.bak /opt/xcat/share/xcat/install/rh/postinstall; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/exlist.bak /opt/xcat/share/xcat/install/rh/exlist; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/pkglist.bak /opt/xcat/share/xcat/install/rh/pkglist; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/template.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/template.bak /opt/xcat/share/xcat/install/rh/template; fi +end From 04119953138ab1d0b69ce0da70275f30401aa15f Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 23 May 2018 04:12:59 -0400 Subject: [PATCH 100/117] update some typo --- .../testcase/xcat-inventory/cases.osimage | 98 +++++++++---------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage index 7699a59e8..6b27a7cbd 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage @@ -913,6 +913,7 @@ cmd:rm -rf /tmp/export_single_osimage_then_modify_yaml_then_import check:rc==0 end + start:export_import_single_osimage_by_dir description:This case is used to test xcat-inventory export and import one linux osimage definition by files. cmd:if [ -e /tmp/otherpkglist ]; then cp -f /tmp/otherpkglist /tmp/otherpkglist.bak; fi @@ -930,20 +931,20 @@ check:rc==0 cmd:chdef -t osimage -o test_myimage imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist check:rc==0 cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage/ /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi -cmd:xcat-inventory export -t osimage -o test_myimage --format yaml -d //opt/inventory/site/osimage/ +cmd:xcat-inventory export -t osimage -o test_myimage --format yaml -d /opt/inventory/site/osimage/ check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage/ -cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage/$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage/$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage/$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage/$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage$exlist check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage |grep pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage/$pkglist +cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage$pkglist check:rc!=0 -cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage/$template +cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage$template check:rc!=0 cmd: rmdef -t osimage -o test_myimage check:rc==0 @@ -953,25 +954,25 @@ check:rc==0 check:output=~The object test_myimage has been imported cmd:lsdef -t osimage -o test_myimage check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage/$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage/$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage/$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage/$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage/$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage$exlist check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage |grep pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist"]; then return 0; else return 1; fi +cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then echo 0; else echo 1; fi check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl"]; then return 0; else return 1; fi +cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then echo 0; else echo 1; fi check:rc==0 cmd: rmdef -t osimage -o test_myimage check:rc==0 -cmd: if [ -e /tmp/test_myimage.stanza]; then cat /tmp/test_myimage.stanza |mkdef -z;fi -cmd: if [ -e /opt/inventory/site/osimage/]; then rm -rf /opt/inventory/site/osimage/;fi -cmd: if [ -e /opt/inventory/site/osimage.bak]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi +cmd: if [ -e /tmp/test_myimage.stanza ]; then cat /tmp/test_myimage.stanza |mkdef -z;fi +cmd: if [ -e /opt/inventory/site/osimage/ ]; then rm -rf /opt/inventory/site/osimage/;fi +cmd: if [ -e /opt/inventory/site/osimage.bak ]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi @@ -1015,34 +1016,32 @@ check:rc==0 cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist check:rc==0 cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage/ /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi -cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format yaml -d //opt/inventory/site/osimage/ +cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format yaml -d /opt/inventory/site/osimage/ check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage/ -cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1/$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1/$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1/$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1/$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$pkglist +cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$pkglist check:rc!=0 -cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$template +cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$template check:rc!=0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$otherpkglist check:rc!=0 -cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$synclists check:rc!=0 -cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$postinstall check:rc!=0 -cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$postinstall +cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$exlist check:rc!=0 -cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1/$exlist -check:rc!=0 -cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2/$pkglist +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2/$template +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 @@ -1053,38 +1052,36 @@ check:output=~The object test_myimage1 has been imported check:output=~The object test_myimage2 has been imported cmd:lsdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1/$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1/$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1/$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1/$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist"]; then return 0; else return 1; fi +cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then echo 0; else echo 1; fi check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl"]; then return 0; else return 1; fi +cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then echo 0; else echo 1; fi check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist"]; then return 0; else return 1; fi +cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist" ]; then echo 0; else echo 1; fi check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists"]; then return 0; else return 1; fi +cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists" ]; then echo 0; else echo 1; fi check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall"]; then return 0; else return 1; fi +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall" ]; then echo 0; else echo 1; fi check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist"]; then return 0; else return 1; fi +cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then echo 0; else echo 1; fi check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage |grep pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2/$pkglist +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2/$template +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 -cmd: rmdef -t osimage -o test_myimage1,test_myimage2 -check:rc==0 -cmd: if [ -e /tmp/test_myimage1.stanza]; then cat /tmp/test_myimage1.stanza |mkdef -z;fi -cmd: if [ -e /tmp/test_myimage2.stanza]; then cat /tmp/test_myimage2.stanza |mkdef -z;fi -cmd: if [ -e /opt/inventory/site/osimage/]; then rm -rf /opt/inventory/site/osimage/;fi -cmd: if [ -e /opt/inventory/site/osimage.bak]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi +cmd: if [ -e /tmp/test_myimage1.stanza ]; then cat /tmp/test_myimage1.stanza |mkdef -z;fi +cmd: if [ -e /tmp/test_myimage2.stanza ]; then cat /tmp/test_myimage2.stanza |mkdef -z;fi +cmd: if [ -e /opt/inventory/site/osimage/ ]; then rm -rf /opt/inventory/site/osimage/;fi +cmd: if [ -e /opt/inventory/site/osimage.bak ]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi @@ -1097,3 +1094,4 @@ cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist.bak ]; then mv -f /opt/xcat/s cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/pkglist.bak /opt/xcat/share/xcat/install/rh/pkglist; fi cmd:if [ -e /opt/xcat/share/xcat/install/rh/template.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/template.bak /opt/xcat/share/xcat/install/rh/template; fi end + From 4bd21ff38705d8e80f7edfb1c905845292a58994 Mon Sep 17 00:00:00 2001 From: huweihua Date: Thu, 24 May 2018 02:31:49 -0400 Subject: [PATCH 101/117] Modify some error or typo in some old cases --- xCAT-test/autotest/testcase/chtab/cases0 | 2 +- xCAT-test/autotest/testcase/chvm/cases0 | 12 ++++++++++-- xCAT-test/autotest/testcase/mkdef/cases0 | 4 ++-- xCAT-test/autotest/testcase/nodech/cases0 | 2 +- xCAT-test/autotest/testcase/xcatsnap/cases0 | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/chtab/cases0 b/xCAT-test/autotest/testcase/chtab/cases0 index 0567dd9b2..cedb96420 100644 --- a/xCAT-test/autotest/testcase/chtab/cases0 +++ b/xCAT-test/autotest/testcase/chtab/cases0 @@ -61,7 +61,7 @@ start:chtab_err_table description:chtab with error table cmd:chtab error=error site.comment=error check:rc!=0 -check:output=~no such column +check:output=~no such column|column \"error\" does not exist end diff --git a/xCAT-test/autotest/testcase/chvm/cases0 b/xCAT-test/autotest/testcase/chvm/cases0 index 61bddffd2..61f76fc9b 100644 --- a/xCAT-test/autotest/testcase/chvm/cases0 +++ b/xCAT-test/autotest/testcase/chvm/cases0 @@ -44,7 +44,15 @@ check:rc!=0 check:output=~Usage end start:chvm_err_node -cmd:chvm testnode +cmd:dir="/tmp/chvm_err_node";echo ${dir}".old";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi; mkdir -p $dir +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/chvm_err_node/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:chvm bogusnode check:rc!=0 -check:output=~Usage +check:output=~Error: Invalid nodes and/or groups in noderange +cmd:if [[ -e /tmp/chvm_err_node/bogusnode.stanza ]]; then cat /tmp/chvm_err_node/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:dir="/tmp/chvm_err_node"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi +check:rc==0 end diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index 547992ffd..af33335c1 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -294,8 +294,8 @@ check:rc==0 check:output=~1 object definitions have been created or modified cmd:lsdef auto_test_cec_node check:output=~Object name\: auto\_test\_cec\_node -check:output=~groups\=test\_template\_priority -check:output!=groups\=cec\,all +check:output!=groups\=test\_template\_priority +check:output=~groups\=cec\,all check:output=~hwtype\=cec check:output=~mgt\=hmc check:output=~nodetype\=ppc diff --git a/xCAT-test/autotest/testcase/nodech/cases0 b/xCAT-test/autotest/testcase/nodech/cases0 index 7857848db..8529b4a8c 100644 --- a/xCAT-test/autotest/testcase/nodech/cases0 +++ b/xCAT-test/autotest/testcase/nodech/cases0 @@ -173,7 +173,7 @@ end start:nodech_d_error description:nodech --delete -cmd:chdef -t node -o testnode os=hello +cmd:chdef -t node -o testnode os=hello groups=test check:rc==0 cmd:nodech --delete check:rc!=0 diff --git a/xCAT-test/autotest/testcase/xcatsnap/cases0 b/xCAT-test/autotest/testcase/xcatsnap/cases0 index 8e374578c..3c336f61c 100644 --- a/xCAT-test/autotest/testcase/xcatsnap/cases0 +++ b/xCAT-test/autotest/testcase/xcatsnap/cases0 @@ -29,7 +29,7 @@ start:xcatsnap_v description:xcatsnap -v and --version cmd:xcatsnap -v check:output=~version|Version -cmd:xcatsnamp --version +cmd:xcatsnap --version check:output=~version|Version end From 380beadb379e784bb4d63fe6baca84275b00bdc1 Mon Sep 17 00:00:00 2001 From: yangsbj Date: Thu, 24 May 2018 02:50:11 -0400 Subject: [PATCH 102/117] add test cases for xcat-inventory import -d for osimage inventory directory --- .../cases.osimage.import_from_osimage_dir | 124 ++++++++++++++++++ .../templates/cluster_invdir/cluster.json | 1 + .../osimage/test_myimage/definition.json | 21 +++ .../osimage/test_myimage/test_myimage.stanza | 13 ++ .../test_myimage/tmp/test_myimage/exlist | 1 + .../tmp/test_myimage/otherpkglist | 1 + .../tmp/test_myimage/partitionfile | 1 + .../test_myimage/tmp/test_myimage/postinstall | 1 + .../test_myimage/tmp/test_myimage/synclists | 1 + .../osimage/test_myimage2/definition.json | 21 +++ .../test_myimage2/test_myimage2.stanza | 13 ++ .../test_myimage2/tmp/test_myimage2/exlist | 1 + .../tmp/test_myimage2/otherpkglist | 1 + .../tmp/test_myimage2/partitionfile | 1 + .../tmp/test_myimage2/postinstall | 1 + .../test_myimage2/tmp/test_myimage2/synclists | 1 + 16 files changed, 203 insertions(+) create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/cluster.json create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir new file mode 100644 index 000000000..a628974f9 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir @@ -0,0 +1,124 @@ +start:export_import_an_osimage_directory +description: import an osimage diretory with `xcat-inventroy import -d ` +#backup any existing test_myimage +cmd:mkdir -p /tmp/export_import_an_osimage_directory/backup +check:rc==0 +cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza;fi + +#remove any existing test_myimage +cmd:rmdef -t osimage -o test_myimage +cmd: lsdef -t osimage -o test_myimage +check:rc!=0 +cmd: rm -rf /tmp/test_myimage + +#import test_myimage +cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage +check:rc==0 + +#check whether the osimage definition is created +cmd: lsdef -t osimage -o test_myimage -z |tee /tmp/export_import_an_osimage_directory/test_myimage.stanza +check:rc==0 +cmd: diff /tmp/export_import_an_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza +check: rc==0 +#check whether the customized osimage files are imported +cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/ +check:rc==0 + +#cleanup +cmd:rmdef -t osimage -o test_myimage +cmd:rm -rf /tmp/test_myimage + +#restore the original test_myimage if any +#cmd: [ -e '/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza' ] && cat /tmp/export_import_an_osimage_directory/backup/test_myimage.stanza|mkdef -z +cmd: rm -rf /tmp/export_import_an_osimage_directory +end + + +################################################################################# + +start:export_import_multiple_osimages_from_osimage_directory +description: import multiple osimage diretories with `xcat-inventroy import -d ` +#backup any existing test_myimage,test_myimage2 +cmd:mkdir -p /tmp/export_import_multiple_osimages_from_osimage_directory/backup +check:rc==0 +cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza;fi +cmd:lsdef -t osimage -o test_myimage2 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage2 -z >/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza;fi + +#remove any existing test_myimage,test_myimage2 +cmd:rmdef -t osimage -o test_myimage,test_myimage2 +cmd: lsdef -t osimage -o test_myimage +check:rc!=0 +cmd: lsdef -t osimage -o test_myimage2 +check:rc!=0 +cmd: rm -rf /tmp/test_myimage +cmd: rm -rf /tmp/test_myimage2 + +#import osimages +cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ +check:rc==0 + +#check whether the osimage definition is created +cmd: lsdef -t osimage -o test_myimage -z | tee /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage.stanza +check:rc==0 +cmd: lsdef -t osimage -o test_myimage2 -z | tee /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage2.stanza +check:rc==0 +cmd: diff /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza +check: rc==0 +cmd: diff /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage2.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza +check: rc==0 +#check whether the customized osimage files are imported +cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/ +check:rc==0 +cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/ /tmp/test_myimage2/ +check:rc==0 + +#cleanup +cmd:rmdef -t osimage -o test_myimage +cmd:rm -rf /tmp/test_myimage +cmd:rmdef -t osimage -o test_myimage2 +cmd:rm -rf /tmp/test_myimage2 + +#restore the original osimages if any +cmd: if [ -e '/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi + +cmd: if [ -e '/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza' ]; then cat /tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza|mkdef -z; fi + +cmd: rm -rf /tmp/export_import_multiple_osimages_from_osimage_directory +end + +################################################3 + +start:export_import_specified_from_osimage_directory +description: import specified osimage from osimage diretory with `xcat-inventroy import -d -t osimage -o` +#backup any existing test_myimage +cmd:mkdir -p /tmp/export_import_specified_from_osimage_directory/backup +check:rc==0 +cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza;fi + +#remove any existing test_myimage +cmd:rmdef -t osimage -o test_myimage +cmd: lsdef -t osimage -o test_myimage +check:rc!=0 +cmd: rm -rf /tmp/test_myimage + +#import test_myimage +cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ -t osimage -o test_myimage +check:rc==0 + +#check whether the osimage definition is created +cmd: lsdef -t osimage -o test_myimage -z |tee /tmp/export_import_specified_from_osimage_directory/test_myimage.stanza +check:rc==0 +cmd: diff /tmp/export_import_specified_from_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza +check: rc==0 +#check whether the customized osimage files are imported +cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/ +check:rc==0 + +#cleanup +cmd:rmdef -t osimage -o test_myimage +cmd:rm -rf /tmp/test_myimage + +#restore the original test_myimage if any +#cmd: [ -e '/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza' ] && cat /tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza|mkdef -z +cmd: rm -rf /tmp/export_import_specified_from_osimage_directory +end diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/cluster.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/cluster.json new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/cluster.json @@ -0,0 +1 @@ + diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json new file mode 100644 index 000000000..6f4a69076 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json @@ -0,0 +1,21 @@ +{ + "osimage": { + "test_myimage": { + "diskpartitionspec": "/tmp/test_myimage/partitionfile", + "filestosync": "/tmp/test_myimage/synclists", + "genimgoptions": { + "exlist": "/tmp/test_myimage/exlist", + "postinstall": "/tmp/test_myimage/postinstall" + }, + "imagetype": "linux", + "package_selection": { + "otherpkglist": "/tmp/test_myimage/otherpkglist", + "pkglist": "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" + }, + "provision_mode": "install", + "template": "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" + } + }, + "schema_version": "1.0" +} +#Version 2.14.1 (git commit ac941fd2501e8a581bfcc4c79b9301f6ec37ab93, built Mon May 21 06:15:46 EDT 2018) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza new file mode 100644 index 000000000..ae4b51f00 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza @@ -0,0 +1,13 @@ +# + +test_myimage: + objtype=osimage + exlist=/tmp/test_myimage/exlist + imagetype=linux + otherpkglist=/tmp/test_myimage/otherpkglist + partitionfile=/tmp/test_myimage/partitionfile + pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist + postinstall=/tmp/test_myimage/postinstall + provmethod=install + synclists=/tmp/test_myimage/synclists + template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist new file mode 100644 index 000000000..791a1f8f5 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist @@ -0,0 +1 @@ +exlist diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist new file mode 100644 index 000000000..4feeb217e --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist @@ -0,0 +1 @@ +otherpkglist diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile new file mode 100644 index 000000000..81b906ea2 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile @@ -0,0 +1 @@ +partitionfile diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall new file mode 100644 index 000000000..7d24ce596 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall @@ -0,0 +1 @@ +postinstall diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists new file mode 100644 index 000000000..adf6202ea --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists @@ -0,0 +1 @@ +synclists diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json new file mode 100644 index 000000000..9e983695c --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json @@ -0,0 +1,21 @@ +{ + "osimage": { + "test_myimage2": { + "diskpartitionspec": "/tmp/test_myimage2/partitionfile", + "filestosync": "/tmp/test_myimage2/synclists", + "genimgoptions": { + "exlist": "/tmp/test_myimage2/exlist", + "postinstall": "/tmp/test_myimage2/postinstall" + }, + "imagetype": "linux", + "package_selection": { + "otherpkglist": "/tmp/test_myimage2/otherpkglist", + "pkglist": "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" + }, + "provision_mode": "install", + "template": "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" + } + }, + "schema_version": "1.0" +} +#Version 2.14.1 (git commit ac941fd2501e8a581bfcc4c79b9301f6ec37ab93, built Mon May 21 06:15:46 EDT 2018) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza new file mode 100644 index 000000000..3edf4dc98 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza @@ -0,0 +1,13 @@ +# + +test_myimage2: + objtype=osimage + exlist=/tmp/test_myimage2/exlist + imagetype=linux + otherpkglist=/tmp/test_myimage2/otherpkglist + partitionfile=/tmp/test_myimage2/partitionfile + pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist + postinstall=/tmp/test_myimage2/postinstall + provmethod=install + synclists=/tmp/test_myimage2/synclists + template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist new file mode 100644 index 000000000..791a1f8f5 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist @@ -0,0 +1 @@ +exlist diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist new file mode 100644 index 000000000..4feeb217e --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist @@ -0,0 +1 @@ +otherpkglist diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile new file mode 100644 index 000000000..81b906ea2 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile @@ -0,0 +1 @@ +partitionfile diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall new file mode 100644 index 000000000..7d24ce596 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall @@ -0,0 +1 @@ +postinstall diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists new file mode 100644 index 000000000..adf6202ea --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists @@ -0,0 +1 @@ +synclists From f25c9119f52df47d95ab8794149efcc59a2008cd Mon Sep 17 00:00:00 2001 From: yangsbj Date: Thu, 24 May 2018 03:33:44 -0400 Subject: [PATCH 103/117] refine code according to comments --- .../cases.osimage.import_from_osimage_dir | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir index a628974f9..dff942529 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir @@ -9,7 +9,7 @@ cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsd cmd:rmdef -t osimage -o test_myimage cmd: lsdef -t osimage -o test_myimage check:rc!=0 -cmd: rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi #import test_myimage cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage @@ -26,10 +26,10 @@ check:rc==0 #cleanup cmd:rmdef -t osimage -o test_myimage -cmd:rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi #restore the original test_myimage if any -#cmd: [ -e '/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza' ] && cat /tmp/export_import_an_osimage_directory/backup/test_myimage.stanza|mkdef -z +cmd: if [ -e '/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_an_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi cmd: rm -rf /tmp/export_import_an_osimage_directory end @@ -50,8 +50,8 @@ cmd: lsdef -t osimage -o test_myimage check:rc!=0 cmd: lsdef -t osimage -o test_myimage2 check:rc!=0 -cmd: rm -rf /tmp/test_myimage -cmd: rm -rf /tmp/test_myimage2 +cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi +cmd:dir="/tmp/test_myimage2";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi #import osimages cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ @@ -74,9 +74,10 @@ check:rc==0 #cleanup cmd:rmdef -t osimage -o test_myimage -cmd:rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi + cmd:rmdef -t osimage -o test_myimage2 -cmd:rm -rf /tmp/test_myimage2 +cmd:dir="/tmp/test_myimage2"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi #restore the original osimages if any cmd: if [ -e '/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi @@ -99,7 +100,7 @@ cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsd cmd:rmdef -t osimage -o test_myimage cmd: lsdef -t osimage -o test_myimage check:rc!=0 -cmd: rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi #import test_myimage cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ -t osimage -o test_myimage @@ -116,9 +117,9 @@ check:rc==0 #cleanup cmd:rmdef -t osimage -o test_myimage -cmd:rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi #restore the original test_myimage if any -#cmd: [ -e '/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza' ] && cat /tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza|mkdef -z +cmd: if [ -e '/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi cmd: rm -rf /tmp/export_import_specified_from_osimage_directory end From 21c6c3a907f809561d6fd238546fd6baf50c4c75 Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Thu, 24 May 2018 16:15:45 +0800 Subject: [PATCH 104/117] Add one test case for xcat-inventory export option -f (#5244) --- .../testcase/xcat-inventory/cases.common | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.common b/xCAT-test/autotest/testcase/xcat-inventory/cases.common index 018d74d05..7340bb6eb 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.common +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.common @@ -53,13 +53,47 @@ check:output!~Traceback (most recent call last): check:rc!=0 end -#start:xcat_inventory_export_option_f_invalid_file -#description:This case is used to test xcat-inventory export subcommand to handle invalid file for option f -#cmd:xcat-inventory export -f aaa -#check:output=~The specified path does not exist -#check:output !~Traceback -#check:rc!=0 -#end +start:xcat_inventory_export_option_f +description:This case is used to test xcat-inventory export subcommand to handle option f +cmd:dir="/tmp/xcat_inventory_export_option_f";echo ${dir}".old";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi; mkdir -p $dir +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/xcat_inventory_export_option_f/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode | tee /tmp/xcat_inventory_export_option_f/export_yaml_without_f +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode -f /tmp/xcat_inventory_export_option_f/export_yaml_with_f +check:rc==0 +check:output !~Traceback +cmd:diff /tmp/xcat_inventory_export_option_f/export_yaml_without_f /tmp/xcat_inventory_export_option_f/export_yaml_with_f +check:rc==0 +cmd:xcat-inventory export -t node -o bogusnode | tee /tmp/xcat_inventory_export_option_f/export_json_without_f +check:rc==0 +cmd:xcat-inventory export -t node -o bogusnode --path /tmp/xcat_inventory_export_option_f/export_json_with_f +check:rc==0 +cmd:diff /tmp/xcat_inventory_export_option_f/export_json_without_f /tmp/xcat_inventory_export_option_f/export_json_with_f +check:rc==0 +cmd:xcat-inventory export -t node -o bogusnode -f +check:rc!=0 +check:output ~=usage +check:output ~= error: argument -f/--path: expected one argument +cmd:xcat-inventory export -t node -o bogusnode --path +check:rc!=0 +eck:output ~=usage +check:output ~= error: argument -f/--path: expected one argument +cmd:mkdir /tmp/xcat_inventory_export_option_f/testdir +check:rc==0 +cmd:xcat-inventory export -t node -o bogusnode -f /tmp/xcat_inventory_export_option_f/testdir +check:rc!=0 +check:output ~= Error: the specified file /tmp/xcat_inventory_export_option_f/testdir already exists, is not a file! +cmd:rmdef bogusnode +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_export_option_f/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_export_option_f/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:dir="/tmp/xcat_inventory_export_option_f"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi +check:rc==0 +end start:xcat_inventory_import_option_f_invalid_file description:This case is used to test xcat-inventory import subcommand to handle invalid file for option f From 9ecb8a251b45895bae737e728de4d34f749b73fd Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 24 May 2018 05:42:30 -0400 Subject: [PATCH 105/117] update to add new xcat-inventory osimage cases --- .../testcase/xcat-inventory/cases.osimage | 188 ++++++++++++++++-- 1 file changed, 172 insertions(+), 16 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage index 6b27a7cbd..29d99ffe6 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage @@ -924,16 +924,18 @@ cmd:if [ -e /tmp/postinstall ]; then cp -f /tmp/postinstall /tmp/postinstall.bak cmd:echo "test" >> /tmp/postinstall cmd:if [ -e /tmp/exlist ]; then cp -f /tmp/exlist /tmp/exlist.bak; fi cmd:echo "test" >> /tmp/exlist +cmd:if [ -e /tmp/partitionfile ]; then cp -f /tmp/partitionfile /tmp/partitionfile.bak; fi +cmd:echo "test" >> /tmp/partitionfile cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/test_myimage.stanza ;rmdef -t osimage -o test_myimage;fi check:rc==0 #cmd:ssh $$DSTMN 'lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/test_myimage.stanza ;rmdef -t osimage -o test_myimage;fi' #check:rc==0 -cmd:chdef -t osimage -o test_myimage imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist +cmd:chdef -t osimage -o test_myimage imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist partitionfile=/tmp/partitionfile check:rc==0 -cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage/ /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi -cmd:xcat-inventory export -t osimage -o test_myimage --format yaml -d /opt/inventory/site/osimage/ +cmd:if [ -e /opt/inventory/site/osimage ]; then cp -f /opt/inventory/site/osimage /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage; fi +cmd:xcat-inventory export -t osimage -o test_myimage --format yaml -d /opt/inventory/site/osimage check:rc==0 -check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage/ +check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage$synclists @@ -942,28 +944,30 @@ cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{pr check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage$exlist check:rc==0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage$partitionfile +check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage$pkglist check:rc!=0 cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage$template check:rc!=0 cmd: rmdef -t osimage -o test_myimage check:rc==0 -cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist -cmd:xcat-inventory import -t osimage -o test_myimage -d /opt/inventory/site/osimage/ +cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/partitionfile +cmd:xcat-inventory import -t osimage -o test_myimage -d /opt/inventory/site/osimage check:rc==0 check:output=~The object test_myimage has been imported cmd:lsdef -t osimage -o test_myimage check:rc==0 cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist -check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage$synclists check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage$postinstall check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage$exlist check:rc==0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage$partitionfile +check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then echo 0; else echo 1; fi check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then echo 0; else echo 1; fi @@ -977,6 +981,7 @@ cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/other cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi cmd:if [ -e /tmp/exlist.bak ]; then mv -f /tmp/exlist.bak /tmp/exlist; fi +cmd:if [ -e /tmp/partitionfile.bak ]; then mv -f /tmp/partitionfile.bak /tmp/partitionfile; fi end start:export_import_multiple_osimages_by_dir @@ -989,9 +994,11 @@ cmd:if [ -e /tmp/postinstall ]; then cp -f /tmp/postinstall /tmp/postinstall.bak cmd:echo "test" >> /tmp/postinstall cmd:if [ -e /tmp/exlist ]; then cp -f /tmp/exlist /tmp/exlist.bak; fi cmd:echo "test" >> /tmp/exlist +cmd:if [ -e /tmp/partitionfile ]; then cp -f /tmp/partitionfile /tmp/partitionfile.bak; fi +cmd:echo "test" >> /tmp/partitionfile cmd:if [ -e /tmp/pkglist ]; then cp -f /tmp/pkglist /tmp/pkglist.bak; fi cmd:echo "test" >> /tmp/pkglist -cmd:if [ -e /tmp/template ]; then cp -f /tmp/template /tmp/pkglist.bak; fi +cmd:if [ -e /tmp/template ]; then cp -f /tmp/template /tmp/template.bak; fi cmd:echo "test" >> /tmp/template cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/otherpkglist /opt/xcat/share/xcat/install/rh/otherpkglist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/otherpkglist @@ -1003,6 +1010,8 @@ cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall ]; then cp -f /opt/xcat/ cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/postinstall cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist ]; then cp -f /opt/xcat/share/xcat/install/rh/exlist /opt/xcat/share/xcat/install/rh/exlist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/exlist +cmd:if [ -e /opt/xcat/share/xcat/install/rh/partitionfile ]; then cp -f /opt/xcat/share/xcat/install/rh/partitionfile /opt/xcat/share/xcat/install/rh/partitionfile.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/partitionfile cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/pkglist /opt/xcat/share/xcat/install/rh/pkglist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/pkglist cmd:if [ -e /opt/xcat/share/xcat/install/rh/template ]; then cp -f /opt/xcat/share/xcat/install/rh/template /opt/xcat/share/xcat/install/rh/template.bak; fi @@ -1011,14 +1020,14 @@ cmd:lsdef -t osimage -o test_myimage1 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then ls `check:rc==0 cmd:lsdef -t osimage -o test_myimage2 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage2 -z >/tmp/test_myimage2.stanza ;rmdef -t osimage -o test_myimage2;fi check:rc==0 -cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist +cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist partitionfile=/tmp/partitionfile check:rc==0 -cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist +cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist partitionfile=/opt/xcat/share/xcat/install/rh/partitionfile check:rc==0 -cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage/ /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi -cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format yaml -d /opt/inventory/site/osimage/ +cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi +cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format yaml -d /opt/inventory/site/osimage check:rc==0 -check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage/ +check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists @@ -1027,6 +1036,8 @@ cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{p check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile +check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$pkglist check:rc!=0 cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$template @@ -1039,14 +1050,16 @@ cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{p check:rc!=0 cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$exlist check:rc!=0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$partitionfile +check:rc!=0 cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 -cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/pkglist /tmp/template -cmd:xcat-inventory import -t osimage -o test_myimage1,test_myimage2 -d /opt/inventory/site/osimage/ +cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/partitionfile /tmp/pkglist /tmp/template +cmd:xcat-inventory import -t osimage -o test_myimage1,test_myimage2 -d /opt/inventory/site check:rc==0 check:output=~The object test_myimage1 has been imported check:output=~The object test_myimage2 has been imported @@ -1060,6 +1073,8 @@ cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{p check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile +check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then echo 0; else echo 1; fi check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then echo 0; else echo 1; fi @@ -1072,6 +1087,8 @@ cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{p check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then echo 0; else echo 1; fi check:rc==0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then echo 0; else echo 1; fi +check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template @@ -1086,12 +1103,151 @@ cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/other cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi cmd:if [ -e /tmp/exlist.bak ]; then mv -f /tmp/exlist.bak /tmp/exlist; fi +cmd:if [ -e /tmp/partitionfile.bak ]; then mv -f /tmp/partitionfile.bak /tmp/partitionfile; fi cmd:if [ -e /tmp/pkglist.bak ]; then mv -f /tmp/pkglist.bak /tmp/pkglist fi cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/otherpkglist.bak /opt/xcat/share/xcat/install/rh/otherpkglist; fi cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/synclists.bak /opt/xcat/share/xcat/install/rh/synclists; fi cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/postinstall.bak /opt/xcat/share/xcat/install/rh/postinstall; fi cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/exlist.bak /opt/xcat/share/xcat/install/rh/exlist; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/partitionfile.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/partitionfile.bak /opt/xcat/share/xcat/install/rh/partitionfile; fi cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/pkglist.bak /opt/xcat/share/xcat/install/rh/pkglist; fi cmd:if [ -e /opt/xcat/share/xcat/install/rh/template.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/template.bak /opt/xcat/share/xcat/install/rh/template; fi end +start:export_import_all_osimages_by_dir +description:This case is used to test xcat-inventory export and import all linux osimage definition by files. +cmd:lsdef -t osimage -z | tee /tmp/osimage.list +check:rc==0 +#backup all osimage +cmd:if [ -e /tmp/osimages ]; then cp -f /tmp/osimages /tmp/osimages.bak ; else mkdir -p /tmp/osimages; fi +cmd:imgdir='/tmp/osimages';for img in $(lsdef -t osimage -s|awk -F' ' '{print $1}'); do lsdef -t osimage -o $img -z > $imgdir/${img}.stanza;done +check:rc==0 +cmd:for img in $(lsdef -t osimage -s|awk -F' ' '{print $1}');do rmdef -t osimage -o $img;done +check:rc==0 +cmd:if [ -e /tmp/otherpkglist ]; then cp -f /tmp/otherpkglist /tmp/otherpkglist.bak; fi +cmd:echo "test" >> /tmp/otherpkglist +cmd:if [ -e /tmp/synclists ]; then cp -f /tmp/synclists /tmp/synclists.bak; fi +cmd:echo "test" >> /tmp/synclists +cmd:if [ -e /tmp/postinstall ]; then cp -f /tmp/postinstall /tmp/postinstall.bak; fi +cmd:echo "test" >> /tmp/postinstall +cmd:if [ -e /tmp/exlist ]; then cp -f /tmp/exlist /tmp/exlist.bak; fi +cmd:echo "test" >> /tmp/exlist +cmd:if [ -e /tmp/partitionfile ]; then cp -f /tmp/partitionfile /tmp/partitionfile.bak; fi +cmd:echo "test" >> /tmp/partitionfile +cmd:if [ -e /tmp/pkglist ]; then cp -f /tmp/pkglist /tmp/pkglist.bak; fi +cmd:echo "test" >> /tmp/pkglist +cmd:if [ -e /tmp/template ]; then cp -f /tmp/template /tmp/pkglist.bak; fi +cmd:echo "test" >> /tmp/template +cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/otherpkglist /opt/xcat/share/xcat/install/rh/otherpkglist.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/otherpkglist +cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists ]; then cp -f /opt/xcat/share/xcat/install/rh/synclists /opt/xcat/share/xcat/install/rh/synclists.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/synclists +cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall ]; then cp -f /opt/xcat/share/xcat/install/rh/postinstall /opt/xcat/share/xcat/install/rh/postinstall.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/postinstall +cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist ]; then cp -f /opt/xcat/share/xcat/install/rh/exlist /opt/xcat/share/xcat/install/rh/exlist.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/exlist +cmd:if [ -e /opt/xcat/share/xcat/install/rh/partitionfile ]; then cp -f /opt/xcat/share/xcat/install/rh/partitionfile /opt/xcat/share/xcat/install/rh/partitionfile.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/partitionfile +cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/pkglist /opt/xcat/share/xcat/install/rh/pkglist.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/pkglist +cmd:if [ -e /opt/xcat/share/xcat/install/rh/template ]; then cp -f /opt/xcat/share/xcat/install/rh/template /opt/xcat/share/xcat/install/rh/template.bak; fi +cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/template +cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist partitionfile=/tmp/partitionfile +check:rc==0 +cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist partitionfile=/opt/xcat/share/xcat/install/rh/partitionfile +check:rc==0 +cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage/ /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi +cmd:xcat-inventory export -d /opt/inventory/site/ +check:rc==0 +check:output=~The osimage objects has been exported to directory /opt/inventory/site/ +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist +check:rc==0 +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists +check:rc==0 +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall +check:rc==0 +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist +check:rc==0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile +check:rc==0 +cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$pkglist +check:rc!=0 +cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$template +check:rc!=0 +cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$otherpkglist +check:rc!=0 +cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$synclists +check:rc!=0 +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$postinstall +check:rc!=0 +cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$exlist +check:rc!=0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$partitionfile +check:rc!=0 +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist +check:rc==0 +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template +check:rc==0 +cmd: rmdef -t osimage -o test_myimage1,test_myimage2 +check:rc==0 +cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/pkglist /tmp/template /tmp/partitionfile +cmd:xcat-inventory import -t osimage -d /opt/inventory/site/osimage/ +check:rc==0 +check:output=~Importing object: test_myimage1 +check:output=~Inventory import successfully! +check:output=~The object test_myimage1 has been imported +check:output=~Importing object: test_myimage2 +check:output=~Inventory import successfully! +check:output=~The object test_myimage2 has been imported +cmd:lsdef -t osimage -o test_myimage1,test_myimage2 +check:rc==0 +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist +check:rc==0 +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists +check:rc==0 +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall +check:rc==0 +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist +check:rc==0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile +check:rc==0 +cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then echo 0; else echo 1; fi +check:rc==0 +cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then echo 0; else echo 1; fi +check:rc==0 +cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist" ]; then echo 0; else echo 1; fi +check:rc==0 +cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists" ]; then echo 0; else echo 1; fi +check:rc==0 +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall" ]; then echo 0; else echo 1; fi +check:rc==0 +cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then echo 0; else echo 1; fi +check:rc==0 +cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then echo 0; else echo 1; fi +check:rc==0 +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist +check:rc==0 +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template +check:rc==0 +cmd: rmdef -t osimage -o test_myimage1,test_myimage2 +check:rc==0 +cmd: if [ -e /tmp/test_myimage1.stanza ]; then cat /tmp/test_myimage1.stanza |mkdef -z;fi +cmd: if [ -e /tmp/test_myimage2.stanza ]; then cat /tmp/test_myimage2.stanza |mkdef -z;fi +cmd: if [ -e /opt/inventory/site/osimage/ ]; then rm -rf /opt/inventory/site/osimage/;fi +cmd: if [ -e /opt/inventory/site/osimage.bak ]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi +cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi +cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi +cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi +cmd:if [ -e /tmp/exlist.bak ]; then mv -f /tmp/exlist.bak /tmp/exlist; fi +cmd:if [ -e /tmp/partitionfile.bak ]; then mv -f /tmp/partitionfile.bak /tmp/partitionfile; fi +cmd:if [ -e /tmp/pkglist.bak ]; then mv -f /tmp/pkglist.bak /tmp/pkglist fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/otherpkglist.bak /opt/xcat/share/xcat/install/rh/otherpkglist; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/synclists.bak /opt/xcat/share/xcat/install/rh/synclists; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/postinstall.bak /opt/xcat/share/xcat/install/rh/postinstall; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/exlist.bak /opt/xcat/share/xcat/install/rh/exlist; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/partitionfile.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/partitionfile.bak /opt/xcat/share/xcat/install/rh/partitionfile; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/pkglist.bak /opt/xcat/share/xcat/install/rh/pkglist; fi +cmd:if [ -e /opt/xcat/share/xcat/install/rh/template.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/template.bak /opt/xcat/share/xcat/install/rh/template; fi +cmd:for file in /tmp/osimages/*.stanza; do cat $file|mkdef -z; done +cmd:if [ -e /tmp/osimages.bak ]; then mv -f /tmp/osimages.bak /tmp/osimages; fi +end From 558d5b173f34a94c591577872986d60af7a8ae55 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 24 May 2018 13:11:38 -0400 Subject: [PATCH 106/117] Increase packet size of recv() --- xCAT-server/sbin/xcatd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index fb05f544e..eb345bdfe 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -809,7 +809,7 @@ sub do_udp_service { # This function opens up a UDP port my $hdl; foreach $hdl (@hdls) { if ($hdl == $socket) { - $part = $socket->recv($data, 2000); + $part = $socket->recv($data, 3000); $packets{$part} = [ $part, $data ]; } elsif ($hdl == $sslctl) { next; @@ -861,7 +861,7 @@ sub do_udp_service { # This function opens up a UDP port while (@hdls = $select->can_read(0)) { # grab any incoming requests during run foreach my $hdl (@hdls) { if ($hdl == $socket) { - $part = $socket->recv($data, 1500); + $part = $socket->recv($data,3000); $packets{$part} = [ $part, $data ]; #} elsif ($hdl == $sslctl) { From 521f265eb1e52a9b3dd2476b9f1f65e567dc7d2e Mon Sep 17 00:00:00 2001 From: yangsbj Date: Thu, 24 May 2018 23:35:53 -0400 Subject: [PATCH 107/117] refine xcat-inventory test case --- .../testcase/xcat-inventory/cases.common | 8 ++++--- .../testcase/xcat-inventory/cases.site | 23 +++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.common b/xCAT-test/autotest/testcase/xcat-inventory/cases.common index 7340bb6eb..f688d02cb 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.common +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.common @@ -66,13 +66,15 @@ check:rc==0 cmd:xcat-inventory export --format=yaml -t node -o bogusnode -f /tmp/xcat_inventory_export_option_f/export_yaml_with_f check:rc==0 check:output !~Traceback -cmd:diff /tmp/xcat_inventory_export_option_f/export_yaml_without_f /tmp/xcat_inventory_export_option_f/export_yaml_with_f +cmd:#!/bin/bash +diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_export_option_f/export_yaml_without_f /tmp/xcat_inventory_export_option_f/export_yaml_with_f check:rc==0 cmd:xcat-inventory export -t node -o bogusnode | tee /tmp/xcat_inventory_export_option_f/export_json_without_f check:rc==0 cmd:xcat-inventory export -t node -o bogusnode --path /tmp/xcat_inventory_export_option_f/export_json_with_f check:rc==0 -cmd:diff /tmp/xcat_inventory_export_option_f/export_json_without_f /tmp/xcat_inventory_export_option_f/export_json_with_f +cmd:#!/bin/bash +diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_export_option_f/export_json_without_f /tmp/xcat_inventory_export_option_f/export_json_with_f check:rc==0 cmd:xcat-inventory export -t node -o bogusnode -f check:rc!=0 @@ -101,7 +103,7 @@ cmd:mkdir -p /tmp/xcat_inventory_import_option_f_invalid_file check:rc==0 #to handle a non-existed file cmd:xcat-inventory import -f aaa -check:output=~The specified inventory file does not exist +check:output=~the directory does not exist or is not a directory check:output !~Traceback check:rc!=0 #To handle a invalid json file diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.site b/xCAT-test/autotest/testcase/xcat-inventory/cases.site index e23b916a5..8026ff444 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.site +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.site @@ -31,7 +31,7 @@ cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed check:rc==0 cmd: cat /tmp/export_import_site_by_yaml/dstsite.stanza check:rc==0 -cmd:diff -y /tmp/export_import_site_by_yaml/srcsite.stanza /tmp/export_import_site_by_yaml/dstsite.stanza +cmd:diff -y --ignore-blank-lines /tmp/export_import_site_by_yaml/srcsite.stanza /tmp/export_import_site_by_yaml/dstsite.stanza check:rc==0 cmd:cat /tmp/export_import_site_by_yaml/site.stanza | mkdef -z -f check:rc==0 @@ -77,7 +77,7 @@ cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed check:rc==0 cmd: cat /tmp/export_import_site_by_json/dstsite.stanza check:rc==0 -cmd:diff -y /tmp/export_import_site_by_json/srcsite.stanza /tmp/export_import_site_by_json/dstsite.stanza +cmd:diff -y --ignore-blank-lines /tmp/export_import_site_by_json/srcsite.stanza /tmp/export_import_site_by_json/dstsite.stanza check:rc==0 cmd:cat /tmp/export_import_site_by_json/site.stanza | mkdef -z -f check:rc==0 @@ -197,7 +197,8 @@ cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed check:rc==0 cmd:xcat-inventory export -t site |tee /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.export check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.export +cmd:#!/bin/bash +diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.export check:rc==0 cmd:cat /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.stanza | mkdef -z -f check:rc==0 @@ -312,7 +313,8 @@ cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed check:rc==0 cmd:xcat-inventory export --format=json -t site |tee /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.export check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.export +cmd:#!/bin/bash +diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.export check:rc==0 cmd:cat /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.stanza | mkdef -z -f check:rc==0 @@ -423,7 +425,8 @@ cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed check:rc==0 cmd:xcat-inventory export --format=yaml -t site|sed -e '/^\s*$/d' |tee /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.export check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.export +cmd:#!/bin/bash +diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.export check:rc==0 cmd:cat /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.stanza | mkdef -z -f check:rc==0 @@ -838,7 +841,8 @@ cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_site_ check:rc==0 cmd:lsdef -t site -o clustersite > /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.import check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.org /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.import +cmd:#!/bin/bash +diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.org /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.import check:rc==0 cmd:lsdef bogusgroup1 check:output=~Error: Could not find an object @@ -1203,7 +1207,8 @@ cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_site_ check:rc==0 cmd:lsdef -t site -o clustersite > /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.import check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.org /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.import +cmd:#!/bin/bash +diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.org /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.import check:rc==0 cmd:lsdef bogusgroup1 check:output=~Error: Could not find an object @@ -1278,7 +1283,7 @@ cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed check:rc==0 cmd: cat /tmp/export_site_table_then_modify_yaml_then_import/dstsite.stanza check:rc==0 -cmd:diff -y /tmp/export_site_table_then_modify_yaml_then_import/srcsite.stanza /tmp/export_site_table_then_modify_yaml_then_import/dstsite.stanza +cmd:diff -y --ignore-blank-lines /tmp/export_site_table_then_modify_yaml_then_import/srcsite.stanza /tmp/export_site_table_then_modify_yaml_then_import/dstsite.stanza check:rc==0 cmd:cat /tmp/export_site_table_then_modify_yaml_then_import/site.stanza | mkdef -z -f check:rc==0 @@ -1341,7 +1346,7 @@ cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed check:rc==0 cmd: cat /tmp/export_site_table_then_modify_json_then_import/dstsite.stanza check:rc==0 -cmd:diff -y /tmp/export_site_table_then_modify_json_then_import/srcsite.stanza /tmp/export_site_table_then_modify_json_then_import/dstsite.stanza +cmd:diff -y --ignore-blank-lines /tmp/export_site_table_then_modify_json_then_import/srcsite.stanza /tmp/export_site_table_then_modify_json_then_import/dstsite.stanza check:rc==0 cmd:cat /tmp/export_site_table_then_modify_json_then_import/site.stanza | mkdef -z -f check:rc==0 From 699486a15c6e352ac1a8d293cf32d0ba0ce7c31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=E1=B4=8F=C9=B4=C9=A2=20Jie?= Date: Fri, 25 May 2018 16:09:54 +0800 Subject: [PATCH 108/117] Add new test cases for the syncfiles feature (#5228) * Add new test cases for the syncfiles feature * Update the test case for EXECUTEALWAYS feature * Test regular updatenode -F and the scp feature separately * Ignore some failling when use scp --- xCAT-test/autotest/testcase/updatenode/cases4 | 11 ++ .../autotest/testcase/updatenode/syncfiles | 111 ++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 xCAT-test/autotest/testcase/updatenode/cases4 create mode 100755 xCAT-test/autotest/testcase/updatenode/syncfiles diff --git a/xCAT-test/autotest/testcase/updatenode/cases4 b/xCAT-test/autotest/testcase/updatenode/cases4 new file mode 100644 index 000000000..008767fb3 --- /dev/null +++ b/xCAT-test/autotest/testcase/updatenode/cases4 @@ -0,0 +1,11 @@ +start:updatenode_syncfiles +description: Test cases for the syncfiles feature +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/updatenode/syncfiles $$CN +check:rc==0 +end + +start:updatenode_syncfiles_scp +description: Test cases for the syncfiles feature with scp +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/updatenode/syncfiles $$CN scp +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/updatenode/syncfiles b/xCAT-test/autotest/testcase/updatenode/syncfiles new file mode 100755 index 000000000..7e5dd72ae --- /dev/null +++ b/xCAT-test/autotest/testcase/updatenode/syncfiles @@ -0,0 +1,111 @@ +#!/bin/bash + +set -x + +COMPUTE_NODE="${1:?empty compute node}" + +NODE_RCP="${2:+-r /usr/bin/scp}" + +OSIMAGE="$(lsdef "${COMPUTE_NODE}" -i provmethod | awk -F = '/provmethod=/ { print $2 }')" + +TMP_DIR="$(mktemp -d "/tmp/${0##*/}.XXXXXXXX" 2>/dev/null)" + +function cleanup() +{ + rm -rf "${TMP_DIR}" + chdef -t osimage "${OSIMAGE}" "synclists=" +} + +trap cleanup EXIT + +function compute_node_cleanup() +{ + xdsh "${COMPUTE_NODE}" "rm -rf /etc/files" +} + +declare -i failed=0 + +mkdir -p "${TMP_DIR}/files" +echo foo >"${TMP_DIR}/files/foo" +echo bar >"${TMP_DIR}/files/bar" +echo baz >"${TMP_DIR}/files/baz" + +cat >"${TMP_DIR}/foobar.synclist" < /etc/files/foo +${TMP_DIR}/files/bar -> /etc/files/bar +${TMP_DIR}/files/baz -> /etc/files/baz +EOF + +chdef -t osimage "${OSIMAGE}" "synclists=${TMP_DIR}/foobar.synclist" + +updatenode "${COMPUTE_NODE}" -F ${NODE_RCP} +# Check return code +(( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep foo /etc/files/foo' +(( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep bar /etc/files/bar' +(( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep baz /etc/files/baz' +(( failed += $? )) +compute_node_cleanup + +# ====== # + +xdsh "${COMPUTE_NODE}" 'mkdir -p /etc/files/bar' +updatenode "${COMPUTE_NODE}" -F ${NODE_RCP} +# Check return code +[ -z "${NODE_RCP}" ] && (( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep foo /etc/files/foo' +(( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep bar /etc/files/bar' +[ -z "${NODE_RCP}" ] && (( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep baz /etc/files/baz' +(( failed += $? )) +compute_node_cleanup + +# ====== # + +rm -f "${TMP_DIR}/files/bar" + +updatenode "${COMPUTE_NODE}" -F ${NODE_RCP} +xdsh "${COMPUTE_NODE}" 'grep foo /etc/files/foo' +(( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep baz /etc/files/baz' +(( failed += $? )) +compute_node_cleanup + +# ====== # + +mkdir -p "${TMP_DIR}/files/bar" +xdsh "${COMPUTE_NODE}" 'mkdir -p /etc/files && echo bar >/etc/files/bar' +updatenode "${COMPUTE_NODE}" -F ${NODE_RCP} +[ -z "${NODE_RCP}" ] && (( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep foo /etc/files/foo' +(( failed += $? )) +xdsh "${COMPUTE_NODE}" 'test -d /etc/files/bar' +[ -z "${NODE_RCP}" ] && (( failed += $? )) +xdsh "${COMPUTE_NODE}" 'grep baz /etc/files/baz' +(( failed += $? )) +compute_node_cleanup + +# ====== # + +cat >"${TMP_DIR}/files/qux" </etc/files/zzz +EOF +chmod 0755 "${TMP_DIR}/files/qux" +cat >>"${TMP_DIR}/foobar.synclist" < Date: Fri, 25 May 2018 16:29:22 +0800 Subject: [PATCH 109/117] Add resource check in xcatmn (#5202) * Add more checking for xcat mn healthy --- xCAT-probe/subcmds/xcatmn | 153 +++++++++++++++++++++++++++++++++++--- 1 file changed, 141 insertions(+), 12 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index acc3a5409..2cabc7013 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -57,10 +57,12 @@ sub do_main_job { my $checkpoint; my $rc = 0; my $installnicip; + my $flag = "w"; - #check if all xcat deamons are running - $rst = check_all_xcat_deamons(\$checkpoint, \@error); - print_check_result($checkpoint, "f", $rst, \@error); + #check if all xcat daemons are running + ($rst, $flag) = check_all_xcat_daemons(\$checkpoint, \@error); + print_check_result($checkpoint, $flag, $rst, \@error); + $rst = 0 if ($flag == "w"); return $rst if ($rst); #check if xcatd can receive request @@ -136,10 +138,24 @@ sub do_main_job { print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; + #check linux ulimits configuration + ($rst, $flag) = check_ulimits(\$checkpoint, \@error); + print_check_result($checkpoint, $flag, $rst, \@error); + $rc |= $rst; + + #check network parameter configuration + ($rst, $flag) = check_network_parameter(\$checkpoint, \@error); + print_check_result($checkpoint, $flag, $rst, \@error); + $rc |= $rst; #some sepecific check points in MN if (!$is_sn) { + #check xCAT daemon attributes configuration + ($rst, $flag) = check_daemon_attributes(\$checkpoint, \@error); + print_check_result($checkpoint, $flag, $rst, \@error); + $rc |= $rst; + #check if log can be recorded in log file $rst = check_log_record(\$checkpoint, \@error); print_check_result($checkpoint, "w", $rst, \@error); @@ -267,15 +283,16 @@ sub print_check_result { } -sub check_all_xcat_deamons { +sub check_all_xcat_daemons { my $checkpoint_ref = shift; my $error_ref = shift; my $rst = 0; + my $rst_type = "f"; - $$checkpoint_ref = "Checking all xCAT deamons are running..."; + $$checkpoint_ref = "Checking all xCAT daemons are running..."; @$error_ref = (); - my @deamon_list = ("SSL listener", + my @daemon_list = ("SSL listener", "DB Access", "UDP listener", "install monitor", @@ -283,14 +300,28 @@ sub check_all_xcat_deamons { "Command log writer"); my $output = `ps aux 2>&1|grep -v grep|grep xcatd`; - foreach my $deamon (@deamon_list) { - if ($output !~ /$deamon/) { - push @$error_ref, "Deamon '$deamon' isn't running"; + foreach my $daemon (@daemon_list) { + my $counter = $output =~ s/$daemon/$daemon/g; + if ($counter > 1) { + if ($daemon == "SSL listener") { + my $cur_pid = `cat /var/run/xcatd.pid`; + my @ssl_pids = `ps aux 2>&1|grep -v grep|grep "xcatd: $daemon"|awk -F' ' '{print \$2}'`; + foreach my $ssl_pid (@ssl_pids) { + next if ($cur_pid == $ssl_pid); + my $child_pid = `ps --ppid $ssl_pid 2>&1 | grep "xcatd SSL:" | wc -l`; + chomp($child_pid); + $rst_type = "w" if ($child_pid); + } + } + push @$error_ref, "More Daemon '$daemon' is running"; + $rst = 1; + } elsif ($counter == 0) { + push @$error_ref, "Daemon '$daemon' isn't running"; $rst = 1; } } - return $rst; + return ($rst, $rst_type); } sub check_xcatd_receive_request { @@ -917,7 +948,7 @@ sub check_dhcp_service { # on sn, just check dhcpd service whether running my $dhcpoutput = `ps aux 2>&1| grep dhcpd |grep -v grep`; if (!$dhcpoutput) { - push @$error_ref, "There isn't 'dhcpd' deamon in current server"; + push @$error_ref, "There isn't 'dhcpd' daemon in current server"; $rst = 1; } } else { @@ -1042,6 +1073,104 @@ sub check_dhcp_leases { return $rst; } +sub check_ulimits { + my $checkpoint_ref = shift; + my $error_ref = shift; + my $rst = 0; + my $rst_type = "w"; + + $$checkpoint_ref = "Checking Linux ulimits configuration..."; + @$error_ref = (); + + my $nofile_num = `sh -c 'ulimit -n' 2>&1`; + chomp($nofile_num); + + my $process_id = `cat /var/run/xcatd.pid`; + chomp($process_id); + my $process_folder = "/proc/$process_id/fd/"; + + my $open_num = 0; + $open_num = `ls $process_folder | wc -l` if (-e $process_folder); + chomp($open_num); + return ($rst, $rst_type) unless($open_num); + + my $percent = $open_num/$nofile_num; + unless ($percent < 0.8) { + push @$error_ref, "The number of open files is not enough for xcatd service, increase the limits for it according to xCAT document"; + $rst = 1; + if ($percent >= 1) { + $rst_type = "f"; + } + } + return ($rst, $rst_type); +} + +sub check_network_parameter { + my $checkpoint_ref = shift; + my $error_ref = shift; + my $rst = 0; + my $rst_type = "w"; + + $$checkpoint_ref = "Checking network kernel parameter configuration..."; + @$error_ref = (); + + my $net_set_file = "/etc/sysctl.conf"; + my $net_gc_thresh = 512; + my $net_set_value = `sysctl -n net.ipv4.neigh.default.gc_thresh2`; + chomp($net_set_value); + $net_gc_thresh = $net_set_value if ($net_set_value); + + my $arp_num = `arp -a | wc -l`; + chomp($arp_num); + + my $percent = $arp_num/$net_gc_thresh; + unless ($percent < 0.8) { + push @$error_ref, "Most ARP has been used, please tuning network parameter as document"; + $rst = 1; + if ($percent >= 1) { + $rst_type = "f"; + } + } + return ($rst, $rst_type); +} + +sub check_daemon_attributes { + my $checkpoint_ref = shift; + my $error_ref = shift; + my $rst = 0; + $rst_type = "w"; + + $$checkpoint_ref = "Checking xCAT daemon attributes configuration..."; + @$error_ref = (); + + my $node_num = `nodels 2>&1 | wc -l`; + chomp($node_num); + my $xcatmaxconnections = 64; + my $xcatmaxbatchconnections = 50; + + my @site_max_info = `lsdef -t site -i xcatmaxconnections,xcatmaxbatchconnections -c 2>&1`; + foreach my $site_max (@site_max_info) { + if ($site_max =~ /xcatmaxconnections=(\d+)/) { + $xcatmaxconnections_site = $1; + } + if ($site_max =~ /xcatmaxbatchconnections=(\d+)/) { + $xcatmaxbatchconnections_site = $1; + } + } + + if ($xcatmaxconnections_site <= $xcatmaxbatchconnections_site) { + push @$error_ref, "Attribute xcatmaxbatchconnections must be less than xcatmaxconnections."; + $rst = 1; + $rst_type = "f"; + } elsif ($xcatmaxconnections_site < $xcatmaxconnections or + $xcatmaxbatchconnections_site < $xcatmaxbatchconnections and + $node_num >= 500) { + push @$error_ref, "Management nodes are more than 500, please tuning xCAT daemon attributes as document"; + $rst = 1; + } + return ($rst, $rst_type); +} + sub returncmdoutput { my $rst = shift; my $error_ref = shift; @@ -1135,7 +1264,7 @@ while ($hierarchy_instance->read_reply(\%reply_cache)) { #print ">>>$reply_cache{$servers}->[$_]<<<\n"; #For cases like below: - #c910f02c04p04: [ok] :All xCAT deamons are running + #c910f02c04p04: [ok] :All xCAT daemons are running if ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/) { if ("$1" eq "$server") { $logmsg = "$2: $3"; From c866af4872b04e5c87a16bc0a8eb4a4ff748b9fe Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 25 May 2018 04:46:11 -0400 Subject: [PATCH 110/117] update according to comments --- .../testcase/xcat-inventory/cases.osimage | 234 +++++++++--------- 1 file changed, 119 insertions(+), 115 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage index 29d99ffe6..6574d1ed3 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage @@ -27,7 +27,7 @@ cmd: scp $$DSTMN:/tmp/export_import_single_osimage_by_yaml_$$DSTMN/dst_bogus_ima check:rc==0 cmd: cat /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza check:rc==0 -cmd:diff -y /tmp/export_import_single_osimage_by_yaml/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza +cmd:diff -y -y /tmp/export_import_single_osimage_by_yaml/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 @@ -70,7 +70,7 @@ cmd: scp $$DSTMN:/tmp/export_import_single_osimage_by_json_$$DSTMN/dst_bogus_ima check:rc==0 cmd: cat /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza check:rc==0 -cmd:diff -y /tmp/export_import_single_osimage_by_json/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza +cmd:diff -y -y /tmp/export_import_single_osimage_by_json/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 @@ -431,7 +431,7 @@ cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_osima check:rc==0 cmd:lsdef -t osimage -l|sort > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import_osimage check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import_osimage +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import_osimage check:rc==0 cmd:lsdef -t node -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_nodes_db check:rc==0 @@ -447,19 +447,19 @@ cmd:tabdump networks > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yam check:rc==0 cmd:tabdump routes > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_route_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_nodes_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_nodes_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_group_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_group_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_site_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_site_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_pw_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_pw_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_policy_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_policy_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_network_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_network_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_route_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_route_db check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 @@ -761,7 +761,7 @@ cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_osima check:rc==0 cmd:lsdef -t osimage -l|sort > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import_osimage check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import_osimage +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import_osimage check:rc==0 cmd:lsdef -t node -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_nodes_db check:rc==0 @@ -777,19 +777,19 @@ cmd:tabdump networks > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_jso check:rc==0 cmd:tabdump routes > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_route_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_nodes_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_nodes_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_group_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_group_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_site_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_site_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_pw_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_pw_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_policy_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_policy_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_network_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_network_db check:rc==0 -cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_route_db +cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_route_db check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 @@ -843,7 +843,7 @@ cmd: scp $$DSTMN:/tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN check:rc==0 cmd: cat /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza check:rc==0 -cmd:diff -y /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza +cmd:diff -y -y /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 @@ -899,7 +899,7 @@ cmd: scp $$DSTMN:/tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN check:rc==0 cmd: cat /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza check:rc==0 -cmd:diff -y /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza +cmd:diff -y -y /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 @@ -932,19 +932,21 @@ check:rc==0 #check:rc==0 cmd:chdef -t osimage -o test_myimage imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist partitionfile=/tmp/partitionfile check:rc==0 -cmd:if [ -e /opt/inventory/site/osimage ]; then cp -f /opt/inventory/site/osimage /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage; fi +cmd:lsdef -t osimage test_myimage +cmd:dir="/opt/inventory/site/osimage";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir cmd:xcat-inventory export -t osimage -o test_myimage --format yaml -d /opt/inventory/site/osimage check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage -cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist +cmd: ls -lFR /opt/inventory/site/osimage +cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage$exlist check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage$partitionfile +cmd:partitionfile=`lsdef -t osimage -o test_myimage |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage$pkglist check:rc!=0 @@ -958,30 +960,30 @@ check:rc==0 check:output=~The object test_myimage has been imported cmd:lsdef -t osimage -o test_myimage check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage$exlist check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage$partitionfile +cmd:partitionfile=`lsdef -t osimage -o test_myimage |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage$partitionfile check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then echo 0; else echo 1; fi +cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then echo 0; else echo 1; fi +cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then exit 0; else exit 1; fi check:rc==0 cmd: rmdef -t osimage -o test_myimage check:rc==0 cmd: if [ -e /tmp/test_myimage.stanza ]; then cat /tmp/test_myimage.stanza |mkdef -z;fi -cmd: if [ -e /opt/inventory/site/osimage/ ]; then rm -rf /opt/inventory/site/osimage/;fi -cmd: if [ -e /opt/inventory/site/osimage.bak ]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi +cmd:dir="/opt/inventory/site/osimage"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi -cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi -cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi -cmd:if [ -e /tmp/exlist.bak ]; then mv -f /tmp/exlist.bak /tmp/exlist; fi -cmd:if [ -e /tmp/partitionfile.bak ]; then mv -f /tmp/partitionfile.bak /tmp/partitionfile; fi +cmd:file="/tmp/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi end start:export_import_multiple_osimages_by_dir @@ -1024,19 +1026,20 @@ cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist check:rc==0 cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist partitionfile=/opt/xcat/share/xcat/install/rh/partitionfile check:rc==0 -cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi -cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format yaml -d /opt/inventory/site/osimage +cmd:lsdef -t osimage test_myimage1,test_myimage2 +cmd:dir="/opt/inventory/site/osimage";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir +cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format json -d /opt/inventory/site/osimage check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage -cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile +cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$pkglist check:rc!=0 @@ -1052,9 +1055,9 @@ cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'` check:rc!=0 cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$partitionfile check:rc!=0 -cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff -y $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 @@ -1065,53 +1068,53 @@ check:output=~The object test_myimage1 has been imported check:output=~The object test_myimage2 has been imported cmd:lsdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile +cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then echo 0; else echo 1; fi +cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then echo 0; else echo 1; fi +cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist" ]; then echo 0; else echo 1; fi +cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists" ]; then echo 0; else echo 1; fi +cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall" ]; then echo 0; else echo 1; fi +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then echo 0; else echo 1; fi +cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then echo 0; else echo 1; fi +cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then exit 0; else echo 1; fi check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff -y $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd: if [ -e /tmp/test_myimage1.stanza ]; then cat /tmp/test_myimage1.stanza |mkdef -z;fi cmd: if [ -e /tmp/test_myimage2.stanza ]; then cat /tmp/test_myimage2.stanza |mkdef -z;fi -cmd: if [ -e /opt/inventory/site/osimage/ ]; then rm -rf /opt/inventory/site/osimage/;fi -cmd: if [ -e /opt/inventory/site/osimage.bak ]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi -cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi -cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi -cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi -cmd:if [ -e /tmp/exlist.bak ]; then mv -f /tmp/exlist.bak /tmp/exlist; fi -cmd:if [ -e /tmp/partitionfile.bak ]; then mv -f /tmp/partitionfile.bak /tmp/partitionfile; fi -cmd:if [ -e /tmp/pkglist.bak ]; then mv -f /tmp/pkglist.bak /tmp/pkglist fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/otherpkglist.bak /opt/xcat/share/xcat/install/rh/otherpkglist; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/synclists.bak /opt/xcat/share/xcat/install/rh/synclists; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/postinstall.bak /opt/xcat/share/xcat/install/rh/postinstall; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/exlist.bak /opt/xcat/share/xcat/install/rh/exlist; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/partitionfile.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/partitionfile.bak /opt/xcat/share/xcat/install/rh/partitionfile; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/pkglist.bak /opt/xcat/share/xcat/install/rh/pkglist; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/template.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/template.bak /opt/xcat/share/xcat/install/rh/template; fi +cmd:dir="/opt/inventory/site/osimage"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi +cmd:file="/tmp/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/pkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/template"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/pkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/template"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi end start:export_import_all_osimages_by_dir @@ -1156,19 +1159,19 @@ cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist check:rc==0 cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist partitionfile=/opt/xcat/share/xcat/install/rh/partitionfile check:rc==0 -cmd:if [ -e /opt/inventory/site/osimage/ ]; then cp -f /opt/inventory/site/osimage/ /opt/inventory/site/osimage.bak; else mkdir -p /opt/inventory/site/osimage/; fi +cmd:dir="/opt/inventory/site/osimage";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir cmd:xcat-inventory export -d /opt/inventory/site/ check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/ -cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile +cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$pkglist check:rc!=0 @@ -1184,14 +1187,14 @@ cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'` check:rc!=0 cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$partitionfile check:rc!=0 -cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff -y $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/pkglist /tmp/template /tmp/partitionfile -cmd:xcat-inventory import -t osimage -d /opt/inventory/site/osimage/ +cmd:xcat-inventory import -t osimage -d /opt/inventory/site check:rc==0 check:output=~Importing object: test_myimage1 check:output=~Inventory import successfully! @@ -1201,53 +1204,54 @@ check:output=~Inventory import successfully! check:output=~The object test_myimage2 has been imported cmd:lsdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist +cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff $synclists /opt/inventory/site/osimage/test_myimage1$synclists +cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall +cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff $exlist /opt/inventory/site/osimage/test_myimage1$exlist +cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile +cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then echo 0; else echo 1; fi +cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then echo 0; else echo 1; fi +cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist" ]; then echo 0; else echo 1; fi +cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists" ]; then echo 0; else echo 1; fi +cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall" ]; then echo 0; else echo 1; fi +cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then echo 0; else echo 1; fi +cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then echo 0; else echo 1; fi +cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist +cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 -cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff $template /opt/inventory/site/osimage/test_myimage2$template +cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff -y $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd: if [ -e /tmp/test_myimage1.stanza ]; then cat /tmp/test_myimage1.stanza |mkdef -z;fi cmd: if [ -e /tmp/test_myimage2.stanza ]; then cat /tmp/test_myimage2.stanza |mkdef -z;fi -cmd: if [ -e /opt/inventory/site/osimage/ ]; then rm -rf /opt/inventory/site/osimage/;fi -cmd: if [ -e /opt/inventory/site/osimage.bak ]; then mv /opt/inventory/site/osimage.bak /opt/inventory/site/osimage;fi -cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi -cmd:if [ -e /tmp/synclists.bak ]; then mv -f /tmp/synclists.bak /tmp/synclists; fi -cmd:if [ -e /tmp/postinstall.bak ]; then mv -f /tmp/postinstall.bak /tmp/postinstall; fi -cmd:if [ -e /tmp/exlist.bak ]; then mv -f /tmp/exlist.bak /tmp/exlist; fi -cmd:if [ -e /tmp/partitionfile.bak ]; then mv -f /tmp/partitionfile.bak /tmp/partitionfile; fi -cmd:if [ -e /tmp/pkglist.bak ]; then mv -f /tmp/pkglist.bak /tmp/pkglist fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/otherpkglist.bak /opt/xcat/share/xcat/install/rh/otherpkglist; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/synclists.bak /opt/xcat/share/xcat/install/rh/synclists; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/postinstall.bak /opt/xcat/share/xcat/install/rh/postinstall; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/exlist.bak /opt/xcat/share/xcat/install/rh/exlist; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/partitionfile.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/partitionfile.bak /opt/xcat/share/xcat/install/rh/partitionfile; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/pkglist.bak /opt/xcat/share/xcat/install/rh/pkglist; fi -cmd:if [ -e /opt/xcat/share/xcat/install/rh/template.bak ]; then mv -f /opt/xcat/share/xcat/install/rh/template.bak /opt/xcat/share/xcat/install/rh/template; fi +cmd:dir="/opt/inventory/site/osimage"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi +cmd:dir="/opt/inventory/site/osimage"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi +cmd:file="/tmp/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/pkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/tmp/template"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/pkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi +cmd:file="/opt/xcat/share/xcat/install/rh/template"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:for file in /tmp/osimages/*.stanza; do cat $file|mkdef -z; done cmd:if [ -e /tmp/osimages.bak ]; then mv -f /tmp/osimages.bak /tmp/osimages; fi end From a064d1d207d9cf60af2d6bd666365cffe7a91838 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 25 May 2018 09:41:43 -0400 Subject: [PATCH 111/117] fix an error --- .../testcase/xcat-inventory/cases.osimage | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage index 6574d1ed3..7cf2f25a1 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage @@ -27,7 +27,7 @@ cmd: scp $$DSTMN:/tmp/export_import_single_osimage_by_yaml_$$DSTMN/dst_bogus_ima check:rc==0 cmd: cat /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza check:rc==0 -cmd:diff -y -y /tmp/export_import_single_osimage_by_yaml/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza +cmd:diff -y /tmp/export_import_single_osimage_by_yaml/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 @@ -70,7 +70,7 @@ cmd: scp $$DSTMN:/tmp/export_import_single_osimage_by_json_$$DSTMN/dst_bogus_ima check:rc==0 cmd: cat /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza check:rc==0 -cmd:diff -y -y /tmp/export_import_single_osimage_by_json/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza +cmd:diff -y /tmp/export_import_single_osimage_by_json/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 @@ -431,7 +431,7 @@ cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_osima check:rc==0 cmd:lsdef -t osimage -l|sort > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import_osimage check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import_osimage +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import_osimage check:rc==0 cmd:lsdef -t node -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_nodes_db check:rc==0 @@ -447,19 +447,19 @@ cmd:tabdump networks > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yam check:rc==0 cmd:tabdump routes > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_route_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_nodes_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_nodes_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_group_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_group_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_site_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_site_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_pw_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_pw_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_policy_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_policy_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_network_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_network_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_route_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_route_db check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 @@ -761,7 +761,7 @@ cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_osima check:rc==0 cmd:lsdef -t osimage -l|sort > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import_osimage check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import_osimage +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import_osimage check:rc==0 cmd:lsdef -t node -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_nodes_db check:rc==0 @@ -777,19 +777,19 @@ cmd:tabdump networks > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_jso check:rc==0 cmd:tabdump routes > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_route_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_nodes_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_nodes_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_group_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_group_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_site_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_site_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_pw_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_pw_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_policy_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_policy_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_network_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_network_db check:rc==0 -cmd:diff -y -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_route_db +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_route_db check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 @@ -843,7 +843,7 @@ cmd: scp $$DSTMN:/tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN check:rc==0 cmd: cat /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza check:rc==0 -cmd:diff -y -y /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza +cmd:diff -y /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 @@ -899,7 +899,7 @@ cmd: scp $$DSTMN:/tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN check:rc==0 cmd: cat /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza check:rc==0 -cmd:diff -y -y /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza +cmd:diff -y /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 From 3745bac26d888dcc1041966110521893b538ac86 Mon Sep 17 00:00:00 2001 From: robin2008 Date: Sat, 26 May 2018 11:43:26 +0800 Subject: [PATCH 112/117] Update the testcase to cover the changes in #5119 using regular expression to cover the error/warn message which contains the server name --- .../UT_openbmc/reventlog_resolved_cases0 | 10 +- .../testcase/UT_openbmc/rflash_cases0 | 16 +-- .../testcase/UT_openbmc/rspconfig_cases0 | 4 +- xCAT-test/autotest/testcase/addkitcomp/case0 | 2 +- xCAT-test/autotest/testcase/chdef/cases0 | 8 +- xCAT-test/autotest/testcase/chvm/cases0 | 2 +- xCAT-test/autotest/testcase/lsdef/cases0 | 2 +- xCAT-test/autotest/testcase/nodeset/cases0 | 4 +- xCAT-test/autotest/testcase/packimg/cases0 | 4 +- xCAT-test/autotest/testcase/pdu/case0 | 2 +- xCAT-test/autotest/testcase/pping/cases0 | 2 +- .../autotest/testcase/restapi/table/cases0 | 2 +- xCAT-test/autotest/testcase/reventlog/cases0 | 4 +- .../autotest/testcase/rflash/rflash_openbmc.0 | 126 +++++++++--------- xCAT-test/autotest/testcase/rinv/cases0 | 4 +- xCAT-test/autotest/testcase/rmkitcomp/case0 | 2 +- xCAT-test/autotest/testcase/rpower/cases0 | 6 +- xCAT-test/autotest/testcase/rsetboot/cases0 | 2 +- xCAT-test/autotest/testcase/rspconfig/cases0 | 52 ++++---- xCAT-test/autotest/testcase/rspconfig/cases1 | 14 +- .../testcase/xcat-inventory/cases.node | 12 +- .../testcase/xcat-inventory/cases.site | 12 +- .../testcase/xcat-inventory/validatehelper | 4 +- xCAT-test/autotest/testcase/xcatd/case0 | 8 +- xCAT-test/autotest/testcase/xdsh/cases0 | 2 +- 25 files changed, 153 insertions(+), 153 deletions(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/reventlog_resolved_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/reventlog_resolved_cases0 index 43b9a6410..64bf22eb4 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/reventlog_resolved_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/reventlog_resolved_cases0 @@ -4,7 +4,7 @@ os:Linux hcp:openbmc cmd:reventlog $$CN resolved check:rc==1 -check:output=~Error: Usage error. Provide a comma separated +check:output=~Error: (\[.*?\]: )?Usage error. Provide a comma separated end start:reventlog_resolved_parse_error2 @@ -13,7 +13,7 @@ os:Linux hcp:openbmc cmd:reventlog $$CN resolved= check:rc==1 -check:output=~Error: Usage error. Provide a comma separated +check:output=~Error: (\[.*?\]: )?Usage error. Provide a comma separated end start:reventlog_resolved_parse_error3 @@ -22,7 +22,7 @@ os:Linux hcp:openbmc cmd:reventlog $$CN resolved 1,2,3 check:rc==1 -check:output=~Error: Usage error. Provide a comma separated +check:output=~Error: (\[.*?\]: )?Usage error. Provide a comma separated end start:reventlog_resolved_parse_error4 @@ -31,7 +31,7 @@ os:Linux hcp:openbmc cmd:reventlog $$CN resolved=-1 check:rc==1 -check:output=~Error: Invalid ID= +check:output=~Error: (\[.*?\]: )?Invalid ID= end start:reventlog_resolved_parse_error5 @@ -40,7 +40,7 @@ os:Linux hcp:openbmc cmd:reventlog $$CN resolved=abc check:rc==1 -check:output=~Error: Invalid ID= +check:output=~Error: (\[.*?\]: )?Invalid ID= end start:reventlog_resolved_list diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 index 63911d67b..8f4eadb75 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 @@ -14,7 +14,7 @@ os:Linux hcp:openbmc cmd: rflash $$CN -a /tmp/abc123.tz check:rc==1 -check:output=~Error: Invalid firmware specified with -a +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with -a end start:rflash_invalid_activate_and_delete @@ -23,7 +23,7 @@ os:Linux hcp:openbmc cmd: rflash $$CN -a 123 --delete 123 check:rc==1 -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported end start:rflash_invalid_id @@ -32,7 +32,7 @@ os:Linux hcp:openbmc cmd: rflash $$CN -a 123 check:rc==1 -check:output=~Error: Invalid ID provided to activate +check:output=~Error: (\[.*?\]: )?Invalid ID provided to activate end start:rflash_invalid_multiple_id_3 @@ -41,7 +41,7 @@ os:Linux hcp:openbmc cmd: rflash $$CN -a 123 abc asdbas check:rc==1 -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported end start:rflash_invalid_multiple_id_2 @@ -50,7 +50,7 @@ os:Linux hcp:openbmc cmd: rflash $$CN -a asdbas 123 check:rc==1 -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported end start:rflash_invalid_node @@ -59,7 +59,7 @@ os:Linux hcp:openbmc cmd: rflash -a 221d9020 check:rc==1 -check:output=~Error: Invalid nodes and/or groups in noderange: 221d9020 +check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange: 221d9020 end start:rflash_invalid_delete_2 @@ -68,7 +68,7 @@ os:Linux hcp:openbmc cmd: rflash $$CN --delete 221d9020 221d9020 check:rc==1 -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported end start:rflash_delete_active_bmc @@ -77,5 +77,5 @@ os:Linux hcp:openbmc cmd: rflash $$CN -l | grep \* | grep BMC | awk '{print $2}' | xargs -i{} rflash $$CN --delete {} check:rc==1 -check:output=~$$CN: Error: Deleting currently active BMC firmware is not supported +check:output=~$$CN: (\[.*?\]: )?Error: Deleting currently active BMC firmware is not supported end diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 index a1d4c4925..8004c3605 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rspconfig_cases0 @@ -23,7 +23,7 @@ description: Check the parsing code for rspconfig (error cases) hcp: openbmc cmd: rspconfig $$CN ip,netmask,gateway,hostname,vlan check:rc==1 -check:output=~Error: Unsupported command +check:output=~Error: (\[.*?\]: )?Unsupported command end start:rspconfig_get_set_error @@ -31,7 +31,7 @@ description: Check the parsing code for rspconfig (error cases) - Cannot get/set hcp: openbmc cmd: rspconfig $$CN ip netmask=255.0.0.0 check:rc==1 -check:output=~Error: Can not set and query OpenBMC information at the same time +check:output=~Error: (\[.*?\]: )?Can not set and query OpenBMC information at the same time end start:rspconfig_get_and_set_hostname diff --git a/xCAT-test/autotest/testcase/addkitcomp/case0 b/xCAT-test/autotest/testcase/addkitcomp/case0 index 20cd04b48..9581d6e15 100644 --- a/xCAT-test/autotest/testcase/addkitcomp/case0 +++ b/xCAT-test/autotest/testcase/addkitcomp/case0 @@ -110,7 +110,7 @@ check:output=~KIT_DEPLOY_PARAMS check:output=~KIT_COMPONENTS cmd:rmkitcomp -i testimage ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el check:rc==1 -check:output=~Error: Failed to remove kitcomponent +check:output=~Error: (\[.*?\]: )?Failed to remove kitcomponent cmd:rmkitcomp -i testimage -f ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el check:rc==0 check:output=~Removing kitcomponent ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el from osimage testimage diff --git a/xCAT-test/autotest/testcase/chdef/cases0 b/xCAT-test/autotest/testcase/chdef/cases0 index c301f2ff4..f0e32c59c 100644 --- a/xCAT-test/autotest/testcase/chdef/cases0 +++ b/xCAT-test/autotest/testcase/chdef/cases0 @@ -21,13 +21,13 @@ check:output=~groups=linux cmd:chdef -t node -o testnode postscripts="syslog,remoteshell,syncfiles" check:rc==0 check:output!~Error -check:output=~Warning: testnode: postscripts 'syslog' is already included -check:output=~Warning: testnode: postscripts 'remoteshell' is already included -check:output=~Warning: testnode: postscripts 'syncfiles' is already included +check:output=~Warning: (\[.*?\]: )?testnode: postscripts 'syslog' is already included +check:output=~Warning: (\[.*?\]: )?testnode: postscripts 'remoteshell' is already included +check:output=~Warning: (\[.*?\]: )?testnode: postscripts 'syncfiles' is already included cmd:chdef -t node -o testnode postbootscripts=otherpkgs check:rc==0 check:output!~Error -check:output=~Warning: testnode: postbootscripts 'otherpkgs' is already included +check:output=~Warning: (\[.*?\]: )?testnode: postbootscripts 'otherpkgs' is already included cmd:rmdef -t node testnode check:rc==0 end diff --git a/xCAT-test/autotest/testcase/chvm/cases0 b/xCAT-test/autotest/testcase/chvm/cases0 index 61f76fc9b..b177591e5 100644 --- a/xCAT-test/autotest/testcase/chvm/cases0 +++ b/xCAT-test/autotest/testcase/chvm/cases0 @@ -50,7 +50,7 @@ cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z check:rc==0 cmd:chvm bogusnode check:rc!=0 -check:output=~Error: Invalid nodes and/or groups in noderange +check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange cmd:if [[ -e /tmp/chvm_err_node/bogusnode.stanza ]]; then cat /tmp/chvm_err_node/bogusnode.stanza | mkdef -z;fi check:rc==0 cmd:dir="/tmp/chvm_err_node"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index 55e846e11..eeae5f910 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -246,5 +246,5 @@ description:lsdef --template with invalid template name cmd:result=`lsdef | grep test_with_invalid_name`; if [[ $result =~ "test_with_invalid_name" ]]; then noderm test_with_invalid_name; fi cmd:lsdef --template "test_with_invalid_name" check:rc==1 -check:output=~Error: Could not find test_with_invalid_name in xCAT templates. +check:output=~Error: (\[.*?\]: )?Could not find test_with_invalid_name in xCAT templates. end diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 9ff89525c..c95fbec9c 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -173,7 +173,7 @@ cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "el" || "__GETNODEATTR($$CN,arch)__" = check:rc==0 cmd:lsdef testnode1 cmd:nodeset testnode1 osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -check:output=~Warning: testnode1:.+might be invalid +check:output=~Warning: (\[.*?\]: )?testnode1:.+might be invalid cmd:noderm testnode1 end @@ -349,7 +349,7 @@ description:This testcase is to very nodeset osimage errorcommand could give rig Attribute: $$CN-The operation object of nodeset command cmd:nodeset $$CN osimage= __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==1 -check:output=~Error: Invalid argument: +check:output=~Error: (\[.*?\]: )?Invalid argument: check:output=~Usage: nodeset end diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index 5aa73c626..92f14a549 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -343,7 +343,7 @@ cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/c check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m invalid check:rc!=0 -check:output=~Error: Invalid archive method 'invalid' requested +check:output=~Error: (\[.*?\]: )?Invalid archive method 'invalid' requested cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg end @@ -359,7 +359,7 @@ cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/c check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -c invalid check:rc!=0 -check:output=~Error: Invalid compress method 'invalid' requested +check:output=~Error: (\[.*?\]: )?Invalid compress method 'invalid' requested cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg end diff --git a/xCAT-test/autotest/testcase/pdu/case0 b/xCAT-test/autotest/testcase/pdu/case0 index 6e4bb26c2..82a8c57f7 100644 --- a/xCAT-test/autotest/testcase/pdu/case0 +++ b/xCAT-test/autotest/testcase/pdu/case0 @@ -27,7 +27,7 @@ cmd:rmdef $$PDU check:rc==0 cmd:lsdef $$PDU check:rc!=0 -check:output=~Error: Could not find an object named '$$PDU' +check:output=~Error: (\[.*?\]: )?Could not find an object named '$$PDU' cmd:mkdef $$PDU groups=pdu ip=$$PDUIP mgt=pdu nodetype=pdu check:rc==0 cmd:chdef $$PDU machinetype=1u diff --git a/xCAT-test/autotest/testcase/pping/cases0 b/xCAT-test/autotest/testcase/pping/cases0 index 0a569ab89..b7f4c4b16 100644 --- a/xCAT-test/autotest/testcase/pping/cases0 +++ b/xCAT-test/autotest/testcase/pping/cases0 @@ -24,5 +24,5 @@ end start:pping_invalidnode cmd:pping test check:rc!=0 -check:output=~Warning: Invalid nodes in noderange:test +check:output=~Warning: (\[.*?\]: )?Invalid nodes in noderange:test end diff --git a/xCAT-test/autotest/testcase/restapi/table/cases0 b/xCAT-test/autotest/testcase/restapi/table/cases0 index e424ad8f4..6a9ed807b 100644 --- a/xCAT-test/autotest/testcase/restapi/table/cases0 +++ b/xCAT-test/autotest/testcase/restapi/table/cases0 @@ -54,5 +54,5 @@ cmd: restapitest -m POST -r /networks/network_rest -d '{"gateway":"10.1.0.1","ma cmd: restapitest -m DELETE -r /tables/networks/rows/net=199.168.0.0 -u $$username -p $$password check:rc==200 cmd: lsdef -t network network_rest -check:output=~Error: Could not find an object named 'network_rest' of type 'network'. +check:output=~Error: (\[.*?\]: )?Could not find an object named 'network_rest' of type 'network'. end diff --git a/xCAT-test/autotest/testcase/reventlog/cases0 b/xCAT-test/autotest/testcase/reventlog/cases0 index 8ebfcdec6..db17b616b 100644 --- a/xCAT-test/autotest/testcase/reventlog/cases0 +++ b/xCAT-test/autotest/testcase/reventlog/cases0 @@ -36,9 +36,9 @@ cmd:reventlog $$CN -s all check:output=~The -s option is not supported for OpenBMC|Only one option is supported at the same time for reventlog check:rc!=0 cmd:reventlog $$CN -s -check:output=~Error: Unsupported command +check:output=~Error: (\[.*?\]: )?Unsupported command check:rc!=0 cmd:reventlog $$CN all aaa -check:output=~Error: Only one option is supported at the same time +check:output=~Error: (\[.*?\]: )?Only one option is supported at the same time check:rc!=0 end diff --git a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 index f562c43e1..b1a1c77f6 100644 --- a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 +++ b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 @@ -6,7 +6,7 @@ cmd:rflash -c check:output=~Usage: cmd:rflash -c 1.tar check:rc != 0 -check:output=~Error: Invalid nodes and/or groups in noderange +check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange end start:rflash_option_l_without_specify_noderange @@ -25,10 +25,10 @@ cmd:rflash -a check:output=~Usage: cmd:rflash -a 1.tar check:rc != 0 -check:output=~Error: Invalid nodes and/or groups in noderange +check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange cmd:rflash -a 123abc check:rc != 0 -check:output=~Error: Invalid nodes and/or groups in noderange +check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange end start:rflash_option_u_without_specify_noderange @@ -39,7 +39,7 @@ cmd:rflash -u check:output=~Usage: cmd:rflash -u 1.tar check:rc != 0 -check:output=~Error: Invalid nodes and/or groups in noderange +check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange end start:rflash_option_d_without_specify_noderange @@ -52,7 +52,7 @@ cmd:rflash -d /1234 check:Usage: cmd:rflash --delete 1234abc check:rc != 0 -check:output=~Error: Invalid nodes and/or groups in noderange +check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange end start:rflash_without_option @@ -61,7 +61,7 @@ os:Linux hcp:openbmc cmd:rflash $$CN 1.tar check:rc != 0 -check:output=~Error: Invalid option specified when a file is provided: +check:output=~Error: (\[.*?\]: )?Invalid option specified when a file is provided: end start:rflash_unsupport_multiple_option_a_u @@ -69,7 +69,7 @@ description: basic usage check. If specify multiple options a+u, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -a 1.tz -u -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -78,7 +78,7 @@ description: basic usage check. If specify multiple options a+c, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -a 1.tz -c -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -87,7 +87,7 @@ description: basic usage check. If specify multiple options a+l, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -a 1.tz -l -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -96,7 +96,7 @@ description: basic usage check. If specify multiple options a+d, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -a 1.tz -d -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -105,7 +105,7 @@ description: basic usage check. If specify multiple options c+l, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -c 1.tz -l -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -114,7 +114,7 @@ description: basic usage check. If specify multiple options c+u, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -c 1.tz -u -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -123,7 +123,7 @@ description: basic usage check. If specify multiple options c+d, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -c 1.tz -d -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -132,7 +132,7 @@ description: basic usage check. If specify multiple options l+d, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -l -d -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -141,7 +141,7 @@ description: basic usage check. If specify multiple options l+u, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -l -u -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -150,7 +150,7 @@ description: basic usage check. If specify multiple options u+d, should throw ou os:Linux hcp:openbmc cmd:rflash $$CN -u -d -check:output=~Error: Multiple options are not supported +check:output=~Error: (\[.*?\]: )?Multiple options are not supported check:rc != 0 end @@ -159,22 +159,22 @@ description: basic usage check for option c. if the file does not exist, should os:Linux hcp:openbmc cmd:rflash $$CN -c /tmp/abc123.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:rc != 0 cmd:rflash $$CN -c /tmp/ -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:rc != 0 cmd:rflash $$CN /tmp/abc123.tz -c -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:rc != 0 cmd:rflash $$CN /tmp/ -c -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:rc != 0 cmd:rflash $$CN 1.tar -c -check:output=~Error: Cannot access +check:output=~Error: (\[.*?\]: )?Cannot access check:rc != 0 cmd:rflash $$CN -c /tmp/1.tar -check:output=~Error: Cannot access +check:output=~Error: (\[.*?\]: )?Cannot access check:rc != 0 end @@ -183,16 +183,16 @@ description: basic usage check for option c. if there are multiple value assigne os:Linux hcp:openbmc cmd:rflash $$CN -c /tmp/abc123.tz /tmp/abc124.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:rc != 0 cmd:rflash $$CN -c 1.tz 2.tz 3.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:rc != 0 cmd:rflash $$CN 1.tz 2.tz 3.tz -c -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:rc != 0 cmd:rflash $$CN 1.tz -c 2.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:rc != 0 end @@ -234,10 +234,10 @@ description: basic usage check for option l. if there is value for l option, sh os:Linux hcp:openbmc cmd:rflash $$CN -l /tmp/abc123.tz -check:output=~Error: Invalid option +check:output=~Error: (\[.*?\]: )?Invalid option check:rc != 0 cmd: rflash $$CN /tmp/abc123.tz -l -check:output=~Error: Invalid option +check:output=~Error: (\[.*?\]: )?Invalid option check:rc != 0 end @@ -263,27 +263,27 @@ description: basic usage check for option u. if the file does not exist, should os:Linux hcp:openbmc cmd:rflash $$CN -u /tmp/abc123.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN -u /tmp/ -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN /tmp/abc123.tz -u -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN /tmp/ -u -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN 1.tar -u -check:output=~Error: Cannot access +check:output=~Error: (\[.*?\]: )?Cannot access check:output!~Attempting to check:rc != 0 cmd:rflash $$CN -u /tmp/1.tar -check:output=~Error: Cannot access +check:output=~Error: (\[.*?\]: )?Cannot access check:output!~Attempting to check:rc != 0 end @@ -293,19 +293,19 @@ description: basic usage check for option u. if there are multiple value assigne os:Linux hcp:openbmc cmd:rflash $$CN -u /tmp/abc123.tz /tmp/abc124.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN -u 1.tz 2.tz 3.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN 1.tz 2.tz 3.tz -u -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN 1.tz -u 2.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 end @@ -331,11 +331,11 @@ check:output=~rror: Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN 1.tar -a -check:output=~Error: Cannot access +check:output=~Error: (\[.*?\]: )?Cannot access check:output!~Attempting to check:rc != 0 cmd:rflash $$CN -a /tmp/1.tar -check:output=~Error: Cannot access +check:output=~Error: (\[.*?\]: )?Cannot access check:output!~Attempting to check:rc != 0 end @@ -345,27 +345,27 @@ description: basic usage check for option a. if there are multiple value assigne os:Linux hcp:openbmc cmd:rflash $$CN -a /tmp/abc123.tz /tmp/abc124.tz -check:output=~Error: Invalid firmware specified with +check:output=~Error: (\[.*?\]: )?Invalid firmware specified with check:output!~Attempting to check:rc != 0 cmd:rflash $$CN -a 1.tz 2.tz 3.tz -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported check:output!~Attempting to check:rc != 0 cmd:rflash $$CN 1.tz 2.tz 3.tz -a -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported check:output!~Attempting to check:rc != 0 cmd:rflash $$CN 1.tz -a 2.tz -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported check:output!~Attempting to check:rc != 0 cmd:rflash $$CN 1234567 -a 2345678 -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported check:output!~Attempting to check:rc != 0 cmd:rflash $$CN -a 123 abc asdbas -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported check:output!~Attempting to check:rc != 0 end @@ -376,10 +376,10 @@ description: basic usage check for option a. if active a non-existent firmware I os:Linux hcp:openbmc cmd:rflash $$CN -a 1234567 -check:output=~Error: Invalid ID provided to activate +check:output=~Error: (\[.*?\]: )?Invalid ID provided to activate check:rc != 0 cmd:rflash $$CN -a d123abc -check:output=~Error: Invalid ID provided to activate +check:output=~Error: (\[.*?\]: )?Invalid ID provided to activate check:rc != 0 end @@ -388,15 +388,15 @@ description: basic usage check for option delete. if there are multiple value as os:Linux hcp:openbmc cmd:rflash $$CN --delete 1234567 2345678 -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported check:output!~Attempting to delete check:rc != 0 cmd:rflash $$CN 1234567 2345678 --delete -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported check:output!~Attempting to delete check:rc != 0 cmd:rflash $$CN 1234567 --delete 2345678 -check:output=~Error: More than one firmware specified is not supported +check:output=~Error: (\[.*?\]: )?More than one firmware specified is not supported check:output!~Attempting to delete check:rc != 0 end @@ -406,10 +406,10 @@ description: basic usage check for option --delete. if delete a non-existent fir os:Linux hcp:openbmc cmd:rflash $$CN --delete 1234567 -check:output=~Error: Invalid ID provided to delete +check:output=~Error: (\[.*?\]: )?Invalid ID provided to delete check:rc != 0 cmd:rflash $$CN --delete d123abc -check:output=~Error: Invalid ID provided to delete +check:output=~Error: (\[.*?\]: )?Invalid ID provided to delete check:rc != 0 end @@ -418,15 +418,15 @@ description: basic usage check for option d. if there are multiple value assigne os:Linux hcp:openbmc cmd:rflash $$CN -d /123/ /234/ -check:output=~Error: More than one +check:output=~Error: (\[.*?\]: )?More than one check:output!~Attempting to check:rc != 0 cmd:rflash $$CN /123/ /234/ -d -check:output=~Error: More than one +check:output=~Error: (\[.*?\]: )?More than one check:output!~Attempting to check:rc != 0 cmd:rflash $$CN /123/ -d /234/ -check:output=~Error: More than one +check:output=~Error: (\[.*?\]: )?More than one check:output!~Attempting to check:rc != 0 end @@ -439,28 +439,28 @@ hcp:openbmc cmd:rm -rf /tmp/bogus123 check:rc == 0 cmd:rflash $$CN -d /tmp/bogus123 -check:output=~Error: Can't open directory +check:output=~Error: (\[.*?\]: )?Can't open directory check:output!~Attempting to check:rc != 0 cmd:rflash $$CN /tmp/bogus123 -check:output=~Error: Invalid option specified +check:output=~Error: (\[.*?\]: )?Invalid option specified check:rc != 0 cmd:mkdir -p /tmp/bogus123 check:rc == 0 cmd:rflash $$CN /tmp/bogus123 -d -check:output =~Error: No BMC tar file found|Can't open directory +check:output =~Error: (\[.*?\]: )?No BMC tar file found|Can't open directory check:output!~Attempting to check:rc != 0 cmd:touch /tmp/bogus123/obmc-phosphor-image-witherspoon.ubi.mtd.tar check:rc == 0 cmd:rflash $$CN -d /tmp/bogus123 -check:output =~Error: No BMC tar file found|Can't open directory +check:output =~Error: (\[.*?\]: )?No BMC tar file found|Can't open directory check:output!~Attempting to check:rc != 0 cmd:touch /tmp/bogus123/witherspoon.pnor.squashfs.tar check:rc == 0 cmd:rflash $$CN -d /tmp/bogus123 -check:output =~Error: No BMC tar file found|Can't open directory +check:output =~Error: (\[.*?\]: )?No BMC tar file found|Can't open directory check:output!~Attempting to check:rc != 0 cmd:rm -rf /tmp/bogus123 @@ -485,9 +485,9 @@ os:Linux hcp:openbmc cmd:activenum=`rflash $$CN -l |grep -w "Host\s*Active(\*)" |awk '{print $2}'`;rflash $$CN $activenum --delete check:rc != 0 -check:output =~$$CN\s*:\s*Error: Deleting currently active firmware on powered on host is not supported +check:output =~$$CN\s*:\s*(\[.*?\]: )?Error: Deleting currently active firmware on powered on host is not supported cmd:activenum=`rflash $$CN -l |grep -w "BMC\s*Active(\*)" |awk '{print $2}'`;rflash $$CN $activenum --delete check:rc != 0 -check:output =~~$$CN\s*:\s*Error: Deleting currently active BMC firmware is not supported +check:output =~~$$CN\s*:\s*(\[.*?\]: )?Error: Deleting currently active BMC firmware is not supported end diff --git a/xCAT-test/autotest/testcase/rinv/cases0 b/xCAT-test/autotest/testcase/rinv/cases0 index 37f916efa..25709872f 100644 --- a/xCAT-test/autotest/testcase/rinv/cases0 +++ b/xCAT-test/autotest/testcase/rinv/cases0 @@ -121,7 +121,7 @@ cmd:chdef $$CN bmcpassword=test check:rc==0 cmd:rinv $$CN all check:rc==1 -check:output=~$$CN: Error:.+Invalid username or password|Error: ERROR: Incorrect password provided +check:output=~$$CN: (\[.*?\]: )?Error:.+Invalid username or password|Error: (\[.*?\]: )?ERROR: Incorrect password provided cmd:cat /tmp/testnode.stanza | chdef -z;rm -rf /tmp/testnode.stanza check:rc==0 end @@ -129,5 +129,5 @@ start:rinv_errorcommand description:get right return if input error command cmd:rinv $$CN dafds check:rc==1 -check:output=~Unsupported command|Error: Usage: +check:output=~Unsupported command|Error: (\[.*?\]: )?Usage: end diff --git a/xCAT-test/autotest/testcase/rmkitcomp/case0 b/xCAT-test/autotest/testcase/rmkitcomp/case0 index 857a823b5..2cd12c966 100644 --- a/xCAT-test/autotest/testcase/rmkitcomp/case0 +++ b/xCAT-test/autotest/testcase/rmkitcomp/case0 @@ -81,7 +81,7 @@ check:output=~ubuntukit-compute-1 check:output=~ubuntukit-compute-2 cmd:rmkitcomp -i testimage ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el check:rc==1 -check:output=~Error: Failed to remove kitcomponent +check:output=~Error: (\[.*?\]: )?Failed to remove kitcomponent cmd:rmkitcomp -i testimage -f ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el check:rc==0 check:output=~Removing kitcomponent ubuntukit-compute-1-1.0-1-ubuntu-14.04-ppc64el from osimage testimage diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index e0fd45c74..78310d253 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -162,7 +162,7 @@ end start:rpower_suspend_OpenpowerBmc hcp:openbmc cmd:rpower $$CN suspend -check:output=~Error: Unsupported command: rpower suspend +check:output=~Error: (\[.*?\]: )?Unsupported command: rpower suspend check:rc==1 end @@ -170,14 +170,14 @@ end start:rpower_wake_OpenpowerBmc hcp:openbmc cmd:rpower $$CN wake -check:output=~Error: Unsupported command: rpower wake +check:output=~Error: (\[.*?\]: )?Unsupported command: rpower wake check:rc==1 end start:rpower_errorcommand_OpenpowerBmc hcp:openbmc cmd:rpower $$CN ddd -check:output=~Error: Unsupported command: rpower ddd +check:output=~Error: (\[.*?\]: )?Unsupported command: rpower ddd check:rc==1 end diff --git a/xCAT-test/autotest/testcase/rsetboot/cases0 b/xCAT-test/autotest/testcase/rsetboot/cases0 index bcec836d4..960f69261 100644 --- a/xCAT-test/autotest/testcase/rsetboot/cases0 +++ b/xCAT-test/autotest/testcase/rsetboot/cases0 @@ -120,7 +120,7 @@ description:rsetboot node using invalidaction Attribute: $$CN-The operation object of rsetboot command. cmd:rsetboot $$CN dsdf check:rc!=0 -check:output=~Error: unsupported command|Unsupported command +check:output=~Error: (\[.*?\]: )?unsupported command|Unsupported command end start:rsetboot_group_net diff --git a/xCAT-test/autotest/testcase/rspconfig/cases0 b/xCAT-test/autotest/testcase/rspconfig/cases0 index 97494f030..431c7e5fe 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases0 +++ b/xCAT-test/autotest/testcase/rspconfig/cases0 @@ -62,7 +62,7 @@ Attribute: $$CN-The operation object of rspconfig command os:Linux hcp:openbmc cmd:rspconfig $$CN ip=__GETNODEATTR($$CN,bmc)__ -check:output=~Error: IP, netmask and gateway must be configured together. +check:output=~Error: (\[.*?\]: )?IP, netmask and gateway must be configured together. check:rc!=0 end @@ -72,7 +72,7 @@ Attribute: $$CN-The operation object of rspconfig command os:Linux hcp:openbmc cmd:rspconfig $$CN ip=ddd gateway=0.0.0.0 netmask=255.255.0.0 -check:output=~Error: Invalid parameter for option ip +check:output=~Error: (\[.*?\]: )?Invalid parameter for option ip check:rc!=0 end @@ -95,7 +95,7 @@ Attribute: $$CN-The operation object of rspconfig command os:Linux hcp:openbmc cmd:rspconfig $$CN netmask=255.255.0.0 -check:output=~Error: IP, netmask and gateway must be configured together. +check:output=~Error: (\[.*?\]: )?IP, netmask and gateway must be configured together. check:rc!=0 end @@ -103,13 +103,13 @@ start:rspconfig_netmask_invalid despcription:rspconfig could not change openbmc netmask using invalid netmask Attribute: $$CN-The operation object of rspconfig command cmd:rspconfig $$CN netmask=ddd -check:output=~Error: Invalid parameter for option netmask +check:output=~Error: (\[.*?\]: )?Invalid parameter for option netmask check:rc!=0 cmd:rspconfig $$CN netmask=ddd ip=__GETNODEATTR($$CN,bmc)__ gateway=0.0.0.0 -check:output=~Error: Invalid parameter for option netmask +check:output=~Error: (\[.*?\]: )?Invalid parameter for option netmask check:rc!=0 cmd:rspconfig $$CN netmask= ip=__GETNODEATTR($$CN,bmc)__ gateway=0.0.0.0 -check:output=~Error: Invalid parameter for option netmask +check:output=~Error: (\[.*?\]: )?Invalid parameter for option netmask check:rc!=0 end @@ -119,7 +119,7 @@ Attribute: $$CN-The operation object of rspconfig command os:Linux hcp:openbmc cmd:rspconfig $$CN gateway=0.0.0.0 -check:output=~Error: IP, netmask and gateway must be configured together. +check:output=~Error: (\[.*?\]: )?IP, netmask and gateway must be configured together. check:rc!=0 end @@ -127,10 +127,10 @@ start:rspconfig_set_vlan description:rspconfig change openbmc gateway Attribute: $$CN-The operation object of rspconfig command cmd:rspconfig $$CN vlan=0 -check:output=~Error: Invalid parameter for option vlan|Error: VLAN must be configured with IP, netmask and gateway +check:output=~Error: (\[.*?\]: )?Invalid parameter for option vlan|Error: (\[.*?\]: )?VLAN must be configured with IP, netmask and gateway check:rc!=0 cmd:rspconfig $$CN vlan=111 -check:output=~Error: VLAN must be configured with IP, netmask and gateway +check:output=~Error: (\[.*?\]: )?VLAN must be configured with IP, netmask and gateway check:rc!=0 end @@ -147,13 +147,13 @@ Attribute: $$CN-The operation object of rspconfig command os:Linux hcp:openbmc cmd:rspconfig $$CN gateway=ddd -check:output=~Error: Invalid parameter for option gateway +check:output=~Error: (\[.*?\]: )?Invalid parameter for option gateway check:rc!=0 cmd:rspconfig $$CN gateway= ip=__GETNODEATTR($$CN,bmc)__ netmask=255.0.0.0 -check:output=~Error: Invalid parameter for option gateway +check:output=~Error: (\[.*?\]: )?Invalid parameter for option gateway check:rc!=0 cmd:rspconfig $$CN gateway= -check:output=~Error: Invalid parameter for option gateway +check:output=~Error: (\[.*?\]: )?Invalid parameter for option gateway check:rc!=0 end @@ -163,7 +163,7 @@ Attribute: $$CN-The operation object of rspconfig command os:Linux hcp:openbmc cmd:rspconfig $$CN vlan=dddsdsdfs -check:output=~Error: VLAN must be configured with IP, netmask and gateway +check:output=~Error: (\[.*?\]: )?VLAN must be configured with IP, netmask and gateway check:rc!=0 end @@ -173,7 +173,7 @@ Attribute: $$CN-The operation object of rspconfig command os:Linux hcp:openbmc cmd:rspconfig $$CN ip=dsd gateway=ooo netmask=asfsf vlan=dddsdsdfs -check:output=~Error: Invalid parameter +check:output=~Error: (\[.*?\]: )?Invalid parameter check:rc!=0 end @@ -184,7 +184,7 @@ hcp:openbmc cmd:test=$(lsdef testnode);if [[ $? -eq 0 ]]; then lsdef -l testnode -z >/tmp/testnode.stanza ;rmdef testnode;fi check:rc==0 cmd:rspconfig testnode ip -check:output=~Error: Invalid nodes and/or groups in noderange +check:output=~Error: (\[.*?\]: )?Invalid nodes and/or groups in noderange check:rc!=0 cmd:if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stanza | chdef -z;rm -rf /tmp/testnode.stanza;fi check:rc==0 @@ -197,7 +197,7 @@ hcp:openbmc cmd:test=$(lsdef testnode);if [[ $? -eq 0 ]]; then lsdef -l testnode -z >/tmp/testnode.stanza ;rmdef testnode;fi check:rc==0 cmd:rspconfig testnode,$$CN ip -check:output=~Error: Invalid nodes +check:output=~Error: (\[.*?\]: )?Invalid nodes check:rc!=0 cmd:if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stanza | chdef -z;rm -rf /tmp/testnode.stanza;fi check:rc==0 @@ -323,13 +323,13 @@ description: To test with error input, should throw out erro os:Linux hcp:openbmc cmd:rspconfig $$CN hostname bogus -check:output =~Error: Unsupported command +check:output =~Error: (\[.*?\]: )?Unsupported command check:rc != 0 cmd:rspconfig $$CN bogus hostname -check:output =~Error: Unsupported command +check:output =~Error: (\[.*?\]: )?Unsupported command check:rc != 0 cmd:rspconfig $$CN hostname= -check:output =~Error: Invalid parameter for option hostname +check:output =~Error: (\[.*?\]: )?Invalid parameter for option hostname check:rc != 0 end @@ -364,19 +364,19 @@ description: To test "rspconfig admin_passwd=xxx,yyy". If the format of " os:Linux hcp:openbmc cmd:rspconfig $$CN admin_passwd=cluster, -check:output =~Error: Invalid parameter for option admin_passwd +check:output =~Error: (\[.*?\]: )?Invalid parameter for option admin_passwd check:rc != 0 cmd:rspconfig $$CN admin_passwd=,cluster -check:output =~Error: Invalid parameter for option admin_passwd +check:output =~Error: (\[.*?\]: )?Invalid parameter for option admin_passwd check:rc != 0 cmd:rspconfig $$CN admin_passwd=, -check:output =~Error: Invalid parameter for option admin_passwd +check:output =~Error: (\[.*?\]: )?Invalid parameter for option admin_passwd check:rc != 0 cmd:rspconfig $$CN admin_passwd= -check:output =~Error: Invalid parameter for option admin_passwd +check:output =~Error: (\[.*?\]: )?Invalid parameter for option admin_passwd check:rc != 0 cmd:rspconfig $$CN admin_passwd=; -check:output =~Error: Invalid parameter for option admin_passwd +check:output =~Error: (\[.*?\]: )?Invalid parameter for option admin_passwd end start:rspconfig_set_admin_passwd_with_error_origin_password @@ -393,10 +393,10 @@ description: To test "rspconfig sshcfg" with error input, should throw ou os:Linux hcp:openbmc cmd:rspconfig $$CN sshcfg aaa -check:output =~Error: Configure sshcfg must be issued without other options. +check:output =~Error: (\[.*?\]: )?Configure sshcfg must be issued without other options. check:rc != 0 cmd:rspconfig $$CN hostname sshcfg -check:output =~Error: Configure sshcfg must be issued without other options. +check:output =~Error: (\[.*?\]: )?Configure sshcfg must be issued without other options. check:rc != 0 end diff --git a/xCAT-test/autotest/testcase/rspconfig/cases1 b/xCAT-test/autotest/testcase/rspconfig/cases1 index a71397392..5eade2cb5 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases1 +++ b/xCAT-test/autotest/testcase/rspconfig/cases1 @@ -6,7 +6,7 @@ cmd:rspconfig $$CN ipsrc check:output=~$$CN\s*:\s*BMC IP Source: Static|BMC IP Source: Dynamic check:rc == 0 cmd:rspconfig $$CN hostname sshcfg -check:output =~Error: Configure sshcfg must be issued without other options. +check:output =~Error: (\[.*?\]: )?Configure sshcfg must be issued without other options. check:rc != 0 end @@ -188,7 +188,7 @@ cmd:rspconfig $$CN powerrestorepolicy=restore check:output =~$$CN:\s*BMC Setting BMC PowerRestorePolicy... check:rc == 0 cmd:rspconfig $$CN powerrestorepolicy=abc -check:output =~$$CN:\s*Error: Invalid value '\S*' for 'powerrestorepolicy', Valid values: restore,always_on,always_off +check:output =~$$CN:\s*(\[.*?\]: )?Error: Invalid value '\S*' for 'powerrestorepolicy', Valid values: restore,always_on,always_off check:rc != 0 cmd:rspconfig $$CN powerrestorepolicy check:rc == 0 @@ -218,7 +218,7 @@ cmd:rspconfig $$CN powersupplyredundancy check:rc == 0 check:output =~$$CN:\s*BMC PowerSupplyRedundancy:\s*Disabled cmd:rspconfig $$CN powersupplyredundancy=abc -check:output =~$$CN:\s*Error: Invalid value \S* for 'powersupplyredundancy', Valid values: disabled,enabled +check:output =~$$CN:\s*(\[.*?\]: )?Error: Invalid value \S* for 'powersupplyredundancy', Valid values: disabled,enabled check:rc != 0 cmd:redundancy=`cat /tmp/powersupplyredundancy | awk -F ":" '{print $3}'`;newredundancy=`echo $redundancy |tr 'A-Z' 'a-z'`;rspconfig $$CN powersupplyredundancy=$newredundancy check:rc == 0 @@ -245,7 +245,7 @@ cmd:rspconfig $$CN timesyncmethod check:rc == 0 check:output =~$$CN:\s*BMC TimeSyncMethod:\s*Manual cmd:rspconfig $$CN timesyncmethod=abc -check:output =~$$CN:\s*Error: Invalid value \S* for 'timesyncmethod', Valid values: ntp,manual +check:output =~$$CN:\s*(\[.*?\]: )?Error: Invalid value \S* for 'timesyncmethod', Valid values: ntp,manual check:rc != 0 cmd:syncmethod=`cat /tmp/timesyncmethod | awk -F ":" '{print $3}'`;newsyncmethod=`echo $syncmethod |tr 'A-Z' 'a-z'`;rspconfig $$CN timesyncmethod=$newsyncmethod check:rc == 0 @@ -278,7 +278,7 @@ cmd:rspconfig $$CN bootmode check:rc == 0 check:output =~$$CN:\s*BMC BootMode:\s*Setup cmd:rspconfig $$CN bootmode=abc -check:output =~$$CN:\s*Error: Invalid value \S* for 'bootmode', Valid values: regular,safe,setup +check:output =~$$CN:\s*(\[.*?\]: )?Error: Invalid value \S* for 'bootmode', Valid values: regular,safe,setup check:rc != 0 cmd:mode=`cat /tmp/bootmode |awk -F ":" '{print $3}'`;newmode=`echo $mode |tr 'A-Z' 'a-z'`;rspconfig $$CN bootmode=$newmode check:rc == 0 @@ -305,7 +305,7 @@ cmd:rspconfig $$CN autoreboot check:rc == 0 check:output =~$$CN:\s*BMC AutoReboot:\s*0 cmd:rspconfig $$CN autoreboot=2 -check:output =~$$CN:\s*Error: Invalid value \S* for 'autoreboot', Valid values: 0,1 +check:output =~$$CN:\s*(\[.*?\]: )?Error: Invalid value \S* for 'autoreboot', Valid values: 0,1 check:rc != 0 cmd:autoreboot=`cat /tmp/autoreboot |awk -F ":" '{print $3}'`;newautoreboot=`echo $autoreboot |tr 'A-Z' 'a-z'`;rspconfig $$CN autoreboot=$newautoreboot check:rc == 0 @@ -317,7 +317,7 @@ description: To test "rspconfig invalid_value" should throw out error me os:Linux hcp:openbmc cmd:rspconfig $$CN aaa -check:output =~Error: Unsupported command: rspconfig aaa +check:output =~Error: (\[.*?\]: )?Unsupported command: rspconfig aaa check:rc != 0 end diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.node b/xCAT-test/autotest/testcase/xcat-inventory/cases.node index 16d4880a9..ece113319 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.node +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.node @@ -730,10 +730,10 @@ check:rc==0 cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza ;rmdef bogusnode;fi check:rc==0 cmd: xcat-inventory export --format=json -t node -o bogusnode -check:output=~Error: cannot find node objects: bogusnode! +check:output=~Error: (\[.*?\]: )?cannot find node objects: bogusnode! check:rc!=0 cmd: xcat-inventory export --format=yaml -t node -o bogusnode -check:output=~Error: cannot find node objects: bogusnode! +check:output=~Error: (\[.*?\]: )?cannot find node objects: bogusnode! check:rc!=0 cmd:if [[ -e /tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza | mkdef -z;fi check:rc==0 @@ -752,12 +752,12 @@ check:rc==0 cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/xcat_inventory_try_to_import_nonexisted_node/json check:rc==0 cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_nonexisted_node/json -t node -o bogusnode1 -check:output=~Error: cannot find node objects: bogusnode1! +check:output=~Error: (\[.*?\]: )?cannot find node objects: bogusnode1! check:rc!=0 cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/xcat_inventory_try_to_import_nonexisted_node/yaml check:rc==0 cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_nonexisted_node/yaml -t node -o bogusnode1 -check:output=~Error: cannot find node objects: bogusnode1! +check:output=~Error: (\[.*?\]: )?cannot find node objects: bogusnode1! check:rc!=0 cmd:rmdef bogusnode check:rc==0 @@ -1647,7 +1647,7 @@ check:rc==0 cmd:diff -y /tmp/export_more_nodes_import_part_nodes_json/nodes.bogus /tmp/export_more_nodes_import_part_nodes_json/nodes.import check:rc==0 cmd:lsdef -t node bogusnode3 -check:output=~Error: Could not find an object +check:output=~Error: (\[.*?\]: )?Could not find an object check:rc!=0 cmd:rmdef bogusnode[1-2] check:rc==0 @@ -1689,7 +1689,7 @@ check:rc==0 cmd:diff -y /tmp/export_more_nodes_import_part_nodes_yaml/nodes.bogus /tmp/export_more_nodes_import_part_nodes_yaml/nodes.import check:rc==0 cmd:lsdef -t node bogusnode3 -check:output=~Error: Could not find an object +check:output=~Error: (\[.*?\]: )?Could not find an object check:rc!=0 cmd:rmdef bogusnode[1-2] check:rc==0 diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.site b/xCAT-test/autotest/testcase/xcat-inventory/cases.site index 8026ff444..e135da258 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.site +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.site @@ -845,13 +845,13 @@ cmd:#!/bin/bash diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.org /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.import check:rc==0 cmd:lsdef bogusgroup1 -check:output=~Error: Could not find an object +check:output=~Error: (\[.*?\]: )?Could not find an object check:rc!=0 cmd:lsdef bogusgroup2 -check:output=~Error: Could not find an object +check:output=~Error: (\[.*?\]: )?Could not find an object check:rc!=0 cmd:lsdef bogusgroup3 -check:output=~Error: Could not find an object +check:output=~Error: (\[.*?\]: )?Could not find an object check:rc!=0 cmd:tabdump networks|grep 100_0_0_0-255_0_0_0 check:rc!=0 @@ -1211,13 +1211,13 @@ cmd:#!/bin/bash diff -y --ignore-blank-lines --ignore-matching-lines="^#" /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.org /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.import check:rc==0 cmd:lsdef bogusgroup1 -check:output=~Error: Could not find an object +check:output=~Error: (\[.*?\]: )?Could not find an object check:rc!=0 cmd:lsdef bogusgroup2 -check:output=~Error: Could not find an object +check:output=~Error: (\[.*?\]: )?Could not find an object check:rc!=0 cmd:lsdef bogusgroup3 -check:output=~Error: Could not find an object +check:output=~Error: (\[.*?\]: )?Could not find an object check:rc!=0 cmd:tabdump networks|grep 100_0_0_0-255_0_0_0 check:rc!=0 diff --git a/xCAT-test/autotest/testcase/xcat-inventory/validatehelper b/xCAT-test/autotest/testcase/xcat-inventory/validatehelper index bedc695a7..e953678ef 100755 --- a/xCAT-test/autotest/testcase/xcat-inventory/validatehelper +++ b/xCAT-test/autotest/testcase/xcat-inventory/validatehelper @@ -59,7 +59,7 @@ def GetAttrInFile(fpath,objtype,objname,attrpath): try: objdict=yaml.load(f) except Exception,e: - raise Exception("Error: cannot open file "+fpath+"! "+str(e)) + raise Exception("Error: (\[.*?\]: )?cannot open file "+fpath+"! "+str(e)) f.close() myattrpath=objtype+"."+objname+"."+attrpath @@ -109,7 +109,7 @@ def UpdateAttrInFile(fpath,fformat,objtype,objname,attrpath,value): try: objdict=yaml.load(f) except Exception,e: - raise Exception("Error: cannot open file "+fpath+"! "+str(e)) + raise Exception("Error: (\[.*?\]: )?cannot open file "+fpath+"! "+str(e)) f.close() myattrpath=objtype+"."+objname+"."+attrpath diff --git a/xCAT-test/autotest/testcase/xcatd/case0 b/xCAT-test/autotest/testcase/xcatd/case0 index bec49085a..dd9c72a65 100644 --- a/xCAT-test/autotest/testcase/xcatd/case0 +++ b/xCAT-test/autotest/testcase/xcatd/case0 @@ -242,7 +242,7 @@ check:output=~xcatd service is running cmd:chtab name=root policy.rule=disable check:rc==0 cmd:lsdef -check:output=~Error: Permission denied for request +check:output=~Error: (\[.*?\]: )?Permission denied for request cmd:XCATBYPASS=YES lsdef check:rc==0 cmd:XCATBYPASS=YES chtab name=root policy.rule=allow @@ -261,7 +261,7 @@ check:output=~active \(running\) cmd:chtab name=root policy.rule=disable check:rc==0 cmd:lsdef -check:output=~Error: Permission denied for request +check:output=~Error: (\[.*?\]: )?Permission denied for request cmd:XCATBYPASS=YES lsdef check:rc==0 cmd:XCATBYPASS=YES chtab name=root policy.rule=allow @@ -285,7 +285,7 @@ check:rc==0 cmd:lsdef check:rc==0 cmd:tabdump policy -check:output=~Error: Permission denied for request +check:output=~Error: (\[.*?\]: )?Permission denied for request cmd:chtab name=root policy.commands= policy.rule=allow check:rc==0 end @@ -306,7 +306,7 @@ check:rc==0 cmd:lsdef check:rc==0 cmd:tabdump policy -check:output=~Error: Permission denied for request +check:output=~Error: (\[.*?\]: )?Permission denied for request cmd:chtab name=root policy.commands= policy.rule=allow check:rc==0 end diff --git a/xCAT-test/autotest/testcase/xdsh/cases0 b/xCAT-test/autotest/testcase/xdsh/cases0 index a30722e49..f267c658a 100644 --- a/xCAT-test/autotest/testcase/xdsh/cases0 +++ b/xCAT-test/autotest/testcase/xdsh/cases0 @@ -88,7 +88,7 @@ cmd:date +%s > /tmp/start.txt check:rc==0 cmd:xdsh $$CN -t 5 "ssh 1.1.1.1" check:rc!=0 -check:output=~Error: Caught SIGINT - terminating the child processes. +check:output=~Error: (\[.*?\]: )?Caught SIGINT - terminating the child processes. cmd:date +%s > /tmp/end.txt check:rc==0 cmd:a=`cat /tmp/start.txt`;b=`cat /tmp/end.txt`;c=$[$b-$a];echo $c From c17dcaab6b7bdb6f7065b192aecab7223ded24ca Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 28 May 2018 03:17:22 -0400 Subject: [PATCH 113/117] refine xcat osimage import and export cases --- xCAT-test/autotest/testcase/xcat-inventory/cases.osimage | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage index 7cf2f25a1..0567e79c5 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage @@ -928,8 +928,6 @@ cmd:if [ -e /tmp/partitionfile ]; then cp -f /tmp/partitionfile /tmp/partitionfi cmd:echo "test" >> /tmp/partitionfile cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/test_myimage.stanza ;rmdef -t osimage -o test_myimage;fi check:rc==0 -#cmd:ssh $$DSTMN 'lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/test_myimage.stanza ;rmdef -t osimage -o test_myimage;fi' -#check:rc==0 cmd:chdef -t osimage -o test_myimage imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist partitionfile=/tmp/partitionfile check:rc==0 cmd:lsdef -t osimage test_myimage @@ -1090,7 +1088,7 @@ cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{p check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then exit 0; else exit 1; fi check:rc==0 -cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then exit 0; else echo 1; fi +cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then exit 0; else exit 1; fi check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 @@ -1159,10 +1157,12 @@ cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist check:rc==0 cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist partitionfile=/opt/xcat/share/xcat/install/rh/partitionfile check:rc==0 +cmd:lsdef -t osimage -o test_myimage1,test_myimage2 cmd:dir="/opt/inventory/site/osimage";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir cmd:xcat-inventory export -d /opt/inventory/site/ check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/ +cmd:ls -lFR /opt/inventory/site/ cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists From 3460a6915c765d2e27d98bda132c80b059e156ef Mon Sep 17 00:00:00 2001 From: yangsbj Date: Mon, 28 May 2018 05:15:41 -0400 Subject: [PATCH 114/117] * log the size of packets received by udp listener --- xCAT-server/sbin/xcatd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index eb345bdfe..53c1ab745 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -810,6 +810,9 @@ sub do_udp_service { # This function opens up a UDP port foreach $hdl (@hdls) { if ($hdl == $socket) { $part = $socket->recv($data, 3000); + if(length($data)>1500){ + xCAT::MsgUtils->message("S", "$0: received ".length($data)."B data packet from ".$socket->peerhost); + } $packets{$part} = [ $part, $data ]; } elsif ($hdl == $sslctl) { next; @@ -862,6 +865,9 @@ sub do_udp_service { # This function opens up a UDP port foreach my $hdl (@hdls) { if ($hdl == $socket) { $part = $socket->recv($data,3000); + if(length($data)>1500){ + xCAT::MsgUtils->message("S", "$0: received ".length($data)."B data packet from ".$socket->peerhost); + } $packets{$part} = [ $part, $data ]; #} elsif ($hdl == $sslctl) { From a307bfa96a9f011c8faf4887d38d4a4d8c1a2208 Mon Sep 17 00:00:00 2001 From: robin2008 Date: Mon, 28 May 2018 20:38:15 +0800 Subject: [PATCH 115/117] Fix code error to generate the right socket file name based on the caller PID (#5257) --- xCAT-server/lib/perl/xCAT/OPENBMC.pm | 16 +++++++++++++--- xCAT-server/lib/xcat/plugins/openbmc2.pm | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/OPENBMC.pm b/xCAT-server/lib/perl/xCAT/OPENBMC.pm index 832618247..2061a191a 100644 --- a/xCAT-server/lib/perl/xCAT/OPENBMC.pm +++ b/xCAT-server/lib/perl/xCAT/OPENBMC.pm @@ -25,8 +25,8 @@ use xCAT_monitoring::monitorctrl; use xCAT::TableUtils; my $LOCK_DIR = "/var/lock/xcat/"; -my $LOCK_PATH = "/var/lock/xcat/agent-$$.lock"; -my $AGENT_SOCK_PATH = "/var/run/xcat/agent-$$.sock"; +my $LOCK_PATH = "/var/lock/xcat/agent.lock"; +my $AGENT_SOCK_PATH = "/var/run/xcat/agent.sock"; my $PYTHON_LOG_PATH = "/var/log/xcat/agent.log"; my $PYTHON_AGENT_FILE = "/opt/xcat/lib/python/agent/agent.py"; my $MSG_TYPE = "message"; @@ -62,8 +62,15 @@ sub send_request { # if lock is released unexpectedly, python side would aware of the error after # getting this lock sub acquire_lock { + my $ppid = shift; + $ppid = shift if (($ppid) && ($ppid =~ /OPENBMC/)); + mkpath($LOCK_DIR); # always create a new lock file + if ($ppid) { + $LOCK_PATH = "$LOCK_PATH.$ppid"; + $AGENT_SOCK_PATH = "$AGENT_SOCK_PATH.$ppid"; + } unlink($LOCK_PATH); open($lock_fd, ">>", $LOCK_PATH) or return undef; flock($lock_fd, LOCK_EX) or return undef; @@ -82,7 +89,10 @@ sub python_agent_reaper { } sub start_python_agent { - if (!defined(acquire_lock())) { + my $ppid = shift; + $ppid = shift if (($ppid) && ($ppid =~ /OPENBMC/)); + + if (!defined(acquire_lock($ppid))) { xCAT::MsgUtils->message("S", "start_python_agent() Error: Failed to acquire lock"); return undef; } diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index 524c0b634..3f1e22886 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -149,7 +149,7 @@ sub process_request { return unless(%node_info); # If we can't start the python agent, exit immediately - my $pid = xCAT::OPENBMC::start_python_agent(); + my $pid = xCAT::OPENBMC::start_python_agent($$); if (!defined($pid)) { xCAT::MsgUtils->message("E", { data => ["Failed to start the xCAT Python agent. Check /var/log/xcat/cluster.log for more information."] }, $callback); return; From f70858cd315989e829b5525d129b1d1416deef58 Mon Sep 17 00:00:00 2001 From: robin2008 Date: Mon, 28 May 2018 21:19:30 +0800 Subject: [PATCH 116/117] Update the testcase to cover the changes in #5119 - missing some test cases --- xCAT-test/autotest/testcase/dockercommand/cases0 | 4 ++-- xCAT-test/autotest/testcase/mkdef/cases0 | 10 +++++----- xCAT-test/autotest/testcase/rsetboot/cases0 | 4 ++-- .../snpool/cfg_wrong_cn_in_sn_pool_tftp_sync_mode | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/dockercommand/cases0 b/xCAT-test/autotest/testcase/dockercommand/cases0 index e28c5d629..4baaa725b 100644 --- a/xCAT-test/autotest/testcase/dockercommand/cases0 +++ b/xCAT-test/autotest/testcase/dockercommand/cases0 @@ -122,7 +122,7 @@ cmd:mkdocker $$DOCKERCN image=$$DOCKERIMAGE command=$$DOCKERCOMMAND dockerflag= check:rc==0 cmd:rpower $$DOCKERCN pause check:rc!=0 -check:output=~$$DOCKERCN: Error +check:output=~$$DOCKERCN: (\[.*?\]: )?Error cmd:rpower $$DOCKERCN start check:rc==0 cmd:rpower $$DOCKERCN pause @@ -223,7 +223,7 @@ cmd:rmdocker $$DOCKERCN check:rc==0 cmd:lsdocker -l $$DOCKERCN check:rc!=0 -check:output=~$$DOCKERCN: Error +check:output=~$$DOCKERCN: (\[.*?\]: )?Error cmd:makehosts -d $$DOCKERCN check:rc==0 cmd:rmdef $$DOCKERCN diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index af33335c1..968783972 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -212,10 +212,10 @@ cmd:result=`lsdef | grep auto_test_node`; if [[ $result =~ "auto_test_node" ]]; cmd:result=`lsdef | grep auto_test_invalid_template`; if [[ $result =~ "auto_test_invalid_template" ]]; then echo $result; noderm auto_test_invalid_template; fi cmd:lsdef --template auto_test_invalid_template check:rc==1 -check:output=~Error\: Could not find auto\_test\_invalid\_template in xCAT templates +check:output=~Error\: (\[.*?\]: )?Could not find auto\_test\_invalid\_template in xCAT templates cmd:mkdef -t node -o auto_test_node --template auto_test_invalid_template check:rc==1 -check:output=~Error\: Could not find the template object named \'auto\_test\_invalid\_template\' of type \'node\' +check:output=~Error\: (\[.*?\]: )?Could not find the template object named \'auto\_test\_invalid\_template\' of type \'node\' end start:mkdef_node_with_a_node_template @@ -255,13 +255,13 @@ description:create a node with cec template step by step cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template check:rc==1 -check:output=~Error\: The attribute \"serial\" must be specified! +check:output=~Error\: (\[.*?\]: )?The attribute \"serial\" must be specified! cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test check:rc==1 -check:output=~Error\: The attribute \"mtm\" must be specified! +check:output=~Error\: (\[.*?\]: )?The attribute \"mtm\" must be specified! cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test check:rc==1 -check:output=~Error\: The attribute \"hcp\" must be specified! +check:output=~Error\: (\[.*?\]: )?The attribute \"hcp\" must be specified! cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test check:rc==0 check:output=~1 object definitions have been created or modified diff --git a/xCAT-test/autotest/testcase/rsetboot/cases0 b/xCAT-test/autotest/testcase/rsetboot/cases0 index 960f69261..1520b3699 100644 --- a/xCAT-test/autotest/testcase/rsetboot/cases0 +++ b/xCAT-test/autotest/testcase/rsetboot/cases0 @@ -103,10 +103,10 @@ cmd:if [[ -f /tmp/rsetboot.stat ]];then mv -f /tmp/rsetboot.stat /tmp/rsetboot.s check:rc==0 cmd:rsetboot $$CN,testnode net check:output=~$$CN: Network -check:output=~testnode: Error +check:output=~testnode: (\[.*?\]: )?Error cmd:rsetboot $$CN,testnode stat check:output=~$$CN: Network -check:output=~testnode: Error +check:output=~testnode: (\[.*?\]: )?Error cmd:if [[ `grep CD /tmp/rsetboot.stat` ]];then rsetboot $$CN cd;elif [[ `grep Network /tmp/rsetboot.stat` ]];then rsetboot $$CN net;else rsetboot $$CN hd;fi check:rc==0 cmd:if [[ -f /tmp/rsetboot.stat.bak ]];then mv -f /tmp/rsetboot.stat.bak /tmp/rsetboot.stat;else rm -rf /tmp/rsetboot.stat;fi diff --git a/xCAT-test/autotest/testcase/snpool/cfg_wrong_cn_in_sn_pool_tftp_sync_mode b/xCAT-test/autotest/testcase/snpool/cfg_wrong_cn_in_sn_pool_tftp_sync_mode index 235fe1e6c..90344fd49 100644 --- a/xCAT-test/autotest/testcase/snpool/cfg_wrong_cn_in_sn_pool_tftp_sync_mode +++ b/xCAT-test/autotest/testcase/snpool/cfg_wrong_cn_in_sn_pool_tftp_sync_mode @@ -147,7 +147,7 @@ cmd:chdef compute1 mac= check:rc==0 cmd:nodeset compute1 osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-compute check:rc!=0 -check:output=~compute1: Error +check:output=~compute1: (\[.*?\]: )?Error cmd:noderm compute1 check:rc==0 From 550ef1a74aab6d8f260ad62af9a27c94405b5986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=E1=B4=8F=C9=B4=C9=A2=20Jie?= Date: Tue, 29 May 2018 15:21:37 +0800 Subject: [PATCH 117/117] Test case for copycds, with a bogus disc (#5236) --- .../testcase/copycds/BOGUS-RHEL-7.0-ppc64.iso | Bin 0 -> 376832 bytes xCAT-test/autotest/testcase/copycds/cases1 | 5 +++++ .../testcase/copycds/copycds_bogus_disc | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 xCAT-test/autotest/testcase/copycds/BOGUS-RHEL-7.0-ppc64.iso create mode 100644 xCAT-test/autotest/testcase/copycds/cases1 create mode 100755 xCAT-test/autotest/testcase/copycds/copycds_bogus_disc diff --git a/xCAT-test/autotest/testcase/copycds/BOGUS-RHEL-7.0-ppc64.iso b/xCAT-test/autotest/testcase/copycds/BOGUS-RHEL-7.0-ppc64.iso new file mode 100644 index 0000000000000000000000000000000000000000..57b0d7c97b0f6d71e3315528b37f5b45cbe55527 GIT binary patch literal 376832 zcmeI*-)|Jh9RTpzNKuK?rcu;HRRm=crBSNZ=R0GYIDIyg%iO2eSqND@hjZt`O0#?AcaIPIpiX`q&Nn&d z!?`+fEq>P{S{uDdg+m~YAx-r=sU+H&; z`7-lzyxN-P-LjgD*RHmz-fl4*7UL@~``XvrozL5w>+7AZc4wo#xf!3zXg@K9r;f8BkI(s!oLKL~rFpHeZ+MfwiqDep#_XDKyGxjSipo!?K}W!nBU&Aqf$ zrtMxTyG-dO=OCr_(|nN5`8wQBxu^d;$00F1*FjG;=1*lj(fqfy|7WZ1Jqyt^ztb!U zoB@IVF5CYz5Q`895FkK+0D+eyke=Yi+5N*fN>5_f*JEevi+1OWjrRP>=E|j3yAxNB z;_B77I*Y3h=709%v)=`*-i@1PBlyK!5-N0t5)W$^!E{{|ny#zsjGX*a;9IK!5-N z0t5&UAV7e?X#)Q^wU7O3`m5~U{|ROJX7+G;{V&-!-MY-~H>nf;dRnZSje5E4vwt@D zFnedwVgG#fSzK)O^7GjrniCeQ5FRz#kM10we?p(X*$WILd><}0^R$M zBiUQ2Z~FcyZ~e7X*ZTMI=|3&)wy6U4HD$3ZMUhvQZFA$-(C@zJ6i=T?g1w|_oY zpE{4?pkGwIVmx^4kfLbSojTpV^VQwwiDFs7GK#wN`KA7*UM=csg0Lh&fB=D)A#i#h z`==g}ZJg46yq5+H_%hrM_tF3Zx5J(ARk)jSmaXHnTi##KJAdz{uHHwf6Znk~8;ld$ z$@fxM@@43Taq3jQmC`$@GkFsM0t5&UAaIgEUOviJW`9d})y4E64Zqgu&UW)yPI}j3 zS@f^uu^7+tvbWnEr}VU(%qG3buukk3{k)3R-gG)CXK|1QaGOr5;`)5(x40Plt;$E; z@vP`o(_!AN^4ObUfIiAF;;o1 z_4vS4Wh!n^q;raK3ZfWw%NucjGTa;GF@@7h7f}x-R~NXfE8VtE%F(>o<3Wl}!jMmZ z009C7UK4@YZcz{48oN#B{qv@IF&^)0BH%I!5FkK+!0RV4h{vzE&%)T4FCd1+JNuPE z{K;$U7f|jmU&LF-uiX6$?e+Vc>WT>vAn;-ZI+wP$H#WA{*SA`o&CSirpRX*3?~B#p z(SyUI)_fGdm1g;3>sA^80t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U RAV7cs0RjXF5O`jJ{{a`_O3MHM literal 0 HcmV?d00001 diff --git a/xCAT-test/autotest/testcase/copycds/cases1 b/xCAT-test/autotest/testcase/copycds/cases1 new file mode 100644 index 000000000..dd3d2ddec --- /dev/null +++ b/xCAT-test/autotest/testcase/copycds/cases1 @@ -0,0 +1,5 @@ +start:copycds_bogus_disc +description: Test cases for the copycds with a bogus disc +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/copycds/copycds_bogus_disc +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/copycds/copycds_bogus_disc b/xCAT-test/autotest/testcase/copycds/copycds_bogus_disc new file mode 100755 index 000000000..b292f8d04 --- /dev/null +++ b/xCAT-test/autotest/testcase/copycds/copycds_bogus_disc @@ -0,0 +1,18 @@ +#!/bin/bash + +set -x + +function cleanup() +{ + rm -rf /install/rhels7/ppc64 + rmdef -t osimage rhels7-ppc64-install-compute + rmdef -t osimage rhels7-ppc64-install-service + rmdef -t osimage rhels7-ppc64-netboot-compute + rmdef -t osimage rhels7-ppc64-statelite-compute +} + +trap cleanup EXIT + +ISO_FILE="/opt/xcat/share/xcat/tools/autotest/testcase/copycds/BOGUS-RHEL-7.0-ppc64.iso" + +copycds "${ISO_FILE}"