From 6700d8497611d60206986735c51e329edd8a70af Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 15 Mar 2017 07:14:55 -0400 Subject: [PATCH 001/162] modify bundle list according to disk diskless case modify --- xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/sles12_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index 4a8e312bb..319263cd8 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -1,6 +1,6 @@ setup_vm -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_x diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 65ff91ea2..fba0b2b96 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -1,6 +1,6 @@ setup_vm -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_x diff --git a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle index 65ff91ea2..fba0b2b96 100644 --- a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle @@ -1,6 +1,6 @@ setup_vm -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_x diff --git a/xCAT-test/autotest/bundle/sles12_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12_ppc64le.bundle index 31b05bf80..4189d2a14 100644 --- a/xCAT-test/autotest/bundle/sles12_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12_ppc64le.bundle @@ -1,6 +1,6 @@ setup_vm -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat makehosts_h makehosts_help makehosts_n diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle index 9aecea63a..3c4472521 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle @@ -1,6 +1,6 @@ setup_vm -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat makehosts_h makehosts_help makehosts_n_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle index b714108f4..48d7290d3 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle @@ -1,6 +1,6 @@ setup_vm -Ubuntu_diskless_installation_flat_x86_vm -Ubuntu_full_installation_flat_x86_vm +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat makehosts_h makehosts_help makehosts_n_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index be6932c9d..619a31895 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -1,6 +1,6 @@ setup_vm -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_xcat-version-1 diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 72d300f72..e81520d4d 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -1,6 +1,6 @@ setup_vm -Ubuntu_diskless_installation_flat_x86_vm -Ubuntu_full_installation_flat_x86_vm +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_xcat-version-1 diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 74df70cbe..44a902112 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -1,6 +1,6 @@ setup_vm -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_xcat-version-1 diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index 51decc528..d9d9f3d53 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -1,6 +1,6 @@ setup_vm -Ubuntu_diskless_installation_flat_x86_vm -Ubuntu_full_installation_flat_x86_vm +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_xcat-version-1 diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle index db2beed03..db918d358 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle @@ -1,6 +1,6 @@ setup_vm -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_x diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle index 07491602a..31619a4fe 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle @@ -1,6 +1,6 @@ setup_vm -Ubuntu_diskless_installation_flat_x86_vm -Ubuntu_full_installation_flat_x86_vm +reg_linux_diskless_installation_flat +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_x From aa3c152ae2611f089623709ba18675a56e4ea02c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 29 Mar 2017 14:32:10 -0400 Subject: [PATCH 002/162] lsvm to display VM details --- .../admin-guides/references/man1/lsvm.1.rst | 20 ++--- xCAT-client/pods/man1/lsvm.1.pod | 20 ++--- xCAT-server/lib/xcat/plugins/kvm.pm | 86 +++++++++++++++++-- 3 files changed, 97 insertions(+), 29 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/lsvm.1.rst b/docs/source/guides/admin-guides/references/man1/lsvm.1.rst index ee8b7bf31..dc53a2c47 100644 --- a/docs/source/guides/admin-guides/references/man1/lsvm.1.rst +++ b/docs/source/guides/admin-guides/references/man1/lsvm.1.rst @@ -56,15 +56,15 @@ DESCRIPTION *********** -The lsvm command lists all partition profiles defined for the partitions specified in noderange. If noderange is a CEC, all the partitions associated with that CEC are displayed. +The \ **lsvm**\ command lists all partition profiles defined for the partitions specified in \ *noderange*\ . If \ *noderange*\ is a CEC, all the partitions associated with that CEC are displayed. For PPC (using Direct FSP Management): ====================================== -For Power 775(use option \ *--p775*\ to specify), lsvm lists all partition I/O slots information for the partitions specified in noderange. If noderange is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information. +For Power 775 (use option \ **-**\ **-p775**\ to specify), \ **lsvm**\ lists all partition I/O slots information for the partitions specified in \ *noderange*\ . If \ *noderange*\ is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information. -For DFM-managed (short for Direct FSP Management mode) normal power machine, lsvm lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC. +For DFM-managed (short for Direct FSP Management mode) normal power machine, \ **lsvm**\ lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC. The pump mode value has the valid options: 1 - Node Pump Mode @@ -83,9 +83,9 @@ For KVM and VMware ================== -The virtual machines that defined in the hypervisor \ *noderange*\ will be displayed. \ *noderange*\ can only be hypervisor. +If \ *noderange*\ is a hypervisor, virtual machines defined on that hypervisor will be displayed. If \ *noderange*\ is a VM, details for that VM will be displayed. -Note: Only the virtual machine which is in power on state can be listed by lsvm command. +Note: Only the virtual machine which is in power on state can be listed by \ **lsvm**\ command. For zVM: @@ -107,7 +107,7 @@ Display usage message. \ **-v**\ -Command Version. +Command version. \ **-V**\ @@ -157,7 +157,7 @@ Output is similar to: lpar3: name=lpar3,lpar_name=lpar3,lpar_id=4,lpar_env=aixlinux,all_resources=0,min_mem=512, desired_mem=2048, max_mem=3072,min_num_huge_pages=0,desired_num_huge_pages=0,max_num_huge_pages=0,proc_mode=shared, min_proc_units=0.5,desired_proc_units=0.5,max_proc_units=0.5,min_procs=1,desired_procs=1,max_procs=1, sharing_mode=uncap,uncap_weight=128,shared_proc_pool_id=0,shared_proc_pool_name=DefaultPool,io_slots=none, lpar_io_pool_ids=none,max_virtual_slots=10, "virtual_serial_adapters=1/server/1/any//any/1,0/server/1/any//any/1", virtual_scsi_adapters=2/client/1/p6vios/4/1,virtual_eth_adapters=3/0/1//0/1,hca_adapters=none,boot_mode=norm,conn_monitoring=0,auto_start=0,power_ctrl_lpar_ids=none,work_group_id=none,redundant_err_path_reporting=0, bsr_arrays=0,lhea_logical_ports=none,lhea_capabilities=none,lpar_proc_compat_mode=default,electronic_err_reporting=null -2.To list all IVM-managed partitions associated with CEC cec01, enter: +2. To list all IVM-managed partitions associated with CEC cec01, enter: .. code-block:: perl @@ -252,7 +252,7 @@ Output is similar to: OctantID=7,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2; -6.To list the lparname of lpars, enter: +6. To list the lparname of lpars, enter: .. code-block:: perl @@ -360,9 +360,9 @@ Output is similar to: Available BSR array: 256 -Note: The lines list in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicate a physical I/O resource in normal power machine. +Note: The lines listed in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicates a physical I/O resource in a normal power machine. -9.For DFM-managed partition on normal power machine, list out the detailed information: +9. For DFM-managed partition on normal power machine, list out the detailed information: .. code-block:: perl diff --git a/xCAT-client/pods/man1/lsvm.1.pod b/xCAT-client/pods/man1/lsvm.1.pod index a9843bb8b..d588fbf42 100644 --- a/xCAT-client/pods/man1/lsvm.1.pod +++ b/xCAT-client/pods/man1/lsvm.1.pod @@ -28,13 +28,13 @@ B I =head1 DESCRIPTION -The lsvm command lists all partition profiles defined for the partitions specified in noderange. If noderange is a CEC, all the partitions associated with that CEC are displayed. +The B command lists all partition profiles defined for the partitions specified in I. If I is a CEC, all the partitions associated with that CEC are displayed. =head2 For PPC (using Direct FSP Management): -For Power 775(use option I<--p775> to specify), lsvm lists all partition I/O slots information for the partitions specified in noderange. If noderange is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information. +For Power 775 (use option B<--p775> to specify), B lists all partition I/O slots information for the partitions specified in I. If I is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information. -For DFM-managed (short for Direct FSP Management mode) normal power machine, lsvm lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC. +For DFM-managed (short for Direct FSP Management mode) normal power machine, B lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC. The pump mode value has the valid options: 1 - Node Pump Mode @@ -50,9 +50,9 @@ More information about this part, refer to the section Using the *vm commands to =head2 For KVM and VMware -The virtual machines that defined in the hypervisor I will be displayed. I can only be hypervisor. +If I is a hypervisor, virtual machines defined on that hypervisor will be displayed. If I is a VM, details for that VM will be displayed. -Note: Only the virtual machine which is in power on state can be listed by lsvm command. +Note: Only the virtual machine which is in power on state can be listed by B command. =head2 For zVM: @@ -67,7 +67,7 @@ Display usage message. B<-v> -Command Version. +Command version. B<-V> @@ -101,7 +101,7 @@ Output is similar to: lpar3: name=lpar3,lpar_name=lpar3,lpar_id=4,lpar_env=aixlinux,all_resources=0,min_mem=512, desired_mem=2048, max_mem=3072,min_num_huge_pages=0,desired_num_huge_pages=0,max_num_huge_pages=0,proc_mode=shared, min_proc_units=0.5,desired_proc_units=0.5,max_proc_units=0.5,min_procs=1,desired_procs=1,max_procs=1, sharing_mode=uncap,uncap_weight=128,shared_proc_pool_id=0,shared_proc_pool_name=DefaultPool,io_slots=none, lpar_io_pool_ids=none,max_virtual_slots=10, "virtual_serial_adapters=1/server/1/any//any/1,0/server/1/any//any/1", virtual_scsi_adapters=2/client/1/p6vios/4/1,virtual_eth_adapters=3/0/1//0/1,hca_adapters=none,boot_mode=norm,conn_monitoring=0,auto_start=0,power_ctrl_lpar_ids=none,work_group_id=none,redundant_err_path_reporting=0, bsr_arrays=0,lhea_logical_ports=none,lhea_capabilities=none,lpar_proc_compat_mode=default,electronic_err_reporting=null -2.To list all IVM-managed partitions associated with CEC cec01, enter: +2. To list all IVM-managed partitions associated with CEC cec01, enter: lsvm cec01 @@ -164,7 +164,7 @@ Output is similar to: OctantID=6,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2; OctantID=7,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2; -6.To list the lparname of lpars, enter: +6. To list the lparname of lpars, enter: lsvm cec1 -l --p775 @@ -248,9 +248,9 @@ Output is similar to: Bytes per BSR array: 4096 Available BSR array: 256 -Note: The lines list in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicate a physical I/O resource in normal power machine. +Note: The lines listed in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicates a physical I/O resource in a normal power machine. -9.For DFM-managed partition on normal power machine, list out the detailed information: +9. For DFM-managed partition on normal power machine, list out the detailed information: lsvm lpar1 diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 6e2434eea..ec659b73c 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -81,7 +81,7 @@ sub handled_commands { #rvitals => 'nodehm:mgt', #rinv => 'nodehm:mgt', getrvidparms => 'nodehm:mgt', - lsvm => 'nodehm:mgt=ipmi', + lsvm => ['nodehm:mgt=ipmi', 'nodehm:mgt=kvm'], #allow both hypervisor and VMs as params rbeacon => 'nodehm:mgt', revacuate => 'hypervisor:type', vmstatenotify => 'hypervisor:type', @@ -3512,11 +3512,73 @@ sub rscan { } sub lsvm { - my $node = shift; + my $host = shift; + my $vm = shift; my @doms = $hypconn->list_domains(); my @vms; - foreach (@doms) { - push @vms, $_->get_name(); + + if ($host ne $vm) { + # Processing lsvm for a VM, display details about that VM + foreach (@doms) { + if ($_->get_name() eq $vm) { + push @vms, "Id:" . $_->get_id(); + push @vms, "Host:" . $host; + push @vms, "OS:" . $_->get_os_type(); + my $domain_info = $_->get_info(); + if (exists $domain_info->{"memory"}) { + push @vms, "Memory:" . $domain_info->{"memory"}; + } + if (exists $domain_info->{"nrVirtCpu"}) { + push @vms, "Virt CPU: " . $domain_info->{"nrVirtCpu"}; + } + if (exists $domain_info->{"state"}) { + my $state = $domain_info->{"state"}; + my $state_string = "Unknown"; + if ($state == &Sys::Virt::Domain::STATE_NOSTATE) {$state_string = "The domain is active, but is not running / blocked (eg idle)";} + elsif ($state == &Sys::Virt::Domain::STATE_RUNNING) {$state_string = "The domain is active and running";} + elsif ($state == &Sys::Virt::Domain::STATE_BLOCKED) {$state_string = "The domain is active, but execution is blocked";} + elsif ($state == &Sys::Virt::Domain::STATE_PAUSED) {$state_string = "The domain is active, but execution has been paused";} + elsif ($state == &Sys::Virt::Domain::STATE_SHUTDOWN) {$state_string = "The domain is active, but in the shutdown phase";} + elsif ($state == &Sys::Virt::Domain::STATE_SHUTOFF) {$state_string = "The domain is inactive, and shut down";} + elsif ($state == &Sys::Virt::Domain::STATE_CRUSHED) {$state_string = "The domain is inactive, and crashed";} + elsif ($state == &Sys::Virt::Domain::STATE_PMSUSPENDED) {$state_string = "The domain is active, but in power management suspend state";} + push @vms, "State :" . $domain_info->{"state"} . " ($state_string)"; + } + # The following block of code copied from rscan command processng for disks + my $currxml = $_->get_xml_description(); + if ($currxml) { + my $domain = $parser->parse_string($currxml); + my @vmstoragediskobjs = $domain->findnodes("/domain/devices/disk"); + foreach my $vmstoragediskobj (@vmstoragediskobjs) { + my ($vmstorage_file_obj, $vmstorage_block_obj); + if (($vmstoragediskobj->getAttribute("device") eq "disk") and ($vmstoragediskobj->getAttribute("type") eq "file")) { + my @vmstorageobj = $vmstoragediskobj->findnodes("./source"); + if (@vmstorageobj) { + $vmstorage_file_obj = $vmstorageobj[0]->getAttribute("file"); + push @vms, "Disk file:" . $vmstorage_file_obj; + } + } + if (($vmstoragediskobj->getAttribute("device") eq "disk") and ($vmstoragediskobj->getAttribute("type") eq "block")) { + my @vmstorageobj = $vmstoragediskobj->findnodes("./source"); + if (@vmstorageobj) { + $vmstorage_block_obj = $vmstorageobj[0]->getAttribute("dev"); + push @vms, "Disk object:" . $vmstorage_block_obj; + } + } + } + } + } + } + } + else { + # Processing lsvm for hypervisor, display a list of VMs on that hypervisor + foreach (@doms) { + push @vms, $_->get_name(); + } + } + # Check if we were able to get any data + unless (@vms) { + push @vms, "Could not get any information about specified object"; } return (0, @vms); } @@ -3547,7 +3609,7 @@ sub guestcmd { } elsif ($command eq "getcons") { return getcons($node, @args); } elsif ($command eq "lsvm") { - return lsvm($node, @args); + return lsvm($hyp, $node, @args); } elsif ($command eq "rscan") { return rscan($node, @args); } @@ -3783,7 +3845,7 @@ sub process_request { if ($::XCATSITEVALS{usexhrm}) { $use_xhrm = 1; } $vmtab = xCAT::Table->new("vm"); $confdata = {}; - unless ($command eq 'lsvm' or $command eq 'rscan') { + unless ($command eq 'rscan') { xCAT::VMCommon::grab_table_data($noderange, $confdata, $callback); # Add debug info for issue 1958, the rmvm issue my $test_file_fd; @@ -3824,7 +3886,8 @@ sub process_request { my $inputs = new IO::Select; my $sub_fds = new IO::Select; %hyphash = (); - if ($command eq 'lsvm' or $command eq 'rscan') { #command intended for hypervisors, not guests + + if ($command eq 'rscan') { #command intended for hypervisors, not guests foreach (@$noderange) { $hyphash{$_}->{nodes}->{$_} = 1; } } else { foreach (keys %{ $confdata->{vm} }) { @@ -3868,6 +3931,12 @@ sub process_request { # foreach (keys %orphans) { # $hyphash{'!@!XCATDUMMYHYPERVISOR!@!'}->{nodes}->{$_}=1; # } + } elsif ($command eq "lsvm") { + # Special processing for lsvm command, which takes vm name or hypervisor name + unless (%hyphash) { + # if hyperhash has not been set already, we are processing vms, set it here + foreach (@$noderange) { $hyphash{$_}->{nodes}->{$_} = 1; } + } } else { $callback->({ error => "Can't find " . join(",", keys %orphans), errorcode => [1] }); return; @@ -4000,7 +4069,6 @@ sub dohyp { $offlinehyps{$hyp} = 1; } - eval { #Contain Sys::Virt bugs that make $@ useless if ($hyp eq '!@!XCATDUMMYHYPERVISOR!@!') { #Fake connection for commands that have a fake hypervisor key $hypconn = 1; @@ -4031,7 +4099,7 @@ sub dohyp { return 1, "General error establishing libvirt communication"; } } - if (($command eq 'mkvm' or $command eq 'chvm' or $command eq 'rpower') and $hypconn) { + if (($command eq 'mkvm' or $command eq 'chvm' or $command eq 'rpower' or $command eq 'lsvm') and $hypconn) { my $nodeinfo = $hypconn->get_node_info(); if (exists($nodeinfo->{model})) { $confdata->{$hyp}->{cpumodel} = $nodeinfo->{model}; From f82ff37c2bf63900c8cdbfbf4b45e8c794a9319f Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 31 Mar 2017 15:29:09 +0800 Subject: [PATCH 003/162] [go-xcat] Ignore any error of `yum clean metadata` --- xCAT-server/share/xcat/tools/go-xcat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index b445b04a8..370481f0f 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.15 +# Version 1.0.16 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -955,6 +955,7 @@ function remove_repo_yum() # This is a quick and dirty method. rm -f $(grep -l "^\[${repo_id}\]$" "/etc/yum.repos.d/"*".repo" 2>/dev/null) yum clean metadata + : } # $1 repo id From 7b65e01db8787832ce0310b3d284a34d699ba28c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 7 Apr 2017 14:07:59 -0400 Subject: [PATCH 004/162] add --buffersize option to rflash --- xCAT-server/lib/xcat/plugins/ipmi.pm | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index c14c31ac3..5f4849beb 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1766,6 +1766,7 @@ sub do_firmware_update { my $ret; my $ipmitool_ver; my $verbose = 0; + my $verbose_opt; $ret = get_ipmitool_version(\$ipmitool_ver); exit $ret if $ret < 0; @@ -1848,6 +1849,21 @@ sub do_firmware_update { $buffer_size = "15000"; } + # check verbose and buffersize options + for my $opt (@{$sessdata->{'extraargs'}}) { + if ($opt =~ /-V{1,4}/) { + $verbose_opt = lc($opt); + $verbose = 1; + } + if ($opt =~ /buffersize=/) { + my ($attribute, $buffer_value) = split(/=/, $opt); + if ($buffer_value) { + # buffersize option was passed in, reset the default + $buffer_size = $buffer_value; + } + } + } + # check for 8335-GTB Firmware above 1610A release. If below, exit if ($output =~ /8335-GTB/) { $cmd = $pre_cmd . " fru print 47"; @@ -1899,14 +1915,8 @@ sub do_firmware_update { # step 4 upgrade firmware $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force "; - # check verbose debug option - for my $opt (@{$sessdata->{'extraargs'}}) { - if ($opt =~ /-V{1,4}/) { - $cmd .= lc($opt); - $verbose = 1; - last; - } - } + $cmd .= $verbose_opt; + my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); $cmd .= " >".$rflash_log_file." 2>&1"; xCAT::SvrUtils::sendmsg([ 0, @@ -1933,7 +1943,7 @@ sub do_firmware_update { "Running ipmitool command $cmd failed: $output"); } $exit_with_success_func->($sessdata->{node}, $callback, - "Success to update firmware. FRU information will be populated in a few minutes."); + "Success updating firmware. FRU information will be populated in a few minutes."); } sub rflash { @@ -1946,7 +1956,7 @@ sub rflash { if ($opt =~ /^(-c|--check)$/i) { $sessdata->{subcommand} = "check"; # support verbose options for ipmitool command - } elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$/) { + } elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$/ && $opt !~ /^--buffersize=/) { $callback->({ error => "The option $opt is not supported", errorcode => 1 }); return; From f9d065ee06fc5cdfc73f34cdd3f5afe43a485cab Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 10 Apr 2017 11:12:18 -0400 Subject: [PATCH 005/162] Improve progress messages --- xCAT-server/lib/xcat/plugins/ipmi.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 5f4849beb..ed0bc59ab 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1885,6 +1885,7 @@ sub do_firmware_update { # step 1 power off $cmd = $pre_cmd . " chassis power off"; + xCAT::SvrUtils::sendmsg("Preparing to upgrade firmware, powering chassis off...", $callback, $sessdata->{node}, %allerrornodes); $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { $exit_with_error_func->($sessdata->{node}, $callback, @@ -1936,6 +1937,7 @@ sub do_firmware_update { "Timeout to check the bmc status"); } + xCAT::SvrUtils::sendmsg("Firmware updated, powering chassis on to populate FRU information...", $callback, $sessdata->{node}, %allerrornodes); $cmd = $pre_cmd . " chassis power on"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { @@ -1943,7 +1945,7 @@ sub do_firmware_update { "Running ipmitool command $cmd failed: $output"); } $exit_with_success_func->($sessdata->{node}, $callback, - "Success updating firmware. FRU information will be populated in a few minutes."); + "Success updating firmware."); } sub rflash { From db8a465900c8ffe284b7a4ead9c24a9da9008374 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 10 Apr 2017 22:11:01 -0400 Subject: [PATCH 006/162] Modify syntax error of two cases --- xCAT-test/autotest/testcase/renergy/case_9125-F2C | 2 +- xCAT-test/autotest/testcase/xcatsnap/cases0 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/renergy/case_9125-F2C b/xCAT-test/autotest/testcase/renergy/case_9125-F2C index ba5e624af..f82300796 100644 --- a/xCAT-test/autotest/testcase/renergy/case_9125-F2C +++ b/xCAT-test/autotest/testcase/renergy/case_9125-F2C @@ -218,7 +218,7 @@ check:output!~ffoNorm check:output!~ffovalue end -tart:query_9125-F2C_ffoVmin +start:query_9125-F2C_ffoVmin description: type:9125-F2C cmd:renergy $$CN ffoVmin diff --git a/xCAT-test/autotest/testcase/xcatsnap/cases0 b/xCAT-test/autotest/testcase/xcatsnap/cases0 index 58030d661..8e374578c 100644 --- a/xCAT-test/autotest/testcase/xcatsnap/cases0 +++ b/xCAT-test/autotest/testcase/xcatsnap/cases0 @@ -25,7 +25,7 @@ check:output=~Usage end -start;xcatsnap_v +start:xcatsnap_v description:xcatsnap -v and --version cmd:xcatsnap -v check:output=~version|Version From e5b3e4786eb3ec1bdad445363893fd796b34d385 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 11 Apr 2017 02:24:07 -0400 Subject: [PATCH 007/162] Add code to support rinv and rsetboot for openbmc --- xCAT-server/lib/xcat/plugins/openbmc.pm | 186 ++++++++++++++++++++++-- 1 file changed, 176 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index b4107e68c..0fd10a66e 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -24,6 +24,7 @@ use xCAT::Usage; use xCAT::SvrUtils; use File::Basename; use Data::Dumper; +use Getopt::Long; use JSON; $::OPENBMC_DEVEL = $ENV{'OPENBMC_DEVEL'}; @@ -117,11 +118,50 @@ my %status_info = ( RINV_REQUEST => { method => "GET", - init_url => "$openbmc_url/inventory/enumerate", + init_url => "$openbmc_project_url/inventory/enumerate", }, RINV_RESPONSE => { process => \&rinv_response, }, + RSETBOOT_HD_REQUEST => { + method => "PUT", + init_url => "", + data => "", + }, + RSETBOOT_HD_RESPONSE => { + process => \&rsetboot_response, + }, + RSETBOOT_NET_REQUEST => { + method => "PUT", + init_url => "", + data => "", + }, + RSETBOOT_NET_RESPONSE => { + process => \&rsetboot_response, + }, + RSETBOOT_CD_REQUEST => { + method => "PUT", + init_url => "", + data => "", + }, + RSETBOOT_CD_RESPONSE => { + process => \&rsetboot_response, + }, + RSETBOOT_DEF_REQUEST => { + method => "PUT", + init_url => "", + data => "", + }, + RSETBOOT_DEF_RESPONSE => { + process => \&rsetboot_response, + }, + RSETBOOT_STATUS_REQUEST => { + method => "GET", + init_url => "", + }, + RSETBOOT_STATUS_RESPONSE => { + process => \&rsetboot_response, + }, ); @@ -289,7 +329,7 @@ sub parse_args { my $extrargs = shift; my $check = undef; - if (scalar(@ARGV) > 1) { + if (scalar(@ARGV) > 1 and $command ne "rsetboot") { return ([ 1, "Only one option is supported at the same time" ]); } @@ -312,12 +352,23 @@ sub parse_args { # $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } - - unless ($subcommand =~ /^cpu$|^dimm$|^bios$|^all$/) { + $subcommand = "all" if (!defined($ARGV[0])); + unless ($subcommand =~ /^cpu$|^dimm$|^bios$|^model$|^serial$|^all$/) { return ([ 1, "Unsupported command: $command $subcommand" ]); } } elsif ($command eq "getopenbmccons") { #command for openbmc rcons + } elsif ($command eq "rsetboot") { + if (!defined($extrargs)) { + return ([ 1, "No option specified for $command" ]); + } + # + # disable function until fully tested + # + $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } + unless ($subcommand =~ /^net$|^hd$|^cd$|^def$|^default$|^stat$/) { + return ([ 1, "Unsupported command: $command $subcommand" ]); + } } else { return ([ 1, "Command is not supported." ]); } @@ -336,11 +387,12 @@ sub parse_args { #------------------------------------------------------- sub parse_command_status { my $command = shift; + my $subcommand; $next_status{LOGIN_REQUEST} = "LOGIN_RESPONSE"; if ($command eq "rpower") { - my $subcommand = $ARGV[0]; + $subcommand = $ARGV[0]; if ($subcommand eq "on") { $next_status{LOGIN_RESPONSE} = "RPOWER_ON_REQUEST"; @@ -365,15 +417,54 @@ sub parse_command_status { } if ($command eq "rinv") { - my $subcommand = $ARGV[0]; + if (defined($ARGV[0])) { + $subcommand = $ARGV[0]; + } else { + $subcommand = "all"; + } - if ($subcommand eq "cpu" or $subcommand eq "dimm" or $subcommand eq "bios" or $subcommand eq "all") { + if ($subcommand eq "cpu" or $subcommand eq "dimm" or $subcommand eq "bios" or $subcommand eq "model" or $subcommand eq "serial" or $subcommand eq "all") { $next_status{LOGIN_RESPONSE} = "RINV_REQUEST"; $next_status{RINV_REQUEST} = "RINV_RESPONSE"; $status_info{RINV_RESPONSE}{argv} = "$subcommand"; } } + if ($command eq "rsetboot") { + my $persistent = 0; + my $uefi = 0; + unless (GetOptions( + "p" => \$persistent, + )) { + xCAT::SvrUtils::sendmsg([ 1, "Error parsing arguments" ], $callback); + exit 1; + } + + $subcommand = $ARGV[0]; + if ($subcommand eq "hd") { + $next_status{LOGIN_RESPONSE} = "RSETBOOT_HD_REQUEST"; + $next_status{RSETBOOT_HD_REQUEST} = "RSETBOOT_HD_RESPONSE"; + # modify $status_info{RSETBOOT_SET_REQUEST}{data} if $persistent or $uefi + } elsif ($subcommand eq "net") { + $next_status{LOGIN_RESPONSE} = "RSETBOOT_NET_REQUEST"; + $next_status{RSETBOOT_NET_REQUEST} = "RSETBOOT_NET_RESPONSE"; + # modify $status_info{RSETBOOT_SET_REQUEST}{data} if $persistent or $uefi + } elsif ($subcommand eq "cd"){ + $next_status{LOGIN_RESPONSE} = "RSETBOOT_CD_REQUEST"; + $next_status{RSETBOOT_CD_REQUEST} = "RSETBOOT_CD_RESPONSE"; + # modify $status_info{RSETBOOT_SET_REQUEST}{data} if $persistent or $uefi + } elsif ($subcommand eq "default" or $subcommand eq "def") { + $next_status{LOGIN_RESPONSE} = "RSETBOOT_DEF_REQUEST"; + $next_status{RSETBOOT_DEF_REQUEST} = "RSETBOOT_DEF_RESPONSE"; + # modify $status_info{RSETBOOT_SET_REQUEST}{data} if $persistent or $uefi + } elsif ($subcommand eq "stat") { + $next_status{LOGIN_RESPONSE} = "RSETBOOT_STATUS_REQUEST"; + $next_status{RSETBOOT_STATUS_REQUEST} = "RSETBOOT_STATUS_RESPONSE"; + } + xCAT::SvrUtils::sendmsg("Command $command is not available now!", $callback); + exit; + } + print Dumper(\%next_status) . "\n"; } @@ -598,7 +689,11 @@ sub rpower_response { } if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE") { - xCAT::SvrUtils::sendmsg($response_info->{'data'}->{CurrentHostState}, $callback, $node); + if ($response_info->{'data'}->{CurrentHostState} =~ /Off$/) { + xCAT::SvrUtils::sendmsg("off", $callback, $node); + } else { + xCAT::SvrUtils::sendmsg("on", $callback, $node); + } } if ($next_status{ $node_info{$node}{cur_status} }) { @@ -642,14 +737,31 @@ sub rinv_response { my $content_info; foreach my $key_url (keys %{$response_info->{data}}) { - if ($grep_string eq "all" or $key_url =~ /\/$grep_string/) { + my %content = %{ ${ $response_info->{data} }{$key_url} }; + + if ($grep_string eq "model") { + if ($key_url =~ /\/motherboard$/) { + my $model = "Model : " . $content{Model}; + my $partnumber = "PartNumber : " . "$content{PartNumber}"; + xCAT::SvrUtils::sendmsg("$model", $callback, $node); + xCAT::SvrUtils::sendmsg("$partnumber", $callback, $node); + next; + } + } elsif ($grep_string eq "serial") { + if ($key_url =~ /\/motherboard$/) { + my $prettyname = "PrettyName : " . $content{PrettyName}; + my $serialnumber = "SerialNumber : " . "$content{SerialNumber}"; + xCAT::SvrUtils::sendmsg("$prettyname", $callback, $node); + xCAT::SvrUtils::sendmsg("$serialnumber", $callback, $node); + next; + } + } elsif ($grep_string eq "all" or $key_url =~ /\/$grep_string/) { if ($key_url =~ /\/(cpu\d*)\/(\w+)/) { $src = "$1 $2"; } else { $src = basename $key_url; } - my %content = %{ ${ $response_info->{data} }{$key_url} }; foreach my $key (keys %content) { $content_info = uc ($src) . " " . $key . " : " . $content{$key}; xCAT::SvrUtils::sendmsg("$content_info", $callback, $node); @@ -695,6 +807,60 @@ sub getopenbmccons { return $rsp; } +#------------------------------------------------------- +=head3 rsetboot_response + + Deal with response of rsetboot command + Input: + $node: nodename of current response + $response: Async return response + +=cut + +#------------------------------------------------------- +sub rsetboot_response { + my $node = shift; + my $response = shift; + + my $response_info = decode_json $response->content; + + if ($node_info{$node}{cur_status} eq "RSETBOOT_HD_RESPONSE") { + if ($response_info->{'message'} eq "200 OK") { + xCAT::SvrUtils::sendmsg("HD", $callback, $node); + } + } + + if ($node_info{$node}{cur_status} eq "RSETBOOT_NET_RESPONSE") { + if ($response_info->{'message'} eq "200 OK") { + xCAT::SvrUtils::sendmsg("NET", $callback, $node); + } + } + + if ($node_info{$node}{cur_status} eq "RSETBOOT_CD_RESPONSE") { + if ($response_info->{'message'} eq "200 OK") { + xCAT::SvrUtils::sendmsg("CD", $callback, $node); + } + } + + if ($node_info{$node}{cur_status} eq "RSETBOOT_DEF_RESPONSE") { + if ($response_info->{'message'} eq "200 OK") { + xCAT::SvrUtils::sendmsg("DEF", $callback, $node); + } + } + + if ($node_info{$node}{cur_status} eq "RSETBOOT_STATUS_RESPONSE") { + # wait for more information + } + + if ($next_status{ $node_info{$node}{cur_status} }) { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + gen_send_request($node); + } else { + $wait_node_num--; + } + + return; +} 1; From f6b80e0e61f508be9873963444741c22842532a6 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 11 Apr 2017 08:43:20 -0400 Subject: [PATCH 008/162] modify installation testcase for synfile part issue:2834 --- .../reg_linux_diskfull_installation_flat | 9 +++++++-- .../reg_linux_diskfull_installation_hierarchy | 9 ++++++++- .../reg_linux_diskless_installation_flat | 14 +++++++------- .../reg_linux_diskless_installation_hierarchy | 13 +++++++------ 4 files changed, 29 insertions(+), 16 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 e740bed52..2d3b96197 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -31,6 +31,9 @@ cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? check:rc==0 cmd:copycds $$ISO check:rc==0 +cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; +cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/tmp/test.synclist +check:rc==0 cmd:if ! ([[ "__GETNODEATTR($$CN,os)__" = "sles12.1" ]] || [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" && "__GETNODEATTR($$CN,arch)__" = "x86_64" ]]) ; then chdef -t node -o $$CN postscripts=setupntp; fi check:rc==0 cmd:lsdef -l $$CN @@ -38,10 +41,8 @@ check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 check:output=~Provision node\(s\)\: $$CN - cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done - cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN @@ -65,4 +66,8 @@ cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" +cmd:xdsh $$CN "cat /tmp/test.synclist" +check:rc==0 +cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/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 09f12aecc..2501064c1 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -26,7 +26,9 @@ cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? check:rc==0 cmd:copycds $$ISO check:rc==0 - +cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; +cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/tmp/test.synclist +check:rc==0 cmd:updatenode $$CN -f check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute @@ -53,4 +55,9 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" +cmd:xdsh $$CN "cat /tmp/test.synclist" +check:rc==0 +cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/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 e3864b0bf..af959e324 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -25,14 +25,9 @@ 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 ]; then mv $rootimgdir $rootimgdir.regbak -f;fi check:rc==0 - -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -d /install/custom/netboot/rh ]; then mkdir -p /install/custom/netboot/rh; fi; elif cat /etc/*release |grep "Ubuntu" >/dev/null;then if [ ! -d /install/custom/netboot/ubuntu ]; then mkdir -p /install/custom/netboot/ubuntu; fi; fi +cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; +cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/tmp/test.synclist check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -e /install/custom/netboot/rh/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/rh/compute.synclist; fi; elif cat /etc/*release |grep "Ubuntu" >/dev/null;then if [ ! -e /install/custom/netboot/ubuntu/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/ubuntu/compute.synclist;fi; fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/sles/compute.synclist; elif cat /etc/*release |grep "Red Hat" >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/rh/compute.synclist;elif cat /etc/*release |grep "Ubuntu" >/dev/null; then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/ubuntu/compute.synclist;fi -check:rc==0 - cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi cmd:mount |sort > /tmp/mountoutput/file.org cmd:cat /tmp/mountoutput/file.org @@ -73,4 +68,9 @@ check:output=~64 bytes from $$CN 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:xdsh $$CN "cat /var/log/xcat/xcat.log" +cmd:xdsh $$CN "cat /tmp/test.synclist" +check:rc==0 +cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi +cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=" " +check:rc==0 end 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 187640357..4a083478a 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -29,12 +29,8 @@ 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 ]; then mv $rootimgdir $rootimgdir.regbak;fi check:rc==0 - -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -d /install/custom/netboot/rh ]; then mkdir -p /install/custom/netboot/rh; fi;fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -e /install/custom/netboot/rh/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/rh/compute.synclist; fi;fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/sles/compute.synclist; elif cat /etc/*release |grep "Red Hat" >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/install/custom/netboot/rh/compute.synclist;fi +cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; +cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/tmp/test.synclist check:rc==0 cmd:updatenode $$CN -f check:rc==0 @@ -66,4 +62,9 @@ check:output=~on / type tmpfs cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" 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:xdsh $$CN "cat /tmp/test.synclist" +check:rc==0 +cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi +cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=" " +check:rc==0 end From cf64f8854d51db965b52d86d061d280be275568d Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 12 Apr 2017 04:56:52 -0400 Subject: [PATCH 009/162] add test cases for encrypted password, for bug #2827 --- xCAT-test/autotest/testcase/passwd/case0 | 304 +++++++++++++++++++++++ 1 file changed, 304 insertions(+) create mode 100644 xCAT-test/autotest/testcase/passwd/case0 diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 new file mode 100644 index 000000000..bad868dc3 --- /dev/null +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -0,0 +1,304 @@ +start:encrypted_passwd_md5_diskfull +description: this case is to test when cryptmethod=md5 in passwd table, the password is encryped with the md5 method. When compute node is diskfull provisioned, users can login node with correct password. This case should be run when node is correctly defined. +cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +check:rc==0 +cmd:chtab key=system passwd.cryptmethod=md5 +check:rc==0 +cmd:tabdump passwd |grep -i md5 +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:grep '\$1\$' /install/autoinst/$$CN +check:rc==0 +cmd:oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.cryptmethod=$oldcryptmethod +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rm -rf /tmp/tmpcryptmethod +end + +start:encrypted_passwd_md5_diskless +description: this case is to test when cryptmethod=md5 in passwd table, the password is encryped with the md5 method. When compute node is diskless provisioned, users can login node with correct password. This case should be run when node is correctly defined. +cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +check:rc==0 +cmd:chtab key=system passwd.cryptmethod=md5 +check:rc==0 +cmd:tabdump passwd |grep -i md5 +check:rc==0 +#config CN to do diskless provision +cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done +check:rc==0 +cmd:copycds $$ISO +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 ]; then mv $rootimgdir $rootimgdir.regbak -f;fi +check:rc==0 +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:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:scp $$CN:/etc/shadow /tmp +check:rc==0 +cmd:grep 'root:\$1\$' /tmp/shadow +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:oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.cryptmethod=$oldcryptmethod +check:rc==0 +cmd:rm -rf /tmp/tmpcryptmethod /tmp/shadow +end + +start:encrypted_passwd_sha256_diskfull +description: this case is to test when cryptmethod=sha256 in passwd table, the password is encryped with the sha256 method. When compute node is diskfull provisioned, users can login node with correct password. This case should be run when node is correctly defined. +cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +check:rc==0 +cmd:chtab key=system passwd.cryptmethod=sha256 +check:rc==0 +cmd:tabdump passwd |grep -i sha256 +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:grep '\$5\$' /install/autoinst/$$CN +check:rc==0 +cmd:oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.cryptmethod=$oldcryptmethod +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rm -rf /tmp/tmpcryptmethod +end + +start:encrypted_passwd_sha256_diskless +description: this case is to test when cryptmethod=sha256 in passwd table, the password is encryped with the sha256 method. When compute node is diskless provisioned, users can login node with correct password. This case should be run when node is correctly defined. +cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +check:rc==0 +cmd:chtab key=system passwd.cryptmethod=sha256 +check:rc==0 +cmd:tabdump passwd |grep -i sha256 +check:rc==0 +#config CN to do diskless provision +cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done +check:rc==0 +cmd:copycds $$ISO +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 ]; then mv $rootimgdir $rootimgdir.regbak -f;fi +check:rc==0 +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:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:scp $$CN:/etc/shadow /tmp +check:rc==0 +cmd:grep 'root:\$5\$' /tmp/shadow +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:oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.cryptmethod=$oldcryptmethod +check:rc==0 +cmd:rm -rf /tmp/tmpcryptmethod /tmp/shadow +end + +start:encrypted_passwd_sha512_diskfull +description: this case is to test when cryptmethod=sha512 in passwd table, the password is encryped with the sha512 method. When compute node is diskfull provisioned, users can login node with correct password. This case should be run when node is correctly defined. +cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +check:rc==0 +cmd:chtab key=system passwd.cryptmethod=sha512 +check:rc==0 +cmd:tabdump passwd |grep -i sha512 +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:grep '\$6\$' /install/autoinst/$$CN +check:rc==0 +cmd:oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.cryptmethod=$oldcryptmethod +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rm -rf /tmp/tmpcryptmethod +end + +start:encrypted_passwd_sha512_diskless +description: this case is to test when cryptmethod=sha512 in passwd table, the password is encryped with the sha512 method. When compute node is diskless provisioned, users can login node with correct password. This case should be run when node is correctly defined. +cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +check:rc==0 +cmd:chtab key=system passwd.cryptmethod=sha512 +check:rc==0 +cmd:tabdump passwd |grep -i sha512 +check:rc==0 +#config CN to do diskless provision +cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done +check:rc==0 +cmd:copycds $$ISO +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 ]; then mv $rootimgdir $rootimgdir.regbak -f;fi +check:rc==0 +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:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:scp $$CN:/etc/shadow /tmp +check:rc==0 +cmd:grep 'root:\$6\$' /tmp/shadow +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:oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.cryptmethod=$oldcryptmethod +check:rc==0 +cmd:rm -rf /tmp/tmpcryptmethod /tmp/shadow +end + + +start:encrypted_passwd_openssl_diskfull +description: this case is to test when password is encrypted with openssl, the password is encryped in password table. When compute node is diskfull provisioned, users can login node with correct password. This case should be run when node is correctly defined. +cmd:tabdump passwd |grep -i system > /tmp/tmpcryptmethod +check:rc==0 +cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` +check:rc==0 +cmd:tabdump passwd |grep '\$1\$' +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:grep '\$1\$' /install/autoinst/$$CN +check:rc==0 +cmd:oldpassword=`cat /tmp/tmpcryptmethod |awk -F , '{print $3}' |sed 's/\"//g'`;oldcryptmethod=`cat /tmp/tmpcryptmethod |awk -F , '{print $4}' |sed 's/\"//g'`;chtab key=system passwd.password=$oldpassword passwd.cryptmethod=$oldcryptmethod +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:rm -rf /tmp/tmpcryptmethod +end + +start:encrypted_passwd_openssl_diskless +description: this case is to test when password is encrypted with openssl, the password is encryped in password table. When compute node is diskless provisioned, users can login node with correct password. This case should be run when node is correctly defined. +cmd:tabdump passwd |grep -i system > /tmp/tmpcryptmethod +check:rc==0 +cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` +check:rc==0 +cmd:tabdump passwd |grep '\$1\$' +check:rc==0 +#config CN to do diskless provision +cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done +check:rc==0 +cmd:copycds $$ISO +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 ]; then mv $rootimgdir $rootimgdir.regbak -f;fi +check:rc==0 +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:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:scp $$CN:/etc/shadow /tmp +check:rc==0 +cmd:grep 'root:\$1\$' /tmp/shadow +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:oldpassword=`cat /tmp/tmpcryptmethod |awk -F , '{print $3}' |sed 's/\"//g'`;oldcryptmethod=`cat /tmp/tmpcryptmethod |awk -F , '{print $4}' |sed 's/\"//g'`;chtab key=system passwd.password=$oldpassword passwd.cryptmethod=$oldcryptmethod +check:rc==0 +cmd:rm -rf /tmp/tmpcryptmethod /tmp/shadow +end From ffd203eeaf85abd291984867b0deb7727b3d655f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 12 Apr 2017 14:03:18 -0400 Subject: [PATCH 010/162] Add --retry option to rflash command --- xCAT-server/lib/xcat/plugins/ipmi.pm | 92 +++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index ed0bc59ab..dbf87b666 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1766,6 +1766,7 @@ sub do_firmware_update { my $ret; my $ipmitool_ver; my $verbose = 0; + my $retry = 2; my $verbose_opt; $ret = get_ipmitool_version(\$ipmitool_ver); exit $ret if $ret < 0; @@ -1834,8 +1835,6 @@ sub do_firmware_update { if ($bmc_password) { $pre_cmd = $pre_cmd . " -P $bmc_password"; } - xCAT::SvrUtils::sendmsg("rflash started, please wait.......", - $callback, $sessdata->{node}, %allerrornodes); # check for 8335-GTB Model Type to adjust buffer size my $buffer_size = "30000"; @@ -1849,7 +1848,7 @@ sub do_firmware_update { $buffer_size = "15000"; } - # check verbose and buffersize options + # check verbose, buffersize, and retry options for my $opt (@{$sessdata->{'extraargs'}}) { if ($opt =~ /-V{1,4}/) { $verbose_opt = lc($opt); @@ -1862,8 +1861,18 @@ sub do_firmware_update { $buffer_size = $buffer_value; } } + if ($opt =~ /retry=/) { + my ($attribute, $retry_value) = split(/=/, $opt); + if ($retry_value) { + # retry option was passed in, reset the default + $retry = $retry_value; + } + } } + xCAT::SvrUtils::sendmsg("rflash started, individual node upgrade failure will be retried upto $retry times. Please wait.......", + $callback, $sessdata->{node}, %allerrornodes); + # check for 8335-GTB Firmware above 1610A release. If below, exit if ($output =~ /8335-GTB/) { $cmd = $pre_cmd . " fru print 47"; @@ -1883,6 +1892,9 @@ sub do_firmware_update { } } +RETRY_UPGRADE: + my $failed_upgrade = 0; + # step 1 power off $cmd = $pre_cmd . " chassis power off"; xCAT::SvrUtils::sendmsg("Preparing to upgrade firmware, powering chassis off...", $callback, $sessdata->{node}, %allerrornodes); @@ -1925,9 +1937,21 @@ sub do_firmware_update { $callback, $sessdata->{node}); $output = xCAT::Utils->runcmd($cmd, -1); + # if upgrade command failed and we exausted number of retries + # report an error, exit to the caller and leave node in powered off state + # otherwise report an error, power on the node and try upgrade again if ($::RUNCMD_RC != 0) { - $exit_with_error_func->($sessdata->{node}, $callback, - "Running ipmitool command $cmd failed: $output"); + if ($retry == 0) { + # No more retries left, report and error and exit + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); + } + else { + # Error upgrading, set a flag to attempt a retry + xCAT::SvrUtils::sendmsg("Running ipmitool command $cmd failed: $output", $callback, $sessdata->{node}, %allerrornodes); + $failed_upgrade = 1; + + } } # step 5 power on @@ -1937,15 +1961,65 @@ sub do_firmware_update { "Timeout to check the bmc status"); } - xCAT::SvrUtils::sendmsg("Firmware updated, powering chassis on to populate FRU information...", $callback, $sessdata->{node}, %allerrornodes); + if ($failed_upgrade) { + xCAT::SvrUtils::sendmsg("Firmware update failed, powering chassis on for a retry. This can take several minutes. $retry retries left ...", $callback, $sessdata->{node}, %allerrornodes); + } + else { + xCAT::SvrUtils::sendmsg("Firmware updated, powering chassis on to populate FRU information...", $callback, $sessdata->{node}, %allerrornodes); + } + $cmd = $pre_cmd . " chassis power on"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { $exit_with_error_func->($sessdata->{node}, $callback, "Running ipmitool command $cmd failed: $output"); } - $exit_with_success_func->($sessdata->{node}, $callback, - "Success updating firmware."); + + my $node_ready_for_retry = 0; + if ($failed_upgrade) { + # Update has failed in step 4. Wait for node to reboot and try again + if ($verbose) { + xCAT::SvrUtils::sendmsg("Sleeping for a few min waiting for node to power on before attempting a retry", $callback, $sessdata->{node}, %allerrornodes); + } + sleep(300); # sleep for 5 min for node to reboot + # Start testing every 10 sec for node to be booted. Give up after 5 min. + foreach (1..30) { + # Test node is booted in to OS + $cmd = "nodestat $sessdata->{node} | grep sshd"; + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC == 0) { + # Node is ready to retry an upgrage + if ($verbose) { + xCAT::SvrUtils::sendmsg("Detected node booted. Will retry upgrade", $callback, $sessdata->{node}, %allerrornodes); + } + $node_ready_for_retry = 1; + last; + } + else { + # Still not booted, wait for 10 sec and try again + if ($verbose) { + xCAT::SvrUtils::sendmsg("Node still not ready, Test again in 10 sec.", $callback, $sessdata->{node}, %allerrornodes); + } + sleep(10); + } + } + if ($node_ready_for_retry) { + $retry--; # decrement number of retries left + # Yes, it is a goto statement here. Ugly, but removes the need to restructure + # the above block of code. + goto RETRY_UPGRADE; + } + else { + # After 10 min of waiting node has not rebooted. Give up retrying. + $exit_with_error_func->($sessdata->{node}, $callback, + "Giving up waiting for the node to reboot. No firther upgrade retries will be attempted."); + } + + } + else { + $exit_with_success_func->($sessdata->{node}, $callback, + "Success updating firmware."); + } } sub rflash { @@ -1958,7 +2032,7 @@ sub rflash { if ($opt =~ /^(-c|--check)$/i) { $sessdata->{subcommand} = "check"; # support verbose options for ipmitool command - } elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$/ && $opt !~ /^--buffersize=/) { + } elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$/ && $opt !~ /^--buffersize=/ && $opt !~ /^--retry=/) { $callback->({ error => "The option $opt is not supported", errorcode => 1 }); return; From 5ac200a363445fc2e9745b6e81dbb5c8751cd743 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 12 Apr 2017 14:44:20 -0400 Subject: [PATCH 011/162] Add --retry flag to rflash man page --- .../guides/admin-guides/references/man1/rflash.1.rst | 8 +++++++- xCAT-client/pods/man1/rflash.1.pod | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rflash.1.rst b/docs/source/guides/admin-guides/references/man1/rflash.1.rst index 0945ec619..47b35ae06 100644 --- a/docs/source/guides/admin-guides/references/man1/rflash.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rflash.1.rst @@ -50,7 +50,7 @@ OpenPOWER BMC specific: ======================= -\ **rflash**\ \ *noderange*\ \ *hpm_file_path*\ [\ **-c | -**\ **-check**\ ] [\ **-V**\ ] +\ **rflash**\ \ *noderange*\ \ *hpm_file_path*\ [\ **-c | -**\ **-check**\ ] [\ **-**\ **-retry=**\ \ *count*\ ] [\ **-V**\ ] @@ -174,6 +174,12 @@ The command will update firmware for OpenPOWER BMC when given an OpenPOWER node +\ **-**\ **-retry=**\ \ *count*\ + + Specify number of times to retry the update if failure is detected. Default value is 2. Value of 0 can be used to indicate no retries. + + + \ **-v|-**\ **-version**\ Displays the command's version. diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index 2a02fc315..de1f11e60 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -24,7 +24,7 @@ B I I =head2 OpenPOWER BMC specific: -B I I [B<-c>|B<--check>] [B<-V>] +B I I [B<-c>|B<--check>] [B<--retry=>I] [B<-V>] =head1 B @@ -114,6 +114,10 @@ Used to commit the flash image in the temporary side of the chip to the permanen Used to recover the flash image in the permanent side of the chip to the temporary side for both managed systems and power subsystems. +=item B<--retry=>I + +Specify number of times to retry the update if failure is detected. Default value is 2. Value of 0 can be used to indicate no retries. + =item B<-v|--version> Displays the command's version. From 998a9e82e2453783c0fee96e5f6bb998533620a8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 12 Apr 2017 15:16:47 -0400 Subject: [PATCH 012/162] Message fixes suggested in review comments --- xCAT-server/lib/xcat/plugins/ipmi.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index dbf87b666..16fa35f48 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1870,7 +1870,7 @@ sub do_firmware_update { } } - xCAT::SvrUtils::sendmsg("rflash started, individual node upgrade failure will be retried upto $retry times. Please wait.......", + xCAT::SvrUtils::sendmsg("rflash started, upgrade failure will be retried up to $retry times. Please wait...", $callback, $sessdata->{node}, %allerrornodes); # check for 8335-GTB Firmware above 1610A release. If below, exit @@ -2012,7 +2012,7 @@ RETRY_UPGRADE: else { # After 10 min of waiting node has not rebooted. Give up retrying. $exit_with_error_func->($sessdata->{node}, $callback, - "Giving up waiting for the node to reboot. No firther upgrade retries will be attempted."); + "Giving up waiting for the node to reboot. No further retries will be attempted."); } } From 21a9d1499c15a4478aa2b8b96e79302df452a255 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 12 Apr 2017 21:41:41 -0400 Subject: [PATCH 013/162] Add timestamp for every cmd log in xcatteat log --- xCAT-test/xcattest | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 541fad827..adb91d428 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -907,7 +907,8 @@ sub runcase #by my $runstart = timelocal(localtime()); - log_this("\nRUN:$cmd"); + my $runstartstr = scalar(localtime()); + log_this("\nRUN:$cmd [$runstartstr]"); push(@record, "\nRUN:$cmd"); @output = &runcmd($cmd); $rc = $::RUNCMD_RC; From a761e64c0caf8991cff5a96b734193252fbb5dbd Mon Sep 17 00:00:00 2001 From: yangsong Date: Wed, 12 Apr 2017 22:31:54 -0500 Subject: [PATCH 014/162] fix issue #2856: [DEV] nodes provisioned with redhat osimages created by xCAT 2.12.3 or earlier missed yum repo to MN in xCAT 2.12.4 or later (#2857) * fix issue [DEV] nodes provisioned with redhat osimages created by xCAT 2.12.3 or earlier missed yum repo to MN in xCAT 2.12.4 or later #2856 * fix issue [DEV] nodes provisioned with redhat osimages created by xCAT 2.12.3 or earlier missed yum repo to MN in xCAT 2.12.4 or later #2856 --- perl-xCAT/xCAT/Yum.pm | 8 ++++++-- xCAT-server/lib/perl/xCAT/Template.pm | 5 +++-- xCAT-server/lib/xcat/plugins/anaconda.pm | 9 +++++++++ xCAT-server/share/xcat/install/scripts/post.xcat | 6 +++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/perl-xCAT/xCAT/Yum.pm b/perl-xCAT/xCAT/Yum.pm index b8eeb8c02..71faef8c9 100644 --- a/perl-xCAT/xCAT/Yum.pm +++ b/perl-xCAT/xCAT/Yum.pm @@ -9,12 +9,16 @@ my $distname; my $arch; my $installpfx; +my $distrepopfx="/install/postscripts/repos"; + sub localize_yumrepo { my $self = shift; my $pkgdir = shift; $distname=shift; $arch=shift; - open($yumrepofile, ">", "$pkgdir/local-repository.tmpl"); + + mkpath("$distrepopfx/$pkgdir"); + open($yumrepofile, ">", "$distrepopfx/$pkgdir/local-repository.tmpl"); my %options = ( wanted => \&check_tofix, follow_fast => 1 @@ -27,7 +31,7 @@ sub localize_yumrepo { sub remove_yumrepo { my $self = shift; my $pkgdir = shift; - rmtree("$pkgdir/local-repository.tmpl"); + rmtree("$distrepopfx/$pkgdir/local-repository.tmpl"); } sub check_tofix { diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 06dc55b2b..d1415fa3a 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -303,11 +303,12 @@ sub subvars { $source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos"; $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9 } - if( -f "$pkgdir/local-repository.tmpl"){ + my $distrepofile="/install/postscripts/repos/$pkgdir/local-repository.tmpl"; + if( -f "$distrepofile"){ my $repofd; my $repo_in_post; local $/=undef; - open($repofd,"<","$pkgdir/local-repository.tmpl"); + open($repofd,"<","$distrepofile"); $repo_in_post = <$repofd>; close($repofd); $repo_in_post =~ s#baseurl=#baseurl=http://$master/#g; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 237a4e8b7..05bec81e5 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -1260,6 +1260,15 @@ sub mkinstall } } + unless(-f "/install/postscripts/repos/$pkgdir/local-repository.tmpl"){ + #fix issue #2856@github + #for the osimages created by <=xCAT 2.12.3 + #there is no local-repository.tmpl under pkgdir created on copycds + #generate local-repository.tmpl here if it does not exist + require xCAT::Yum; + xCAT::Yum->localize_yumrepo($pkgdir, $os, $arch); + } + my @missingparms; unless ($os) { if ($imagename) { push @missingparms, "osimage.osvers"; } diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 48024de9c..ba66f082b 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -410,9 +410,9 @@ export ARCH=#TABLE:nodetype:THISNODE:arch# export CONSOLEPORT=#TABLEBLANKOKAY:nodehm:THISNODE:serialport# #for redhat: -##place-holder for the code to save the repo info on compute node,pointing to the "pkgdir" of the osimage -##so that the provisioned node -##WRITEREPO# +#place-holder for the code to save the repo info on compute node,pointing to the "pkgdir" of the osimage +#so that the provisioned node has the repo pointed to the distro path on MN +#WRITEREPO# if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "info" "running mypostscript" "/var/log/xcat/xcat.log" From 991ae3e1531d6f389dcc26406fde36d131fb8382 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 13 Apr 2017 01:11:07 -0400 Subject: [PATCH 015/162] fix issue [DEV] nodes provisioned with redhat osimages created by xCAT 2.12.3 or earlier missed yum repo to MN in xCAT 2.12.4 or later #2856: process the multiple dirs in pkgdir --- perl-xCAT/xCAT/Yum.pm | 3 ++- xCAT-server/lib/xcat/plugins/anaconda.pm | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/Yum.pm b/perl-xCAT/xCAT/Yum.pm index 71faef8c9..368992a78 100644 --- a/perl-xCAT/xCAT/Yum.pm +++ b/perl-xCAT/xCAT/Yum.pm @@ -54,8 +54,9 @@ sub generate_repo my $dirlocation = shift; my @dircomps = File::Spec->splitdir($dirlocation); pop(@dircomps); + my $reponame = join("-",@dircomps); my $yumurl = File::Spec->catdir(@dircomps); - my $reponame = $dircomps[$#dircomps]; + print $yumrepofile "[local-$distname-$arch-$reponame]\n"; print $yumrepofile "name=xCAT configured yum repository for $yumurl\n"; print $yumrepofile "baseurl=$yumurl\n"; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 05bec81e5..0222362ba 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -16,6 +16,7 @@ use xCAT::TableUtils; use xCAT::NetworkUtils; use xCAT::MsgUtils; use xCAT::SvrUtils; +use xCAT::Yum; #use Data::Dumper; use Getopt::Long; @@ -1260,13 +1261,15 @@ sub mkinstall } } - unless(-f "/install/postscripts/repos/$pkgdir/local-repository.tmpl"){ - #fix issue #2856@github - #for the osimages created by <=xCAT 2.12.3 - #there is no local-repository.tmpl under pkgdir created on copycds - #generate local-repository.tmpl here if it does not exist - require xCAT::Yum; - xCAT::Yum->localize_yumrepo($pkgdir, $os, $arch); + my @pkgdirs=split(/,/,$pkgdir); + foreach my $mypkgdir (@pkgdirs){ + unless(-f "/install/postscripts/repos/$mypkgdir/local-repository.tmpl"){ + #fix issue #2856@github + #for the osimages created by <=xCAT 2.12.3 + #there is no local-repository.tmpl under pkgdir created on copycds + #generate local-repository.tmpl here if it does not exist + xCAT::Yum->localize_yumrepo($mypkgdir, $os, $arch); + } } my @missingparms; @@ -2471,8 +2474,6 @@ sub copycd } } - - require xCAT::Yum; xCAT::Yum->localize_yumrepo($path, $distname, $arch); if ($rc != 0) From 61f1fd37f97192b80a6e648b7c4ebdc209403822 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 13 Apr 2017 01:36:43 -0400 Subject: [PATCH 016/162] fix issue 2710, print usage when run renergy node without option --- xCAT-server/lib/xcat/plugins/energy.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/energy.pm b/xCAT-server/lib/xcat/plugins/energy.pm index 916cf0263..e889d33ea 100644 --- a/xCAT-server/lib/xcat/plugins/energy.pm +++ b/xCAT-server/lib/xcat/plugins/energy.pm @@ -151,6 +151,8 @@ sub parse_args { if ($::VERBOSE) { $opt->{verbose} = 1; } + } else { + return (1, &usage()); } # if the request has node range From 0396a5097fe337b93ab98eb3df068898df54a5de Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 13 Apr 2017 03:26:02 -0400 Subject: [PATCH 017/162] add case for bug #2572, test case bug is #2826 --- xCAT-test/autotest/testcase/makedns/cases0 | 46 ++++++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/makedns/cases0 b/xCAT-test/autotest/testcase/makedns/cases0 index af2aa5f49..9e7549f03 100644 --- a/xCAT-test/autotest/testcase/makedns/cases0 +++ b/xCAT-test/autotest/testcase/makedns/cases0 @@ -1219,11 +1219,41 @@ cmd:chtab -d netname=testnetwork networks check:rc==0 end - - - - - - - - +start:makedns_n_noderange +description:to verify makedns -n noderange works as design. add case for bug #2572. Test case bug number is #2826. +cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254 +check:rc==0 +cmd:chdef -t node -o dnstestnode[1-10] groups=dnsnode ip="|dnstestnode(\d+)|100.100.100.(\$1+0)|" +check:rc==0 +cmd:cp /etc/hosts /etc/hosts.testbak +check:rc==0 +cmd:for i in {1..10}; do echo "100.100.100.$i dnstestnode$i" >> /etc/hosts; done +check:rc==0 +cmd:makedns -n dnstestnode[1-10] +check:rc==0 +cmd:nslookup dnstestnode5 $$MN +check:output~=Server: $$MN +check:output!~(server can't find dnstestnode) +cmd:makedns -d dnstestnode[1-10] +check:rc==0 +cmd:nslookup dnstestnode5 $$MN +check:output~=Server: $$MN +check:output~=(server can't find dnstestnode) +cmd:makedns -n dnsnode +check:rc==0 +cmd:nslookup dnstestnode5 $$MN +check:output~=Server: $$MN +check:output!~(server can't find dnstestnode) +cmd:makedns -d dnsnode +check:rc==0 +cmd:nslookup dnstestnode5 $$MN +check:output~=Server: $$MN +check:output~=(server can't find dnstestnode) +cmd:rmdef -t node dnstestnode[1-10] +check:rc==0 +cmd:chtab -d netname=testnetwork networks +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:cp /etc/hosts.testbak /etc/hosts +end From 9e245025caa692b3cede577df72d9f8a6dc16859 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 13 Apr 2017 16:29:21 +0800 Subject: [PATCH 018/162] [go-xcat] Fix zypper repository querying. Search packages in repository only. --- xCAT-server/share/xcat/tools/go-xcat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 370481f0f..a9d7da03f 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.16 +# Version 1.0.17 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -517,7 +517,7 @@ function check_repo_version_zypper() do name+=("${name}") ver+=("${ver}") - done < <(zypper --no-gpg-checks -n search -s --match-exact "$@" \ + done < <(zypper --no-gpg-checks -n search -u -s --match-exact "$@" \ 2>/dev/null | awk -F ' *\\| *' '/ package / { print $2, $4 }') local -i i while [[ -n "$1" ]] From 4b9f06b641fbf7a4fe55deae00da908caa0c2542 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 13 Apr 2017 05:29:23 -0400 Subject: [PATCH 019/162] update for comments --- xCAT-test/autotest/testcase/makedns/cases0 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/makedns/cases0 b/xCAT-test/autotest/testcase/makedns/cases0 index 9e7549f03..e39a35857 100644 --- a/xCAT-test/autotest/testcase/makedns/cases0 +++ b/xCAT-test/autotest/testcase/makedns/cases0 @@ -1225,7 +1225,7 @@ cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.2 check:rc==0 cmd:chdef -t node -o dnstestnode[1-10] groups=dnsnode ip="|dnstestnode(\d+)|100.100.100.(\$1+0)|" check:rc==0 -cmd:cp /etc/hosts /etc/hosts.testbak +cmd:cp -f /etc/hosts /etc/hosts.testbak check:rc==0 cmd:for i in {1..10}; do echo "100.100.100.$i dnstestnode$i" >> /etc/hosts; done check:rc==0 @@ -1255,5 +1255,5 @@ cmd:chtab -d netname=testnetwork networks check:rc==0 cmd:makedns -n check:rc==0 -cmd:cp /etc/hosts.testbak /etc/hosts +cmd:cp -f /etc/hosts.testbak /etc/hosts end From e64d8d8567c0f800241d0223f9c3a075cbb95abc Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 13 Apr 2017 08:55:28 -0400 Subject: [PATCH 020/162] Change to using the long commit ID instead of short commit ID to help automation testing scripts calculate more information. Sync'ed up the code between LINUX and UBUNTU builds so the variables are more similar --- build-ubunturepo | 16 ++++++++-------- buildcore.sh | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 49e46cf63..70f4bda55 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -177,7 +177,7 @@ then short_short_ver=`cat Version|cut -d. -f 1` build_time=`date` build_machine=`hostname` - commit_id=`git rev-parse --short HEAD` + commit_id=`git rev-parse HEAD` package_dir_name=debs$REL #TODO: define the core path and tarball name @@ -362,14 +362,14 @@ __EOF__ chmod 775 mklocalrepo.sh # - # Add a buildinfo file under xcat-core to track information about the build + # Add a buildinfo file into the tar.bz2 file to track information about the build # - buildinfo=$local_core_repo_path/buildinfo - echo "VERSION=$ver" > $buildinfo - echo "RELEASE=$xcat_release" >> $buildinfo - echo "BUILD_TIME=$build_time" >> $buildinfo - echo "BUILD_MACHINE=$build_machine" >> $buildinfo - echo "COMMIT_ID=$commit_id" >> $buildinfo + BUILDINFO=$local_core_repo_path/buildinfo + echo "VERSION=$ver" > $BUILDINFO + echo "RELEASE=$xcat_release" >> $BUILDINFO + echo "BUILD_TIME=$build_time" >> $BUILDINFO + echo "BUILD_MACHINE=$build_machine" >> $BUILDINFO + echo "COMMIT_ID=$commit_id" >> $BUILDINFO #create the xcat-core.list file diff --git a/buildcore.sh b/buildcore.sh index 77b44068b..8686203c3 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -188,7 +188,7 @@ function setversionvars { SHORTSHORTVER=`echo $VER|cut -d. -f 1` BUILD_TIME=`date` BUILD_MACHINE=`hostname` - COMMIT_ID=`git rev-parse --short HEAD` + COMMIT_ID=`git rev-parse HEAD` XCAT_RELEASE="snap$(date '+%Y%m%d%H%M')" echo "$XCAT_RELEASE" >Release } @@ -541,7 +541,7 @@ else fi # -# Add a VERSION file into the tar.bz2 file to track information about the build +# Add a buildinfo file into the tar.bz2 file to track information about the build # BUILDINFO=$XCATCORE/buildinfo echo "VERSION=$VER" > $BUILDINFO From a154d39e437b891a3eb147314f38750583817c6d Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 14 Apr 2017 05:38:49 -0400 Subject: [PATCH 021/162] modify installation testcases for issue:2834 --- .../testcase/installation/SN_setup_case | 11 ++++++++- .../reg_linux_diskfull_installation_flat | 11 ++++++++- .../reg_linux_diskfull_installation_hierarchy | 12 +++++++++- .../reg_linux_diskless_installation_flat | 12 ++++++++-- .../reg_linux_diskless_installation_hierarchy | 11 ++++++++- .../reg_linux_statelite_installation_flat | 24 +++++++++++++++++++ ...ux_statelite_installation_hierarchy_by_nfs | 17 +++++++++++++ ...tatelite_installation_hierarchy_by_ramdisk | 19 +++++++++++++-- 8 files changed, 109 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 9ccde6576..862fb291c 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -1,5 +1,13 @@ start:SN_setup_case os:Linux +cmd:df +check:rc==0 +cmd:fdisk -l +check:rc==0 +cmd:cat /proc/meminfo +check:rc==0 +cmd:cat /proc/cpuinfo +check:rc==0 cmd:XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ check:rc==0 @@ -22,7 +30,8 @@ cmd:makedhcp -a check:rc==0 cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi check:output=~$$SN - +cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +check:rc==0 cmd:chdef -t node $$SN groups=service,all check:rc==0 cmd:chdef -t group -o service profile=service primarynic=mac installnic=mac 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 2d3b96197..4dbf7365b 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -1,6 +1,13 @@ start:reg_linux_diskfull_installation_flat os:Linux - +cmd:df +check:rc==0 +cmd:fdisk -l +check:rc==0 +cmd:cat /proc/meminfo +check:rc==0 +cmd:cat /proc/cpuinfo +check:rc==0 cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:MINIISO=NUll;if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]];then mkdir /tmp/iso; mount -o loop $$MINIISO /tmp/iso ; mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot; cp /tmp/iso/install/initrd.gz /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot;umount /tmp/iso; rmdir /tmp/iso; fi check:rc==0 @@ -29,6 +36,8 @@ check:rc==0 cmd:sleep 10 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 +cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +check:rc==0 cmd:copycds $$ISO check:rc==0 cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; 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 2501064c1..ac832a2df 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -1,6 +1,13 @@ start:reg_linux_diskfull_installation_hierarchy os:Linux - +cmd:df +check:rc==0 +cmd:fdisk -l +check:rc==0 +cmd:cat /proc/meminfo +check:rc==0 +cmd:cat /proc/cpuinfo +check:rc==0 cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 cmd:chdef -t node $$SN groups=service,all @@ -24,6 +31,9 @@ cmd:makedhcp -a check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 +cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +check:rc==0 + cmd:copycds $$ISO check:rc==0 cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; 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 af959e324..bc260728d 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -1,6 +1,13 @@ start:reg_linux_diskless_installation_flat os:Linux - +cmd:df +check:rc==0 +cmd:fdisk -l +check:rc==0 +cmd:cat /proc/meminfo +check:rc==0 +cmd:cat /proc/cpuinfo +check:rc==0 cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -19,7 +26,8 @@ cmd:makedhcp -a check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 - +cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +check:rc==0 cmd:copycds $$ISO 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 4a083478a..d506e8bf8 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -1,6 +1,13 @@ start:reg_linux_diskless_installation_hierarchy os:Linux - +cmd:df +check:rc==0 +cmd:fdisk -l +check:rc==0 +cmd:cat /proc/meminfo +check:rc==0 +cmd:cat /proc/cpuinfo +check:rc==0 cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 cmd:chdef -t node $$SN groups=service,all @@ -23,6 +30,8 @@ cmd:service dhcpd restart check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 +cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +check:rc==0 cmd:copycds $$ISO 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 fe31a9c33..7738a7ec3 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -1,5 +1,13 @@ start:reg_linux_statelite_installation_flat os:Linux +cmd:df +check:rc==0 +cmd:fdisk -l +check:rc==0 +cmd:cat /proc/meminfo +check:rc==0 +cmd:cat /proc/cpuinfo +check:rc==0 cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -15,6 +23,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 +cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +check:rc==0 cmd:copycds $$ISO check:rc==0 @@ -79,6 +89,13 @@ check:rc==0 check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~compute/rootimg on / type nfs cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" +cmd:xdsh $$CN "echo "test"> /test.statelite" +check:rc==0 +cmd:xdsh $$CN cat /test.statelite +check:rc==0 +check:output=~test +cmd:xdsh $$CN rm -rf /test.statelite +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 ]; then rm -rf $rootimgdir;fi check:rc==0 @@ -115,6 +132,13 @@ cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" +cmd:xdsh $$CN "echo "test"> /test.statelite" +check:rc==0 +cmd:xdsh $$CN cat /test.statelite +check:rc==0 +check:output=~test +cmd:xdsh $$CN rm -rf /test.statelite +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 64098d579..a40c9d7e6 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 @@ -1,5 +1,13 @@ start:reg_linux_statelite_installation_hierarchy_by_nfs os:Linux +cmd:df +check:rc==0 +cmd:fdisk -l +check:rc==0 +cmd:cat /proc/meminfo +check:rc==0 +cmd:cat /proc/cpuinfo +check:rc==0 cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 @@ -17,6 +25,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 +cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +check:rc==0 cmd:copycds $$ISO check:rc==0 @@ -87,6 +97,13 @@ check:rc==0 check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~compute/rootimg on / type nfs cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" +cmd:xdsh $$CN "echo "test"> /test.statelite" +check:rc==0 +cmd:xdsh $$CN cat /test.statelite +check:rc==0 +check:output=~test +cmd:xdsh $$CN rm -rf /test.statelite +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 ]; then rm -rf $rootimgdir;fi check:rc==0 end 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 ab4d5d101..4cce48c31 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 @@ -1,6 +1,13 @@ start:reg_linux_statelite_installation_hierarchy_by_ramdisk os:Linux - +cmd:df +check:rc==0 +cmd:fdisk -l +check:rc==0 +cmd:cat /proc/meminfo +check:rc==0 +cmd:cat /proc/cpuinfo +check:rc==0 cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 cmd:chdef -t node $$SN groups=service,all @@ -17,7 +24,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 - +cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +check:rc==0 cmd:copycds $$ISO check:rc==0 cmd:xdsh $$SN df|grep /install;if [ $? -eq 0 ] ;then xdsh $$SN umount /install;fi @@ -90,6 +98,13 @@ check:rc==0 check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~rootfs on / type cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" +cmd:xdsh $$CN "echo "test"> /test.statelite" +check:rc==0 +cmd:xdsh $$CN cat /test.statelite +check:rc==0 +check:output=~test +cmd:xdsh $$CN rm -rf /test.statelite +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 05f40199bc508ecf33ae67b6a518325342e6689e Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 14 Apr 2017 13:19:15 -0400 Subject: [PATCH 022/162] Update README.rst --- README.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index d7f1ae9f6..2cb961dfd 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ Documentation xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/ -|docs_latest| |docs_2132| |docs_2131| |docs_2130| |docs_212| |docs_211| +|docs_latest| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212| |docs_211| Open Source License ------------------- @@ -22,6 +22,11 @@ Developers Developers and prospective contributors are encouraged to read the `Developers Guide `_ In particular the `GitHub `_ related subsection. +.. |docs_2133| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.3 + :alt: 2.13.3 documentation status + :scale: 100% + :target: http://xcat-docs.readthedocs.io/en/2.13.3/ + .. |docs_2132| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.2 :alt: 2.13.2 documentation status :scale: 100% From 5e886321720f7a93f6efb1b70ba3f3b6e374e885 Mon Sep 17 00:00:00 2001 From: khm Date: Fri, 14 Apr 2017 15:11:32 -0700 Subject: [PATCH 023/162] xCAT-server: fix S7200AP ipmi detection --- xCAT-server/share/xcat/cons/ipmi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/cons/ipmi b/xCAT-server/share/xcat/cons/ipmi index 6dc4a4ed0..fd4546c3c 100755 --- a/xCAT-server/share/xcat/cons/ipmi +++ b/xCAT-server/share/xcat/cons/ipmi @@ -124,7 +124,7 @@ my $iface = "lanplus"; if (grep /IPMI Version : 1.5/, @mcinfo) { $solcom = "isol"; $iface = "lan"; -} elsif (grep /Manufacturer ID : 343/, @mcinfo) { +} elsif (grep /Manufacturer ID : 343/, @mcinfo && ! grep /Product ID : 117/,@mcinfo) { $isintel = 1; } my $inteloption = ""; From 2e4e1d0acb303f45ead39d10d8c29fe35cdc5ae3 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Sun, 16 Apr 2017 06:00:17 -0400 Subject: [PATCH 024/162] The bundle file of basic cases which are related xcatd, DB and so on --- xCAT-test/autotest/bundle/basic_cases.bundle | 231 +++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 xCAT-test/autotest/bundle/basic_cases.bundle diff --git a/xCAT-test/autotest/bundle/basic_cases.bundle b/xCAT-test/autotest/bundle/basic_cases.bundle new file mode 100644 index 000000000..3f792cfef --- /dev/null +++ b/xCAT-test/autotest/bundle/basic_cases.bundle @@ -0,0 +1,231 @@ +assign_certain_command_permission +chdef_dynamic_group +chdef_group +chdef_group_p +chdef_m +chdef_multiple_keys +chdef_n +chdef_null +chdef_p +chdef_t_network +chdef_t_node +chdef_t_o_error +chdef_template +chdef_z +check_mkdef_node_with_template_priority +check_mn_cluster_log_file +chtab_d +chtab_err_symble +chtab_err_table +chtab_h +chtab_modify_key +chtab_modify_node +chtab_null +chtab_v +disable_root_permission_in_policy_table +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_a_p_skiptables +dumpxCATdb_h +dumpxCATdb_p_V +dumpxCATdb_p_nullskiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_p_skiptables +dumpxCATdb_v +gettab_H +gettab_err +gettab_h +gettab_key_table +lsdef_a +lsdef_nics +lsdef_null +lsdef_s +lsdef_t +lsdef_t_auditlog +lsdef_t_err +lsdef_t_eventlog +lsdef_t_h_i +lsdef_t_i_o +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t_policy +lsdef_t_site +lsdef_t_w +lsdef_template +lsdef_template_switch_template +lsdef_template_with_invalid_name +lsxcatd_a +lsxcatd_d +lsxcatd_h +lsxcatd_null +makeconservercf_d +makeconservercf_noderange +makeconservercf_null +makedhcp_a_d_linux +makedhcp_a_linux +makedhcp_d_linux +makedhcp_h +makedhcp_help +makedhcp_n +makedhcp_n_linux +makedns +makedns_d_node +makedns_h +makedns_n +makedns_node +makehost_n_r +makehosts_d +makehosts_h +makehosts_help +makehosts_l +makehosts_n +makehosts_n_noderange +makehosts_null +makeknownhosts_h +makenetworks +makenetworks_d +makenetworks_d_V +makenetworks_h +makenetworks_help +makenetworks_v +mkdef_dynamic_group +mkdef_f +mkdef_github_issue2582 +mkdef_group +mkdef_multiple_keys +mkdef_node +mkdef_node_with_a_node_template +mkdef_null +mkdef_t_network +mkdef_t_o_error +mkdef_template_cec_template_step_by_step +mkdef_template_cec_template_without_remainder +mkdef_template_invalid_template +mkdef_template_switch_template_without_attribute +mkdef_z +nodeadd_err_symbol +nodeadd_h +nodeadd_noderange +nodeadd_noderange_nodetype +nodeadd_null +nodeadd_v +nodech_d_error +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_noderanage_table_at +nodech_noderange_shortname_groups +nodech_noderange_shortname_mgt +nodech_noderange_shortname_tags +nodech_noderange_table +nodech_noderange_table_arrow +nodech_noderange_table_comma +nodech_noderange_table_comma_arrow +nodech_noderange_table_equal +nodech_noderange_table_include +nodech_noderange_table_unequal +nodech_noderange_table_uninclude +nodech_v +nodegrpch_err +nodegrpch_groups +nodegrpch_h +nodegrpch_v +nodels_H +nodels_S +nodels_b +nodels_err_noderange +nodels_err_symbol +nodels_h +nodels_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_mgt +nodels_noderange_shortname_tags +nodels_noderange_table +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_noderange_table_uninclude +nodels_noderange_tablecolumn +nodels_null +nodels_table_include +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_v +noderange_10-20 +noderange_XCAT_NODE_PREFIX +noderange_XCAT_NODE_SUFFIX +noderange_dir_tmp-nodelistfile +noderange_exclusion +noderange_f1-f2_n1-n3 +noderange_group1-group3 +noderange_group_intersection +noderange_individual_grp +noderange_individual_node +noderange_node01-node10 +noderange_node01_10 +noderange_node10_plus_3 +noderange_node_01-10 +noderange_slash_urtestnode_dot_star +noderm_err_node +noderm_h +noderm_noderange +noderm_null +nodestat_err_node +restorexCAT_h +restorexCATdb_a_p_V +restorexCATdb_p_V +restorexCATdb_v +restorexCATdb_wrongpath +restorexcatdb_p +rmdef_dynamic_group +rmdef_group +rmdef_node +rmdef_null +rmdef_t_err +rmdef_t_node +rmdef_t_o_network +rmdef_t_o_node +rmdef_template +run_command_with_XCATBYPASS +tabdump_d +tabdump_d_nodehm +tabdump_f_d +tabdump_h +tabdump_help +tabdump_null +tabdump_table +tabdump_v +tabdump_w_equal +tabdump_w_ge +tabdump_w_gt +tabdump_w_le +tabdump_w_lt +tabdump_w_match +tabdump_w_ne +tabdump_w_notmatch +tabgrep_err +tabgrep_h +tabgrep_node +tabgrep_null +tabprune_V_a_eventlog +tabprune_V_n_auditlog +tabprune_a_eventlog +tabprune_h +tabprune_i_auditlog +tabprune_p_auditlog +tabprune_v +tabrestore_err +tabrestore_h +tabrestore_null +tabrestore_table +xcatd_restart +xcatd_start +xcatd_stop +xcatsnap_b_d +xcatsnap_h +xcatsnap_null +xcatsnap_v +xcatstanzafile_attribute +xcatstanzafile_colon +xcatstanzafile_objtype +xcatstanzafile_specificvalue From a0f4ddaf9eb74f57179fe3ddac307a5fa64af345 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 17 Apr 2017 01:15:42 -0400 Subject: [PATCH 025/162] Add timestamp to every cmd for xcattest failedcases log --- xCAT-test/xcattest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index adb91d428..c77ae148e 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -909,7 +909,7 @@ sub runcase my $runstart = timelocal(localtime()); my $runstartstr = scalar(localtime()); log_this("\nRUN:$cmd [$runstartstr]"); - push(@record, "\nRUN:$cmd"); + push(@record, "\nRUN:$cmd [$runstartstr]"); @output = &runcmd($cmd); $rc = $::RUNCMD_RC; From 561206dccf5d37569f8edda695d445c735616647 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 17 Apr 2017 15:00:59 +0800 Subject: [PATCH 026/162] Delete unused file xCAT-test/autotest/testcase/migration/.redhat_migration.swp --- .../testcase/migration/.redhat_migration.swp | Bin 16384 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 xCAT-test/autotest/testcase/migration/.redhat_migration.swp diff --git a/xCAT-test/autotest/testcase/migration/.redhat_migration.swp b/xCAT-test/autotest/testcase/migration/.redhat_migration.swp deleted file mode 100644 index 89bebd163186eb8143ce40adb6f1d997edc02df0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHNO>7)V6|Tf_He}<;5)c9j(90ysCf@Y)j1w8~FoBR*Sxbq7Z0`!O8#y)IH8YL- zPt`qkyo!JmLfk-t8=N@7fdfJauE4H99MG;Y;*`60$+6s4;8u#fYpRk^Z5+ z9G(a}@cNRcUKH9=xC5SUjtUMl$lNy!7zU;=FsI9!t%YlJzJB4{2VR&`#}pX`3GHFkl!k3>XFs1MgJ^;*`y>uZ((kJpa|rug7pzVE@fOdAXNg9bC)z|C5)W%dfvJ z?&tr_#V}wPFbo(53GHFkl!k3>XFs1BQVoz<|rOQo=U=m-+xeW&`&BXa5Ae z4fFs3e4Me`Pk|o*&jX)kZ0<+E*MY|XUh~gE+T0zW4b%agA~^FG;E%xXfG+~8zztvl zK%FzF^Yp&~)O-3W@DboC#!mkW_#W^rKmxGi^amMx->bmSf%gNmjGg*B@CN|0PeJ#o zOTbCSp86~B7VtXo6X4rG0`!5;0gJ#1#!mhN_!aOo;Hv=6Je*tt8jQ`tu36YM3;nau zKZ|1$vzHk=@lW8-z#G78!1n<>ML7ZaCmsMF2F@@x^EUt-&cKG5?*QKb)&bZ#gMQDP zX6*Qzz;A%>0^bBsejMe;z?bsLv0r2^Ir!Td2xn_aI-O3FIf1+M$V~=x@#3vjs_za1 za(ux<3Pj3Xp7ORTvUX`0#YT50E9c=lL!+j~@sF4gR%}BW< z>r0Qedo(g+zJbC<_mzdphU50DgD3AuG4!gomW+eMNG)nad{hW5w98=_dSSmR&=MiHJx7o_Ammb#@^qL?iUEZych+uh ztlVF1ZN9j?wvHcFGW{fzW^EUerjC>(8cJxkMe5kGjC!6g8m{)#VPUy9#<=en!^;a{ zz3-D6U6p!OY(~DTY#hbKlNny)X6WNt?`&|6bw|mWC+pUzmz8XkhWMBi5Ej2y1kIOb$@NS(uV5hx0gR(**Z_Jh5x&+cyV=d3btGic`YszG@isI61GJ0$r&ls z7vt(>_hol!^i?qwRKm}17j3)9>cZ9eKqmpR{A}iUjG-*zddYxU?=;&x0}LfPPY=fwJT8gPerKl84cislb~yC?hi!5rN_+u3TFv(5 z%lx_Lu3Tw*J$i{QaLW?+d7O#(*$WWxJ&ziEf@Do8Yj&_8a zBrtWWTdF$;-I!|hOH^g`p3x85q)C%W$p(T!ZR&Xw-kw5(p5m=3H}c+EdGzCqXMl;P z2)ezzo4H2!Gjl#N?lx8^g9x!W;S4q7z|4#l%rOD)i_R3?@7gFQigz71fufc5`x7K6 zQ+3e5(a6-vlGVbnIf_7X$ksAC4U8M4{@xkPW9-B#6w@6EUdzKdOwnQ!5oz zhCG0)Dya-%^nSKv;$WdZCA7i3T2os)MF>tG=c8PssLGQKJa%+ivz!oYXGxtbtoUN0 zOP7d(tx;h@3(Y&FJh2x`%G*b`>_L%)Qr>lk0b*-MuO&Mj#V$eNrW*Qs&!Rkgp_~{l zs08m!E=qO7+zqO2hl0Yx5PENw!d{X&Jo}sW(zyIzuR8;tq(bTn&XB{IorwB=)a5?KTq4+DE@64@g$O$@Bm`>D>w_|1uqau&tJdO7kL#t$gY+$y z?f>U~i2eN8(*FM(_WRh|p2gnw>|Nlq0QS^1?0aj!2YwCw7{H#j_B8-|;~Mtgwa)<8 z0PNFi&j65Fs~x;^HFpdHh5^HXVZbn87%&VN1`Gp+0mFb{;7Ktc!r}>B@rZbG8@lfy zPw92z5#P0_y*VCgtBZPvH2FZgDA!Lr#-x{CQx)dD%eP8Hq)$ From 191f6a03a0e84dad0d042ef5266416afa1a27c14 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 17 Apr 2017 03:22:23 -0400 Subject: [PATCH 027/162] update for comments --- xCAT-test/autotest/testcase/passwd/case0 | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index bad868dc3..0c41c9b65 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -1,11 +1,9 @@ start:encrypted_passwd_md5_diskfull description: this case is to test when cryptmethod=md5 in passwd table, the password is encryped with the md5 method. When compute node is diskfull provisioned, users can login node with correct password. This case should be run when node is correctly defined. -cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=md5 check:rc==0 -cmd:tabdump passwd |grep -i md5 -check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$1\$' /install/autoinst/$$CN @@ -19,12 +17,10 @@ end start:encrypted_passwd_md5_diskless description: this case is to test when cryptmethod=md5 in passwd table, the password is encryped with the md5 method. When compute node is diskless provisioned, users can login node with correct password. This case should be run when node is correctly defined. -cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=md5 check:rc==0 -cmd:tabdump passwd |grep -i md5 -check:rc==0 #config CN to do diskless provision cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -76,7 +72,7 @@ end start:encrypted_passwd_sha256_diskfull description: this case is to test when cryptmethod=sha256 in passwd table, the password is encryped with the sha256 method. When compute node is diskfull provisioned, users can login node with correct password. This case should be run when node is correctly defined. -cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha256 check:rc==0 @@ -95,12 +91,10 @@ end start:encrypted_passwd_sha256_diskless description: this case is to test when cryptmethod=sha256 in passwd table, the password is encryped with the sha256 method. When compute node is diskless provisioned, users can login node with correct password. This case should be run when node is correctly defined. -cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha256 check:rc==0 -cmd:tabdump passwd |grep -i sha256 -check:rc==0 #config CN to do diskless provision cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -152,12 +146,10 @@ end start:encrypted_passwd_sha512_diskfull description: this case is to test when cryptmethod=sha512 in passwd table, the password is encryped with the sha512 method. When compute node is diskfull provisioned, users can login node with correct password. This case should be run when node is correctly defined. -cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha512 check:rc==0 -cmd:tabdump passwd |grep -i sha512 -check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$6\$' /install/autoinst/$$CN @@ -171,12 +163,10 @@ end start:encrypted_passwd_sha512_diskless description: this case is to test when cryptmethod=sha512 in passwd table, the password is encryped with the sha512 method. When compute node is diskless provisioned, users can login node with correct password. This case should be run when node is correctly defined. -cmd:tabdump passwd |grep -i system| awk -F, '{print $4}' > /tmp/tmpcryptmethod +cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha512 check:rc==0 -cmd:tabdump passwd |grep -i sha512 -check:rc==0 #config CN to do diskless provision cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 From 0000e4edd89e1b8d30bdd6f5c31e6e8a9e66a912 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 17 Apr 2017 03:46:02 -0400 Subject: [PATCH 028/162] update for comments --- xCAT-test/autotest/testcase/passwd/case0 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index 0c41c9b65..74e7c52fc 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -76,8 +76,6 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:chtab key=system passwd.cryptmethod=sha256 check:rc==0 -cmd:tabdump passwd |grep -i sha256 -check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$5\$' /install/autoinst/$$CN @@ -219,30 +217,34 @@ end start:encrypted_passwd_openssl_diskfull description: this case is to test when password is encrypted with openssl, the password is encryped in password table. When compute node is diskfull provisioned, users can login node with correct password. This case should be run when node is correctly defined. -cmd:tabdump passwd |grep -i system > /tmp/tmpcryptmethod +cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod +check:rc==0 +cmd:gettab key=system passwd.password > /tmp/tmppassword check:rc==0 cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` check:rc==0 -cmd:tabdump passwd |grep '\$1\$' +cmd:gettab key=system passwd.password |grep '\$1\$' check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:grep '\$1\$' /install/autoinst/$$CN check:rc==0 -cmd:oldpassword=`cat /tmp/tmpcryptmethod |awk -F , '{print $3}' |sed 's/\"//g'`;oldcryptmethod=`cat /tmp/tmpcryptmethod |awk -F , '{print $4}' |sed 's/\"//g'`;chtab key=system passwd.password=$oldpassword passwd.cryptmethod=$oldcryptmethod +cmd:oldpassword=`cat /tmp/tmppassword |sed 's/\"//g'`;oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.password=$oldpassword passwd.cryptmethod=$oldcryptmethod check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 -cmd:rm -rf /tmp/tmpcryptmethod +cmd:rm -rf /tmp/tmpcryptmethod /tmp/tmppassword end start:encrypted_passwd_openssl_diskless description: this case is to test when password is encrypted with openssl, the password is encryped in password table. When compute node is diskless provisioned, users can login node with correct password. This case should be run when node is correctly defined. -cmd:tabdump passwd |grep -i system > /tmp/tmpcryptmethod +cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod +check:rc==0 +cmd:gettab key=system passwd.password > /tmp/tmppassword check:rc==0 cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` check:rc==0 -cmd:tabdump passwd |grep '\$1\$' +cmd:gettab key=system passwd.password |grep '\$1\$' check:rc==0 #config CN to do diskless provision cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -288,7 +290,7 @@ cmd:grep 'root:\$1\$' /tmp/shadow 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:oldpassword=`cat /tmp/tmpcryptmethod |awk -F , '{print $3}' |sed 's/\"//g'`;oldcryptmethod=`cat /tmp/tmpcryptmethod |awk -F , '{print $4}' |sed 's/\"//g'`;chtab key=system passwd.password=$oldpassword passwd.cryptmethod=$oldcryptmethod +cmd:oldpassword=`cat /tmp/tmppassword |sed 's/\"//g'`;oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.password=$oldpassword passwd.cryptmethod=$oldcryptmethod check:rc==0 -cmd:rm -rf /tmp/tmpcryptmethod /tmp/shadow +cmd:rm -rf /tmp/tmpcryptmethod /tmp/tmppassword /tmp/shadow end From b3749bb85d46979bcace5c38df73920b50743e98 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 17 Apr 2017 15:32:23 -0400 Subject: [PATCH 029/162] Fix docs and usage for clonevm, rflash, and img* commands --- .../references/man1/clonevm.1.rst | 57 ++++++++++++++----- .../references/man1/imgcapture.1.rst | 10 ++-- .../references/man1/imgexport.1.rst | 41 ++++++++++--- .../references/man1/imgimport.1.rst | 35 +++++++++--- perl-xCAT/xCAT/Usage.pm | 8 +-- xCAT-client/pods/man1/clonevm.1.pod | 44 +++++++++----- xCAT-client/pods/man1/imgcapture.1.pod | 10 ++-- xCAT-client/pods/man1/imgexport.1.pod | 31 +++++++--- xCAT-client/pods/man1/imgimport.1.pod | 28 ++++++--- xCAT-server/lib/xcat/plugins/imgcapture.pm | 2 +- 10 files changed, 187 insertions(+), 79 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/clonevm.1.rst b/docs/source/guides/admin-guides/references/man1/clonevm.1.rst index d2b485d8d..f97967bae 100644 --- a/docs/source/guides/admin-guides/references/man1/clonevm.1.rst +++ b/docs/source/guides/admin-guides/references/man1/clonevm.1.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **clonevm**\ \ *noderange*\ [ \ **-t**\ \ *mastertobemade*\ | \ **-b**\ \ *master to base vms upon*\ ] \ **-d|-**\ **-detached -f|-**\ **-force**\ +\ **clonevm**\ \ *noderange*\ [ \ **-t**\ \ *master_to_be_made*\ | \ **-b**\ \ *master_to_base_vms_upon*\ ] [ \ **-d|-**\ **-detached**\ ] [\ **-f|-**\ **-force**\ ] *********** @@ -31,15 +31,15 @@ Command to promote a VM's current configuration and storage to a master as well performing the converse operation of creating VMs based on a master. By default, attempting to create a master from a running VM will produce an error. -The force argument will request that a master be made of the VM anyway. +The \ **-**\ **-force**\ argument will request that a master be made of the VM anyway. Also, by default a VM that is used to create a master will be rebased as a thin -clone of that master. If the force argument is used to create a master of a powered -on vm, this will not be done. Additionally, the detached option can be used to +clone of that master. If the \ **-**\ **-force**\ argument is used to create a master of a powered +on vm, this will not be done. Additionally, the \ **-**\ **-detached**\ option can be used to explicitly request that a clone not be tethered to a master image, allowing the clones to not be tied to the health of a master, at the cost of additional storage. -When promoting a VM's current state to master, all rleated virtual disks will be +When promoting a VM's current state to master, all related virtual disks will be copied and merged with any prerequisite images. A master will not be tethered to other masters. @@ -49,19 +49,48 @@ OPTIONS ******* -\ **-h|-**\ **-help**\ Display usage message. -\ **-b**\ The master to base the clones upon +\ **-h|-**\ **-help**\ + + Display usage message. + -\ **-t**\ The target master to copy a single VM's state to -\ **-d**\ Explicitly request that the noderange be untethered from any masters. +\ **-b**\ \ *master_to_base_vms_upon*\ + + The master to base the clones upon + -\ **-f**\ Force cloning of a powered on VM. Implies -d if the VM is on. -\ **-v|-**\ **-version**\ Command Version. +\ **-t**\ \ *master_to_be_made*\ + + The target master to copy a single VM's state to + + + +\ **-d|-**\ **-detached**\ + + Explicitly request that the noderange be untethered from any masters. + + + +\ **-f|-**\ **-force**\ + + Force cloning of a powered on VM. Implies \ **-d**\ if the VM is on. + + + +\ **-v|-**\ **-version**\ + + Command Version. + + + +\ **-V|-**\ **-verbose**\ + + Verbose output. + -\ **-V|-**\ **-verbose**\ Verbose output. ************ @@ -80,7 +109,7 @@ EXAMPLES -1. Creating a master named appserver from a node called vm1: +1. Creating a master named \ *appserver*\ from a node called \ *vm1*\ : .. code-block:: perl @@ -90,7 +119,7 @@ EXAMPLES -2. Cleating 30 VMs from a master named appserver: +2. Cleating 30 VMs from a master named \ *appserver*\ : .. code-block:: perl diff --git a/docs/source/guides/admin-guides/references/man1/imgcapture.1.rst b/docs/source/guides/admin-guides/references/man1/imgcapture.1.rst index d68369fe9..663064609 100644 --- a/docs/source/guides/admin-guides/references/man1/imgcapture.1.rst +++ b/docs/source/guides/admin-guides/references/man1/imgcapture.1.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **imgcapture**\ \ *node*\ \ **-t | -**\ **-type**\ {\ **diskless | sysclone**\ } \ **-o | -**\ **-osimage**\ \ *osimage*\ [\ **-V | -**\ **-verbose**\ ] +\ **imgcapture**\ \ *node*\ \ **-t | -**\ **-type**\ {\ **diskless | sysclone**\ } \ **-o | -**\ **-osimage**\ \ *osimage*\ [\ **-i**\ \ *nodebootif*\ ] [\ **-n**\ \ *nodenetdrivers*\ ] [\ **-V | -**\ **-verbose**\ ] \ **imgcapture**\ [\ **-h**\ | \ **-**\ **-help**\ ] | [\ **-v**\ | \ **-**\ **-version**\ ] @@ -31,9 +31,9 @@ DESCRIPTION The \ **imgcapture**\ command will capture an image from one running diskful Linux node and create a diskless or diskful image for later use. -The \ **node**\ should be one diskful Linux node, managed by the xCAT MN, and the remote shell between MN and the \ **node**\ should have been configured. AIX is not supported. +The \ **node**\ should be one diskful Linux node, managed by the xCAT MN, and the remote shell between MN and the \ **node**\ should have been configured. AIX is not supported. VMs are not supported. -The \ **imgcapture**\ command supports two image types: \ **diskless**\ and \ **sysclone**\ . For the \ **diskless**\ type, it will capture an image from one running diskful Linux node, prepares the rootimg directory, kernel and initial rmadisks for the \ **liteimg**\ /\ **packimage**\ command to generate the statelite/stateless rootimg. For the \ **sysclone**\ type, it will capture an image from one running diskful Linux node, create an osimage which can be used to clone other diskful Linux nodes. +The \ **imgcapture**\ command supports two image types: \ **diskless**\ and \ **sysclone**\ . For the \ **diskless**\ type, it will capture an image from one running diskful Linux node, prepares the rootimg directory, kernel and initial ramdisks for the \ **liteimg**\ /\ **packimage**\ command to generate the statelite/stateless rootimg. For the \ **sysclone**\ type, it will capture an image from one running diskful Linux node, create an osimage which can be used to clone other diskful Linux nodes. The \ **diskless**\ type: @@ -80,15 +80,13 @@ OPTIONS The network interface the diskless node will boot over (e.g. eth0), which is used by the \ **genimage**\ command to generate initial ramdisks. - This is optional. - \ **-n**\ \ *nodenetdrivers*\ The driver modules needed for the network interface, which is used by the \ **genimage**\ command to generate initial ramdisks. - This is optional. By default, the \ **genimage**\ command can provide drivers for the following network interfaces: + By default, the \ **genimage**\ command can provide drivers for the following network interfaces: For x86 or x86_64 platform: diff --git a/docs/source/guides/admin-guides/references/man1/imgexport.1.rst b/docs/source/guides/admin-guides/references/man1/imgexport.1.rst index 94fe7f237..2e08a1b61 100644 --- a/docs/source/guides/admin-guides/references/man1/imgexport.1.rst +++ b/docs/source/guides/admin-guides/references/man1/imgexport.1.rst @@ -29,7 +29,7 @@ DESCRIPTION *********** -The imgexport command will export an image that is being used by xCAT. To export images, you must have the images defined in the \ *osimage*\ table. All the columns in the \ *osimage*\ and \ *linuximage*\ tables will be exported. If kits are used in stateful or stateless images, \ *kit*\ , \ *kitcomponent*\ and \ *kitrepo*\ tables will be exported. In addition, the following files will also be exported. +The \ **imgexport**\ command will export an image that is being used by xCAT. To export images, you must have the images defined in the \ *osimage*\ table. All the columns in the \ *osimage*\ and \ *linuximage*\ tables will be exported. If kits are used in stateful or stateless images, \ *kit*\ , \ *kitcomponent*\ and \ *kitrepo*\ tables will be exported. In addition, the following files will also be exported. For stateful: x.pkglist @@ -61,7 +61,7 @@ For statelite: where x is the name of the profile. -Any files specified by the -e flag will also be exported. If -p flag is specified, the names of the postscripts and the postbootscripts for the given node will be exported. The postscripts themsleves need to be manualy exported using -e flag. +Any files specified by the \ **-e**\ flag will also be exported. If \ **-p**\ flag is specified, the names of the postscripts and the postbootscripts for the given node will be exported. The postscripts themsleves need to be manualy exported using \ **-e**\ flag. For statelite, the litefile table settings for the image will also be exported. The litetree and statelite tables are not exported. @@ -71,17 +71,42 @@ OPTIONS ******* -\ **-e|-**\ **-extra**\ \ *srcfile:destdir*\ Pack up extra files. If \ *destdir*\ is omitted, the destination directory will be the same as the source directory. -\ **-h|-**\ **-help**\ Display usage message. +\ **-e|-**\ **-extra**\ \ *srcfile:destdir*\ + + Pack up extra files. If \ *destdir*\ is omitted, the destination directory will be the same as the source directory. + -\ **-p|-**\ **-postscripts**\ \ *node_name*\ Get the names of the postscripts and postbootscripts for the given node and pack them into the image. -\ **-v|-**\ **-verbose**\ Verbose output. +\ **-h|-**\ **-help**\ + + Display usage message. + -\ *image_name*\ The name of the image. Use \ *lsdef -t*\ osimage to find out all the image names. -\ *destination*\ The output bundle file name. +\ **-p|-**\ **-postscripts**\ \ *node_name*\ + + Get the names of the postscripts and postbootscripts for the given node and pack them into the image. + + + +\ **-v|-**\ **-verbose**\ + + Verbose output. + + + +\ *image_name*\ + + The name of the image. Use \ **lsdef -t osimage**\ to find out all the image names. + + + +\ *destination*\ + + The output bundle file name. + + ************ diff --git a/docs/source/guides/admin-guides/references/man1/imgimport.1.rst b/docs/source/guides/admin-guides/references/man1/imgimport.1.rst index 49384e7eb..e5e542f7c 100644 --- a/docs/source/guides/admin-guides/references/man1/imgimport.1.rst +++ b/docs/source/guides/admin-guides/references/man1/imgimport.1.rst @@ -29,7 +29,7 @@ DESCRIPTION *********** -The imgimport command will import an image that has been exported by \ *imgexport*\ from xCAT. This is the easiest way to transfer/backup/, change or share images created by xCAT whether they be stateless or stateful. The bundle file will be unpacked in the current working directory. The xCAT configuration such as \ *osimage*\ and \ *linuximage*\ tables will then be updated. +The \ **imgimport**\ command will import an image that has been exported by \ **imgexport**\ from xCAT. This is the easiest way to transfer, backup, change or share images created by xCAT whether they be stateless or stateful. The bundle file will be unpacked in the current working directory. The xCAT configuration such as \ *osimage*\ and \ *linuximage*\ tables will then be updated. For stateful, the following files will be copied to the appropriate directories. x.pkglist @@ -61,15 +61,15 @@ For statelite, the following files will be copied to the appropriate directories where x is the profile name. -Any extra files, included by --extra flag in the imgexport command, will also be copied to the appropriate directories. +Any extra files, included by \ **-**\ **-extra**\ flag in the \ **imgexport**\ command, will also be copied to the appropriate directories. For statelite, the litefile table will be updated for the image. The litetree and statelite tables are not imported. -If -p flag is specified, the \ *postscripts*\ table will be updated with the postscripts and the postbootscripts names from the image for the nodes given by this flag. +If \ **-p**\ flag is specified, the \ *postscripts*\ table will be updated with the postscripts and the postbootscripts names from the image for the nodes given by this flag. -If -f flag is not specified, all the files will be copied to the same directories as the source. If it is specified, the old profile name x will be changed to the new and the files will be copied to the appropriate directores for the new profiles. For example, \ */opt/xcat/share/xcat/netboot/sles/x.pkglist*\ will be copied to \ */install/custom/netboot/sles/compute_new.pkglist*\ and \ */install/netboot/sles11/ppc64/x/kernel*\ will be copied to \ */install/netboot/sles11/ppc64/compute_new/kernel*\ . This flag is commonly used when you want to copy the image on the same xCAT mn so you can make modification on the new one. +If \ **-f**\ flag is not specified, all the files will be copied to the same directories as the source. If it is specified, the old profile name x will be changed to the new and the files will be copied to the appropriate directores for the new profiles. For example, \ */opt/xcat/share/xcat/netboot/sles/x.pkglist*\ will be copied to \ */install/custom/netboot/sles/compute_new.pkglist*\ and \ */install/netboot/sles11/ppc64/x/kernel*\ will be copied to \ */install/netboot/sles11/ppc64/compute_new/kernel*\ . This flag is commonly used when you want to copy the image on the same xCAT mn so you can make modification on the new one. -After this command, you can run the \ *nodeset*\ command and then start deploying the nodes. You can also choose to modify the files and run the following commands before the node depolyment. +After this command, you can run the \ **nodeset**\ command and then start deploying the nodes. You can also choose to modify the files and run the following commands before the node depolyment. For stateful: nodeset @@ -90,13 +90,30 @@ OPTIONS ******* -\ **-f|-**\ **-profile**\ \ *new_prof*\ Import the image with a new profile name. -\ **-h|-**\ **-help**\ Display usage message. +\ **-f|-**\ **-profile**\ \ *new_profile*\ + + Import the image with a new profile name. + -\ **-p|-**\ **-postscripts**\ \ *nodelist*\ Import the postscripts. The postscripts contained in the image will be set in the postscripts table for \ *nodelist*\ . -\ **-v|-**\ **-verbose**\ Verbose output. +\ **-h|-**\ **-help**\ + + Display usage message. + + + +\ **-p|-**\ **-postscripts**\ \ *nodelist*\ + + Import the postscripts. The postscripts contained in the image will be set in the postscripts table for \ *nodelist*\ . + + + +\ **-v|-**\ **-verbose**\ + + Verbose output. + + ************ diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 0cbba194a..8e2786a52 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -324,14 +324,14 @@ my %usage = ( "Usage: rflash [ -h|--help|-v|--version] PPC (with HMC) specific: - rflash -p [--activate concurrent | disruptive][-V|--verbose] - rflash [--commit | --recover] [-V|--verbose] + rflash -p [--activate {concurrent | disruptive}] [-V|--verbose] + rflash {--commit | --recover} [-V|--verbose] PPC (using Direct FSP Management) specific: - rflash -p --activate [-d ] + rflash -p [--activate {disruptive|deferred}] [-d ] rflash [--commit | --recover] [-V|--verbose] rflash [--bpa_acdl] PPC64LE (using BMC Management) specific: - rflash [-c | --check] ", + rflash [-c | --check] [--retry=] [-V] ", "mkhwconn" => "Usage: mkhwconn [-h|--help] diff --git a/xCAT-client/pods/man1/clonevm.1.pod b/xCAT-client/pods/man1/clonevm.1.pod index 4437a65c1..81de9c85e 100644 --- a/xCAT-client/pods/man1/clonevm.1.pod +++ b/xCAT-client/pods/man1/clonevm.1.pod @@ -4,7 +4,7 @@ B - Create masters from virtual machines and virtual machines from mast =head1 SYNOPSIS -B I [ B<-t> I | B<-b> I ] B<-d|--detached -f|--force> +B I [ B<-t> I | B<-b> I ] [ B<-d|--detached>] [B<-f|--force>] =head1 DESCRIPTION @@ -12,35 +12,51 @@ Command to promote a VM's current configuration and storage to a master as well performing the converse operation of creating VMs based on a master. By default, attempting to create a master from a running VM will produce an error. -The force argument will request that a master be made of the VM anyway. +The B<--force> argument will request that a master be made of the VM anyway. Also, by default a VM that is used to create a master will be rebased as a thin -clone of that master. If the force argument is used to create a master of a powered -on vm, this will not be done. Additionally, the detached option can be used to +clone of that master. If the B<--force> argument is used to create a master of a powered +on vm, this will not be done. Additionally, the B<--detached> option can be used to explicitly request that a clone not be tethered to a master image, allowing the clones to not be tied to the health of a master, at the cost of additional storage. -When promoting a VM's current state to master, all rleated virtual disks will be +When promoting a VM's current state to master, all related virtual disks will be copied and merged with any prerequisite images. A master will not be tethered to other masters. =head1 OPTIONS +=over 4 -B<-h|--help> Display usage message. +=item B<-h|--help> -B<-b> The master to base the clones upon +Display usage message. -B<-t> The target master to copy a single VM's state to +=item B<-b> I -B<-d> Explicitly request that the noderange be untethered from any masters. +The master to base the clones upon -B<-f> Force cloning of a powered on VM. Implies -d if the VM is on. +=item B<-t> I -B<-v|--version> Command Version. +The target master to copy a single VM's state to -B<-V|--verbose> Verbose output. +=item B<-d|--detached> +Explicitly request that the noderange be untethered from any masters. + +=item B<-f|--force> + +Force cloning of a powered on VM. Implies B<-d> if the VM is on. + +=item B<-v|--version> + +Command Version. + +=item B<-V|--verbose> + +Verbose output. + +=back =head1 RETURN VALUE @@ -53,12 +69,12 @@ Any other value: An error has occurred. =over 3 =item 1. -Creating a master named appserver from a node called vm1: +Creating a master named I from a node called I: clonevm vm1 -t appserver =item 2. -Cleating 30 VMs from a master named appserver: +Cleating 30 VMs from a master named I: clonevm vm1-vm30 -b appserver diff --git a/xCAT-client/pods/man1/imgcapture.1.pod b/xCAT-client/pods/man1/imgcapture.1.pod index 96b0b44a3..5c67d9a8a 100644 --- a/xCAT-client/pods/man1/imgcapture.1.pod +++ b/xCAT-client/pods/man1/imgcapture.1.pod @@ -4,7 +4,7 @@ B - Captures an image from a Linux diskful node and create a diskles =head1 SYNOPSIS -B I B<-t>|B<--type> {B|B} B<-o>|B<--osimage> I [B<-V>|B<--verbose>] +B I B<-t>|B<--type> {B|B} B<-o>|B<--osimage> I [B<-i> I] [B<-n> I] [B<-V>|B<--verbose>] B [B<-h> | B<--help>] | [B<-v> | B<--version>] @@ -12,9 +12,9 @@ B [B<-h> | B<--help>] | [B<-v> | B<--version>] The B command will capture an image from one running diskful Linux node and create a diskless or diskful image for later use. -The B should be one diskful Linux node, managed by the xCAT MN, and the remote shell between MN and the B should have been configured. AIX is not supported. +The B should be one diskful Linux node, managed by the xCAT MN, and the remote shell between MN and the B should have been configured. AIX is not supported. VMs are not supported. -The B command supports two image types: B and B. For the B type, it will capture an image from one running diskful Linux node, prepares the rootimg directory, kernel and initial rmadisks for the B/B command to generate the statelite/stateless rootimg. For the B type, it will capture an image from one running diskful Linux node, create an osimage which can be used to clone other diskful Linux nodes. +The B command supports two image types: B and B. For the B type, it will capture an image from one running diskful Linux node, prepares the rootimg directory, kernel and initial ramdisks for the B/B command to generate the statelite/stateless rootimg. For the B type, it will capture an image from one running diskful Linux node, create an osimage which can be used to clone other diskful Linux nodes. The B type: @@ -52,13 +52,11 @@ The osimage name. The network interface the diskless node will boot over (e.g. eth0), which is used by the B command to generate initial ramdisks. -This is optional. - =item B<-n> I The driver modules needed for the network interface, which is used by the B command to generate initial ramdisks. -This is optional. By default, the B command can provide drivers for the following network interfaces: +By default, the B command can provide drivers for the following network interfaces: For x86 or x86_64 platform: diff --git a/xCAT-client/pods/man1/imgexport.1.pod b/xCAT-client/pods/man1/imgexport.1.pod index d3a1c2648..a2376df26 100644 --- a/xCAT-client/pods/man1/imgexport.1.pod +++ b/xCAT-client/pods/man1/imgexport.1.pod @@ -11,7 +11,7 @@ B I [I] [[B<-e>|B<--extra> I] ... =head1 DESCRIPTION -The imgexport command will export an image that is being used by xCAT. To export images, you must have the images defined in the I table. All the columns in the I and I tables will be exported. If kits are used in stateful or stateless images, I, I and I tables will be exported. In addition, the following files will also be exported. +The B command will export an image that is being used by xCAT. To export images, you must have the images defined in the I table. All the columns in the I and I tables will be exported. If kits are used in stateful or stateless images, I, I and I tables will be exported. In addition, the following files will also be exported. For stateful: x.pkglist @@ -45,24 +45,39 @@ For statelite: where x is the name of the profile. -Any files specified by the -e flag will also be exported. If -p flag is specified, the names of the postscripts and the postbootscripts for the given node will be exported. The postscripts themsleves need to be manualy exported using -e flag. +Any files specified by the B<-e> flag will also be exported. If B<-p> flag is specified, the names of the postscripts and the postbootscripts for the given node will be exported. The postscripts themsleves need to be manualy exported using B<-e> flag. For statelite, the litefile table settings for the image will also be exported. The litetree and statelite tables are not exported. =head1 OPTIONS +=over 4 -B<-e|--extra> I Pack up extra files. If I is omitted, the destination directory will be the same as the source directory. +=item B<-e|--extra> I -B<-h|--help> Display usage message. +Pack up extra files. If I is omitted, the destination directory will be the same as the source directory. + +=item B<-h|--help> + +Display usage message. -B<-p|--postscripts> I Get the names of the postscripts and postbootscripts for the given node and pack them into the image. +=item B<-p|--postscripts> I -B<-v|--verbose> Verbose output. +Get the names of the postscripts and postbootscripts for the given node and pack them into the image. -I The name of the image. Use I osimage to find out all the image names. +=item B<-v|--verbose> -I The output bundle file name. +Verbose output. + +=item I + +The name of the image. Use B to find out all the image names. + +=item I + +The output bundle file name. + +=back =head1 RETURN VALUE diff --git a/xCAT-client/pods/man1/imgimport.1.pod b/xCAT-client/pods/man1/imgimport.1.pod index b674ea048..f652f9d74 100644 --- a/xCAT-client/pods/man1/imgimport.1.pod +++ b/xCAT-client/pods/man1/imgimport.1.pod @@ -10,7 +10,7 @@ B I [B<-p>|B<--postscripts> I] [B<-f>|B<- =head1 DESCRIPTION -The imgimport command will import an image that has been exported by I from xCAT. This is the easiest way to transfer/backup/, change or share images created by xCAT whether they be stateless or stateful. The bundle file will be unpacked in the current working directory. The xCAT configuration such as I and I tables will then be updated. +The B command will import an image that has been exported by B from xCAT. This is the easiest way to transfer, backup, change or share images created by xCAT whether they be stateless or stateful. The bundle file will be unpacked in the current working directory. The xCAT configuration such as I and I tables will then be updated. For stateful, the following files will be copied to the appropriate directories. x.pkglist @@ -42,15 +42,15 @@ For statelite, the following files will be copied to the appropriate directories where x is the profile name. -Any extra files, included by --extra flag in the imgexport command, will also be copied to the appropriate directories. +Any extra files, included by B<--extra> flag in the B command, will also be copied to the appropriate directories. For statelite, the litefile table will be updated for the image. The litetree and statelite tables are not imported. -If -p flag is specified, the I table will be updated with the postscripts and the postbootscripts names from the image for the nodes given by this flag. +If B<-p> flag is specified, the I table will be updated with the postscripts and the postbootscripts names from the image for the nodes given by this flag. -If -f flag is not specified, all the files will be copied to the same directories as the source. If it is specified, the old profile name x will be changed to the new and the files will be copied to the appropriate directores for the new profiles. For example, I will be copied to I and I will be copied to I. This flag is commonly used when you want to copy the image on the same xCAT mn so you can make modification on the new one. +If B<-f> flag is not specified, all the files will be copied to the same directories as the source. If it is specified, the old profile name x will be changed to the new and the files will be copied to the appropriate directores for the new profiles. For example, I will be copied to I and I will be copied to I. This flag is commonly used when you want to copy the image on the same xCAT mn so you can make modification on the new one. -After this command, you can run the I command and then start deploying the nodes. You can also choose to modify the files and run the following commands before the node depolyment. +After this command, you can run the B command and then start deploying the nodes. You can also choose to modify the files and run the following commands before the node depolyment. For stateful: nodeset @@ -68,15 +68,25 @@ For statelite =head1 OPTIONS +=over 4 -B<-f|--profile> I Import the image with a new profile name. +=item B<-f|--profile> I -B<-h|--help> Display usage message. +Import the image with a new profile name. -B<-p|--postscripts> I Import the postscripts. The postscripts contained in the image will be set in the postscripts table for I. +=item B<-h|--help> -B<-v|--verbose> Verbose output. +Display usage message. +=item B<-p|--postscripts> I + +Import the postscripts. The postscripts contained in the image will be set in the postscripts table for I. + +=item B<-v|--verbose> + +Verbose output. + +=back =head1 RETURN VALUE diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm index 8502123fe..b8d0f23a9 100755 --- a/xCAT-server/lib/xcat/plugins/imgcapture.pm +++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm @@ -46,7 +46,7 @@ sub process_request { @ARGV = @{ $request->{arg} } if (defined $request->{arg}); my $argc = scalar @ARGV; - my $usage = "Usage:\n imgcapture -t|--type {diskless|sysclone} -o|--osimage [-V | --verbose] \n imgcapture [-h|--help] \n imgcapture [-v|--version]"; + my $usage = "Usage:\n imgcapture -t|--type {diskless|sysclone} -o|--osimage [-i ] [-n ] [-V | --verbose] \n imgcapture [-h|--help] \n imgcapture [-v|--version]"; my $os; my $arch; From a19114cf407a825477d2f4f2ba486a70dffe4eb6 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 18 Apr 2017 02:43:17 -0400 Subject: [PATCH 030/162] update for comments --- xCAT-test/autotest/testcase/passwd/case0 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index 74e7c52fc..656898d2a 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -223,17 +223,19 @@ cmd:gettab key=system passwd.password > /tmp/tmppassword check:rc==0 cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` check:rc==0 -cmd:gettab key=system passwd.password |grep '\$1\$' +cmd:gettab key=system passwd.password > /tmp/tmpcryptedpasswd check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 -cmd:grep '\$1\$' /install/autoinst/$$CN +cmd:grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd +check:rc==0 +cmd:diff /tmp/tmpcryptedpasswd /tmp/instcryptedpasswd check:rc==0 cmd:oldpassword=`cat /tmp/tmppassword |sed 's/\"//g'`;oldcryptmethod=`cat /tmp/tmpcryptmethod |sed 's/\"//g'`;chtab key=system passwd.password=$oldpassword passwd.cryptmethod=$oldcryptmethod check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 -cmd:rm -rf /tmp/tmpcryptmethod /tmp/tmppassword +cmd:rm -rf /tmp/tmpcryptmethod /tmp/tmppassword /tmp/tmpcryptedpasswd /tmp/instcryptedpasswd end start:encrypted_passwd_openssl_diskless From 831a3b6e04cce737f951a251f44ce4612df10180 Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 18 Apr 2017 14:46:45 +0800 Subject: [PATCH 031/162] Make tables which contain nodecol column inheritable (#2785) Actually, the subroutine getNodeAttribs already fetch the attributes related to the groups, but the `defobj` related method ignore these attributes as it is not node column although nodecol is set. This patch treat nodecol column as node to make the attributes in these table inheritable. fix-issue: #2450 --- perl-xCAT/xCAT/DBobjUtils.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 31bc6c14a..5c9679688 100755 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -488,7 +488,9 @@ sub getobjdefs foreach my $lookup_attr (keys %{ $tabentry{'lookup_attrs'} }) { # Check whether the attribute is already in %tabhash # The %tabhash is for performance considerations - if (($lookup_attr eq 'node') && ($objtype eq 'node')) { + my $tabspec = $xCAT::Schema::tabspec{$lookup_table}; + my $nodecol = $tabspec->{'nodecol'} if defined($tabspec->{'nodecol'}); + if (($lookup_attr eq 'node' && $objtype eq 'node') || (defined($nodecol) && $objtype eq 'node')) { if (defined($tabhash{$lookup_table}{$objname}{$tabattr})) { if ($verbose == 1) { $objhash{$objname}{$attr} = "$tabhash{$lookup_table}{$objname}{$tabattr}\t(Table:$lookup_table - Key:$lookup_attr - Column:$tabattr)"; From 108f9aaf8f3c603a7d82ab0972aa64339551a659 Mon Sep 17 00:00:00 2001 From: zet809 Date: Tue, 18 Apr 2017 15:56:52 +0800 Subject: [PATCH 032/162] Update version to 2.13.4 after 2.13.3 released --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index a1a4224dd..965a689ec 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.13.3 +2.13.4 From 16ea967746ff300be2aba592f8ecc4e3d6795165 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 18 Apr 2017 08:01:09 -0400 Subject: [PATCH 033/162] add bmcdiscovery testcases --- .../autotest/testcase/bmcdiscover/cases0 | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/xCAT-test/autotest/testcase/bmcdiscover/cases0 b/xCAT-test/autotest/testcase/bmcdiscover/cases0 index a0e5e70da..25170a1b9 100644 --- a/xCAT-test/autotest/testcase/bmcdiscover/cases0 +++ b/xCAT-test/autotest/testcase/bmcdiscover/cases0 @@ -1,3 +1,33 @@ +start:bmcdiscover_q +os:linux +decription:query usage for bmcdiscover +cmd:bmcdiscover ? +check:rc==0 +check:output=~bmcdiscover - Discover BMC +check:output=~Usage +check:output=~bmcdiscover \[-?|-h|--help\] +check:output=~bmcdiscover \[-v|--version\] +end + +start:bmcdiscover_help +os:linux +decription:show bmcdiscover help information +cmd:bmcdiscover help +check:rc==0 +check:output=~bmcdiscover \- Discover BMC \(Baseboard Management Controller\) using the specified scan method +check:output=~Usage: +check:output=~bmcdiscover \[-?|-h|--help\] +check:output=~bmcdiscover \[-v|--version\] +end + +start:bmcdiscover_version +os:linux +description:show bmcdiscover version +cmd:bmcdiscover --version +check:rc==0 +check:output=~bmcdiscover - xCAT Version +end + start:bmcdiscover_h os:Linux decription:help @@ -42,6 +72,12 @@ check:rc==0 check:output=~bmc=$$bmcrange end +start:bmcdiscover_range_u_p_i_ipsource +description:check the bmcrange is which type address +cmd:bmcdiscover -i $$bmcrange -u $$bmcusername -p $$bmcpasswd --ipsource +check:rc==0 +check:output=~IP Address Source : Static Address +end start:bmcdiscover_range_z cmd:bmcdiscover --range $$bmcrange -u $$bmcusername -p $$bmcpasswd -z check:rc==0 From d41c8054c1ef54cf72986483dd3771e38fd0c95b Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 18 Apr 2017 08:34:49 -0400 Subject: [PATCH 034/162] add rsetboot testcase for issue 2808 --- xCAT-test/autotest/testcase/rsetboot/cases0 | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 xCAT-test/autotest/testcase/rsetboot/cases0 diff --git a/xCAT-test/autotest/testcase/rsetboot/cases0 b/xCAT-test/autotest/testcase/rsetboot/cases0 new file mode 100644 index 000000000..a86916222 --- /dev/null +++ b/xCAT-test/autotest/testcase/rsetboot/cases0 @@ -0,0 +1,37 @@ +start:rsetboot_hd +description:set the boot device from hd +cmd:rsetboot $$CN hd +check:rc==0 +check:output=~Hard Drive +end + +start:rsetboot_net +description:set the boot device from net +cmd:rsetboot $$CN net +check:rc==0 +check:output=~Network +end + +start:rsetboot_cd +description:set the boot device from CD/DVD +cmd:rsetboot $$CN cd +check:rc==0 +check:output=~CD/DVD +end + +start:rsetboot_default +description:set the boot device default +cmd:rsetboot $$CN default +check:rc==0 +check:output=~boot override inactive +end + +start:rsetboot_stat +description:check the status for rsetboot +cmd:rsetboot $$CN cd +check:rc==0 +check:output=~CD/DVD +cmd:rsetboot $$CN stat +check:rc==0 +check:output=~CD/DVD +end From edc93534eaa8c7b88060b1c994f635450efbcd55 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 18 Apr 2017 22:03:53 -0400 Subject: [PATCH 035/162] Add tmp doc for how to use openbmc --- .../admin-guides/manage_clusters/index.rst | 1 + .../manage_clusters/openbmc/configure.rst | 9 +++ .../manage_clusters/openbmc/index.rst | 12 ++++ .../manage_clusters/openbmc/openbmc.rst | 60 +++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 docs/source/guides/admin-guides/manage_clusters/openbmc/configure.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/openbmc/index.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/index.rst b/docs/source/guides/admin-guides/manage_clusters/index.rst index d44e4a099..c2750c383 100644 --- a/docs/source/guides/admin-guides/manage_clusters/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/index.rst @@ -11,3 +11,4 @@ The sections are organized based on hardware architecture. ppc64le/index.rst x86_64/index.rst + openbmc/index.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/openbmc/configure.rst b/docs/source/guides/admin-guides/manage_clusters/openbmc/configure.rst new file mode 100644 index 000000000..0c9de13f3 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/openbmc/configure.rst @@ -0,0 +1,9 @@ +Configure passwords +=================== + +Configure the passwords for Management modules of the compute nodes. + +* For OpenBMC managed systems: :: + + chtab key=openbmc passwd.username=root passwd.password=0penBMC + diff --git a/docs/source/guides/admin-guides/manage_clusters/openbmc/index.rst b/docs/source/guides/admin-guides/manage_clusters/openbmc/index.rst new file mode 100644 index 000000000..9918f7873 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/openbmc/index.rst @@ -0,0 +1,12 @@ +OpenPOWER (OpenBMC managed) +=========================== + +The following sections documents the procedures in managing OpenPOWER servers in an xCAT cluster. +These are machines use the IBM Power Architecture and is **OpenBMC** managed. + + +.. toctree:: + :maxdepth: 2 + + configure.rst + openbmc.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst b/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst new file mode 100644 index 000000000..d9df935a3 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst @@ -0,0 +1,60 @@ +Manually Define Nodes +===================== + +**Manually Define Node** means the admin knows the detailed information of the physical server and manually defines it into xCAT database with ``mkdef`` commands. + +In this document, the following configuration is used in the example + +Compute Node info:: + + CN Hostname: cn1 + BMC Address: 50.0.101.1 + OpenBMC username: root + OpenBMC Password: 0penBMC + +Execute ``mkdef`` command to define the node: :: + + mkdef -t node cn1 groups=openbmc,all mgt=openbmc cons=openbmc bmc=50.0.101.1 bmcusername=root bmcpassword=OpenBMC + +The manually defined node will be like this:: + + # lsdef cn1 + Object name: cn1 + bmc=50.0.101.1 + bmcpassword=OpenBMC + bmcusername=root + cons=openbmc + groups=openbmc,all + mgt=openbmc + postbootscripts=otherpkgs + postscripts=syslog,remoteshell,syncfiles + +Hardware Management +=================== + +Remote Power Control +```````````````````` + +The next important thing is to control the power of a remote physical machine. For this purpose, ``rpower`` command is involved. :: + + rpower cn1 on + rpower cn1 off + rpower cn1 boot + rpower cn1 reset + +Get the current rpower state of a machine, refer to the example below. :: + + # rpower cn1 state + cn1: on + +Remote Console +`````````````` + +In order to get the command line console remotely. xCAT provides the ``rcons`` command. + +#. Make sure the ``conserver`` is configured by running ``makeconservercf``. + +#. After that, you can get the command line console for a specific machine with the ``rcons`` command :: + + rcons cn1 + From ee5a4d8c40791918b17551bf9419df0339037a13 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 19 Apr 2017 03:04:13 -0400 Subject: [PATCH 036/162] modify rsetboot testcase for comments --- xCAT-test/autotest/testcase/rsetboot/cases0 | 39 +++++++++++---------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/xCAT-test/autotest/testcase/rsetboot/cases0 b/xCAT-test/autotest/testcase/rsetboot/cases0 index a86916222..4c9de3fb8 100644 --- a/xCAT-test/autotest/testcase/rsetboot/cases0 +++ b/xCAT-test/autotest/testcase/rsetboot/cases0 @@ -1,37 +1,40 @@ -start:rsetboot_hd +start:rsetboot_hd_statcheck description:set the boot device from hd cmd:rsetboot $$CN hd check:rc==0 check:output=~Hard Drive +cmd:rsetboot $$CN stat +check:rc==0 +check:output=~$$CN: Hard Drive end -start:rsetboot_net +start:rsetboot_net_statcheck description:set the boot device from net cmd:rsetboot $$CN net check:rc==0 check:output=~Network +cmd:rsetboot $$CN stat +check:rc==0 +check:output=~$$CN: Network end -start:rsetboot_cd +start:rsetboot_cd_statcheck description:set the boot device from CD/DVD cmd:rsetboot $$CN cd check:rc==0 check:output=~CD/DVD -end - -start:rsetboot_default -description:set the boot device default -cmd:rsetboot $$CN default -check:rc==0 -check:output=~boot override inactive -end - -start:rsetboot_stat -description:check the status for rsetboot -cmd:rsetboot $$CN cd -check:rc==0 -check:output=~CD/DVD cmd:rsetboot $$CN stat check:rc==0 -check:output=~CD/DVD +check:output=~$$CN: CD/DVD end + +start:rsetboot_default_statcheck +description:set the boot device default +cmd:rsetboot $$CN default +check:rc==0 +check:output=~boot override inactive +cmd:rsetboot $$CN stat +check:rc==0 +check:output=~$$CN: boot override inactive +end + From 560584dd52ba78edcda5d0a34360caf7347e68c4 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 18 Apr 2017 23:20:17 -0400 Subject: [PATCH 037/162] fix issue performing yum update xCAT* overwrote our log rotate settings. #2795 --- xCAT/xCAT.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 4572e89e6..5842d6664 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -251,7 +251,7 @@ exit 0 /install/postscripts /install/prescripts %ifos linux -/etc/logrotate.d/xcat +%config /etc/logrotate.d/xcat /etc/rsyslog.d/xcat-cluster.conf /etc/rsyslog.d/xcat-compute.conf /etc/rsyslog.d/xcat-debug.conf From 129ae02b4f1c0dc50e93842080c30440855d1c2f Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 19 Apr 2017 06:21:38 -0400 Subject: [PATCH 038/162] modify diskfull testcase for ubuntu ppc64le could get initrd.gz --- .../testcase/installation/reg_linux_diskfull_installation_flat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e740bed52..340dfc027 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -2,7 +2,7 @@ start:reg_linux_diskfull_installation_flat os:Linux cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi -cmd:MINIISO=NUll;if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]];then mkdir /tmp/iso; mount -o loop $$MINIISO /tmp/iso ; mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot; cp /tmp/iso/install/initrd.gz /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot;umount /tmp/iso; rmdir /tmp/iso; fi +cmd:MINIISO=NUll;if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]];then mkdir /tmp/iso; mount -o loop $$MINIISO /tmp/iso ; mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot; cp /tmp/iso/install/initrd.gz /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot;umount /tmp/iso; rmdir /tmp/iso; fi check:rc==0 cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN From 780b8fb1be04fb566b859fb98d7e1260ac794125 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 19 Apr 2017 07:14:06 -0400 Subject: [PATCH 039/162] modify rpower testcase :add rpower node status --- xCAT-test/autotest/testcase/rpower/cases0 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index 6f47659f5..52589a34b 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -40,6 +40,19 @@ cmd:rpower $$CN stat check:output=~Running|on end +start:rpower_status +description:checkout rpower node status could get node's stauts +cmd:rpower $$CN off +cmd:a=0;while ! `rpower $$CN status|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +cmd:rpower $$CN status +check:output=~Not Activated|off +cmd:rpower $$CN boot +check:rc==0 +cmd:a=0;while ! `rpower $$CN status|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +cmd:rpower $$CN status +check:output=~Running|on +end + start:rpower_on cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done From 5d518f6fcf896124470bad783551310fe94e5bed Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 19 Apr 2017 08:00:30 -0400 Subject: [PATCH 040/162] modify rpower testcase for bmc --- xCAT-test/autotest/testcase/rpower/cases0 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index 52589a34b..3d0ccc7ab 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -53,6 +53,19 @@ cmd:rpower $$CN status check:output=~Running|on end +start:rpower_state_bmc +description:checkout rpower node status could get node's stauts +cmd:rpower $$CN off +cmd:a=0;while ! `rpower $$CN state|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +cmd:rpower $$CN state +check:output=~Not Activated|off +cmd:rpower $$CN boot +check:rc==0 +cmd:a=0;while ! `rpower $$CN state|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +cmd:rpower $$CN state +check:output=~Running|on +end + start:rpower_on cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done From 47aab350235a048a0181df5e918e8215aebde052 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 18 Apr 2017 13:03:39 +0800 Subject: [PATCH 041/162] [testcase] Do xCAT upgrade by add `--force-resolution` to `zypper` --- xCAT-test/autotest/testcase/migration/sles_migration | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/sles_migration b/xCAT-test/autotest/testcase/migration/sles_migration index 7a7236475..e287ec852 100644 --- a/xCAT-test/autotest/testcase/migration/sles_migration +++ b/xCAT-test/autotest/testcase/migration/sles_migration @@ -88,7 +88,7 @@ cmd:xdsh $$CN "tar -jxvf /xcat-dep*.tar.bz2" check:rc==0 cmd:xdsh $$CN "cd /root/xcat-dep/sles1`more /etc/*release|grep VERSION_ID|cut -c14`/__GETNODEATTR($$CN,arch)__/;./mklocalrepo.sh" check:rc==0 -cmd:xdsh $$CN "zypper refresh;zypper -n update '*xCAT*'" +cmd:xdsh $$CN "zypper refresh;zypper -n update \$(rpm -q --queryformat '%{vendor}\n' xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 | grep -q -v '^IBM Corp\.$' && echo --force-resolution) '*xCAT*'" check:rc==0 cmd:xdsh $$CN "service xcatd status" check:rc==0 @@ -191,7 +191,7 @@ cmd:xdsh $$CN "tar -jxvf /xcat-dep*.tar.bz2" check:rc==0 cmd:xdsh $$CN "cd /root/xcat-dep/sles1`more /etc/*release|grep VERSION_ID|cut -c14`/__GETNODEATTR($$CN,arch)__/;./mklocalrepo.sh" check:rc==0 -cmd:xdsh $$CN "zypper refresh;zypper -n update '*xCAT*'" +cmd:xdsh $$CN "zypper refresh;zypper -n update \$(rpm -q --queryformat '%{vendor}\n' xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 | grep -q -v '^IBM Corp\.$' && echo --force-resolution) '*xCAT*'" check:rc==0 cmd:xdsh $$CN "service xcatd status" check:rc==0 From 1f3f65a35a027bf1c92ce1785227fcce3d97495c Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 19 Apr 2017 08:38:15 -0400 Subject: [PATCH 042/162] standardize rpower testcase name --- .../autotest/bundle/ubuntu14.04.3_x86_64.bundle | 12 ++++++------ .../autotest/bundle/ubuntu14.04.4_x86_64.bundle | 12 ++++++------ xCAT-test/autotest/testcase/dockercommand/cases0 | 12 ++++++------ xCAT-test/autotest/testcase/rpower/cases0 | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle index 48d7290d3..039e6cbc3 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle @@ -245,12 +245,12 @@ nodeset_cmdline nodeset_runimg nodeset_check_warninginfo Full_installation_flat_docker -rpower_stop -rpower_start -rpower_state -rpower_restart -rpower_pause -rpower_unpause +rpower_stop_docker +rpower_start_docker +rpower_state_docker +rpower_restart_docker +rpower_pause_docker +rpower_unpause_docker mkdocker_h mkdocker_command rmdocker_h diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 51738cfbe..07a4513f3 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -267,12 +267,12 @@ nodeset_cmdline nodeset_runimg nodeset_check_warninginfo Full_installation_flat_docker -rpower_stop -rpower_start -rpower_state -rpower_restart -rpower_pause -rpower_unpause +rpower_stop_docker +rpower_start_docker +rpower_state_docker +rpower_restart_docker +rpower_pause_docker +rpower_unpause_docker mkdocker_h mkdocker_command rmdocker_h diff --git a/xCAT-test/autotest/testcase/dockercommand/cases0 b/xCAT-test/autotest/testcase/dockercommand/cases0 index a8b4844d5..4b21baac0 100644 --- a/xCAT-test/autotest/testcase/dockercommand/cases0 +++ b/xCAT-test/autotest/testcase/dockercommand/cases0 @@ -1,4 +1,4 @@ -start:rpower_stop +start:rpower_stop_docker description:stop a created docker instance cmd:chdef $$DOCKERCN dockerhost=$$DOCKERHOST:2375 dockercpus=1 ip=$$DOCKERCONIP dockermemory=4096 groups=docker,all mgt=docker check:rc==0 @@ -25,7 +25,7 @@ check:rc==0 cmd:rmdef $$DOCKERCN check:rc==0 end -start:rpower_start +start:rpower_start_docker description:start a created docker instance cmd:chdef $$DOCKERCN dockerhost=$$DOCKERHOST:2375 dockercpus=1 ip=$$DOCKERCONIP dockermemory=4096 groups=docker,all mgt=docker check:rc==0 @@ -50,7 +50,7 @@ cmd:rmdef $$DOCKERCN check:rc==0 end -start:rpower_state +start:rpower_state_docker description:get state of the instance cmd:chdef $$DOCKERCN dockerhost=$$DOCKERHOST:2375 dockercpus=1 ip=$$DOCKERCONIP dockermemory=4096 groups=docker,all mgt=docker check:rc==0 @@ -82,7 +82,7 @@ cmd:rmdef $$DOCKERCN check:rc==0 end -start:rpower_restart +start:rpower_restart_docker description:restart a created docker instance cmd:chdef $$DOCKERCN dockerhost=$$DOCKERHOST:2375 dockercpus=1 ip=$$DOCKERCONIP dockermemory=4096 groups=docker,all mgt=docker check:rc==0 @@ -112,7 +112,7 @@ cmd:rmdef $$DOCKERCN check:rc==0 end -start:rpower_pause +start:rpower_pause_docker decription:pause all processes in the instance cmd:chdef $$DOCKERCN dockerhost=$$DOCKERHOST:2375 dockercpus=1 ip=$$DOCKERCONIP dockermemory=4096 groups=docker,all mgt=docker check:rc==0 @@ -139,7 +139,7 @@ cmd:rmdef $$DOCKERCN check:rc==0 end -start:rpower_unpause +start:rpower_unpause_docker description:unpause all processes in the instance cmd:chdef $$DOCKERCN dockerhost=$$DOCKERHOST:2375 dockercpus=1 ip=$$DOCKERCONIP dockermemory=4096 groups=docker,all mgt=docker check:rc==0 diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index 3d0ccc7ab..ee6974eac 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -53,7 +53,7 @@ cmd:rpower $$CN status check:output=~Running|on end -start:rpower_state_bmc +start:rpower_state description:checkout rpower node status could get node's stauts cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN state|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done From 750972a1228199026b7a2f8e8726cf5e570210e8 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 19 Apr 2017 21:03:04 -0400 Subject: [PATCH 043/162] modified depending on comments --- .../manage_clusters/openbmc/index.rst | 5 ++--- .../manage_clusters/openbmc/openbmc.rst | 22 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/openbmc/index.rst b/docs/source/guides/admin-guides/manage_clusters/openbmc/index.rst index 9918f7873..b6252768b 100644 --- a/docs/source/guides/admin-guides/manage_clusters/openbmc/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/openbmc/index.rst @@ -1,9 +1,8 @@ OpenPOWER (OpenBMC managed) =========================== -The following sections documents the procedures in managing OpenPOWER servers in an xCAT cluster. -These are machines use the IBM Power Architecture and is **OpenBMC** managed. - +The following sections document the procedures in managing OpenPOWER servers in an xCAT cluster. +OpenPower servers are machines that use IBM Power Architecture and are **OpenBMC** managed. .. toctree:: :maxdepth: 2 diff --git a/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst b/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst index d9df935a3..e832593d4 100644 --- a/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst +++ b/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst @@ -1,9 +1,9 @@ Manually Define Nodes ===================== -**Manually Define Node** means the admin knows the detailed information of the physical server and manually defines it into xCAT database with ``mkdef`` commands. +**Manually Define Node** means if admin knows the detailed information of the physical server, ``mkdef`` command can be used to manually define it into xCAT database.. -In this document, the following configuration is used in the example +In this document, the following configuration is used as an example Compute Node info:: @@ -12,16 +12,16 @@ Compute Node info:: OpenBMC username: root OpenBMC Password: 0penBMC -Execute ``mkdef`` command to define the node: :: +Run ``mkdef`` command to define the node: :: - mkdef -t node cn1 groups=openbmc,all mgt=openbmc cons=openbmc bmc=50.0.101.1 bmcusername=root bmcpassword=OpenBMC + mkdef -t node cn1 groups=openbmc,all mgt=openbmc cons=openbmc bmc=50.0.101.1 bmcusername=root bmcpassword=0penBmc -The manually defined node will be like this:: +The manually defined node will be :: # lsdef cn1 Object name: cn1 bmc=50.0.101.1 - bmcpassword=OpenBMC + bmcpassword=0penBmc bmcusername=root cons=openbmc groups=openbmc,all @@ -35,14 +35,14 @@ Hardware Management Remote Power Control ```````````````````` -The next important thing is to control the power of a remote physical machine. For this purpose, ``rpower`` command is involved. :: +``rpower`` command can be used to control the power of a remote physical machine. :: rpower cn1 on rpower cn1 off rpower cn1 boot rpower cn1 reset -Get the current rpower state of a machine, refer to the example below. :: +To get the current rpower state of a machine: :: # rpower cn1 state cn1: on @@ -50,11 +50,11 @@ Get the current rpower state of a machine, refer to the example below. :: Remote Console `````````````` -In order to get the command line console remotely. xCAT provides the ``rcons`` command. +``rcons`` command can be used to get command line remote console. -#. Make sure the ``conserver`` is configured by running ``makeconservercf``. +#. Make sure the ``conserver`` is configured by running ``makeconservercf cn1``. -#. After that, you can get the command line console for a specific machine with the ``rcons`` command :: +#. Start command line remote console: :: rcons cn1 From e4ddeacf105c5b2e8d442349b535d82cdf15f3f4 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 19 Apr 2017 21:25:16 -0400 Subject: [PATCH 044/162] This case is to verify bug 2225 to test rmimage could work correctly to remove all image files. The case bug is #2829 --- xCAT-test/autotest/testcase/rmimage/case0 | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 xCAT-test/autotest/testcase/rmimage/case0 diff --git a/xCAT-test/autotest/testcase/rmimage/case0 b/xCAT-test/autotest/testcase/rmimage/case0 new file mode 100644 index 000000000..c87c1ec3a --- /dev/null +++ b/xCAT-test/autotest/testcase/rmimage/case0 @@ -0,0 +1,26 @@ +start:genimage_stateless +descriptiion:This case is to verify bug 2225 to test rmimage could work correctly to remove all image files. +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute.bak;fi +cmd:copycds $$ISO +check:rc==0 +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 +check:rc==0 +cmd:rmimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +check:output=~Removing directory /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +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.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. +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc!=0 +check:output=~kernel cannot be found at /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/kernel +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute.bak/;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute;fi +end From fd3e9f3d18e553bf24ebc4a550a2e6f1185dedfc Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 20 Apr 2017 13:06:27 +0800 Subject: [PATCH 045/162] Ignore groups inheritance for ppcdirect table as the special desgin (#2893) This patch aims to fix the error from automation testcase `chdef_multiple_keys` due to the changes to support groups inheritance for switches table. As the strange design about access_tabentry, ppcdirect works like site table and must not support groups. Close-issue: #2450 --- perl-xCAT/xCAT/DBobjUtils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 5c9679688..0bc7e2286 100755 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -490,7 +490,7 @@ sub getobjdefs # The %tabhash is for performance considerations my $tabspec = $xCAT::Schema::tabspec{$lookup_table}; my $nodecol = $tabspec->{'nodecol'} if defined($tabspec->{'nodecol'}); - if (($lookup_attr eq 'node' && $objtype eq 'node') || (defined($nodecol) && $objtype eq 'node')) { + if (($lookup_attr eq 'node' && $objtype eq 'node') || (defined($nodecol) && $objtype eq 'node' && $lookup_table ne 'ppcdirect')) { if (defined($tabhash{$lookup_table}{$objname}{$tabattr})) { if ($verbose == 1) { $objhash{$objname}{$attr} = "$tabhash{$lookup_table}{$objname}{$tabattr}\t(Table:$lookup_table - Key:$lookup_attr - Column:$tabattr)"; From a7bcc3585d2b12d9afbbbdeb43f314f5180e0e92 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 20 Apr 2017 03:10:30 -0400 Subject: [PATCH 046/162] update case name --- xCAT-test/autotest/testcase/rmimage/case0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/rmimage/case0 b/xCAT-test/autotest/testcase/rmimage/case0 index c87c1ec3a..8f5f39415 100644 --- a/xCAT-test/autotest/testcase/rmimage/case0 +++ b/xCAT-test/autotest/testcase/rmimage/case0 @@ -1,4 +1,4 @@ -start:genimage_stateless +start:rmimage_diskless_bug2225 descriptiion:This case is to verify bug 2225 to test rmimage could work correctly to remove all image files. cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute.bak;fi cmd:copycds $$ISO From 95188a68560424b630f234cb0350fb625eff695b Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 20 Apr 2017 16:58:38 +0800 Subject: [PATCH 047/162] Add test case to verify the github issue #2637 --- xCAT-test/autotest/testcase/xdcp/cases1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 xCAT-test/autotest/testcase/xdcp/cases1 diff --git a/xCAT-test/autotest/testcase/xdcp/cases1 b/xCAT-test/autotest/testcase/xdcp/cases1 new file mode 100644 index 000000000..7303f8f3c --- /dev/null +++ b/xCAT-test/autotest/testcase/xdcp/cases1 @@ -0,0 +1,22 @@ +start:xdcp_github_issue2637 +cmd:useradd -m xyzzy +check:rc==0 +cmd:( cd ~ && tar cf - .xcat .ssh ) | ( cd ~xyzzy && tar xf - ) +check:rc==0 +cmd:chown -R xyzzy ~xyzzy/.xcat ~xyzzy/.ssh +check:rc==0 +cmd:xdsh $$CN "useradd -m xyzzy" +check:rc==0 +cmd:xdsh $$CN "( cd ~ && tar cf - .ssh ) | ( cd ~xyzzy && tar xf - )" +check:rc==0 +cmd:xdsh $$CN "chown -R xyzzy ~xyzzy/.ssh" +check:rc==0 +cmd:su -c "xdcp $$CN /etc/sysctl.conf /tmp/sysctl.conf" - xyzzy +check:rc==0 +cmd:xdsh $$CN "stat -c '%U' /tmp/sysctl.conf" +check:output=~xyzzy +cmd:xdsh $$CN "userdel xyzzy" +check:rc==0 +cmd:userdel xyzzy +check:rc==0 +end From d8cd40ff09b891eac411c1f5751b24ef71a8b8f5 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 20 Apr 2017 07:49:44 -0400 Subject: [PATCH 048/162] modify installation testcases for issue:2834 --- .../testcase/installation/SN_setup_case | 10 ++------- .../reg_linux_diskfull_installation_flat | 14 +++++------- .../reg_linux_diskfull_installation_hierarchy | 21 +++++++++--------- .../reg_linux_diskless_installation_flat | 14 +++++------- .../reg_linux_diskless_installation_hierarchy | 20 +++++++++-------- .../reg_linux_statelite_installation_flat | 15 ++----------- ...ux_statelite_installation_hierarchy_by_nfs | 21 +++++++----------- ...tatelite_installation_hierarchy_by_ramdisk | 22 +++++++++---------- 8 files changed, 54 insertions(+), 83 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 862fb291c..2f75d1ca2 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -1,14 +1,8 @@ start:SN_setup_case os:Linux -cmd:df -check:rc==0 cmd:fdisk -l check:rc==0 -cmd:cat /proc/meminfo -check:rc==0 -cmd:cat /proc/cpuinfo -check:rc==0 - +cmd:df -T cmd:XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ check:rc==0 @@ -30,7 +24,7 @@ cmd:makedhcp -a check:rc==0 cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi check:output=~$$SN -cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi check:rc==0 cmd:chdef -t node $$SN groups=service,all check:rc==0 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 4dbf7365b..5b807cd76 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -1,12 +1,8 @@ start:reg_linux_diskfull_installation_flat os:Linux -cmd:df -check:rc==0 cmd:fdisk -l check:rc==0 -cmd:cat /proc/meminfo -check:rc==0 -cmd:cat /proc/cpuinfo +cmd:df -T check:rc==0 cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:MINIISO=NUll;if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]];then mkdir /tmp/iso; mount -o loop $$MINIISO /tmp/iso ; mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot; cp /tmp/iso/install/initrd.gz /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot;umount /tmp/iso; rmdir /tmp/iso; fi @@ -36,11 +32,11 @@ check:rc==0 cmd:sleep 10 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; +cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/tmp/test.synclist check:rc==0 cmd:if ! ([[ "__GETNODEATTR($$CN,os)__" = "sles12.1" ]] || [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" && "__GETNODEATTR($$CN,arch)__" = "x86_64" ]]) ; then chdef -t node -o $$CN postscripts=setupntp; fi @@ -77,6 +73,6 @@ check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /tmp/test.synclist" check:rc==0 -cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi -cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=" " +cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv -f /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/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 ac832a2df..36c9a7f02 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -1,12 +1,15 @@ start:reg_linux_diskfull_installation_hierarchy os:Linux -cmd:df +cmd:xdsh $$SN fdisk -l check:rc==0 -cmd:fdisk -l +cmd:xdsh $$SN df -T check:rc==0 -cmd:cat /proc/meminfo +cmd:xdsh $$SN "echo "test"> /test.hierarchy" check:rc==0 -cmd:cat /proc/cpuinfo +cmd:xdsh $$SN cat /test.hierarchy +check:rc==0 +check:output=~test +cmd:xdsh $$SN rm -rf /test.hierarchy check:rc==0 cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 @@ -31,12 +34,11 @@ cmd:makedhcp -a check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" check:rc==0 - cmd:copycds $$ISO check:rc==0 -cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; +cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/tmp/test.synclist check:rc==0 cmd:updatenode $$CN -f @@ -67,7 +69,6 @@ check:rc==0 cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /tmp/test.synclist" check:rc==0 -cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi -cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=" " - +cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv -f /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/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 bc260728d..41fc0d0af 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -1,12 +1,8 @@ start:reg_linux_diskless_installation_flat os:Linux -cmd:df -check:rc==0 cmd:fdisk -l check:rc==0 -cmd:cat /proc/meminfo -check:rc==0 -cmd:cat /proc/cpuinfo +cmd:df -T check:rc==0 cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -26,14 +22,14 @@ cmd:makedhcp -a check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi check:rc==0 cmd:copycds $$ISO 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 ]; then mv $rootimgdir $rootimgdir.regbak -f;fi check:rc==0 -cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; +cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/tmp/test.synclist check:rc==0 cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi @@ -78,7 +74,7 @@ check:rc==0 cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "cat /tmp/test.synclist" check:rc==0 -cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi -cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=" " +cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv -f /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi +cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 end 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 d506e8bf8..62265bed4 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -1,12 +1,15 @@ start:reg_linux_diskless_installation_hierarchy os:Linux -cmd:df +cmd:xdsh $$SN fdisk -l check:rc==0 -cmd:fdisk -l +cmd:xdsh $$SN df -T check:rc==0 -cmd:cat /proc/meminfo +cmd:xdsh $$SN "echo "test"> /test.hierarchy" check:rc==0 -cmd:cat /proc/cpuinfo +cmd:xdsh $$SN cat /test.hierarchy +check:rc==0 +check:output=~test +cmd:xdsh $$SN rm -rf /test.hierarchy check:rc==0 cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 @@ -30,15 +33,14 @@ cmd:service dhcpd restart check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" check:rc==0 - cmd:copycds $$ISO 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 ]; then mv $rootimgdir $rootimgdir.regbak;fi check:rc==0 -cmd:if [[ -f /tmp/test.synclist ]] ;then mv /tmp/test.synclist /tmp/test.synclist.bak;fi; +cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/tmp/test.synclist check:rc==0 cmd:updatenode $$CN -f @@ -73,7 +75,7 @@ cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,ar check:rc==0 cmd:xdsh $$CN "cat /tmp/test.synclist" check:rc==0 -cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi -cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=" " +cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv -f /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi +cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 end 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 7738a7ec3..3a52fe1f9 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -1,12 +1,8 @@ start:reg_linux_statelite_installation_flat os:Linux -cmd:df -check:rc==0 cmd:fdisk -l check:rc==0 -cmd:cat /proc/meminfo -check:rc==0 -cmd:cat /proc/cpuinfo +cmd:df -T check:rc==0 cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -23,7 +19,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi check:rc==0 cmd:copycds $$ISO @@ -56,13 +52,6 @@ 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 ]; then mv $rootimgdir $rootimgdir.regbak;fi check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -d /install/custom/netboot/rh ]; then mkdir -p /install/custom/netboot/rh; fi;fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -e /install/custom/netboot/rh/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/rh/compute.synclist; fi;fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute synclists=/install/custom/netboot/sles/compute.synclist rootfstype=; elif cat /etc/*release |grep "Red Hat" >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute synclists=/install/custom/netboot/rh/compute.synclist rootfstype=; fi -check:rc==0 - cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute 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 a40c9d7e6..d2ed76204 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 @@ -1,12 +1,15 @@ start:reg_linux_statelite_installation_hierarchy_by_nfs os:Linux -cmd:df +cmd:xdsh $$SN fdisk -l check:rc==0 -cmd:fdisk -l +cmd:xdsh $$SN df -T check:rc==0 -cmd:cat /proc/meminfo +cmd:xdsh $$SN "echo "test"> /test.hierarchy" check:rc==0 -cmd:cat /proc/cpuinfo +cmd:xdsh $$SN cat /test.hierarchy +check:rc==0 +check:output=~test +cmd:xdsh $$SN rm -rf /test.hierarchy check:rc==0 cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN @@ -25,9 +28,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" check:rc==0 - cmd:copycds $$ISO check:rc==0 cmd:xdsh $$SN df|grep /install;if [ $? -eq 0 ] ;then xdsh $$SN umount /install;fi @@ -62,13 +64,6 @@ 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 ]; then mv $rootimgdir $rootimgdir.regbak;fi check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -d /install/custom/netboot/rh ]; then mkdir -p /install/custom/netboot/rh; fi;fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -e /install/custom/netboot/rh/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/rh/compute.synclist; fi;fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute synclists=/install/custom/netboot/sles/compute.synclist rootfstype=; elif cat /etc/*release |grep "Red Hat" >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute synclists=/install/custom/netboot/rh/compute.synclist rootfstype=; fi -check:rc==0 - cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute 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 4cce48c31..5cd5fd69f 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 @@ -2,11 +2,17 @@ start:reg_linux_statelite_installation_hierarchy_by_ramdisk os:Linux cmd:df check:rc==0 -cmd:fdisk -l +cmd:xdsh $$SN fdisk -l check:rc==0 -cmd:cat /proc/meminfo +cmd:xdsh $$SN df -T +check:rc==0 +cmd:xdsh $$SN "echo "test"> /test.hierarchy" +check:rc==0 +cmd:xdsh $$SN cat /test.hierarchy +check:rc==0 +check:output=~test +cmd:xdsh $$SN rm -rf /test.hierarchy check:rc==0 -cmd:cat /proc/cpuinfo check:rc==0 cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 @@ -24,7 +30,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:if cat /var/lib/*/dhcpd.leases ;then exit 0 ;else cat /var/lib/*/*/dhcpd.leases;fi +cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" check:rc==0 cmd:copycds $$ISO check:rc==0 @@ -59,14 +65,6 @@ 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 ]; then mv $rootimgdir $rootimgdir.regbak;fi check:rc==0 - -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -d /install/custom/netboot/rh ]; then mkdir -p /install/custom/netboot/rh; fi;fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -e /install/custom/netboot/rh/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/rh/compute.synclist; fi;fi -check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute synclists=/install/custom/netboot/sles/compute.synclist rootfstype=; elif cat /etc/*release |grep "Red Hat" >/dev/null;then chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute synclists=/install/custom/netboot/rh/compute.synclist rootfstype=; fi -check:rc==0 - cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute rootfstype=ramdisk check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute From 37fe7dc16e30725c7903b706a9661f3124256fdf Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 20 Apr 2017 09:08:58 -0400 Subject: [PATCH 049/162] modify installation testcases for issue:2834 --- .../testcase/installation/SN_setup_case | 4 +--- .../reg_linux_diskfull_installation_flat | 5 +---- .../reg_linux_diskfull_installation_hierarchy | 8 ++------ .../reg_linux_diskless_installation_flat | 5 +---- .../reg_linux_diskless_installation_hierarchy | 9 ++------- .../reg_linux_statelite_installation_flat | 15 ++++----------- ...ux_statelite_installation_hierarchy_by_nfs | 17 ++++------------- ...tatelite_installation_hierarchy_by_ramdisk | 19 ++++--------------- 8 files changed, 19 insertions(+), 63 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 2f75d1ca2..271427394 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -1,7 +1,6 @@ start:SN_setup_case os:Linux cmd:fdisk -l -check:rc==0 cmd:df -T cmd:XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ check:rc==0 @@ -24,8 +23,6 @@ cmd:makedhcp -a check:rc==0 cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi check:output=~$$SN -cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi -check:rc==0 cmd:chdef -t node $$SN groups=service,all check:rc==0 cmd:chdef -t group -o service profile=service primarynic=mac installnic=mac @@ -62,6 +59,7 @@ cmd:rinstall $$SN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-in check:rc==0 check:output=~Provision node\(s\)\: $$SN +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/customize_sleep_for_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ cmd:ping $$SN -c 3 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 5b807cd76..9b049d443 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -1,9 +1,7 @@ start:reg_linux_diskfull_installation_flat os:Linux cmd:fdisk -l -check:rc==0 cmd:df -T -check:rc==0 cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:MINIISO=NUll;if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]] && [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64le" ]];then mkdir /tmp/iso; mount -o loop $$MINIISO /tmp/iso ; mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot; cp /tmp/iso/install/initrd.gz /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot;umount /tmp/iso; rmdir /tmp/iso; fi check:rc==0 @@ -32,8 +30,6 @@ check:rc==0 cmd:sleep 10 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi -check:rc==0 cmd:copycds $$ISO check:rc==0 cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; @@ -46,6 +42,7 @@ check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 check:output=~Provision node\(s\)\: $$CN +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done cmd:ping $$CN -c 3 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 36c9a7f02..86bb3d642 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -1,16 +1,13 @@ start:reg_linux_diskfull_installation_hierarchy os:Linux cmd:xdsh $$SN fdisk -l -check:rc==0 cmd:xdsh $$SN df -T -check:rc==0 cmd:xdsh $$SN "echo "test"> /test.hierarchy" check:rc==0 cmd:xdsh $$SN cat /test.hierarchy check:rc==0 check:output=~test -cmd:xdsh $$SN rm -rf /test.hierarchy -check:rc==0 +cmd:output=$(xdsh $$SN ls -al / |grep test.hierarchy);if [[ $? -eq 0 ]];then xdsh $$SN rm -rf /test.hierarchy;fi cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 cmd:chdef -t node $$SN groups=service,all @@ -34,8 +31,6 @@ cmd:makedhcp -a check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" -check:rc==0 cmd:copycds $$ISO check:rc==0 cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; @@ -47,6 +42,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-in check:rc==0 check:output=~Provision node\(s\)\: $$CN +cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc" ]]; then sleep 120;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then sleep 200;else sleep 180;fi #cmd:lsdef -l $$CN | grep status 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 41fc0d0af..2be3ffabb 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -1,9 +1,7 @@ start:reg_linux_diskless_installation_flat os:Linux cmd:fdisk -l -check:rc==0 cmd:df -T -check:rc==0 cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -22,8 +20,6 @@ cmd:makedhcp -a check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi -check:rc==0 cmd:copycds $$ISO check:rc==0 @@ -49,6 +45,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-ne check:rc==0 check:output=~Provision node\(s\)\: $$CN +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done 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 62265bed4..db86b5019 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -1,18 +1,14 @@ start:reg_linux_diskless_installation_hierarchy os:Linux cmd:xdsh $$SN fdisk -l -check:rc==0 cmd:xdsh $$SN df -T -check:rc==0 cmd:xdsh $$SN "echo "test"> /test.hierarchy" check:rc==0 cmd:xdsh $$SN cat /test.hierarchy check:rc==0 check:output=~test -cmd:xdsh $$SN rm -rf /test.hierarchy -check:rc==0 +cmd:output=$(xdsh $$SN ls -al / |grep test.hierarchy);if [[ $? -eq 0 ]];then xdsh $$SN rm -rf /test.hierarchy;fi cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN -check:rc==0 cmd:chdef -t node $$SN groups=service,all check:rc==0 @@ -33,8 +29,6 @@ cmd:service dhcpd restart check:rc==0 cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" -check:rc==0 cmd:copycds $$ISO check:rc==0 @@ -55,6 +49,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-ne check:rc==0 check:output=~Provision node\(s\)\: $$CN +cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done 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 3a52fe1f9..f6d3dbdf9 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -1,9 +1,7 @@ start:reg_linux_statelite_installation_flat os:Linux cmd:fdisk -l -check:rc==0 cmd:df -T -check:rc==0 cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -19,8 +17,6 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi -check:rc==0 cmd:copycds $$ISO check:rc==0 @@ -61,6 +57,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-st check:rc==0 check:output=~Provision node\(s\)\: $$CN +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done @@ -99,7 +96,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-st check:rc==0 check:output=~Provision node\(s\)\: $$CN - +cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done @@ -122,12 +119,8 @@ check:rc==0 check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" -check:rc==0 -cmd:xdsh $$CN cat /test.statelite -check:rc==0 -check:output=~test -cmd:xdsh $$CN rm -rf /test.statelite -check:rc==0 +check:rc!=0 +cmd:output=$(xdsh $$CN ls -al / |grep test.statelite);if [[ $? -eq 0 ]];then xdsh $$CN rm -rf /test.tatelite;fi 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 d2ed76204..1f625da17 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 @@ -1,17 +1,13 @@ start:reg_linux_statelite_installation_hierarchy_by_nfs os:Linux cmd:xdsh $$SN fdisk -l -check:rc==0 cmd:xdsh $$SN df -T -check:rc==0 cmd:xdsh $$SN "echo "test"> /test.hierarchy" check:rc==0 cmd:xdsh $$SN cat /test.hierarchy check:rc==0 check:output=~test -cmd:xdsh $$SN rm -rf /test.hierarchy -check:rc==0 - +cmd:output=$(xdsh $$SN ls -al / |grep test.hierarchy);if [[ $? -eq 0 ]];then xdsh $$SN rm -rf /test.hierarchy;fi cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 cmd:chdef -t node $$SN groups=service,all @@ -28,8 +24,6 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" -check:rc==0 cmd:copycds $$ISO check:rc==0 cmd:xdsh $$SN df|grep /install;if [ $? -eq 0 ] ;then xdsh $$SN umount /install;fi @@ -75,6 +69,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-st check:rc==0 check:output=~Provision node\(s\)\: $$CN +cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done @@ -93,12 +88,8 @@ check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~compute/rootimg on / type nfs cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" -check:rc==0 -cmd:xdsh $$CN cat /test.statelite -check:rc==0 -check:output=~test -cmd:xdsh $$CN rm -rf /test.statelite -check:rc==0 +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 end 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 5cd5fd69f..27244bb27 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 @@ -1,19 +1,13 @@ start:reg_linux_statelite_installation_hierarchy_by_ramdisk os:Linux -cmd:df -check:rc==0 cmd:xdsh $$SN fdisk -l -check:rc==0 cmd:xdsh $$SN df -T -check:rc==0 cmd:xdsh $$SN "echo "test"> /test.hierarchy" check:rc==0 cmd:xdsh $$SN cat /test.hierarchy check:rc==0 check:output=~test -cmd:xdsh $$SN rm -rf /test.hierarchy -check:rc==0 -check:rc==0 +cmd:output=$(xdsh $$SN ls -al / |grep test.hierarchy);if [[ $? -eq 0 ]];then xdsh $$SN rm -rf /test.hierarchy;fi cmd:chdef -t node -o $$CN servicenode=$$SN monserver=$$SN nfsserver=$$SN tftpserver=$$SN xcatmaster=$$SN check:rc==0 cmd:chdef -t node $$SN groups=service,all @@ -30,8 +24,6 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" -check:rc==0 cmd:copycds $$ISO check:rc==0 cmd:xdsh $$SN df|grep /install;if [ $? -eq 0 ] ;then xdsh $$SN umount /install;fi @@ -79,6 +71,7 @@ cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-st check:rc==0 check:output=~Provision node\(s\)\: $$CN +cmd:xdsh $$SN "if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi" cmd:sleep 900 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done @@ -97,12 +90,8 @@ check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~rootfs on / type cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" -check:rc==0 -cmd:xdsh $$CN cat /test.statelite -check:rc==0 -check:output=~test -cmd:xdsh $$CN rm -rf /test.statelite -check:rc==0 +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.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 end From b02d149213c4787e54c705670e1ea1b1b8e838fd Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 19 Apr 2017 14:44:46 -0400 Subject: [PATCH 050/162] rflash --retry value should be treated as numeric --- xCAT-server/lib/xcat/plugins/ipmi.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 16fa35f48..ea6135b4a 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1863,7 +1863,7 @@ sub do_firmware_update { } if ($opt =~ /retry=/) { my ($attribute, $retry_value) = split(/=/, $opt); - if ($retry_value) { + if (defined $retry_value) { # retry option was passed in, reset the default $retry = $retry_value; } @@ -1941,14 +1941,19 @@ RETRY_UPGRADE: # report an error, exit to the caller and leave node in powered off state # otherwise report an error, power on the node and try upgrade again if ($::RUNCMD_RC != 0) { + # Since "hpm update" command in step 4 above redirects standard out and error to a log file, + # nothing gets returned from execution of the command. Here if RC is not zero, we + # extract all lines containing "Error" from that log file and display them in the sendmsg below + my $get_error_cmd = "/usr/bin/cat ".$rflash_log_file." | grep Error"; + $output = xCAT::Utils->runcmd($get_error_cmd, 0); if ($retry == 0) { # No more retries left, report and error and exit $exit_with_error_func->($sessdata->{node}, $callback, - "Running ipmitool command $cmd failed: $output"); + "Running ipmitool command $cmd failed:\n $output"); } else { # Error upgrading, set a flag to attempt a retry - xCAT::SvrUtils::sendmsg("Running ipmitool command $cmd failed: $output", $callback, $sessdata->{node}, %allerrornodes); + xCAT::SvrUtils::sendmsg("Running ipmitool command $cmd failed:\n $output", $callback, $sessdata->{node}, %allerrornodes); $failed_upgrade = 1; } From fb0ad9eda5af126f1e2f1c2c3b60c045bca5ae0c Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 20 Apr 2017 21:52:09 -0400 Subject: [PATCH 051/162] modified depending on comments --- .../guides/admin-guides/manage_clusters/openbmc/openbmc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst b/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst index e832593d4..54b460176 100644 --- a/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst +++ b/docs/source/guides/admin-guides/manage_clusters/openbmc/openbmc.rst @@ -1,7 +1,7 @@ Manually Define Nodes ===================== -**Manually Define Node** means if admin knows the detailed information of the physical server, ``mkdef`` command can be used to manually define it into xCAT database.. +If admin knows the detailed information of the physical server, ``mkdef`` command can be used to manually define it into xCAT database. In this document, the following configuration is used as an example From 75b86678b849e0636f261ceb84f4d7f20e7a5a23 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 21 Apr 2017 02:54:01 -0400 Subject: [PATCH 052/162] refine installation testcase for issue:2834 --- .../installation/reg_linux_statelite_installation_flat | 8 ++------ 1 file changed, 2 insertions(+), 6 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 f6d3dbdf9..73ccc9866 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -76,12 +76,8 @@ check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~compute/rootimg on / type nfs cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:xdsh $$CN "echo "test"> /test.statelite" -check:rc==0 -cmd:xdsh $$CN cat /test.statelite -check:rc==0 -check:output=~test -cmd:xdsh $$CN rm -rf /test.statelite -check:rc==0 +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 d5e706ec438dd1ba72a5319ef30f7ed7886c6349 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 21 Apr 2017 00:21:05 -0400 Subject: [PATCH 053/162] This case is to verify bug 2614. To support addkcmdline when netboot=xnba --- xCAT-test/autotest/testcase/nodeset/cases0 | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 3f81504ec..792ecbff2 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -173,3 +173,27 @@ check:output=~Warning: testnode1: petitboot might be invalid|testnode1 could not cmd:noderm testnode1 end +start:nodeset_addkcmdline_bug2614 +description: This case is to verify bug 2614. To support addkcmdline when netboot=xnba. +cmd:mkdef -t node -o testnode1 arch=x86_64 cons=kvm groups=kvm ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=kvm monserver=10.1.1.1 nameservers=10.1.1.1 profile=compute tftpserver=10.1.1.1 xcatmaster=10.1.1.1 +os=__GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:cp -f /etc/hosts /etc/hosts.bak +cmd:echo "10.1.1.200 testnode1" >> /etc/hosts +cmd:makedns -n +check:rc==0 +cmd:chdef testnode1 netboot=xnba addkcmdline=rd.break=pre-pivot +check:rc==0 +cmd: mkdef "__GETNODEATTR($$CN,os)__-x86_64-install-compute" -u profile=compute provmethod=install osvers=__GETNODEATTR($$CN,os)__ +check:rc==0 +cmd:nodeset testnode1 osimage=__GETNODEATTR($$CN,os)__-x86_64-install-compute +check:rc==0 +cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1 +check:rc==0 +cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1.elilo +check:rc==0 +cmd:noderm testnode1 +cmd:rmdef -t osimage -o "__GETNODEATTR($$CN,os)__-x86_64-install-compute" +cmd:cp -f /etc/hosts.bak /etc/hosts +end + From 1efc56bfb7b906f4ebcbc607b7fd2e07ae7abdff Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Fri, 21 Apr 2017 12:57:29 +0800 Subject: [PATCH 054/162] Using bulk operation to invoke makedhcp to imporve nodeset perforamnce (#2897) --- xCAT-server/lib/xcat/plugins/petitboot.pm | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index d40e60694..f99b41c92 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -545,21 +545,14 @@ sub process_request { if ($t_entry =~ /0|n|N/) { $do_dhcpsetup = 0; } } if ($do_dhcpsetup) { - foreach my $node (@normalnodeset) { - if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command - xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue makedhcp request"); - $sub_req->({ command => ['makedhcp'], - node => [$node], - arg => ['-l'] }, $callback); - - #arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback); - } else { - xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue makedhcp request"); - $sub_req->({ command => ['makedhcp'], - node => [$node] }, $callback); - - #arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback); - } + if ($::request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue makedhcp request"); + $sub_req->({ command => ['makedhcp'], arg => ['-l'], + node => \@normalnodeset }, $callback); + } else { + xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue makedhcp request"); + $sub_req->({ command => ['makedhcp'], + node => \@normalnodeset }, $callback); } } } From 73b6439f053e40e89eda635e39f2defb13fe0dca Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 21 Apr 2017 01:19:29 -0400 Subject: [PATCH 055/162] fix issue #2898 on ububuntu 14.4+ x86_64 diskless provision , failed to resolve hostname due to lack of libnss_dns.so.2 --- xCAT-server/share/xcat/netboot/ubuntu/genimage | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index c8e6d139d..f6c3ee2db 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -1657,9 +1657,12 @@ EOMS push @filestoadd, $_; } } + if ($arch =~ /x86_64/) { push @filestoadd, "lib64/libnss_dns.so.2"; + #the path of libnss_dns.so.2 for ubuntu 14.4+ + push @filestoadd, "lib/x86_64-linux-gnu/libnss_dns.so.2"; push @filestoadd, "lib64/libresolv.so.2"; } elsif ($arch =~ /ppc64el/) { push @filestoadd, "lib/powerpc64le-linux-gnu/libnss_files.so.2"; From 8c788946550c1b0a3bbcfe33951e57a6cc37d595 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 21 Apr 2017 01:50:50 -0400 Subject: [PATCH 056/162] Add attribute label to xcattest --- xCAT-test/xcattest | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index c77ae148e..30e940801 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -651,8 +651,9 @@ sub loadcase #skip comment lines next if ($line =~ /^\s*#/); - #TODO: description line is treated as a comment line for now + #TODO: description and attribute line is treated as a comment line for now next if ($line =~ /^description\s*:/); + next if ($line =~ /^attribute\s*:/); if ($line =~ /^start\s*:\s*(.*)/) { my $name =$1; From b9e36a58fc6ea113afc0b830791a605ac6b4a022 Mon Sep 17 00:00:00 2001 From: neo954 Date: Fri, 21 Apr 2017 14:10:10 +0800 Subject: [PATCH 057/162] [go-xcat] Fix repository query and force problem resolution for zypper (#2876) * [go-xcat] Fix the issue in upgrade on SLES as some packages vendor name is changed. --- xCAT-server/share/xcat/tools/go-xcat | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index a9d7da03f..b09adea6d 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.17 +# Version 1.0.19 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -517,8 +517,9 @@ function check_repo_version_zypper() do name+=("${name}") ver+=("${ver}") - done < <(zypper --no-gpg-checks -n search -u -s --match-exact "$@" \ - 2>/dev/null | awk -F ' *\\| *' '/ package / { print $2, $4 }') + done < <(zypper --no-gpg-checks -n search --match-exact -C -t package \ + -s "$@" 2>/dev/null | + awk -F ' +\\| +' '/ package / { if ("(" != substr($6, 0, 1)) print $2, $4 }') local -i i while [[ -n "$1" ]] do @@ -592,6 +593,7 @@ function get_package_list_yum() [[ -z "${repo_id}" ]] && return 1 repoquery -qa "--repoid=${repo_id}" --qf "%{name}" 2>/dev/null } + # $1 repo id function get_package_list_zypper() { @@ -599,7 +601,7 @@ function get_package_list_zypper() local repo_id="$1" [[ -z "${repo_id}" ]] && return 1 zypper --no-gpg-checks -n search -r "${repo_id}" 2>/dev/null | - awk -F ' *\\| *' '/ package$/ { print $2 }' + awk -F ' +\\| +' '/ package$/ { print $2 }' } # $1 repo id @@ -1180,7 +1182,7 @@ function install_packages_zypper() type zypper >/dev/null 2>&1 || return 255 local -a yes=() [[ "$1" = "-y" ]] && yes=("-n") && shift - zypper --no-gpg-checks "${yes[@]}" install "$@" + zypper --no-gpg-checks "${yes[@]}" install --force-resolution "$@" } function install_packages_apt() From 1919e5a1ed6bd64ce919e011a93c2a83772a69bb Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 21 Apr 2017 03:13:56 -0400 Subject: [PATCH 058/162] update according to comments --- xCAT-test/autotest/testcase/nodeset/cases0 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 792ecbff2..539a57bae 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -178,7 +178,7 @@ description: This case is to verify bug 2614. To support addkcmdline when netboo cmd:mkdef -t node -o testnode1 arch=x86_64 cons=kvm groups=kvm ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=kvm monserver=10.1.1.1 nameservers=10.1.1.1 profile=compute tftpserver=10.1.1.1 xcatmaster=10.1.1.1 os=__GETNODEATTR($$CN,os)__ check:rc==0 -cmd:cp -f /etc/hosts /etc/hosts.bak +cmd:cp -f /etc/hosts /etc/hosts.xcattestbak cmd:echo "10.1.1.200 testnode1" >> /etc/hosts cmd:makedns -n check:rc==0 @@ -194,6 +194,6 @@ cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1.elilo check:rc==0 cmd:noderm testnode1 cmd:rmdef -t osimage -o "__GETNODEATTR($$CN,os)__-x86_64-install-compute" -cmd:cp -f /etc/hosts.bak /etc/hosts +cmd:cp -f /etc/hosts.xcattestbak /etc/hosts end From 1b43f8cfcd2e95cd5c8b9b16b8f99a41c2da119b Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 20 Apr 2017 21:25:08 -0400 Subject: [PATCH 059/162] modified depending on comments --- xCAT-server/lib/xcat/plugins/openbmc.pm | 70 +++++++++++++++---------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index b0e69d671..eb4453d94 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -30,7 +30,7 @@ use JSON; sub unsupported { my $callback = shift; if (defined($::OPENBMC_DEVEL) && ($::OPENBMC_DEVEL eq "YES")) { - xCAT::SvrUtils::sendmsg("Warning: Currently running development code, use at your own risk. Unset XCAT_OPENBMC_DEVEL", $callback); + xCAT::SvrUtils::sendmsg("Warning: Currently running development code, use at your own risk. Unset XCAT_OPENBMC_DEVEL to disable.", $callback); return; } else { return ([ 1, "This openbmc related function is unsupported and disabled. To bypass, run the following: \n\texport XCAT_OPENBMC_DEVEL=YES" ]); @@ -160,6 +160,9 @@ my %status_info = ( }, ); +$::RESPONSE_OK = "200 OK"; +$::RESPONSE_SERVER_ERROR = "500 Internal Server Error"; +$::RESPONSE_SERVICE_UNAVAILABLE = "503 Service Unavailable"; #----------------------------- @@ -431,19 +434,14 @@ sub parse_command_status { $subcommand = "all"; } - if ($subcommand =~ /^cpu$|^dimm$|^model$|^serial$|^firm$|^mac$|^vpd$|^mprom$|^deviceid$|^guid$|^uuid$|^all$/) { - $next_status{LOGIN_RESPONSE} = "RINV_REQUEST"; - $next_status{RINV_REQUEST} = "RINV_RESPONSE"; - $status_info{RINV_RESPONSE}{argv} = "$subcommand"; - } + $next_status{LOGIN_RESPONSE} = "RINV_REQUEST"; + $next_status{RINV_REQUEST} = "RINV_RESPONSE"; + $status_info{RINV_RESPONSE}{argv} = "$subcommand"; } if ($command eq "rsetboot") { my $persistent = 0; - my $uefi = 0; - unless (GetOptions( - "p" => \$persistent, - )) { + unless (GetOptions("p" => \$persistent,)) { xCAT::SvrUtils::sendmsg([ 1, "Error parsing arguments" ], $callback); exit 1; } @@ -612,13 +610,13 @@ sub deal_with_response { print "$node: DEBUG " . lc ($node_info{$node}{cur_status}) . " " . $response->status_line . "\n"; - if ($response->status_line ne "200 OK") { + if ($response->status_line ne $::RESPONSE_OK) { my $error; - if ($response->status_line eq "503 Service Unavailable") { + if ($response->status_line eq $::RESPONSE_SERVICE_UNAVAILABLE) { $error = "Service Unavailable"; } else { my $response_info = decode_json $response->content; - if ($response->status_line eq "500 Internal Server Error") { + if ($response->status_line eq $::RESPONSE_SERVER_ERROR) { $error = $response_info->{'data'}->{'exception'}; } elsif ($response_info->{'data'}->{'description'} =~ /path or object not found: (.+)/) { $error = "path or object not found $1"; @@ -679,19 +677,19 @@ sub rpower_response { my $response_info = decode_json $response->content; if ($node_info{$node}{cur_status} eq "RPOWER_ON_RESPONSE") { - if ($response_info->{'message'} eq "200 OK") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("on", $callback, $node); } } if ($node_info{$node}{cur_status} eq "RPOWER_OFF_RESPONSE") { - if ($response_info->{'message'} eq "200 OK") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("off", $callback, $node); } } if ($node_info{$node}{cur_status} eq "RPOWER_RESET_RESPONSE") { - if ($response_info->{'message'} eq "200 OK") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("reset", $callback, $node); } } @@ -750,24 +748,38 @@ sub rinv_response { if (($grep_string eq "vpd" or $grep_string eq "model") and $key_url =~ /\/motherboard$/) { my $partnumber = "BOARD Part Number: " . "$content{PartNumber}"; xCAT::SvrUtils::sendmsg("$partnumber", $callback, $node); - next; - } elsif (($grep_string eq "vpd" or $grep_string eq "serial") and $key_url =~ /\/motherboard$/) { + next if ($grep_string eq "model"); + } + + if (($grep_string eq "vpd" or $grep_string eq "serial") and $key_url =~ /\/motherboard$/) { my $serialnumber = "BOARD Serial Number: " . "$content{SerialNumber}"; xCAT::SvrUtils::sendmsg("$serialnumber", $callback, $node); - next; - } elsif (($grep_string eq "vpd" or $grep_string eq "mprom")) { + next if ($grep_string eq "serial"); + } + + if (($grep_string eq "vpd" or $grep_string eq "mprom")) { # wait for interface - } elsif (($grep_string eq "vpd" or $grep_string eq "deviceid")) { + } + + if (($grep_string eq "vpd" or $grep_string eq "deviceid")) { # wait for interface - } elsif ($grep_string eq "uuid") { + } + + if ($grep_string eq "uuid") { # wait for interface - } elsif ($grep_string eq "guid") { + } + + if ($grep_string eq "guid") { # wait for interface - } elsif ($grep_string eq "mac" and $key_url =~ /\/ethernet/) { + } + + if ($grep_string eq "mac" and $key_url =~ /\/ethernet/) { my $macaddress = "MAC: " . $content{MACAddress}; xCAT::SvrUtils::sendmsg("$macaddress", $callback, $node); next; - } elsif ($grep_string eq "all" or $key_url =~ /\/$grep_string/ or ($grep_string eq "firm" and defined($content{Name}) and $content{Name} eq "OpenPOWER Firmware")) { + } + + if ($grep_string eq "all" or $key_url =~ /\/$grep_string/ or ($grep_string eq "firm" and defined($content{Name}) and $content{Name} eq "OpenPOWER Firmware")) { if ($key_url =~ /\/(cpu\d*)\/(\w+)/) { $src = "$1 $2"; } else { @@ -838,25 +850,25 @@ sub rsetboot_response { my $response_info = decode_json $response->content; if ($node_info{$node}{cur_status} eq "RSETBOOT_HD_RESPONSE") { - if ($response_info->{'message'} eq "200 OK") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("Hard Drive", $callback, $node); } } if ($node_info{$node}{cur_status} eq "RSETBOOT_NET_RESPONSE") { - if ($response_info->{'message'} eq "200 OK") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("Network", $callback, $node); } } if ($node_info{$node}{cur_status} eq "RSETBOOT_CD_RESPONSE") { - if ($response_info->{'message'} eq "200 OK") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("CD/DVD", $callback, $node); } } if ($node_info{$node}{cur_status} eq "RSETBOOT_DEF_RESPONSE") { - if ($response_info->{'message'} eq "200 OK") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("boot override inactive", $callback, $node); } } From c72a77f7008c5c63312e7f11740b83c38d24fbe7 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 21 Apr 2017 04:06:23 -0400 Subject: [PATCH 060/162] rename basic_cases.bundle to MN_basic.bundle --- xCAT-test/autotest/bundle/{basic_cases.bundle => MN_basic.bundle} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename xCAT-test/autotest/bundle/{basic_cases.bundle => MN_basic.bundle} (100%) diff --git a/xCAT-test/autotest/bundle/basic_cases.bundle b/xCAT-test/autotest/bundle/MN_basic.bundle similarity index 100% rename from xCAT-test/autotest/bundle/basic_cases.bundle rename to xCAT-test/autotest/bundle/MN_basic.bundle From 016c9e853094ce7a982d00e0877c659e56d7a484 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 21 Apr 2017 16:22:25 +0800 Subject: [PATCH 061/162] =?UTF-8?q?For=20issue=20xCAT=20Object=20Name=20Fo?= =?UTF-8?q?rmat=20error=20when=20trying=20to=20name=20osimages=20=E2=80=A6?= =?UTF-8?q?=20(#2902)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * For issue xCAT Object Name Format error when trying to name osimages starting with rhels7.3 #2157 * For issue xCAT Object Name Format error when trying to name osimages starting with rhels7.3 #2157 * For issue xCAT Object Name Format error when trying to name osimages starting with rhels7.3 #2157 * For issue xCAT Object Name Format error when trying to name osimages starting with rhels7.3 #2157 * For issue xCAT Object Name Format error when trying to name osimages starting with rhels7.3 #2157 --- xCAT-test/autotest/testcase/mkdef/cases0 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index 9595e6e22..38bfacf91 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -324,3 +324,26 @@ check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-comput cmd:rmdef -t osimage -o test-osimage_with_template check:rc==0 end +start:mkdef_rhels73 +os:linux +description:create rhels7.3 osimage +cmd:mkdef -t osimage -o rhels7.3-test-osimage --template __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +output=~1 object definitions have been created or modified +cmd:rmdef -t osimage -o rhels7.3-test-osimage +check:rc==0 +cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -z > /tmp/osiamge.stanza +check:rc==0 +cmd:cat /tmp/osiamge.stanza |sed 's/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute:/rhels7.3-test:/g' >/tmp/osiamge.stanza1 +check:rc==0 +cmd:cat /tmp/osiamge.stanza1|mkdef -z +check:rc==0 +cmd:rm -rf /tmp/osiamge.stanza;rm -rf /tmp/osiamge.stanza1 +check:rc==0 +cmd:lsdef -t osimage -o rhels7.3-test |grep "Object name: rhels7.3-test" +check:rc==0 +cmd:lsdef -t osimage -o rhels7.3-test |grep pkgdir= +check:rc==0 +cmd:rmdef -t osimage -o rhels7.3-test +check:rc==0 +end From 465f99e768ceb6d17fb6ed407b8a1ffd6d4aaf51 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 21 Apr 2017 04:41:13 -0400 Subject: [PATCH 062/162] update according to comments --- xCAT-test/autotest/testcase/nodeset/cases0 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 539a57bae..91bd23af0 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -173,8 +173,8 @@ check:output=~Warning: testnode1: petitboot might be invalid|testnode1 could not cmd:noderm testnode1 end -start:nodeset_addkcmdline_bug2614 -description: This case is to verify bug 2614. To support addkcmdline when netboot=xnba. +start:nodeset_addkcmdline +description: This case is to verify when netboot=xnba, addkcmdline is correctly supported. cmd:mkdef -t node -o testnode1 arch=x86_64 cons=kvm groups=kvm ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=kvm monserver=10.1.1.1 nameservers=10.1.1.1 profile=compute tftpserver=10.1.1.1 xcatmaster=10.1.1.1 os=__GETNODEATTR($$CN,os)__ check:rc==0 @@ -188,9 +188,7 @@ cmd: mkdef "__GETNODEATTR($$CN,os)__-x86_64-install-compute" -u profile=compute check:rc==0 cmd:nodeset testnode1 osimage=__GETNODEATTR($$CN,os)__-x86_64-install-compute check:rc==0 -cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1 -check:rc==0 -cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1.elilo +cmd:find -L /tftpboot -name '*testnode1*' -exec cat {} + | grep "rd.break=pre-pivot" check:rc==0 cmd:noderm testnode1 cmd:rmdef -t osimage -o "__GETNODEATTR($$CN,os)__-x86_64-install-compute" From 1ce6191e768e23fa7f3079a4cec9b18cab0a8779 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 21 Apr 2017 04:43:18 -0400 Subject: [PATCH 063/162] remove invalid case --- xCAT-test/autotest/testcase/nodeset/cases1 | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 xCAT-test/autotest/testcase/nodeset/cases1 diff --git a/xCAT-test/autotest/testcase/nodeset/cases1 b/xCAT-test/autotest/testcase/nodeset/cases1 deleted file mode 100644 index 816f4ee59..000000000 --- a/xCAT-test/autotest/testcase/nodeset/cases1 +++ /dev/null @@ -1,9 +0,0 @@ -start:nodeset_addkcmdline -cmd:chdef $$CN addkcmdline=debug -check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -check:rc==0 -cmd:find -L /tftpboot -name '*$$CN*' -exec cat {} + | grep debug -check:rc==0 -cmd:chdef $$CN addkcmdline= -end From 4228ec1efba82749e19738f2c301c68b6f8837d0 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 21 Apr 2017 04:56:56 -0400 Subject: [PATCH 064/162] update for comments --- xCAT-test/autotest/testcase/nodeset/cases0 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 91bd23af0..6972152d3 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -188,7 +188,9 @@ cmd: mkdef "__GETNODEATTR($$CN,os)__-x86_64-install-compute" -u profile=compute check:rc==0 cmd:nodeset testnode1 osimage=__GETNODEATTR($$CN,os)__-x86_64-install-compute check:rc==0 -cmd:find -L /tftpboot -name '*testnode1*' -exec cat {} + | grep "rd.break=pre-pivot" +cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1 +check:rc==0 +cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1.elilo check:rc==0 cmd:noderm testnode1 cmd:rmdef -t osimage -o "__GETNODEATTR($$CN,os)__-x86_64-install-compute" From 524c416208d6e89ff4b34794417419709181a4f2 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 21 Apr 2017 05:00:45 -0400 Subject: [PATCH 065/162] remove bug number in case --- xCAT-test/autotest/testcase/rmimage/case0 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/rmimage/case0 b/xCAT-test/autotest/testcase/rmimage/case0 index 8f5f39415..a5f1ea566 100644 --- a/xCAT-test/autotest/testcase/rmimage/case0 +++ b/xCAT-test/autotest/testcase/rmimage/case0 @@ -1,5 +1,5 @@ -start:rmimage_diskless_bug2225 -descriptiion:This case is to verify bug 2225 to test rmimage could work correctly to remove all image files. +start:rmimage_diskless +descriptiion:This case is to test rmimage could work correctly to remove all image files. cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute.bak;fi cmd:copycds $$ISO check:rc==0 From 02c8a0d92c967b41cd7f229f21878ffd29f1f406 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 24 Apr 2017 14:48:19 +0800 Subject: [PATCH 066/162] Change test case name --- xCAT-test/autotest/testcase/xdcp/cases1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/xdcp/cases1 b/xCAT-test/autotest/testcase/xdcp/cases1 index 7303f8f3c..c27c54d1e 100644 --- a/xCAT-test/autotest/testcase/xdcp/cases1 +++ b/xCAT-test/autotest/testcase/xdcp/cases1 @@ -1,4 +1,4 @@ -start:xdcp_github_issue2637 +start:xdcp_nonroot_user cmd:useradd -m xyzzy check:rc==0 cmd:( cd ~ && tar cf - .xcat .ssh ) | ( cd ~xyzzy && tar xf - ) From 40441d9e7180a37ea84b6d139b43bac417f9e26d Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 24 Apr 2017 02:32:10 -0400 Subject: [PATCH 067/162] support reventlog command for openbmc --- xCAT-server/lib/xcat/plugins/openbmc.pm | 164 +++++++++++++++++++++--- 1 file changed, 143 insertions(+), 21 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index eb4453d94..1672f244b 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -15,17 +15,19 @@ use lib "$::XCATROOT/lib/perl"; use strict; use warnings "all"; +use JSON; use HTTP::Async; use HTTP::Cookies; +use File::Basename; +use Data::Dumper; +use Getopt::Long; use xCAT::OPENBMC; use xCAT::Utils; use xCAT::Table; use xCAT::Usage; use xCAT::SvrUtils; -use File::Basename; -use Data::Dumper; -use Getopt::Long; -use JSON; +use xCAT::GlobalDef; +use xCAT_monitoring::monitorctrl; sub unsupported { my $callback = shift; @@ -158,6 +160,21 @@ my %status_info = ( RSETBOOT_STATUS_RESPONSE => { process => \&rsetboot_response, }, + REVENTLOG_REQUEST => { + method => "GET", + init_url => "$openbmc_project_url/logging/enumerate", + }, + REVENTLOG_RESPONSE => { + process => \&reventlog_response, + }, + REVENTLOG_CLEAR_REQUEST => { + method => "POST", + init_url => "$openbmc_url/records/events/action/clear", + data => "", + }, + REVENTLOG_CLEAR_RESPONSE => { + process => \&reventlog_response, + }, ); $::RESPONSE_OK = "200 OK"; @@ -279,15 +296,17 @@ sub process_request { parse_node_info($noderange); parse_command_status($command); - $cookie_jar = HTTP::Cookies->new({}); - $async = HTTP::Async->new( - cookie_jar => $cookie_jar, - timeout => 10, - max_request_time => 60, - ssl_options => { - SSL_verify_mode => 0, - }, - ); + if ($request->{command}->[0] ne "getopenbmccons") { + $cookie_jar = HTTP::Cookies->new({}); + $async = HTTP::Async->new( + cookie_jar => $cookie_jar, + timeout => 10, + max_request_time => 60, + ssl_options => { + SSL_verify_mode => 0, + }, + ); + } my $bmcip; my $login_url; @@ -298,13 +317,17 @@ sub process_request { foreach my $node (keys %node_info) { $bmcip = $node_info{$node}{bmc}; - $login_url = "$http_protocol://$bmcip/login"; - $content = '{"data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; - $handle_id = xCAT::OPENBMC->new($async, $login_url, $content); - $handle_id_node{$handle_id} = $node; - $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; - print "$node: DEBUG POST $login_url -d $content\n"; - push @donargs, [ $node,$bmcip,$node_info{$node}{username}, $node_info{$node}{password}]; + + if ($request->{command}->[0] eq "getopenbmccons") { + push @donargs, [ $node,$bmcip,$node_info{$node}{username}, $node_info{$node}{password}]; + } else { + $login_url = "$http_protocol://$bmcip/login"; + $content = '{"data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; + $handle_id = xCAT::OPENBMC->new($async, $login_url, $content); + $handle_id_node{$handle_id} = $node; + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + print "$node: DEBUG POST $login_url -d $content\n"; + } } #process rcons @@ -340,7 +363,7 @@ sub parse_args { my $extrargs = shift; my $check = undef; - if (scalar(@ARGV) > 1 and $command ne "rsetboot") { + if (scalar(@ARGV) > 1 and $command ne "rsetboot" and $command ne "reventlog") { return ([ 1, "Only one option is supported at the same time" ]); } @@ -380,6 +403,16 @@ sub parse_args { unless ($subcommand =~ /^net$|^hd$|^cd$|^def$|^default$|^stat$/) { return ([ 1, "Unsupported command: $command $subcommand" ]); } + } elsif ($command eq "reventlog") { + # + # disable function until fully tested + # + $subcommand = "all" if (!defined($ARGV[0])); + $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } + unless ($subcommand =~ /^\d$|^\d+$|^all$|^clear$/) { + return ([ 1, "Unsupported command: $command $subcommand" ]); + } + } else { return ([ 1, "Command is not supported." ]); } @@ -471,6 +504,30 @@ sub parse_command_status { exit; } + if ($command eq "reventlog") { + my $option_s = 0; + unless (GetOptions("s" => \$option_s,)) { + xCAT::SvrUtils::sendmsg([ 1, "Error parsing arguments" ], $callback); + exit 1; + } + + if (defined($ARGV[0])) { + $subcommand = $ARGV[0]; + } else { + $subcommand = "all"; + } + + if ($subcommand eq "clear") { + $next_status{LOGIN_RESPONSE} = "REVENTLOG_CLEAR_REQUEST"; + $next_status{REVENTLOG_CLEAR_REQUEST} = "REVENTLOG_CLEAR_RESPONSE"; + } else { + $next_status{LOGIN_RESPONSE} = "REVENTLOG_REQUEST"; + $next_status{REVENTLOG_REQUEST} = "REVENTLOG_RESPONSE"; + $status_info{REVENTLOG_RESPONSE}{argv} = "$subcommand"; + $status_info{REVENTLOG_RESPONSE}{argv} .= ",s" if ($option_s); + } + } + print Dumper(\%next_status) . "\n"; } @@ -673,27 +730,33 @@ sub login_response { sub rpower_response { my $node = shift; my $response = shift; + my %new_status = (); my $response_info = decode_json $response->content; if ($node_info{$node}{cur_status} eq "RPOWER_ON_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("on", $callback, $node); + $new_status{$::STATUS_POWERING_ON} = [$node]; } } if ($node_info{$node}{cur_status} eq "RPOWER_OFF_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("off", $callback, $node); + $new_status{$::STATUS_POWERING_OFF} = [$node]; } } if ($node_info{$node}{cur_status} eq "RPOWER_RESET_RESPONSE") { if ($response_info->{'message'} eq $::RESPONSE_OK) { xCAT::SvrUtils::sendmsg("reset", $callback, $node); + $new_status{$::STATUS_POWERING_ON} = [$node]; } } + xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%new_status, 1) if (%new_status); + if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE" and !$next_status{ $node_info{$node}{cur_status} }) { if ($response_info->{'data'}->{CurrentHostState} =~ /Off$/) { xCAT::SvrUtils::sendmsg("off", $callback, $node); @@ -887,4 +950,63 @@ sub rsetboot_response { return; } +#------------------------------------------------------- + +=head3 reventlog_response + + Deal with response of reventlog command + Input: + $node: nodename of current response + $response: Async return response + +=cut + +#------------------------------------------------------- +sub reventlog_response { + my $node = shift; + my $response = shift; + + my $response_info = decode_json $response->content; + + if ($node_info{$node}{cur_status} eq "REVENTLOG_CLEAR_REQUEST") { + if ($response_info->{'message'} eq $::RESPONSE_OK) { + xCAT::SvrUtils::sendmsg("clear", $callback, $node); + } + } else { + my ($entry_string, $option_s) = split(",", $status_info{REVENTLOG_RESPONSE}{argv}); + my $content_info; + my %output_s = () if ($option_s); + my $entry_num = 0; + $entry_string = "all" if ($entry_string eq "0"); + $entry_num = 0 + $entry_string if ($entry_string ne "all"); + + foreach my $key_url (keys %{$response_info->{data}}) { + my %content = %{ ${ $response_info->{data} }{$key_url} }; + my $id_num = 0 + $content{Id} if ($content{Id}); + if (($entry_string eq "all" or ($id_num and ($entry_num ge $id_num))) and $content{Message}) { + my $content_info = $content{Timestamp} . " " . $content{Message}; + if ($option_s) { + $output_s{$id_num} = $content_info; + $entry_num = $id_num if ($entry_num < $id_num); + } else { + xCAT::SvrUtils::sendmsg("$content_info", $callback, $node); + } + } + } + + if (%output_s) { + for (my $key = $entry_num; $key >= 1; $key--) { + xCAT::SvrUtils::sendmsg("$output_s{$key}", $callback, $node) if ($output_s{$key}); + } + } + } + + if ($next_status{ $node_info{$node}{cur_status} }) { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + gen_send_request($node); + } else { + $wait_node_num--; + } +} + 1; From f503fb991f9c3339bc2a0aac24857b205911eafd Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 24 Apr 2017 17:21:24 +0800 Subject: [PATCH 068/162] modify synclist file folder (#2922) --- .../installation/reg_linux_diskfull_installation_flat | 8 ++++---- .../reg_linux_diskfull_installation_hierarchy | 8 ++++---- .../installation/reg_linux_diskless_installation_flat | 8 ++++---- .../reg_linux_diskless_installation_hierarchy | 8 ++++---- 4 files changed, 16 insertions(+), 16 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 6e06a70ec..b5ef8f841 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -32,8 +32,8 @@ cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; -cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/tmp/test.synclist +cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; +cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/test.synclist check:rc==0 cmd:if ! ([[ "__GETNODEATTR($$CN,os)__" = "sles12.1" ]] || [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" && "__GETNODEATTR($$CN,arch)__" = "x86_64" ]]) ; then chdef -t node -o $$CN postscripts=setupntp; fi check:rc==0 @@ -68,8 +68,8 @@ cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" -cmd:xdsh $$CN "cat /tmp/test.synclist" +cmd:xdsh $$CN "cat /test.synclist" check:rc==0 -cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv -f /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi +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 86bb3d642..6094adbbc 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -33,8 +33,8 @@ cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; -cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/tmp/test.synclist +cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; +cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/test.synclist check:rc==0 cmd:updatenode $$CN -f check:rc==0 @@ -63,8 +63,8 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" -cmd:xdsh $$CN "cat /tmp/test.synclist" +cmd:xdsh $$CN "cat /test.synclist" check:rc==0 -cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv -f /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi +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 2be3ffabb..a6e90df47 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -25,8 +25,8 @@ 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 ]; then mv $rootimgdir $rootimgdir.regbak -f;fi check:rc==0 -cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; -cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/tmp/test.synclist +cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; +cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 cmd:if [ ! -d /tmp/mountoutput ]; then mkdir -p /tmp/mountoutput; fi cmd:mount |sort > /tmp/mountoutput/file.org @@ -69,9 +69,9 @@ check:output=~64 bytes from $$CN 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:xdsh $$CN "cat /var/log/xcat/xcat.log" -cmd:xdsh $$CN "cat /tmp/test.synclist" +cmd:xdsh $$CN "cat /test.synclist" check:rc==0 -cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv -f /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi +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 end 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 db86b5019..4b18f9dd0 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -34,8 +34,8 @@ 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 ]; then mv $rootimgdir $rootimgdir.regbak;fi check:rc==0 -cmd:if [[ -f /tmp/test.synclist ]] ;then mv -f /tmp/test.synclist /tmp/test.synclist.bak;fi; -cmd:echo "/tmp/test.synclist -> /tmp/test.synclist" > /tmp/test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/tmp/test.synclist +cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; +cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 cmd:updatenode $$CN -f check:rc==0 @@ -68,9 +68,9 @@ check:output=~on / type tmpfs cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" 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:xdsh $$CN "cat /tmp/test.synclist" +cmd:xdsh $$CN "cat /test.synclist" check:rc==0 -cmd:if [[ -f /tmp/test.synclist.bak ]] ;then mv -f /tmp/test.synclist.bak /tmp/test.synclist;else rm -rf /tmp/test.synclist;fi +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 end From 669561e649180de4c69dfe52b9804a7cc88405cb Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 25 Apr 2017 04:34:31 -0400 Subject: [PATCH 069/162] xcat command returns 0 when cmd fails due authorization #2636: prompt meaningful message for user if client certificates not setup correctly; specify SSL_verify_mode => SSL_VERIFY_NONE explicitly for IO::Socket::SSL->start_SSL --- perl-xCAT/xCAT/Client.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/perl-xCAT/xCAT/Client.pm b/perl-xCAT/xCAT/Client.pm index 9aa8cfd0e..079a62155 100644 --- a/perl-xCAT/xCAT/Client.pm +++ b/perl-xCAT/xCAT/Client.pm @@ -265,7 +265,11 @@ sub submit_request { %sslargs, ); } else { + print "warning: the client certificates under $homedir/.xcat/ are not setup correctly, please run '/opt/xcat/share/xcat/scripts/setup-local-client.sh"." $ENV{'USER'}' as 'root' to generate the client certificates; otherwise, the SSL connection between xcat client and xcatd will be setup without certificate verification and open to Man-In-The-Middle attacks.\n"; + #Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client is deprecated! + #need to specify SSL_verify_mode => SSL_VERIFY_NONE explicitly $client = IO::Socket::SSL->start_SSL($pclient, + SSL_verify_mode => SSL_VERIFY_NONE, Timeout => 0, ); } From 9d9155fc4ff310e6fa9087a59d487231db40857f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 25 Apr 2017 16:10:25 -0400 Subject: [PATCH 070/162] Small changes after review --- xCAT-server/lib/xcat/plugins/ipmi.pm | 47 +++++++++++++++++++--------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index ea6135b4a..00302d365 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -24,6 +24,7 @@ my %needbladeinv; use POSIX qw(ceil floor); use Storable qw(nstore_fd retrieve_fd thaw freeze); +use Scalar::Util qw(looks_like_number); use xCAT::Utils; use xCAT::TableUtils; use xCAT::IMMUtils; @@ -1857,15 +1858,27 @@ sub do_firmware_update { if ($opt =~ /buffersize=/) { my ($attribute, $buffer_value) = split(/=/, $opt); if ($buffer_value) { - # buffersize option was passed in, reset the default - $buffer_size = $buffer_value; + # buffersize option was passed in, reset the default if valid + if (looks_like_number($buffer_value) and $buffer_value > 0) { + $buffer_size = $buffer_value; + } + else { + $exit_with_error_func->($sessdata->{node}, $callback, + "Invalid buffer size value $buffer_value"); + } } } if ($opt =~ /retry=/) { my ($attribute, $retry_value) = split(/=/, $opt); if (defined $retry_value) { - # retry option was passed in, reset the default - $retry = $retry_value; + # retry option was passed in, reset the default if valid + if (looks_like_number($retry_value) and $retry_value >= 0) { + $retry = $retry_value; + } + else { + $exit_with_error_func->($sessdata->{node}, $callback, + "Invalid retry value $retry_value"); + } } } } @@ -1897,7 +1910,9 @@ RETRY_UPGRADE: # step 1 power off $cmd = $pre_cmd . " chassis power off"; - xCAT::SvrUtils::sendmsg("Preparing to upgrade firmware, powering chassis off...", $callback, $sessdata->{node}, %allerrornodes); + if ($verbose) { + xCAT::SvrUtils::sendmsg("Preparing to upgrade firmware, powering chassis off...", $callback, $sessdata->{node}, %allerrornodes); + } $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { $exit_with_error_func->($sessdata->{node}, $callback, @@ -1913,7 +1928,7 @@ RETRY_UPGRADE: } # check reset status - unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 60, 1, $sessdata, $verbose)) { + unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 60, 2, $sessdata, $verbose)) { $exit_with_error_func->($sessdata->{node}, $callback, "Timeout to check the bmc status"); } @@ -1932,9 +1947,11 @@ RETRY_UPGRADE: my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); $cmd .= " >".$rflash_log_file." 2>&1"; - xCAT::SvrUtils::sendmsg([ 0, + if ($verbose) { + xCAT::SvrUtils::sendmsg([ 0, "rflashing ... See the detail progress :\"tail -f $rflash_log_file\"" ], - $callback, $sessdata->{node}); + $callback, $sessdata->{node}); + } $output = xCAT::Utils->runcmd($cmd, -1); # if upgrade command failed and we exausted number of retries @@ -1944,16 +1961,16 @@ RETRY_UPGRADE: # Since "hpm update" command in step 4 above redirects standard out and error to a log file, # nothing gets returned from execution of the command. Here if RC is not zero, we # extract all lines containing "Error" from that log file and display them in the sendmsg below - my $get_error_cmd = "/usr/bin/cat ".$rflash_log_file." | grep Error"; + my $get_error_cmd = "/usr/bin/grep Error $rflash_log_file"; $output = xCAT::Utils->runcmd($get_error_cmd, 0); if ($retry == 0) { - # No more retries left, report and error and exit + # No more retries left, report an error and exit $exit_with_error_func->($sessdata->{node}, $callback, - "Running ipmitool command $cmd failed:\n $output"); + "Running ipmitool command $cmd failed with rc=$::RUNCMD_RC and the following error messages:\n$output\nSee the $rflash_log_file for details."); } else { # Error upgrading, set a flag to attempt a retry - xCAT::SvrUtils::sendmsg("Running ipmitool command $cmd failed:\n $output", $callback, $sessdata->{node}, %allerrornodes); + xCAT::SvrUtils::sendmsg("Running attempt $retry of ipmitool command $cmd failed with rc=$::RUNCMD_RC and the following error messages:\n$output\nSee the $rflash_log_file for details.", $callback, $sessdata->{node}, %allerrornodes); $failed_upgrade = 1; } @@ -1961,7 +1978,7 @@ RETRY_UPGRADE: # step 5 power on # check reset status - unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 60, 15, $sessdata, $verbose)) { + unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 60, 10, $sessdata, $verbose)) { $exit_with_error_func->($sessdata->{node}, $callback, "Timeout to check the bmc status"); } @@ -1970,7 +1987,9 @@ RETRY_UPGRADE: xCAT::SvrUtils::sendmsg("Firmware update failed, powering chassis on for a retry. This can take several minutes. $retry retries left ...", $callback, $sessdata->{node}, %allerrornodes); } else { - xCAT::SvrUtils::sendmsg("Firmware updated, powering chassis on to populate FRU information...", $callback, $sessdata->{node}, %allerrornodes); + if ($verbose) { + xCAT::SvrUtils::sendmsg("Firmware updated, powering chassis on to populate FRU information...", $callback, $sessdata->{node}, %allerrornodes); + } } $cmd = $pre_cmd . " chassis power on"; From 1fed89ff2061eaa8ab2c2bc76b63bb0a1d6321f8 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 26 Apr 2017 01:54:48 -0400 Subject: [PATCH 071/162] docker version updated and the output for docker command changed so modify the testcase --- xCAT-test/autotest/testcase/dockercommand/cases0 | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/dockercommand/cases0 b/xCAT-test/autotest/testcase/dockercommand/cases0 index 4b21baac0..b87da9d35 100644 --- a/xCAT-test/autotest/testcase/dockercommand/cases0 +++ b/xCAT-test/autotest/testcase/dockercommand/cases0 @@ -244,7 +244,6 @@ cmd:rpower $$DOCKERCN start check:rc==0 cmd:rmdocker $$DOCKERCN chec:rc!=0 -check:output=~Stop the container before attempting removal or use -f cmd:rmdocker $$DOCKERCN -f check:rc==0 check:output=~$$DOCKERCN: success From 4a9a7d53ae1a81cff297b72a3e0977fef3e87189 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 26 Apr 2017 03:28:50 -0400 Subject: [PATCH 072/162] docker version updated and the output for docker command changed so modify the testcase --- xCAT-test/autotest/testcase/dockercommand/cases0 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/dockercommand/cases0 b/xCAT-test/autotest/testcase/dockercommand/cases0 index b87da9d35..e28c5d629 100644 --- a/xCAT-test/autotest/testcase/dockercommand/cases0 +++ b/xCAT-test/autotest/testcase/dockercommand/cases0 @@ -243,7 +243,8 @@ check:rc==0 cmd:rpower $$DOCKERCN start check:rc==0 cmd:rmdocker $$DOCKERCN -chec:rc!=0 +check:rc!=0 +check:output=~Stop the container cmd:rmdocker $$DOCKERCN -f check:rc==0 check:output=~$$DOCKERCN: success From 603e26d6a333b8583b352b0a00aab46262b63638 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 26 Apr 2017 01:36:16 -0400 Subject: [PATCH 073/162] A candidate bundle to verify pegas+p9 --- .../autotest/bundle/rhels7.104-ppc64el.bundle | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 xCAT-test/autotest/bundle/rhels7.104-ppc64el.bundle diff --git a/xCAT-test/autotest/bundle/rhels7.104-ppc64el.bundle b/xCAT-test/autotest/bundle/rhels7.104-ppc64el.bundle new file mode 100644 index 000000000..b4a409a0c --- /dev/null +++ b/xCAT-test/autotest/bundle/rhels7.104-ppc64el.bundle @@ -0,0 +1,25 @@ +bmcdiscover_q +bmcdiscover_help +bmcdiscover_version +bmcdiscover_h +bmcdiscover_nmap_range +bmcdiscover_v +bmcdiscover_check_paswd +bmcdiscover_check_passwd_wrong +bmcdiscover_get_ipsource +bmcdiscover_range_w +bmcdiscover_range_u_p_i_ipsource +bmcdiscover_range_z +rpower_off +rpower_stat +rpower_boot +rpower_status +rpower_state +rpower_on +rpower_reset +rsetboot_hd_statcheck +rsetboot_net_statcheck +rsetboot_cd_statcheck +rsetboot_default_statcheck +reg_linux_diskfull_installation_flat +reg_linux_diskless_installation_flat From 3d7bd7bab3681a22e490a01c18ab62b6a18e469a Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 26 Apr 2017 13:19:47 -0400 Subject: [PATCH 074/162] Create a new variable to store the long commit ID incase there are scripts already consuming the short commit ID --- build-ubunturepo | 4 +++- buildcore.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 70f4bda55..6e01caab8 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -177,7 +177,8 @@ then short_short_ver=`cat Version|cut -d. -f 1` build_time=`date` build_machine=`hostname` - commit_id=`git rev-parse HEAD` + commit_id=`git rev-parse --short HEAD` + commit_id_long=`git rev-parse HEAD` package_dir_name=debs$REL #TODO: define the core path and tarball name @@ -370,6 +371,7 @@ __EOF__ echo "BUILD_TIME=$build_time" >> $BUILDINFO echo "BUILD_MACHINE=$build_machine" >> $BUILDINFO echo "COMMIT_ID=$commit_id" >> $BUILDINFO + echo "COMMIT_ID_LONG=$commit_id_long" >> $BUILDINFO #create the xcat-core.list file diff --git a/buildcore.sh b/buildcore.sh index 8686203c3..bab8ce3b0 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -188,7 +188,8 @@ function setversionvars { SHORTSHORTVER=`echo $VER|cut -d. -f 1` BUILD_TIME=`date` BUILD_MACHINE=`hostname` - COMMIT_ID=`git rev-parse HEAD` + COMMIT_ID=`git rev-parse --short HEAD` + COMMIT_ID_LONG=`git rev-parse HEAD` XCAT_RELEASE="snap$(date '+%Y%m%d%H%M')" echo "$XCAT_RELEASE" >Release } @@ -549,6 +550,7 @@ echo "RELEASE=$XCAT_RELEASE" >> $BUILDINFO echo "BUILD_TIME=$BUILD_TIME" >> $BUILDINFO echo "BUILD_MACHINE=$BUILD_MACHINE" >> $BUILDINFO echo "COMMIT_ID=$COMMIT_ID" >> $BUILDINFO +echo "COMMIT_ID_LONG=$COMMIT_ID_LONG" >> $BUILDINFO echo "Creating $(dirname $DESTDIR)/$TARNAME ..." if [[ -e $TARNAME ]]; then From 01a9438cbeba13302f7315ff5d7eecb83705c6d0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 26 Apr 2017 11:50:07 -0400 Subject: [PATCH 075/162] Updates after a review --- xCAT-server/lib/xcat/plugins/kvm.pm | 34 +++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index ec659b73c..bba0002ec 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -26,6 +26,7 @@ use IO::Select; use xCAT::TableUtils; use xCAT::ServiceNodeUtils; use strict; +use feature "switch"; # For given-when block #use warnings; my $use_xhrm = 0; #xCAT Hypervisor Resource Manager, to satisfy networking and storage prerequisites, default to not using it for the moment @@ -3529,19 +3530,30 @@ sub lsvm { push @vms, "Memory:" . $domain_info->{"memory"}; } if (exists $domain_info->{"nrVirtCpu"}) { - push @vms, "Virt CPU: " . $domain_info->{"nrVirtCpu"}; + push @vms, "CPU: " . $domain_info->{"nrVirtCpu"}; } if (exists $domain_info->{"state"}) { my $state = $domain_info->{"state"}; - my $state_string = "Unknown"; - if ($state == &Sys::Virt::Domain::STATE_NOSTATE) {$state_string = "The domain is active, but is not running / blocked (eg idle)";} - elsif ($state == &Sys::Virt::Domain::STATE_RUNNING) {$state_string = "The domain is active and running";} - elsif ($state == &Sys::Virt::Domain::STATE_BLOCKED) {$state_string = "The domain is active, but execution is blocked";} - elsif ($state == &Sys::Virt::Domain::STATE_PAUSED) {$state_string = "The domain is active, but execution has been paused";} - elsif ($state == &Sys::Virt::Domain::STATE_SHUTDOWN) {$state_string = "The domain is active, but in the shutdown phase";} - elsif ($state == &Sys::Virt::Domain::STATE_SHUTOFF) {$state_string = "The domain is inactive, and shut down";} - elsif ($state == &Sys::Virt::Domain::STATE_CRUSHED) {$state_string = "The domain is inactive, and crashed";} - elsif ($state == &Sys::Virt::Domain::STATE_PMSUSPENDED) {$state_string = "The domain is active, but in power management suspend state";} + my $state_string; + given($state) { + when ($state == &Sys::Virt::Domain::STATE_NOSTATE) + {$state_string = "The domain is active, but is not running / blocked (eg idle)";} + when ($state == &Sys::Virt::Domain::STATE_RUNNING) + {$state_string = "The domain is active and running";} + when ($state == &Sys::Virt::Domain::STATE_BLOCKED) + {$state_string = "The domain is active, but execution is blocked";} + when ($state == &Sys::Virt::Domain::STATE_PAUSED) + {$state_string = "The domain is active, but execution has been paused";} + when ($state == &Sys::Virt::Domain::STATE_SHUTDOWN) + {$state_string = "The domain is active, but in the shutdown phase";} + when ($state == &Sys::Virt::Domain::STATE_SHUTOFF) + {$state_string = "The domain is inactive, and shut down";} + when ($state == &Sys::Virt::Domain::STATE_CRUSHED) + {$state_string = "The domain is inactive, and crashed";} + when ($state == &Sys::Virt::Domain::STATE_PMSUSPENDED) + {$state_string = "The domain is active, but in power management suspend state";} + default {$state_string = "Unknown"}; + } push @vms, "State :" . $domain_info->{"state"} . " ($state_string)"; } # The following block of code copied from rscan command processng for disks @@ -4099,7 +4111,7 @@ sub dohyp { return 1, "General error establishing libvirt communication"; } } - if (($command eq 'mkvm' or $command eq 'chvm' or $command eq 'rpower' or $command eq 'lsvm') and $hypconn) { + if (($command =~ /^mkvm$|^chvm$|^rpower$|^lsvm$/) and $hypconn) { my $nodeinfo = $hypconn->get_node_info(); if (exists($nodeinfo->{model})) { $confdata->{$hyp}->{cpumodel} = $nodeinfo->{model}; From 45255ab48c30ce1c840e6121b84dbaae02f57999 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 27 Apr 2017 02:33:19 -0400 Subject: [PATCH 076/162] fix issue 2948, add bmc specific for rpower in usage & return if got error for ipmi mgt --- perl-xCAT/xCAT/Usage.pm | 3 +++ xCAT-server/lib/xcat/plugins/ipmi.pm | 1 + 2 files changed, 4 insertions(+) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 0cbba194a..049df54bd 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -26,6 +26,9 @@ my %usage = ( "rpower" => "Usage: rpower [--nodeps] [on|onstandby|off|suspend|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r ] [-t ] rpower [-h|--help|-v|--version] + BMC (using IPMI) specific: + rpower noderange [on|off|softoff|reset|boot|stat|state|status|wake|suspend [-w timeout] [-o] [-r]] + rpower noderange [pduon|pduoff|pdustat] OpenBMC specific: rpower noderange [on|off|reset|boot|stat|state|status] KVM Virtualization specific: diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 00302d365..fd35a443d 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2510,6 +2510,7 @@ sub power_response { my $text = $codes{ $rsp->{code} }; unless ($text) { $text = sprintf("Unknown response %02xh", $rsp->{code}); } xCAT::SvrUtils::sendmsg([ 1, $text ], $callback, $sessdata->{node}, %allerrornodes); + return; } else { my $command = $sessdata->{subcommand}; my $status = $sessdata->{powerstatus}; From b5fae952051ea307f562a4375ede6f56250ef1da Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 27 Apr 2017 06:40:13 -0400 Subject: [PATCH 077/162] modify makehosts_n_r testcase --- xCAT-test/autotest/testcase/makehosts/cases0 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xCAT-test/autotest/testcase/makehosts/cases0 b/xCAT-test/autotest/testcase/makehosts/cases0 index f2671d6bf..4ca478c4f 100644 --- a/xCAT-test/autotest/testcase/makehosts/cases0 +++ b/xCAT-test/autotest/testcase/makehosts/cases0 @@ -138,26 +138,36 @@ cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | gr check:rc==0 cmd:makehosts s01 check:rc==0 +cmd:sleep 20 +cmd:cat /etc/hosts cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 =~ "70.2.0.254 s01" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi check:rc==0 cmd:makehosts service check:rc==0 +cmd:sleep 20 +cmd:cat /etc/hosts cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 =~ "70.2.0.254 s01" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi check:rc==0 cmd:makehosts -d s01 check:rc==0 +cmd:sleep 20 +cmd:cat /etc/hosts cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 = "" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi check:rc==0 cmd:makehosts check:rc==0 cmd:makehosts -d service check:rc==0 +cmd:sleep 20 +cmd:cat /etc/hosts cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 = "" ]] && [[ $rc2 =~ "80.2.0.254 s01r1b01" ]];then exit 0;else exit 1;fi check:rc==0 cmd:makehosts check:rc==0 cmd:makehosts -d s01r1b01 check:rc==0 +cmd:sleep 20 +cmd:cat /etc/hosts cmd:rc1=`cat /etc/hosts | grep "70.2.0.254" | grep s01`;rc2=`cat /etc/hosts | grep "80.2.0.254" | grep s01r1b01`;if [[ $rc1 =~ "70.2.0.254 s01" ]] && [[ $rc2 = "" ]];then exit 0;else exit 1;fi check:rc==0 cmd:if [ -e /tmp/s01.standa ]; then rmdef s01; cat /tmp/s01.standa | mkdef -z; rm -rf /tmp/s01.standa; else rmdef s01;fi From d154a5543966419a2587e23396e9f6089d081f65 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 27 Apr 2017 08:49:50 -0400 Subject: [PATCH 078/162] modify diskfull and diskless hirerarchy testcase for synclist could not work on these cases --- .../installation/reg_linux_diskfull_installation_hierarchy | 2 ++ .../installation/reg_linux_diskless_installation_hierarchy | 2 ++ 2 files changed, 4 insertions(+) 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 6094adbbc..8f7a91785 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -36,6 +36,8 @@ check:rc==0 cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/test.synclist check:rc==0 +cmd:sleep 20 +cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute cmd:updatenode $$CN -f check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute 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 4b18f9dd0..cb246b3a6 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -37,6 +37,8 @@ check:rc==0 cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 +cmd:sleep 20 +cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-comput cmd:updatenode $$CN -f check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute From e82e64869f804e901329632e01d5ba1d47b9170d Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 27 Apr 2017 09:05:24 -0400 Subject: [PATCH 079/162] modify diskfull and diskless hirerarchy testcase for synclist could not work on these cases --- .../installation/reg_linux_diskfull_installation_hierarchy | 2 ++ .../installation/reg_linux_diskless_installation_hierarchy | 2 ++ 2 files changed, 4 insertions(+) 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 8f7a91785..5c09dc9e0 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -36,8 +36,10 @@ check:rc==0 cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/test.synclist check:rc==0 +#wang jun xia add debug information here to trace synlist could not work on provison cmd:sleep 20 cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +#will delete the debug information after get the root cause cmd:updatenode $$CN -f check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute 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 cb246b3a6..1cde397c0 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -37,8 +37,10 @@ check:rc==0 cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 +#wang jun xia add debug information here to trace synlist could not work on provison cmd:sleep 20 cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-comput +#will delete the debug information after get the root cause cmd:updatenode $$CN -f check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute From 6617d7dfbd4a4983500ac17b0ebf3a536b99e984 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Fri, 28 Apr 2017 10:26:55 +0800 Subject: [PATCH 080/162] work around installer hang for udevadm command in p9 pegas. (#2953) --- .../share/xcat/install/scripts/getinstdisk | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/install/scripts/getinstdisk b/xCAT-server/share/xcat/install/scripts/getinstdisk index fcc517565..743b991b1 100644 --- a/xCAT-server/share/xcat/install/scripts/getinstdisk +++ b/xCAT-server/share/xcat/install/scripts/getinstdisk @@ -141,8 +141,22 @@ if [ -z "$install_disk" ]; then disk_wwn=$(echo $output_for_wwn | $utolcmd) output_for_path=$(IFS= ;echo $disk_info | grep DEVPATH | cut -d "=" -f2) disk_path=$(echo $output_for_path | $utolcmd) - disk_driver=$(udevadm info --attribute-walk --name=$disk | grep DRIVERS| grep -v '""'| grep -v '"sd"'| + + # Work around the issue Pegas running on Power9 installation hang in anaconda + # with "TypeError: argument of type 'NoneType' is not iterable", + # after running of "udevadm info --attribute-walk --name=/dev/sda" in %pre section of kickstart + exec 42>&1 + anaconda_version=$(anaconda --version 2>&1 >&42) + exec 42>&- + cpu_model=$(awk '/model/ { print $NF }' /proc/cpuinfo) + p9_bool=$(grep POWER9 /proc/cpuinfo|head -n 1|awk '{print $3}') + if [ "$anaconda_version" == "anaconda 21.48.22.93-1" -a \ + "$cpu_model" == "0000000000000000" -a "$p9_bool" == "POWER9" ]; then + disk_driver="" + else + disk_driver=$(udevadm info --attribute-walk --name=$disk | grep DRIVERS| grep -v '""'| grep -v '"sd"'| \head -n 1| sed -e 's/[^"]*"//' -e 's/"//' | $utolcmd) + fi echo "[get_install_disk]The disk $disk information: " echo "[get_install_disk] disk_wwn=$disk_wwn" From 467c3c1491159f5bdcfe6bc32ce449bb277431b4 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 28 Apr 2017 14:11:23 +0800 Subject: [PATCH 081/162] delete synclist debug information and modify the testcase for synclist could not work on hierarchy install (#2959) --- .../installation/reg_linux_diskfull_installation_hierarchy | 6 ++---- .../installation/reg_linux_diskless_installation_hierarchy | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) 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 5c09dc9e0..bf4ed46fa 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -36,10 +36,8 @@ check:rc==0 cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/test.synclist check:rc==0 -#wang jun xia add debug information here to trace synlist could not work on provison -cmd:sleep 20 -cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -#will delete the debug information after get the root cause +cmd:nodeset $$CN osimage= __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 cmd:updatenode $$CN -f check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute 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 1cde397c0..d200cce37 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -37,10 +37,8 @@ check:rc==0 cmd:if [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; cmd:echo "/test.synclist -> /test.synclist" > /test.synclist;chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists=/test.synclist check:rc==0 -#wang jun xia add debug information here to trace synlist could not work on provison -cmd:sleep 20 -cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-comput -#will delete the debug information after get the root cause +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 cmd:updatenode $$CN -f check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute From d3f4c7b352310334ad8a15e218187f70e1edcc28 Mon Sep 17 00:00:00 2001 From: bybai Date: Fri, 28 Apr 2017 03:42:36 -0400 Subject: [PATCH 082/162] enhance nfs based statelite testcase --- .../reg_linux_statelite_installation_hierarchy_by_nfs | 8 ++++++++ 1 file changed, 8 insertions(+) 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 1f625da17..7c8e83622 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 @@ -42,6 +42,8 @@ check:rc==0 cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN 'service nfsserver restart'; elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$SN 'service nfs restart'; fi check:rc==0 +cmd:xdsh $$SN 'showmount -e' + cmd:chtab node=$$CN statelite.statemnt="$$SN:/nodedata" check:rc==0 @@ -58,6 +60,12 @@ 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 ]; then mv $rootimgdir $rootimgdir.regbak;fi check:rc==0 +cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute +check:rc==0 + +cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute rootfstype=nfs +check:rc==0 + cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute From 67af79b4c28f4fae6d48506b8b42f0535b54507d Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 28 Apr 2017 08:41:25 -0400 Subject: [PATCH 083/162] enhance rsetboot cases for openbmc #2883 --- xCAT-test/autotest/testcase/rsetboot/cases0 | 58 +++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/xCAT-test/autotest/testcase/rsetboot/cases0 b/xCAT-test/autotest/testcase/rsetboot/cases0 index 4c9de3fb8..a5a3f0a0a 100644 --- a/xCAT-test/autotest/testcase/rsetboot/cases0 +++ b/xCAT-test/autotest/testcase/rsetboot/cases0 @@ -1,5 +1,6 @@ start:rsetboot_hd_statcheck description:set the boot device from hd +Attribute: $$CN-The operation object of rsetboot command. cmd:rsetboot $$CN hd check:rc==0 check:output=~Hard Drive @@ -10,6 +11,7 @@ end start:rsetboot_net_statcheck description:set the boot device from net +Attribute: $$CN-The operation object of rsetboot command. cmd:rsetboot $$CN net check:rc==0 check:output=~Network @@ -20,6 +22,7 @@ end start:rsetboot_cd_statcheck description:set the boot device from CD/DVD +Attribute: $$CN-The operation object of rsetboot command. cmd:rsetboot $$CN cd check:rc==0 check:output=~CD/DVD @@ -30,6 +33,7 @@ end start:rsetboot_default_statcheck description:set the boot device default +Attribute: $$CN-The operation object of rsetboot command. cmd:rsetboot $$CN default check:rc==0 check:output=~boot override inactive @@ -38,3 +42,57 @@ check:rc==0 check:output=~$$CN: boot override inactive end +start:rsetboot_h +description:get rsetboot help information +cmd:rsetboot -h +check:rc==0 +check:output=~Usage: rsetboot +end + +start:rsetboot_help +description:get rsetboot help information using rsetboot help +cmd:rsetboot -help +check:rc==0 +check:output=~Usage: rsetboot +end + +start:rsetboot_v +desription:get rsetboot version +cmd:rsetboot -v +check:rc==0 +check:output=~Version +end + +start:rsetboot_node_invalidnode +desription:rsetboot using invalidenode +cmd:rsetboot testnode boot +check:rc!=0 +check:output=~Error: Invalid nodes +end + +start:rsetboot_noderange_net +description:rsetboot noderange net +Attribute: $$CN,$$BC-The operation object of rsetboot command. +cmd:rsetboot $$CN,$$BC net +check:output=~$$CN: Network +cmd:rsetboot $$CN,$$BC stat +check:output=~$$CN: Network +check:output=~$$BC: Network +end + +start:rsetboot_node_invalidaction +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 +end + +start:rsetboot_group_net +description:rsetboot group node +Attribute: $$CN-The operation object of rsetboot command. +cmd:rsetboot __GETNODEATTR($$CN,groups)__ net +check:output=~$$CN: Network +cmd:rsetboot __GETNODEATTR($$CN,groups)__ stat +check:output=~$$CN: Network +end From 6ba15adab1abb3bf6a0513e30c333c45f72493e3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 28 Apr 2017 12:20:23 -0400 Subject: [PATCH 084/162] Three step hpm update for Firestone machines --- xCAT-server/lib/xcat/plugins/ipmi.pm | 284 +++++++++++++++++++++------ 1 file changed, 229 insertions(+), 55 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 00302d365..e4e94eaae 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1762,6 +1762,56 @@ sub check_bmc_status_with_ipmitool { return 0; } +#----------------------------------------------------------------# +# Wait for OS to reboot by checking "nodestat" to be "sshd" : +# Arguments: +# initial_sleep: seconds to sleep before checking loop start +# inteval: inteval time to check +# retry: max retry time +# sessdata: session data for display +# verbose: verbose output +# Returns: +# 1 when OS is up +# 0 when no response of "sshd" from OS +#----------------------------------------------------------------# +sub wait_for_os_to_reboot { + my $initial_sleep = shift; + my $interval = shift; + my $retry = shift; + my $sessdata = shift; + my $verbose = shift; + my $cmd; + my $output; + if ($verbose) { + xCAT::SvrUtils::sendmsg("Sleeping for a few min waiting for node to power on before attempting to continue", $callback, $sessdata->{node}, %allerrornodes); + } + sleep($initial_sleep); # sleep for this many min for node to reboot + # Start testing every 10 sec for node to be booted. Give up after 5 min. + foreach (1..$retry) { + # Test node is booted in to OS + $cmd = "nodestat $sessdata->{node} | /usr/bin/grep sshd"; + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC == 0) { + # Node is ready to retry an upgrage + if ($verbose) { + xCAT::SvrUtils::sendmsg("Detected node booted. Will retry upgrade", $callback, $sessdata->{node}, %allerrornodes); + } + return 1; #Node booted + } + else { + # Still not booted, wait for 10 sec and try again + if ($verbose) { + $cmd = "nodestat $sessdata->{node}"; + $output = xCAT::Utils->runcmd($cmd, -1); + my ($nodename, $state) = split(/:/, $output); + xCAT::SvrUtils::sendmsg("($_) Node still not ready. Current state - $state, test again in 10 sec.", $callback, $sessdata->{node}, %allerrornodes); + } + sleep($interval); + } + } + return 0; #Node did not boot after requested delay +} + sub do_firmware_update { my $sessdata = shift; my $ret; @@ -1769,6 +1819,9 @@ sub do_firmware_update { my $verbose = 0; my $retry = 2; my $verbose_opt; + my $is_firestone = 0; + my $firestone_update_version; + my $htm_update_version; $ret = get_ipmitool_version(\$ipmitool_ver); exit $ret if $ret < 0; @@ -1789,7 +1842,7 @@ sub do_firmware_update { my $exit_with_success_func = sub { my ($node, $callback, $message) = @_; - my $status = "success to update firmware"; + my $status = "success updating firmware"; my $nodelist_table = xCAT::Table->new('nodelist'); if (!$nodelist_table) { xCAT::MsgUtils->message("S", "Unable to open nodelist table, denying"); @@ -1883,8 +1936,6 @@ sub do_firmware_update { } } - xCAT::SvrUtils::sendmsg("rflash started, upgrade failure will be retried up to $retry times. Please wait...", - $callback, $sessdata->{node}, %allerrornodes); # check for 8335-GTB Firmware above 1610A release. If below, exit if ($output =~ /8335-GTB/) { @@ -1903,6 +1954,69 @@ sub do_firmware_update { "Error: Current firmware level OP8v_$grs_version requires one-time manual update to at least version OP8v_1.7_2.55"); } } + + } + # For Firestone the update from 810 to 820 or from 820 to 810 needs to be done in 3 steps + # instead of usual one. + if ($output =~ /8335-GCA|8335-GTA/) { + $is_firestone = 1; + $cmd = $pre_cmd . " fru print 47"; + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); + } + # Check what firmware version is currently running on the machine + if ($output =~ /OP8_v\d\.\d+_(\d+)\.\d+/) { + my $frs_version = $1; + if ($frs_version == 1) { + $firestone_update_version = "810"; + } + if ($frs_version == 2) { + $firestone_update_version = "820"; + } + } + else { + $exit_with_error_func->($sessdata->{node}, $callback, + "Unable to determine firmware version currently installed."); + } + + # Check what firmware version is specified in htm file + $cmd = "/usr/bin/grep -a FW_DESC $hpm_file"; + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed: $output"); + } + # Parse out build date from the description string + if ($output =~ /FW_DESC=8335 \w+ \w+ \w+ (\w+)/) { + my $htm_date= $1; + # Parse out the year from "mmddyyyy" (skip 4 digits, grab last 4) + if ($htm_date =~ /\d{4}(\d+)/) { + my $htm_year = $1; + if ($htm_year == 2016) { + $htm_update_version = "810"; + } + if ($htm_year == 2017) { + $htm_update_version = "820"; + } + } + } + else { + $exit_with_error_func->($sessdata->{node}, $callback, + "Unable to determine firmware version of $hpm_file."); + } + } + + if ($is_firestone and + (($firestone_update_version eq "820" and $htm_update_version eq "810") or + ($firestone_update_version eq "810" and $htm_update_version eq "820")) + ) { + xCAT::SvrUtils::sendmsg("rflash started, Please wait...", $callback, $sessdata->{node}, %allerrornodes); + $retry = 0; # No retry support for 3 step update process + } + else { + xCAT::SvrUtils::sendmsg("rflash started, upgrade failure will be retried up to $retry times. Please wait...", $callback, $sessdata->{node}, %allerrornodes); } RETRY_UPGRADE: @@ -1942,38 +2056,123 @@ RETRY_UPGRADE: } # step 4 upgrade firmware - $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force "; - $cmd .= $verbose_opt; - my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); - $cmd .= " >".$rflash_log_file." 2>&1"; - if ($verbose) { - xCAT::SvrUtils::sendmsg([ 0, - "rflashing ... See the detail progress :\"tail -f $rflash_log_file\"" ], - $callback, $sessdata->{node}); - } + # For firestone machines if updating from 810 to 820 version or from 820 to 810, + # extra steps are needed. Hanled in "if" block, "else" block is normal update in a single step. + if ($is_firestone and + (($firestone_update_version eq "820" and $htm_update_version eq "810") or + ($firestone_update_version eq "810" and $htm_update_version eq "820")) + ) { - $output = xCAT::Utils->runcmd($cmd, -1); - # if upgrade command failed and we exausted number of retries - # report an error, exit to the caller and leave node in powered off state - # otherwise report an error, power on the node and try upgrade again - if ($::RUNCMD_RC != 0) { - # Since "hpm update" command in step 4 above redirects standard out and error to a log file, - # nothing gets returned from execution of the command. Here if RC is not zero, we - # extract all lines containing "Error" from that log file and display them in the sendmsg below - my $get_error_cmd = "/usr/bin/grep Error $rflash_log_file"; - $output = xCAT::Utils->runcmd($get_error_cmd, 0); - if ($retry == 0) { - # No more retries left, report an error and exit + # Step 4.1 + $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file component 0 force "; + $cmd .= $verbose_opt; + + my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); + $cmd .= " >".$rflash_log_file." 2>&1"; + if ($verbose) { + xCAT::SvrUtils::sendmsg([ 0, + "rflashing component 0, see the detail progress :\"tail -f $rflash_log_file\"" ], + $callback, $sessdata->{node}); + } + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + # Since "hpm update" command in step 4.1 above redirects standard out and error to a log file, + # nothing gets returned from execution of the command. Here if RC is not zero, we + # extract all lines containing "Error" from that log file and display them in the sendmsg below + my $get_error_cmd = "/usr/bin/grep Error $rflash_log_file"; + $output = xCAT::Utils->runcmd($get_error_cmd, 0); $exit_with_error_func->($sessdata->{node}, $callback, "Running ipmitool command $cmd failed with rc=$::RUNCMD_RC and the following error messages:\n$output\nSee the $rflash_log_file for details."); } - else { - # Error upgrading, set a flag to attempt a retry - xCAT::SvrUtils::sendmsg("Running attempt $retry of ipmitool command $cmd failed with rc=$::RUNCMD_RC and the following error messages:\n$output\nSee the $rflash_log_file for details.", $callback, $sessdata->{node}, %allerrornodes); - $failed_upgrade = 1; + + sleep(1); # Sleep for a second before next step + + # Step 4.2 + $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file component 1 force "; + $cmd .= $verbose_opt; + + my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); + $cmd .= " >>".$rflash_log_file." 2>&1"; + if ($verbose) { + xCAT::SvrUtils::sendmsg([ 0, + "rflashing component 1, see the detail progress :\"tail -f $rflash_log_file\"" ], + $callback, $sessdata->{node}); + } + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + # Since "hpm update" command in step 4.2 above redirects standard out and error to a log file, + # nothing gets returned from execution of the command. Here if RC is not zero, we + # extract all lines containing "Error" from that log file and display them in the sendmsg below + my $get_error_cmd = "/usr/bin/grep Error $rflash_log_file"; + $output = xCAT::Utils->runcmd($get_error_cmd, 0); + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed with rc=$::RUNCMD_RC and the following error messages:\n$output\nSee the $rflash_log_file for details."); + } + + # Wait for BMC to reboot before continuing to next step + unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 60, 10, $sessdata, $verbose)) { + $exit_with_error_func->($sessdata->{node}, $callback, + "Timeout waiting for the bmc ready status. Firmware update suspended"); + } + + # Step 4.3 + $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file component 2 force "; + $cmd .= $verbose_opt; + + my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); + $cmd .= " >>".$rflash_log_file." 2>&1"; + if ($verbose) { + xCAT::SvrUtils::sendmsg([ 0, + "rflashing component 2, see the detail progress :\"tail -f $rflash_log_file\"" ], + $callback, $sessdata->{node}); + } + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + # Since "hpm update" command in step 4.3 above redirects standard out and error to a log file, + # nothing gets returned from execution of the command. Here if RC is not zero, we + # extract all lines containing "Error" from that log file and display them in the sendmsg below + my $get_error_cmd = "/usr/bin/grep Error $rflash_log_file"; + $output = xCAT::Utils->runcmd($get_error_cmd, 0); + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed with rc=$::RUNCMD_RC and the following error messages:\n$output\nSee the $rflash_log_file for details."); + } + } + + else { + $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force "; + $cmd .= $verbose_opt; + + my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); + $cmd .= " >".$rflash_log_file." 2>&1"; + if ($verbose) { + xCAT::SvrUtils::sendmsg([ 0, + "rflashing ... See the detail progress :\"tail -f $rflash_log_file\"" ], + $callback, $sessdata->{node}); + } + + $output = xCAT::Utils->runcmd($cmd, -1); + # if upgrade command failed and we exausted number of retries + # report an error, exit to the caller and leave node in powered off state + # otherwise report an error, power on the node and try upgrade again + if ($::RUNCMD_RC != 0) { + # Since "hpm update" command in step 4 above redirects standard out and error to a log file, + # nothing gets returned from execution of the command. Here if RC is not zero, we + # extract all lines containing "Error" from that log file and display them in the sendmsg below + my $get_error_cmd = "/usr/bin/grep Error $rflash_log_file"; + $output = xCAT::Utils->runcmd($get_error_cmd, 0); + if ($retry == 0) { + # No more retries left, report an error and exit + $exit_with_error_func->($sessdata->{node}, $callback, + "Running ipmitool command $cmd failed with rc=$::RUNCMD_RC and the following error messages:\n$output\nSee the $rflash_log_file for details."); + } + else { + # Error upgrading, set a flag to attempt a retry + xCAT::SvrUtils::sendmsg("Running attempt $retry of ipmitool command $cmd failed with rc=$::RUNCMD_RC and the following error messages:\n$output\nSee the $rflash_log_file for details.", $callback, $sessdata->{node}, %allerrornodes); + $failed_upgrade = 1; - } + } + } } # step 5 power on @@ -1999,34 +2198,9 @@ RETRY_UPGRADE: "Running ipmitool command $cmd failed: $output"); } - my $node_ready_for_retry = 0; if ($failed_upgrade) { # Update has failed in step 4. Wait for node to reboot and try again - if ($verbose) { - xCAT::SvrUtils::sendmsg("Sleeping for a few min waiting for node to power on before attempting a retry", $callback, $sessdata->{node}, %allerrornodes); - } - sleep(300); # sleep for 5 min for node to reboot - # Start testing every 10 sec for node to be booted. Give up after 5 min. - foreach (1..30) { - # Test node is booted in to OS - $cmd = "nodestat $sessdata->{node} | grep sshd"; - $output = xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC == 0) { - # Node is ready to retry an upgrage - if ($verbose) { - xCAT::SvrUtils::sendmsg("Detected node booted. Will retry upgrade", $callback, $sessdata->{node}, %allerrornodes); - } - $node_ready_for_retry = 1; - last; - } - else { - # Still not booted, wait for 10 sec and try again - if ($verbose) { - xCAT::SvrUtils::sendmsg("Node still not ready, Test again in 10 sec.", $callback, $sessdata->{node}, %allerrornodes); - } - sleep(10); - } - } + my $node_ready_for_retry = wait_for_os_to_reboot(300,10,30,$sessdata,$verbose); if ($node_ready_for_retry) { $retry--; # decrement number of retries left # Yes, it is a goto statement here. Ugly, but removes the need to restructure From 0246781c8f352c85b9b02882b58115d4c5bdff2b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 1 May 2017 14:48:30 -0400 Subject: [PATCH 085/162] Fixed error message as suggested by the review --- xCAT-server/lib/xcat/plugins/ipmi.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index e4e94eaae..505042365 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1978,7 +1978,7 @@ sub do_firmware_update { } else { $exit_with_error_func->($sessdata->{node}, $callback, - "Unable to determine firmware version currently installed."); + "Unable to determine firmware version currently installed. Verify that \"$cmd | grep OP8_v\" command returns a version."); } # Check what firmware version is specified in htm file From db2ec5ddcc4f71630d7afed001b07f417ecdf650 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 2 May 2017 02:52:03 -0400 Subject: [PATCH 086/162] framework of rspconfig command for openbmc --- xCAT-server/lib/xcat/plugins/openbmc.pm | 261 +++++++++++++++--------- 1 file changed, 165 insertions(+), 96 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 1672f244b..f4560d5af 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -50,17 +50,17 @@ sub unsupported { #------------------------------------------------------- sub handled_commands { return { - rpower => 'nodehm:mgt', - rinv => 'nodehm:mgt', getopenbmccons => 'nodehm:cons', - rsetboot => 'nodehm:mgt', - rspconfig => 'nodehm:mgt', - rvitals => 'nodehm:mgt', - rflash => 'nodehm:mgt', - reventlog => 'nodehm:mgt', - rspreset => 'nodehm:mgt', rbeacon => 'nodehm:mgt', renergy => 'nodehm:mgt', + reventlog => 'nodehm:mgt', + rflash => 'nodehm:mgt', + rinv => 'nodehm:mgt', + rpower => 'nodehm:mgt', + rsetboot => 'nodehm:mgt', + rspconfig => 'nodehm:mgt', + rspreset => 'nodehm:mgt', + rvitals => 'nodehm:mgt', }; } @@ -82,6 +82,30 @@ my %status_info = ( process => \&login_response, }, + REVENTLOG_REQUEST => { + method => "GET", + init_url => "$openbmc_project_url/logging/enumerate", + }, + REVENTLOG_RESPONSE => { + process => \&reventlog_response, + }, + REVENTLOG_CLEAR_REQUEST => { + method => "POST", + init_url => "$openbmc_url/records/events/action/clear", + data => "", + }, + REVENTLOG_CLEAR_RESPONSE => { + process => \&reventlog_response, + }, + + RINV_REQUEST => { + method => "GET", + init_url => "$openbmc_project_url/inventory/enumerate", + }, + RINV_RESPONSE => { + process => \&rinv_response, + }, + RPOWER_ON_REQUEST => { method => "PUT", init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition", @@ -114,43 +138,11 @@ my %status_info = ( process => \&rpower_response, }, - RINV_REQUEST => { - method => "GET", - init_url => "$openbmc_project_url/inventory/enumerate", - }, - RINV_RESPONSE => { - process => \&rinv_response, - }, - RSETBOOT_HD_REQUEST => { + RSETBOOT_SET_REQUEST => { method => "PUT", init_url => "", - data => "", }, - RSETBOOT_HD_RESPONSE => { - process => \&rsetboot_response, - }, - RSETBOOT_NET_REQUEST => { - method => "PUT", - init_url => "", - data => "", - }, - RSETBOOT_NET_RESPONSE => { - process => \&rsetboot_response, - }, - RSETBOOT_CD_REQUEST => { - method => "PUT", - init_url => "", - data => "", - }, - RSETBOOT_CD_RESPONSE => { - process => \&rsetboot_response, - }, - RSETBOOT_DEF_REQUEST => { - method => "PUT", - init_url => "", - data => "", - }, - RSETBOOT_DEF_RESPONSE => { + RSETBOOT_SET_RESPONSE => { process => \&rsetboot_response, }, RSETBOOT_STATUS_REQUEST => { @@ -160,20 +152,21 @@ my %status_info = ( RSETBOOT_STATUS_RESPONSE => { process => \&rsetboot_response, }, - REVENTLOG_REQUEST => { + + RSPCONFIG_GET_REQUEST => { method => "GET", - init_url => "$openbmc_project_url/logging/enumerate", + init_url => "", }, - REVENTLOG_RESPONSE => { - process => \&reventlog_response, + RSPCONFIG_GET_RESPONSE => { + process => \&rspconfig_response, }, - REVENTLOG_CLEAR_REQUEST => { + RSPCONFIG_SET_REQUEST => { method => "POST", - init_url => "$openbmc_url/records/events/action/clear", + init_url => "", data => "", }, - REVENTLOG_CLEAR_RESPONSE => { - process => \&reventlog_response, + RSPCONFIG_SET_RESPONSE => { + process => \&rspconfig_response, }, ); @@ -193,11 +186,10 @@ $::RESPONSE_SERVICE_UNAVAILABLE = "503 Service Unavailable"; cur_status => "LOGIN_REQUEST", cur_url => "", method => "", - back_urls => (), }, ); - 'cur_url', 'method', 'back_urls' used for path has a trailing-slash + 'cur_url', 'method' used for path has a trailing-slash =cut @@ -260,7 +252,7 @@ sub preprocess_request { return; } - my $parse_result = parse_args($command, $extrargs); + my $parse_result = parse_args($command, $extrargs, $noderange); if (ref($parse_result) eq 'ARRAY') { $callback->({ errorcode => $parse_result->[0], data => $parse_result->[1] }); $request = {}; @@ -361,9 +353,10 @@ sub process_request { sub parse_args { my $command = shift; my $extrargs = shift; + my $noderange = shift; my $check = undef; - if (scalar(@ARGV) > 1 and $command ne "rsetboot" and $command ne "reventlog") { + if (scalar(@ARGV) > 1 and $command ne "rsetboot" and $command ne "reventlog" and $command ne "rspconfig") { return ([ 1, "Only one option is supported at the same time" ]); } @@ -412,7 +405,37 @@ sub parse_args { unless ($subcommand =~ /^\d$|^\d+$|^all$|^clear$/) { return ([ 1, "Unsupported command: $command $subcommand" ]); } + } elsif ($command eq "rspconfig") { + if (!defined($extrargs)) { + return ([ 1, "No option specified for $command" ]); + } + # + # disable function until fully tested + # + $check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; } + my $setorget; + foreach $subcommand (@ARGV) { + if ($subcommand =~ /^(\w+)=(.*)/) { + return ([ 1, "Can not configure and display nodes' value at the same time" ]) if ($setorget and $setorget eq "get"); + my $key = $1; + my $value = $2; + return ([ 1, "Unsupported command: $command $key" ]) unless ($key =~ /^ip$|^netmask$|^gateway$/); + + my $nodes_num = @$noderange; + return ([ 1, "Invalid parameter for option $key" ]) unless ($value); + return ([ 1, "Invalid parameter for option $key: $value" ]) unless (xCAT::NetworkUtils->isIpaddr($value)); + if ($key eq "ip") { + return ([ 1, "Can not configure more than 1 nodes' ip at the same time" ]) if ($nodes_num >= 2); + } + $setorget = "set"; + } elsif ($subcommand =~ /^ip$|^netmask$|^gateway$/) { + return ([ 1, "Can not configure and display nodes' value at the same time" ]) if ($setorget and $setorget eq "set"); + $setorget = "get"; + } else { + return ([ 1, "Unsupported command: $command $subcommand" ]); + } + } } else { return ([ 1, "Command is not supported." ]); } @@ -480,22 +503,12 @@ sub parse_command_status { } $subcommand = $ARGV[0]; - if ($subcommand eq "hd") { - $next_status{LOGIN_RESPONSE} = "RSETBOOT_HD_REQUEST"; - $next_status{RSETBOOT_HD_REQUEST} = "RSETBOOT_HD_RESPONSE"; - # modify $status_info{RSETBOOT_SET_REQUEST}{data} if $persistent or $uefi - } elsif ($subcommand eq "net") { - $next_status{LOGIN_RESPONSE} = "RSETBOOT_NET_REQUEST"; - $next_status{RSETBOOT_NET_REQUEST} = "RSETBOOT_NET_RESPONSE"; - # modify $status_info{RSETBOOT_SET_REQUEST}{data} if $persistent or $uefi - } elsif ($subcommand eq "cd"){ - $next_status{LOGIN_RESPONSE} = "RSETBOOT_CD_REQUEST"; - $next_status{RSETBOOT_CD_REQUEST} = "RSETBOOT_CD_RESPONSE"; - # modify $status_info{RSETBOOT_SET_REQUEST}{data} if $persistent or $uefi - } elsif ($subcommand eq "default" or $subcommand eq "def") { - $next_status{LOGIN_RESPONSE} = "RSETBOOT_DEF_REQUEST"; - $next_status{RSETBOOT_DEF_REQUEST} = "RSETBOOT_DEF_RESPONSE"; - # modify $status_info{RSETBOOT_SET_REQUEST}{data} if $persistent or $uefi + if ($subcommand =~ /^hd$|^net$|^cd$|^default$|^def$/) { + $next_status{LOGIN_RESPONSE} = "RSETBOOT_SET_REQUEST"; + $next_status{RSETBOOT_SET_REQUEST} = "RSETBOOT_SET_RESPONSE"; + # modify $status_info{RSETBOOT_SET_REQUEST}{data} + $next_status{RSETBOOT_SET_RESPONSE} = "RSETBOOT_STATUS_REQUEST"; + $next_status{RSETBOOT_STATUS_REQUEST} = "RSETBOOT_STATUS_RESPONSE"; } elsif ($subcommand eq "stat") { $next_status{LOGIN_RESPONSE} = "RSETBOOT_STATUS_REQUEST"; $next_status{RSETBOOT_STATUS_REQUEST} = "RSETBOOT_STATUS_RESPONSE"; @@ -528,6 +541,30 @@ sub parse_command_status { } } + if ($command eq "rspconfig") { + my @options = (); + foreach $subcommand (@ARGV) { + if ($subcommand =~ /^ip$|^netmask$|^gateway$/) { + $next_status{LOGIN_RESPONSE} = "RSPCONFIG_GET_REQUEST"; + $next_status{RSPCONFIG_GET_REQUEST} = "RSPCONFIG_GET_RESPONSE"; + push @options, $subcommand; + } elsif ($subcommand =~ /^(\w+)=(.+)/) { + my $key = $1; + my $value = $2; + $next_status{LOGIN_RESPONSE} = "RSPCONFIG_SET_REQUEST"; + $next_status{RSPCONFIG_SET_REQUEST} = "RSPCONFIG_SET_RESPONSE"; + $next_status{RSPCONFIG_SET_RESPONSE} = "RSPCONFIG_GET_REQUEST"; + $next_status{RSPCONFIG_GET_REQUEST} = "RSPCONFIG_GET_RESPONSE"; + if ($key eq "ip") { + $status_info{RSPCONFIG_SET_RESPONSE}{ip} = $value; + } + $status_info{RSPCONFIG_SET_REQUEST}{data} = ""; # wait for interface, ip/netmask/gateway is $value + push @options, $key; + } + } + $next_status{RSPCONFIG_GET_RESPONSE}{argv} = join(",", @options); + } + print Dumper(\%next_status) . "\n"; } @@ -912,32 +949,11 @@ sub rsetboot_response { my $response_info = decode_json $response->content; - if ($node_info{$node}{cur_status} eq "RSETBOOT_HD_RESPONSE") { - if ($response_info->{'message'} eq $::RESPONSE_OK) { - xCAT::SvrUtils::sendmsg("Hard Drive", $callback, $node); - } - } - - if ($node_info{$node}{cur_status} eq "RSETBOOT_NET_RESPONSE") { - if ($response_info->{'message'} eq $::RESPONSE_OK) { - xCAT::SvrUtils::sendmsg("Network", $callback, $node); - } - } - - if ($node_info{$node}{cur_status} eq "RSETBOOT_CD_RESPONSE") { - if ($response_info->{'message'} eq $::RESPONSE_OK) { - xCAT::SvrUtils::sendmsg("CD/DVD", $callback, $node); - } - } - - if ($node_info{$node}{cur_status} eq "RSETBOOT_DEF_RESPONSE") { - if ($response_info->{'message'} eq $::RESPONSE_OK) { - xCAT::SvrUtils::sendmsg("boot override inactive", $callback, $node); - } - } - - if ($node_info{$node}{cur_status} eq "RSETBOOT_STATUS_RESPONSE") { - # wait for more information + if ($node_info{$node}{cur_status} eq "RSETBOOT_GET_RESPONSE") { + xCAT::SvrUtils::sendmsg("Hard Drive", $callback, $node); #if response data is hd + xCAT::SvrUtils::sendmsg("Network", $callback, $node); #if response data is net + xCAT::SvrUtils::sendmsg("CD/DVD", $callback, $node); #if response data is net + xCAT::SvrUtils::sendmsg("boot override inactive", $callback, $node); #if response data is def } if ($next_status{ $node_info{$node}{cur_status} }) { @@ -1009,4 +1025,57 @@ sub reventlog_response { } } +#------------------------------------------------------- + +=head3 rspconfig_response + + Deal with response of rspconfig command + Input: + $node: nodename of current response + $response: Async return response + +=cut + +#------------------------------------------------------- +sub rspconfig_response { + my $node = shift; + my $response = shift; + + my $response_info = decode_json $response->content; + + if ($node_info{$node}{cur_status} eq "RSPCONFIG_GET_RESPONSE") { + my $grep_string = $status_info{RSPCONFIG_GET_RESPONSE}{argv}; + my $data; + my @output; + if ($grep_string =~ "ip") { + $data = ""; # got data from response + push @output, "BMC IP: $data"; + } + if ($grep_string =~ "netmask") { + $data = ""; # got data from response + push @output, "BMC Netmask: $data"; + } + if ($grep_string =~ "gateway") { + $data = ""; # got data from response + push @output, "BMC Gateway: $data"; + } + + xCAT::SvrUtils::sendmsg("$_", $callback, $node) foreach (@output); + } + + if ($node_info{$node}{cur_status} eq "RSPCONFIG_SET_RESPONSE" and $response_info->{'message'} eq $::RESPONSE_OK) { + if ($status_info{RSPCONFIG_SET_RESPONSE}{ip}) { + $node_info{$node}{bmc} = $status_info{RSPCONFIG_SET_RESPONSE}{ip}; + print "$node: DEBUG BMC IP is $node_info{$node}{bmc}\n"; + } + } + + if ($next_status{ $node_info{$node}{cur_status} }) { + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + gen_send_request($node); + } else { + $wait_node_num--; + } +} + 1; From 8826307c6ec7514c40db323c380de04544d42147 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 2 May 2017 04:13:41 -0400 Subject: [PATCH 087/162] modified depending on comments --- xCAT-server/lib/xcat/plugins/ipmi.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index fd35a443d..516ce40ee 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2364,6 +2364,12 @@ sub power { my $rc = 0; my $text; my $code; + + if (($sessdata->{subcommand} eq "suspend" or $sessdata->{subcommand} eq "wake") and isopenpower($sessdata)) { + xCAT::SvrUtils::sendmsg([ 1, "unsupported command power $sessdata->{subcommand} for OpenPower" ], $callback, $sessdata->{node}, %allerrornodes); + return; + } + if ($sessdata->{subcommand} eq "reseat") { reseat_node($sessdata); } elsif (not $sessdata->{acpistate} and is_systemx($sessdata)) { #Only implemented for IBM servers From 7c68f4595e94ceaf4f5bc6a1e180325e621499a3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 2 May 2017 09:34:18 -0400 Subject: [PATCH 088/162] sleep time fixes in comments and message --- xCAT-server/lib/xcat/plugins/ipmi.pm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 505042365..102061a59 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1785,8 +1785,8 @@ sub wait_for_os_to_reboot { if ($verbose) { xCAT::SvrUtils::sendmsg("Sleeping for a few min waiting for node to power on before attempting to continue", $callback, $sessdata->{node}, %allerrornodes); } - sleep($initial_sleep); # sleep for this many min for node to reboot - # Start testing every 10 sec for node to be booted. Give up after 5 min. + sleep($initial_sleep); # sleep initially for $initial_sleep seconds for node to reboot + # Start testing every $interval sec for node to be booted. Give up after $retry times. foreach (1..$retry) { # Test node is booted in to OS $cmd = "nodestat $sessdata->{node} | /usr/bin/grep sshd"; @@ -1799,12 +1799,12 @@ sub wait_for_os_to_reboot { return 1; #Node booted } else { - # Still not booted, wait for 10 sec and try again + # Still not booted, wait for $interval sec and try again if ($verbose) { $cmd = "nodestat $sessdata->{node}"; $output = xCAT::Utils->runcmd($cmd, -1); my ($nodename, $state) = split(/:/, $output); - xCAT::SvrUtils::sendmsg("($_) Node still not ready. Current state - $state, test again in 10 sec.", $callback, $sessdata->{node}, %allerrornodes); + xCAT::SvrUtils::sendmsg("($_) Node still not ready. Current state - $state, test again in $interval sec.", $callback, $sessdata->{node}, %allerrornodes); } sleep($interval); } @@ -2059,6 +2059,7 @@ RETRY_UPGRADE: # For firestone machines if updating from 810 to 820 version or from 820 to 810, # extra steps are needed. Hanled in "if" block, "else" block is normal update in a single step. + my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); if ($is_firestone and (($firestone_update_version eq "820" and $htm_update_version eq "810") or ($firestone_update_version eq "810" and $htm_update_version eq "820")) @@ -2068,7 +2069,6 @@ RETRY_UPGRADE: $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file component 0 force "; $cmd .= $verbose_opt; - my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); $cmd .= " >".$rflash_log_file." 2>&1"; if ($verbose) { xCAT::SvrUtils::sendmsg([ 0, @@ -2092,7 +2092,6 @@ RETRY_UPGRADE: $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file component 1 force "; $cmd .= $verbose_opt; - my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); $cmd .= " >>".$rflash_log_file." 2>&1"; if ($verbose) { xCAT::SvrUtils::sendmsg([ 0, @@ -2120,7 +2119,6 @@ RETRY_UPGRADE: $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file component 2 force "; $cmd .= $verbose_opt; - my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); $cmd .= " >>".$rflash_log_file." 2>&1"; if ($verbose) { xCAT::SvrUtils::sendmsg([ 0, @@ -2143,7 +2141,6 @@ RETRY_UPGRADE: $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force "; $cmd .= $verbose_opt; - my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); $cmd .= " >".$rflash_log_file." 2>&1"; if ($verbose) { xCAT::SvrUtils::sendmsg([ 0, From e6157c6d51ebbae537b36f87f5d253d26ae02072 Mon Sep 17 00:00:00 2001 From: Amanda Duffy Date: Tue, 2 May 2017 13:49:51 -0400 Subject: [PATCH 089/162] Add piflash man page --- xCAT-client/pods/man1/piflash.1.pod | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 xCAT-client/pods/man1/piflash.1.pod diff --git a/xCAT-client/pods/man1/piflash.1.pod b/xCAT-client/pods/man1/piflash.1.pod new file mode 100644 index 000000000..f10afcde1 --- /dev/null +++ b/xCAT-client/pods/man1/piflash.1.pod @@ -0,0 +1,13 @@ + +=head1 NAME + +B - Remotely applies firmware updates to servers. + +=head1 SYNOPSIS + +B --package + + +=head1 DESCRIPTION + +B Remotely applies firmware updates to servers. \ No newline at end of file From cf57aba831c23202b07e5b004a87c31de701a752 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Tue, 2 May 2017 22:22:42 -0400 Subject: [PATCH 090/162] add more case and description --- .../autotest/bundle/rhels7.104-ppc64el.bundle | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels7.104-ppc64el.bundle b/xCAT-test/autotest/bundle/rhels7.104-ppc64el.bundle index b4a409a0c..e1ed1f7a4 100644 --- a/xCAT-test/autotest/bundle/rhels7.104-ppc64el.bundle +++ b/xCAT-test/autotest/bundle/rhels7.104-ppc64el.bundle @@ -1,3 +1,4 @@ +#The cases in this bundle are used to test hardware control against P9 server and 2 kinds provision on P9 server. bmcdiscover_q bmcdiscover_help bmcdiscover_version @@ -17,9 +18,28 @@ rpower_status rpower_state rpower_on rpower_reset +rsetboot_h +rsetboot_help +rsetboot_v +rsetboot_node_invalidnode +rsetboot_noderange_net +rsetboot_node_invalidaction +rsetboot_group_net rsetboot_hd_statcheck rsetboot_net_statcheck rsetboot_cd_statcheck rsetboot_default_statcheck +reventlog_null +reventlog_all +reventlog_clear +reventlog_numofentries +rspconfig_ip +rspconfig_ip_invalid +rspconfig_netmask +rspconfig_netmask_invalid +rspconfig_gateway +rspconfig_gateway_invalid +rspconfig_node_invalid +rspconfig_ip_null reg_linux_diskfull_installation_flat reg_linux_diskless_installation_flat From f0a6d22c9e058612d4158abbf9f6658b982867c0 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 2 May 2017 22:22:33 -0400 Subject: [PATCH 091/162] modified depending on comments --- .../references/man1/rspconfig.1.rst | 7 +++ perl-xCAT/xCAT/Usage.pm | 4 +- xCAT-client/pods/man1/rspconfig.1.pod | 4 ++ xCAT-server/lib/xcat/plugins/openbmc.pm | 49 ++++++------------- 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst index 38df32d0a..43b873c1c 100644 --- a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst @@ -43,6 +43,13 @@ BMC specific: \ **rspconfig**\ \ *noderange*\ \ **garp**\ =\ *time*\ +OpenBMC specific: +================= + + +\ **rspconfig**\ \ *noderange*\ {\ **vlan | ip | netmask | gateway**\ } + + MPA specific: ============= diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 8e2786a52..e3f61a31a 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -132,9 +132,11 @@ my %usage = ( rspconfig [snmpdest|alert|community] [-V|--verbose] rspconfig [snmpdest=|alert=|community=] BMC specific: - rspconfig [ip|netmask|gateway|backupgateway|garp] + rspconfig [vlan|ip|netmask|gateway|backupgateway|garp] rspconfig [garp=] rspconfig [userid= username= password=] + OpenBMC specific: + rspconfig [vlan|ip|netmask|gateway] iDataplex specific: rspconfig [thermprofile] rspconfig [thermprofile=] diff --git a/xCAT-client/pods/man1/rspconfig.1.pod b/xCAT-client/pods/man1/rspconfig.1.pod index 783eed89e..1b8ff24c4 100644 --- a/xCAT-client/pods/man1/rspconfig.1.pod +++ b/xCAT-client/pods/man1/rspconfig.1.pod @@ -22,6 +22,10 @@ B I {B|B|B|B|B| B I B=I