From aa3c152ae2611f089623709ba18675a56e4ea02c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 29 Mar 2017 14:32:10 -0400 Subject: [PATCH 01/18] 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 e64d8d8567c0f800241d0223f9c3a075cbb95abc Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 13 Apr 2017 08:55:28 -0400 Subject: [PATCH 02/18] 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 b3749bb85d46979bcace5c38df73920b50743e98 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 17 Apr 2017 15:32:23 -0400 Subject: [PATCH 03/18] 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 b02d149213c4787e54c705670e1ea1b1b8e838fd Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 19 Apr 2017 14:44:46 -0400 Subject: [PATCH 04/18] 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 40441d9e7180a37ea84b6d139b43bac417f9e26d Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 24 Apr 2017 02:32:10 -0400 Subject: [PATCH 05/18] 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 669561e649180de4c69dfe52b9804a7cc88405cb Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 25 Apr 2017 04:34:31 -0400 Subject: [PATCH 06/18] 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 07/18] 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 08/18] 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 09/18] 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 3d7bd7bab3681a22e490a01c18ab62b6a18e469a Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 26 Apr 2017 13:19:47 -0400 Subject: [PATCH 10/18] 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 11/18] 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 b5fae952051ea307f562a4375ede6f56250ef1da Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 27 Apr 2017 06:40:13 -0400 Subject: [PATCH 12/18] 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 13/18] 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 14/18] 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 15/18] 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 16/18] 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 17/18] 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 18/18] 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