From 8d897163271e80c4b98a2e5e7719d2c08047f98f Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 30 Apr 2015 04:23:25 -0400 Subject: [PATCH 01/40] modify installation testcase --- .../testcase/installation/reg_linux_SN_installation_hierarchy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index 69e0d1b0b..c04c0b27a 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -3,7 +3,7 @@ os:Linux cmd:chtab key=nameservers site.value="" check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$CN vmstorage=dir:///var/lib/libvirt/images/ && mkvm $$CN -s 25G; fi +cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$SN vmstorage=dir:///var/lib/libvirt/images/ && mkvm $$SN -s 25G; fi cmd:makedns -n check:rc==0 From 579a9106843bfa09f655eadc76dd500ee2ef0318 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 30 Apr 2015 04:33:27 -0400 Subject: [PATCH 02/40] add debuginfo in xcattest --- xCAT-test/xcattest | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index c85ddf158..c70ba64e5 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -637,6 +637,7 @@ sub getnodeattr }else{ foreach my $output1 (@output){ if($output1 =~ /$attr=(\w.+)/){ + log_this("$attr is $1"); return $1; } } From a5e3c066196642293d94c2653cafe68e3bf754b8 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 30 Apr 2015 05:32:50 -0400 Subject: [PATCH 03/40] modify installation testcase --- .../testcase/installation/reg_linux_SN_installation_hierarchy | 2 +- .../testcase/installation/reg_linux_diskfull_installation_flat | 2 +- .../testcase/installation/ubuntu_diskless_installation_vm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index c04c0b27a..428b322fb 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -3,7 +3,7 @@ os:Linux cmd:chtab key=nameservers site.value="" check:rc==0 -cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$SN vmstorage=dir:///var/lib/libvirt/images/ && mkvm $$SN -s 25G; fi +cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$SN vmstorage=dir:///var/lib/libvirt/images/ && rmvm $$SN -f -p && mkvm $$SN -s 25G; fi cmd:makedns -n 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 2544b86da..f52bda468 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -5,7 +5,7 @@ cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$CN vmstorage=dir:///var/lib/libvirt/images/ && mkvm $$CN -s 15G; fi +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$CN vmstorage=dir:///var/lib/libvirt/images/ && rmvm $$CN -f -p && mkvm $$CN -s 15G; fi cmd:makedns -n check:rc==0 cmd:makeconservercf diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 98f25d6d8..3b5602313 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -2,7 +2,7 @@ start:Ubuntu_diskless_installation_flat_x86_vm os:Linux cmd:copycds $$ISO check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$CN vmstorage=dir:///var/lib/libvirt/images/ && mkvm $$CN -s 15G; fi +cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$CN vmstorage=dir:///var/lib/libvirt/images/ && rmvm $$CN -f -p && mkvm $$CN -s 15G; fi cmd:makedns -n check:rc==0 cmd:makedhcp -n From 7ef656579419e5067112ec3bfe68045277fec4b6 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 4 May 2015 03:24:54 -0400 Subject: [PATCH 04/40] modify xcattest --- xCAT-test/xcattest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index c70ba64e5..76c20f6ea 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -631,7 +631,7 @@ sub loadcase sub getnodeattr { my ($node, $attr) = @_; - my @output = runcmd("lsdef -t node -o $node -i $attr"); + my @output = runcmd("XCATBYPASS=1 lsdef -t node -o $node -i $attr"); if($::RUNCMD_RC){ return "Unknown"; }else{ From bfaf893d2ba6e57c349f4f5e919c9ef5bfbbf4ae Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 4 May 2015 03:29:54 -0400 Subject: [PATCH 05/40] modify copycds test case --- xCAT-test/autotest/testcase/copycds/cases0 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-test/autotest/testcase/copycds/cases0 b/xCAT-test/autotest/testcase/copycds/cases0 index 828fe034a..77ce810e4 100644 --- a/xCAT-test/autotest/testcase/copycds/cases0 +++ b/xCAT-test/autotest/testcase/copycds/cases0 @@ -18,6 +18,8 @@ cmd:copycds -n __GETNODEATTR($$CN,os)__ $$ISO check:rc==0 check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__ check:output=~Media copy operation successful +cmd:lsdef $$CN +cmd:ps -aux |grep copycds cmd:ls /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__ check:rc==0 end From dd263f0414e0ccea97a7a9f6cd04b337c79c2c73 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 4 May 2015 04:17:38 -0400 Subject: [PATCH 06/40] modify bundle file --- xCAT-test/autotest/bundle/p_rhels_cmd.bundle | 7 ------- xCAT-test/autotest/bundle/p_sles_cmd.bundle | 7 ------- 2 files changed, 14 deletions(-) diff --git a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle index a35c0ead3..2f52296eb 100644 --- a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle +++ b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle @@ -224,13 +224,6 @@ noderange_XCAT_NODE_PREFIX noderange_XCAT_NODE_SUFFIX noderange_exclusion noderange_group_intersection -confignics_config_one_port_single_value -confignics_config_multiple_ports_single_value -confignics_config_multiple_ports_multiple_value -confignics_config_multiple_port_withnichostnamesuffixes_multiple_value -confignics_config_multiple_port_withnicaliases_multiple_value -confignics_disable_set_to_yes -confignics_disable_set_to_1 xdsh_h xdsh_V xdsh_regular_command diff --git a/xCAT-test/autotest/bundle/p_sles_cmd.bundle b/xCAT-test/autotest/bundle/p_sles_cmd.bundle index a35c0ead3..2f52296eb 100644 --- a/xCAT-test/autotest/bundle/p_sles_cmd.bundle +++ b/xCAT-test/autotest/bundle/p_sles_cmd.bundle @@ -224,13 +224,6 @@ noderange_XCAT_NODE_PREFIX noderange_XCAT_NODE_SUFFIX noderange_exclusion noderange_group_intersection -confignics_config_one_port_single_value -confignics_config_multiple_ports_single_value -confignics_config_multiple_ports_multiple_value -confignics_config_multiple_port_withnichostnamesuffixes_multiple_value -confignics_config_multiple_port_withnicaliases_multiple_value -confignics_disable_set_to_yes -confignics_disable_set_to_1 xdsh_h xdsh_V xdsh_regular_command From d742efdb4305875c6bfea830f4d035f334d22284 Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 4 May 2015 04:30:13 -0400 Subject: [PATCH 07/40] change the name of partition file in ubuntu from /tmp/partitioning to /tmp/partitionfile --- xCAT-server/lib/perl/xCAT/Template.pm | 4 +-- .../share/xcat/install/scripts/pre.ubuntu | 28 +++++++-------- .../xcat/install/scripts/pre.ubuntu.ppc64 | 34 +++++++++---------- .../share/xcat/install/ubuntu/compute.tmpl | 4 +-- .../share/xcat/install/ubuntu/service.tmpl | 15 +++++--- 5 files changed, 46 insertions(+), 39 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index d0e53090a..88d47a65e 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -393,8 +393,8 @@ sub subvars { $partcontent .= "/tmp/partscript\n"; }else{ # Put the code to decode the preseed recipe file - #$partcontent .= "python -c 'import base64; print base64.b64decode(open(\"/tmp/partscript.enc\",\"rb\").read())' >/tmp/partitioning\n"; - $partcontent .= "base64decode/tmp/partitioning\n"; + #$partcontent .= "python -c 'import base64; print base64.b64decode(open(\"/tmp/partscript.enc\",\"rb\").read())' >/tmp/partitionfile\n"; + $partcontent .= "base64decode/tmp/partitionfile\n"; } #replace the #XCA_PARTMAN_RECIPE_SCRIPT# diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu b/xCAT-server/share/xcat/install/scripts/pre.ubuntu index 0e0262595..1fc63dfb6 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu @@ -179,22 +179,22 @@ base64decode() } if [ -d /sys/firmware/efi ]; then - echo "ubuntu-efi ::" > /tmp/partitioning - echo " 512 512 1024 fat16" >> /tmp/partitioning - echo ' $iflabel{ gpt } $reusemethod{ } method{ efi } format{ }' >> /tmp/partitioning - echo " ." >> /tmp/partitioning + echo "ubuntu-efi ::" > /tmp/partitionfile + echo " 512 512 1024 fat16" >> /tmp/partitionfile + echo ' $iflabel{ gpt } $reusemethod{ } method{ efi } format{ }' >> /tmp/partitionfile + echo " ." >> /tmp/partitionfile else - echo "ubuntu-boot ::" > /tmp/partitioning - echo "100 50 100 ext3" >> /tmp/partitioning - echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ /boot }' >> /tmp/partitioning - echo " ." >> /tmp/partitioning + echo "ubuntu-boot ::" > /tmp/partitionfile + echo "100 50 100 ext3" >> /tmp/partitionfile + echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ /boot }' >> /tmp/partitionfile + echo " ." >> /tmp/partitionfile fi -echo "500 10000 1000000000 ext3" >> /tmp/partitioning -echo " method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / }" >> /tmp/partitioning -echo " ." >> /tmp/partitioning -echo "2048 512 300% linux-swap" >> /tmp/partitioning -echo " method{ swap } format{ }" >> /tmp/partitioning -echo " ." >> /tmp/partitioning +echo "500 10000 1000000000 ext3" >> /tmp/partitionfile +echo " method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / }" >> /tmp/partitionfile +echo " ." >> /tmp/partitionfile +echo "2048 512 300% linux-swap" >> /tmp/partitionfile +echo " method{ swap } format{ }" >> /tmp/partitionfile +echo " ." >> /tmp/partitionfile #XCA_PARTMAN_RECIPE_SCRIPT# #XCA_PARTMAN_DISK_SCRIPT# diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 b/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 index 5ca50160f..45637333d 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 @@ -193,27 +193,27 @@ base64decode() } if [ -d /sys/firmware/efi ]; then - echo "ubuntu-efi ::" > /tmp/partitioning - echo " 512 512 1024 fat16" >> /tmp/partitioning - echo ' $iflabel{ gpt } $reusemethod{ } method{ efi } format{ }' >> /tmp/partitioning - echo " ." >> /tmp/partitioning + echo "ubuntu-efi ::" > /tmp/partitionfile + echo " 512 512 1024 fat16" >> /tmp/partitionfile + echo ' $iflabel{ gpt } $reusemethod{ } method{ efi } format{ }' >> /tmp/partitionfile + echo " ." >> /tmp/partitionfile else - echo "ubuntu-boot ::" > /tmp/partitioning + echo "ubuntu-boot ::" > /tmp/partitionfile - echo "8 1 1 prep" >> /tmp/partitioning - echo ' $primary{ } $bootable{ } method{ prep }' >> /tmp/partitioning - echo " ." >> /tmp/partitioning + echo "8 1 1 prep" >> /tmp/partitionfile + echo ' $primary{ } $bootable{ } method{ prep }' >> /tmp/partitionfile + echo " ." >> /tmp/partitionfile - #echo "100 50 100 ext4" >> /tmp/partitioning - #echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /boot }' >> /tmp/partitioning - #echo " ." >> /tmp/partitioning + #echo "100 50 100 ext4" >> /tmp/partitionfile + #echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /boot }' >> /tmp/partitionfile + #echo " ." >> /tmp/partitionfile fi -echo "500 10000 1000000000 ext4" >> /tmp/partitioning -echo " method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ / }" >> /tmp/partitioning -echo " ." >> /tmp/partitioning -echo "2048 512 300% linux-swap" >> /tmp/partitioning -echo " method{ swap } format{ }" >> /tmp/partitioning -echo " ." >> /tmp/partitioning +echo "500 10000 1000000000 ext4" >> /tmp/partitionfile +echo " method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ / }" >> /tmp/partitionfile +echo " ." >> /tmp/partitionfile +echo "2048 512 300% linux-swap" >> /tmp/partitionfile +echo " method{ swap } format{ }" >> /tmp/partitionfile +echo " ." >> /tmp/partitionfile #XCA_PARTMAN_RECIPE_SCRIPT# diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index 39398d6e5..bb784ca26 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -37,7 +37,7 @@ d-i partman-auto/method string regular d-i partman-lvm/device_remove_lvm boolean true d-i partman-md/device_remove_md boolean true -#create the /tmp/partitioning based on the uefi or legacy bios +#create the /tmp/partitionfile based on the uefi or legacy bios d-i partman/early_command string \ set -x; \ if [ -f /tmp/boot_disk ]; then \ @@ -63,7 +63,7 @@ d-i partman/early_command string \ echo "/dev/$DEV" > /tmp/boot_disk; \ fi; \ debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" -d-i partman-auto/expert_recipe_file string /tmp/partitioning +d-i partman-auto/expert_recipe_file string /tmp/partitionfile # This makes partman automatically partition without confirmation, provided # that you told it what to do using one of the methods above. diff --git a/xCAT-server/share/xcat/install/ubuntu/service.tmpl b/xCAT-server/share/xcat/install/ubuntu/service.tmpl index 7690cd96c..5561fb2e7 100644 --- a/xCAT-server/share/xcat/install/ubuntu/service.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/service.tmpl @@ -22,11 +22,12 @@ d-i netcfg/dhcp_timeout string 120 #d-i mirror/suite string testing # Suite to use for loading installer components (optional). #d-i mirror/udeb/suite string testing + # Use the following option to add additional boot parameters for the # installed system (if supported by the bootloader installer). # Note: options passed to the installer will be added automatically. -d-i debian-installer/add-kernel-opts string #XCATVAR:PERSKCMDLINE# +d-i debian-installer/add-kernel-opts string #XCATVAR:PERSKCMDLINE# ### Partitioning # This creates a small /boot partition, suitable @@ -36,9 +37,13 @@ d-i partman-auto/method string regular d-i partman-lvm/device_remove_lvm boolean true d-i partman-md/device_remove_md boolean true -#create the /tmp/partitioning based on the uefi or legacy bios +#create the /tmp/partitionfile based on the uefi or legacy bios d-i partman/early_command string \ set -x; \ + if [ -f /tmp/boot_disk ]; then \ + debconf-set partman-auto/disk "$(cat /tmp/boot_disk)"; \ + exit; \ + fi; \ rm /tmp/devs-with-boot 2>/dev/null || true; \ for d in $(list-devices partition); do \ mkdir -p /tmp/mymount; \ @@ -53,12 +58,12 @@ d-i partman/early_command string \ head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \ rm /tmp/devs-with-boot 2>/dev/null || true; \ else \ - DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \ + DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*[s|h|v]d[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o '[s|h|v]d.*$'`; \ if [[ "$DEV" == "" ]]; then DEV="sda"; fi; \ echo "/dev/$DEV" > /tmp/boot_disk; \ fi; \ debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" -d-i partman-auto/expert_recipe_file string /tmp/partitioning +d-i partman-auto/expert_recipe_file string /tmp/partitionfile # This makes partman automatically partition without confirmation, provided # that you told it what to do using one of the methods above. @@ -68,6 +73,7 @@ d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true +#XCA_PARTMAN_ADDITIONAL_CFG# ### Account setup @@ -137,3 +143,4 @@ d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoin mount -o bind /sys /target/sys; \ chroot /target /root/post.script; \ cp /target/etc/network/interfaces /etc/network/interfaces + From 98e84f617f34d1660f2fa38f8bb4ab794b927186 Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 4 May 2015 05:08:58 -0400 Subject: [PATCH 08/40] add the description of ubuntu partition script support in linuximage.partitionfile schema --- perl-xCAT/xCAT/Schema.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 028cf29dd..87745f7e8 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -771,7 +771,7 @@ linuximage => { permission => 'The mount permission of /.statelite directory is used, its default value is 755', dump => qq{The NFS directory to hold the Linux kernel dump file (vmcore) when the node with this image crashes, its format is "nfs:///". If you want to use the node's "xcatmaster" (its SN or MN), can be left blank. For example, "nfs:///" means the NFS directory to hold the kernel dump file is on the node's SN, or MN if there's no SN.}, crashkernelsize => 'the size that assigned to the kdump kernel. If the kernel size is not set, 256M will be the default value.', - partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.', + partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/boot_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," ', driverupdatesrc => 'The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_srouce_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", From f44b444843d739e4087a6a1cda9fb59a3afef5de Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 6 May 2015 14:48:30 -0400 Subject: [PATCH 09/40] Bug#4663 RUNBOOTSCRIPTS value in the setuppostbootscripts --- xCAT/postscripts/setuppostbootscripts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/setuppostbootscripts b/xCAT/postscripts/setuppostbootscripts index 48a601be0..3efa9ad11 100755 --- a/xCAT/postscripts/setuppostbootscripts +++ b/xCAT/postscripts/setuppostbootscripts @@ -26,9 +26,9 @@ if [ ! -d "/opt/xcat" ]; then fi infofile="/opt/xcat/xcatinfo" if [ "$RUNBOOTSCRIPTS" = "yes" ] || [ "$RUNBOOTSCRIPTS" = "YES" ]; then - RUNBOOTSCRIPTS=YES + RUNBOOTSCRIPTS=yes else - RUNBOOTSCRIPTS=NO + RUNBOOTSCRIPTS=no fi # check to see if current setting is already in the file, if so nothing to do if [ -f $infofile ]; then From f4e8d1c2332c3f238a1ec4e8719e0e059d296f86 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 6 May 2015 16:49:47 -0400 Subject: [PATCH 10/40] Create a plugin to handle switchdiscover command --- perl-xCAT/xCAT/Usage.pm | 6 +- xCAT-client/xCAT-client.spec | 1 + .../lib/xcat/plugins/switchdiscover.pm | 248 ++++++++++++++++++ 3 files changed, 254 insertions(+), 1 deletion(-) create mode 100755 xCAT-server/lib/xcat/plugins/switchdiscover.pm diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index c8b10825e..08e7847a4 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -194,7 +194,7 @@ my %usage = ( PPC specific: getmacs [-F filter] getmacs [-M] - getmacs [-V| --verbose] [-f] [-d] [--arp] | [-D {[-o] [-S server] [-G gateway] [-C client] | [--noping]}] + getmacs [-V| --verbose] [-f] [-d] [--arp] | [-D [-o] [-S server] [-G gateway] [-C client]] blade specific: getmacs [-V| --verbose] [-d] [--arp] [-i ethN|enN] ", @@ -286,6 +286,9 @@ my %usage = ( "Usage: lsslp [-h|--help|-v|--version] lsslp [][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP] [-u] [--range IPranges][-t tries][--vpdtable][-C counts][-T timeout]", + "switchdiscover" => +"Usage: switchdiscover [-h|--help|-v|--version] + switchdiscover [][-V|--verbose][-i adpt[,adpt..]][-w][-r|-x|-z][-n][-s scan_methods]", "rflash" => "Usage: rflash [ -h|--help|-v|--version] @@ -481,6 +484,7 @@ my %version = ( "chvm" => "$vers", "rmvm" => "$vers", "lsslp" => "$vers", + "switchdiscover" => "$vers", "rflash" => "$vers", "renergy" => "$vers", "lsflexnode" => "$vers", diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index 116e4d369..fe4d0c13f 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -163,6 +163,7 @@ ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/lsflexnode ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rmflexnode ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/mkflexnode ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsslp +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/switchdiscover ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/imgcapture ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/swapnodes ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/nodegrpch diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm new file mode 100755 index 000000000..f0c9b6cca --- /dev/null +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -0,0 +1,248 @@ +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html + +package xCAT_plugin::switchdiscover; +use lib "/opt/xcat/lib/perl"; +use strict; +use Getopt::Long; +use xCAT::Usage; +use xCAT::NodeRange; +use xCAT::Utils; + +####################################### +# Power methods +####################################### +my %globalopt; +my @filternodes; + + +########################################################################## +# Invokes the callback with the specified message +########################################################################## +sub send_msg { + + my $request = shift; + my $ecode = shift; + my $msg = shift; + my %output; + + ################################################# + # Called from child process - send to parent + ################################################# + if ( exists( $request->{pipe} )) { + my $out = $request->{pipe}; + + $output{errorcode} = $ecode; + $output{data} = \@_; + print $out freeze( [\%output] ); + print $out "\nENDOFFREEZE6sK4ci\n"; + } + ################################################# + # Called from parent - invoke callback directly + ################################################# + elsif ( exists( $request->{callback} )) { + my $callback = $request->{callback}; + $output{errorcode} = $ecode; + $output{data} = $msg; + $callback->( \%output ); + } +} + + +########################################################################## +# Command handler method from tables +########################################################################## +sub handled_commands { + return( {switchdiscover=>"switchdiscover"} ); +} + +########################################################################## +# Parse the command line options and operands +########################################################################## +sub parse_args { + + my $request = shift; + my $args = $request->{arg}; + my $cmd = $request->{command}; + my %opt; + + ############################################# + # Responds with usage statement + ############################################# + local *usage = sub { + my $usage_string = xCAT::Usage->getUsage($cmd); + return( [$_[0], $usage_string] ); + }; + ############################################# + # No command-line arguments - use defaults + ############################################# + if ( !defined( $args )) { + return(0); + } + ############################################# + # Checks case in GetOptions, allows opts + # to be grouped (e.g. -vx), and terminates + # at the first unrecognized option. + ############################################# + @ARGV = @$args; + $Getopt::Long::ignorecase = 0; + Getopt::Long::Configure( "bundling" ); + + ############################################# + # Process command-line flags + ############################################# + if (!GetOptions( \%opt, + qw(h|help V|Verbose v|version i=s x z w r n range=s s=s))) { + return( usage() ); + } + + ############################################# + # Check for node range + ############################################# + if ( scalar(@ARGV) eq 1 ) { + my @nodes = xCAT::NodeRange::noderange( @ARGV ); + foreach (@nodes) { + push @filternodes, $_; + } + unless (@filternodes) { + return(usage( "Invalid Argument: $ARGV[0]" )); + } + } elsif ( scalar(@ARGV) > 1 ) { + return(usage( "Invalid flag, please check and retry." )); + } + + ############################################# + # Option -V for verbose output + ############################################# + if ( exists( $opt{V} )) { + $globalopt{verbose} = 1; + } + + ############################################# + # Check for mutually-exclusive formatting + ############################################# + if ( (exists($opt{r}) + exists($opt{x}) + exists($opt{z}) ) > 1 ) { + return( usage() ); + } + + ############################################# + # Check for unsupported service type + ############################################# + if ( exists( $opt{s} )) { + $globalopt{service} = $opt{s}; + } + + ############################################# + # Check the validation of -i option + ############################################# + if ( exists( $opt{i} )) { + foreach ( split /,/, $opt{i} ) { + } + $globalopt{i} = $opt{i}; + } + + ############################################# + # write to the database + ############################################# + if ( exists( $opt{w} )) { + $globalopt{w} = 1; + } + + ############################################# + # list the raw information + ############################################# + if ( exists( $opt{r} )) { + $globalopt{r} = 1; + } + + ############################################# + # list the xml formate data + ############################################# + if ( exists( $opt{x} )) { + $globalopt{x} = 1; + } + + ############################################# + # list the stanza formate data + ############################################# + if ( exists( $opt{z} )) { + $globalopt{z} = 1; + } + + ######################################################### + # only list the nodes that discovered for the first time + ######################################################### + if ( exists( $opt{n} )) { + $globalopt{n} = 1; + } + + ######################################################### + # only list the nodes that discovered for the first time + ######################################################### + if ( exists( $opt{n} )) { + $globalopt{n} = 1; + } + + return; +} + + +############################################################################# +# Preprocess request from xCAT daemon +############################################################################# +sub preprocess_request { + my $req = shift; + if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; } + my $callback=shift; + my $command = $req->{command}->[0]; + my $extrargs = $req->{arg}; + my @exargs=($req->{arg}); + if (ref($extrargs)) { + @exargs=@$extrargs; + } + my $usage_string=xCAT::Usage->parseCommand($command, @exargs); + if ($usage_string) { + $callback->({data=>[$usage_string]}); + $req = {}; + return; + } + + my @result = (); + my $mncopy = {%$req}; + push @result, $mncopy; + return \@result; +} + +########################################################################## +# Process request from xCat daemon +########################################################################## +sub process_request { + my $req = shift; + my $callback = shift; + + ########################################### + # Build hash to pass around + ########################################### + my %request; + $request{arg} = $req->{arg}; + $request{callback} = $callback; + $request{command} = $req->{command}->[0]; + + #################################### + # Process command-specific options + #################################### + my $result = parse_args( \%request ); + + #################################### + # Return error + #################################### + if ( ref($result) eq 'ARRAY' ) { + send_msg( \%request, 1, @$result ); + return(1); + } + + return; + +} + +1; + From c6bb6956991ab828db18823ffd8d01cb6395f5f8 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 6 May 2015 22:10:52 -0400 Subject: [PATCH 11/40] commit f4e8d1c2332c3f238a1ec4e8719e0e059d296f86 removed --noping option for getmacs --- perl-xCAT/xCAT/Usage.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 08e7847a4..16815a68c 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -194,7 +194,7 @@ my %usage = ( PPC specific: getmacs [-F filter] getmacs [-M] - getmacs [-V| --verbose] [-f] [-d] [--arp] | [-D [-o] [-S server] [-G gateway] [-C client]] + getmacs [-V| --verbose] [-f] [-d] [--arp] | [-D {[-o] [-S server] [-G gateway] [-C client] | [--noping]}] blade specific: getmacs [-V| --verbose] [-d] [--arp] [-i ethN|enN] ", From f88be79e697566a4c15923fcb3b3874d1f6ae84b Mon Sep 17 00:00:00 2001 From: litingt Date: Wed, 6 May 2015 22:38:12 -0400 Subject: [PATCH 12/40] update to avoid eth0/eth1 issue --- xCAT-test/autotest/testcase/confignics/cases0 | 58 ------------------- 1 file changed, 58 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignics/cases0 b/xCAT-test/autotest/testcase/confignics/cases0 index 72669281a..4b2b09e40 100644 --- a/xCAT-test/autotest/testcase/confignics/cases0 +++ b/xCAT-test/autotest/testcase/confignics/cases0 @@ -6,15 +6,10 @@ cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicn check:rc==0 cmd:updatenode $$CN -P confignics check:rc==0 -cmd:xdsh $$CN ifconfig -check:output=~100.1.0.100 -cmd:xdsh $$CN netstat -rn -check:output=~100.1.0.0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~100.1.0.100 check:output!~dhcp cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 -cmd:xdsh $$CN ifdown $$SECONDNIC cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi end @@ -30,12 +25,6 @@ cmd:chdef $$CN nicips.$$THIRDNIC=200.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnet check:rc==0 cmd:updatenode $$CN -P confignics check:rc==0 -cmd:xdsh $$CN ifconfig -check:output=~100.1.0.100 -check:output=~200.1.0.100 -cmd:xdsh $$CN netstat -rn -check:output=~100.1.0.0 -check:output=~200.1.0.0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~100.1.0.100 check:output!~dhcp @@ -44,8 +33,6 @@ check:output=~200.1.0.100 check:output!~dhcp cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 cmd:rmdef -t network -o 200_1_0_0-255_255_0_0 -cmd:xdsh $$CN ifdown $$SECONDNIC -cmd:xdsh $$CN ifdown $$THIRDNIC cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi end @@ -66,16 +53,6 @@ cmd:chdef $$CN nicips.$$THIRDNIC="13.1.0.100|14.1.0.100" nictypes.$$THIRDNIC=Eth check:rc==0 cmd:updatenode $$CN -P confignics check:rc==0 -cmd:xdsh $$CN ifconfig -check:output=~11.1.0.100 -check:output=~12.1.0.100 -check:output=~13.1.0.100 -check:output=~14.1.0.100 -cmd:xdsh $$CN netstat -rn -check:output=~11.1.0.0 -check:output=~12.1.0.0 -check:output=~13.1.0.0 -check:output=~14.1.0.0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~11.1.0.100 check:output!~dhcp @@ -92,8 +69,6 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 -cmd:xdsh $$CN ifdown $$SECONDNIC -cmd:xdsh $$CN ifdown $$THIRDNIC cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi @@ -125,16 +100,6 @@ check:output=~$$CN-$$THIRDNIC-1 check:output=~$$CN-$$THIRDNIC-2 cmd:updatenode $$CN -P confignics check:rc==0 -cmd:xdsh $$CN ifconfig -check:output=~11.1.0.100 -check:output=~12.1.0.100 -check:output=~13.1.0.100 -check:output=~14.1.0.100 -cmd:xdsh $$CN netstat -rn -check:output=~11.1.0.0 -check:output=~12.1.0.0 -check:output=~13.1.0.0 -check:output=~14.1.0.0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~11.1.0.100 check:output!~dhcp @@ -151,8 +116,6 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 -cmd:xdsh $$CN ifdown $$SECONDNIC -cmd:xdsh $$CN ifdown $$THIRDNIC cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi @@ -183,16 +146,6 @@ check:output=~aliases2-1 check:output=~aliases2-2 cmd:updatenode $$CN -P confignics check:rc==0 -cmd:xdsh $$CN ifconfig -check:output=~11.1.0.100 -check:output=~12.1.0.100 -check:output=~13.1.0.100 -check:output=~14.1.0.100 -cmd:xdsh $$CN netstat -rn -check:output=~11.1.0.0 -check:output=~12.1.0.0 -check:output=~13.1.0.0 -check:output=~14.1.0.0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~11.1.0.100 check:output!~dhcp @@ -209,8 +162,6 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 -cmd:xdsh $$CN ifdown $$SECONDNIC -cmd:xdsh $$CN ifdown $$THIRDNIC cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi @@ -228,10 +179,6 @@ cmd:chtab node=$$CN nics.disable=yes check:rc==0 cmd:updatenode $$CN -P confignics check:rc==0 -cmd:xdsh $$CN ifconfig -check:output!~100.1.0.100 -cmd:xdsh $$CN netstat -rn -check:output!~100.1.0.0 cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC; fi check:output!~100.1.0.100 cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 @@ -249,14 +196,9 @@ cmd:chtab node=$$CN nics.disable=1 check:rc==0 cmd:updatenode $$CN -P confignics check:rc==0 -cmd:xdsh $$CN ifconfig -check:output!~100.1.0.100 -cmd:xdsh $$CN netstat -rn -check:output!~100.1.0.0 cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC; fi check:output!~100.1.0.100 cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 cmd:chtab node=$$CN nics.disable=0 end - From 7cc0fbc068062b49af4b9c80aaa914cd9303245c Mon Sep 17 00:00:00 2001 From: litingt Date: Wed, 6 May 2015 22:54:59 -0400 Subject: [PATCH 13/40] add confignics cases in the bundle --- xCAT-test/autotest/bundle/p_rhels_cmd.bundle | 7 +++++++ xCAT-test/autotest/bundle/p_sles_cmd.bundle | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle index 2f52296eb..a35c0ead3 100644 --- a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle +++ b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle @@ -224,6 +224,13 @@ noderange_XCAT_NODE_PREFIX noderange_XCAT_NODE_SUFFIX noderange_exclusion noderange_group_intersection +confignics_config_one_port_single_value +confignics_config_multiple_ports_single_value +confignics_config_multiple_ports_multiple_value +confignics_config_multiple_port_withnichostnamesuffixes_multiple_value +confignics_config_multiple_port_withnicaliases_multiple_value +confignics_disable_set_to_yes +confignics_disable_set_to_1 xdsh_h xdsh_V xdsh_regular_command diff --git a/xCAT-test/autotest/bundle/p_sles_cmd.bundle b/xCAT-test/autotest/bundle/p_sles_cmd.bundle index 2f52296eb..a35c0ead3 100644 --- a/xCAT-test/autotest/bundle/p_sles_cmd.bundle +++ b/xCAT-test/autotest/bundle/p_sles_cmd.bundle @@ -224,6 +224,13 @@ noderange_XCAT_NODE_PREFIX noderange_XCAT_NODE_SUFFIX noderange_exclusion noderange_group_intersection +confignics_config_one_port_single_value +confignics_config_multiple_ports_single_value +confignics_config_multiple_ports_multiple_value +confignics_config_multiple_port_withnichostnamesuffixes_multiple_value +confignics_config_multiple_port_withnicaliases_multiple_value +confignics_disable_set_to_yes +confignics_disable_set_to_1 xdsh_h xdsh_V xdsh_regular_command From aa9975fde11986513eb38e99bc0d04b56d6b4636 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 7 May 2015 02:45:54 -0400 Subject: [PATCH 14/40] modify makedhcp testcase --- xCAT-test/autotest/testcase/makedhcp/cases0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-test/autotest/testcase/makedhcp/cases0 b/xCAT-test/autotest/testcase/makedhcp/cases0 index 415cc22a7..64f87a839 100644 --- a/xCAT-test/autotest/testcase/makedhcp/cases0 +++ b/xCAT-test/autotest/testcase/makedhcp/cases0 @@ -5,9 +5,12 @@ cmd:makedhcp -n check:rc==0 cmd:ls /etc/dhcp/dhcpd.conf || ls /etc/dhcpd.conf check:rc==0 +cmd:sleep 20 cmd:ps -e | grep dhcpd check:rc==0 check:output=~dhcpd +cmd:if cat /etc/*release |grep Ubuntu >/dev/null;then service isc-dhcp-server status;else service dhcpd status;fi +check:output=~running cmd:if [ -f "/etc/dhcp/dhcpd.conf" ]; then mv -f /etc/dhcp/dhcpd.conf.bak /etc/dhcp/dhcpd.conf; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf.bak /etc/dhcpd.conf; fi end From 0f8948c19f09bccf0d4f0cf4848e7d64b5f31122 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 7 May 2015 02:51:27 -0400 Subject: [PATCH 15/40] modify installation testcase --- .../testcase/installation/reg_linux_diskfull_installation_flat | 1 + 1 file changed, 1 insertion(+) 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 f52bda468..9769750c6 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -19,6 +19,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 +cmd:sleep 10 cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi check:output=~$$CN From 927da03197a4e4dc7c7848fb363296e4e9a07dbf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 7 May 2015 04:43:28 -0400 Subject: [PATCH 16/40] add xcat-dep tar ball name in README --- builddep.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builddep.sh b/builddep.sh index 67bde6af9..823cd1159 100755 --- a/builddep.sh +++ b/builddep.sh @@ -263,6 +263,9 @@ do : ; done # Upload the README to the SF FRS Area cd xcat-dep +# add a comment to indicate the latest xcat-dep tar ball name +sed "6 iThe latest xcat-dep tar ball is ${DFNAME}" -i README + i=0 echo "Uploading README to $FRS/xcat-dep/$FRSDIR/ ..." while [ $((i+=1)) -le 5 ] && ! rsync -v README $UPLOADUSER,xcat@web.sourceforge.net:$FRS/xcat-dep/$FRSDIR/ From d55906f8cc3d9c79df0535eca0a114ba9f0c01d8 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 7 May 2015 15:26:33 -0400 Subject: [PATCH 17/40] Task 41103: Create Man pages for switchdiscover --- xCAT-client/pods/man1/switchdiscover.1.pod | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 xCAT-client/pods/man1/switchdiscover.1.pod diff --git a/xCAT-client/pods/man1/switchdiscover.1.pod b/xCAT-client/pods/man1/switchdiscover.1.pod new file mode 100755 index 000000000..b756b2b47 --- /dev/null +++ b/xCAT-client/pods/man1/switchdiscover.1.pod @@ -0,0 +1,81 @@ + +=head1 NAME + +B - Discover all the switches on the subnets. + + +=head1 SYNOPSIS + +I + +I + + +I + + + +=head1 DESCRIPTION + +The switchdiscover command scan the subnets and discover all the swithches on the subnets. The default subnets will be the ones that the xCAT management node is on. The command will also take a subnet as an input. The default discovery method will be lldpd. The nmap and snmp methods will be supported as options chosen by -s option. The optional -r -x and -z format the output. + + +=head1 OPTIONS + +B The switches which the user want to discover. + If the user specify the noderange, switchdiscover will just return the switches + in the node range. Which means it will help to add the new switches to the xCAT + database without modifying the existed definitions. But the switches' name + specified in noderange should be defined in database in advance. The ips of the + switches will be defined in /etc/hosts file. This command will fill the switch + attributes for the switches defined. + +B<-i> adapter(s) the command will search through (defaults to all available adapters). + +B<-h> Display usage message. + +B<-n> Only display and write the newly discovered switches. + +B<--range> Specify one or more IP ranges. + It accepts multiple formats. For example, 192.168.1.1/24, 40-41.1-2.3-4.1-100. + If the range is huge, for example, 192.168.1.1/8, lsslp may take a very long + time for node scan. So the range should be exactly specified. + +B<-r> Display Raw response. + +B<-s> It is a comma separated list of methods for switch discovery. + The possible switch scan methods are: llpd, nmap and snmp. The default is lldpd. + +B<-v> Command Version. + +B<-V> Verbose output. + +B<-w> Writes output to xCAT database. + +B<-x> XML format. + +B<-z> Stanza formated output. + + +=head1 RETURN VALUE + +0 The command completed successfully. + +1 An error has occurred. + +=head1 EXAMPLES + + + +=head1 FILES + +/opt/xcat/bin/switchdiscover + + +=head1 SEE ALSO + + + + + + From f17fea2637d13f56b45d9fe9be0c0977aa6e1724 Mon Sep 17 00:00:00 2001 From: amy0701 Date: Thu, 7 May 2015 21:52:38 -0400 Subject: [PATCH 18/40] Create a plugin to handle bmcdiscover command --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 296 ++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100755 xCAT-server/lib/xcat/plugins/bmcdiscover.pm diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm new file mode 100755 index 000000000..3797ac0a0 --- /dev/null +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -0,0 +1,296 @@ +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +#------------------------------------------------------- + +=head1 + xCAT plugin package to handle BMC discovery +=cut + +#------------------------------------------------------- +package xCAT_plugin::bmcdiscover; + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + +use xCAT::Table; +use xCAT::Utils; +use xCAT::MsgUtils; +use Getopt::Long; +use Data::Dumper; +use File::Basename; +use File::Path; +use Cwd; + + +my $debianflag = 0; +my $tempstring = xCAT::Utils->osver(); +if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){ + $debianflag = 1; +} + +#------------------------------------------------------- + +=head3 handled_commands + +Return list of commands handled by this plugin + +=cut + +#------------------------------------------------------- + +sub handled_commands +{ + return { + bmcdiscover => "bmcdiscover", + }; +} + +#------------------------------------------------------- + +=head3 process_request + + Process the command + +=cut + +#------------------------------------------------------- +sub process_request +{ + + my $request = shift; + my $callback = shift; + my $request_command = shift; + $::CALLBACK = $callback; + $::args = $request->{arg}; + + + my $command = $request->{command}->[0]; + my $rc; + + if ($command eq "bmcdiscover"){ + $rc = bmcdiscovery($request, $callback, $request_command); + } else{ + $callback->({error=>["Error: $command not found in this module."],errorcode=>[1]}); + return 1; + } + +} + + +#---------------------------------------------------------------------------- + +=head3 bmcdiscover_usage + + Display the bmcdiscover usage +=cut + +#----------------------------------------------------------------------------- + +sub bmcdiscovery_usage { + my $rsp; + push @{ $rsp->{data} }, + "\nUsage: bmcdiscover - discover bmc using scan method,now scan_method can be nmap .\n"; + push @{ $rsp->{data} }, "\tbmcdiscover [-h|--help|-?]\n"; + push @{ $rsp->{data} }, "\tbmcdiscover [-v|--version]\n "; + push @{ $rsp->{data} }, "\tbmcdiscover [-m|--method] scan_method [-r|--range] ip_range \n "; + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); + return 0; +} + +#---------------------------------------------------------------------------- + +=head3 bmcdiscovery_processargs + + Process the bmcdiscovery command line + Returns: + 0 - OK + 1 - just print version + 2 - just print help + 3 - error +=cut + +#----------------------------------------------------------------------------- +sub bmcdiscovery_processargs { + if ( defined ($::args) && @{$::args} ){ + @ARGV = @{$::args}; + } + + # parse the options + # options can be bundled up like -v, flag unsupported options + Getopt::Long::Configure( "bundling", "no_ignore_case", "no_pass_through" ); + my $getopt_success = Getopt::Long::GetOptions( + 'help|h|?' => \$::opt_h, + 'method|m=s' => \$::opt_M, + 'range|r=s' => \$::opt_R, + #'user|U=s' => \$::opt_U, + #'password|P=s' => \$::opt_P, + 'version|v' => \$::opt_v, + ); + + if (!$getopt_success) { + return 3; + } + + ######################################### + # This command is for linux + ######################################### + if ($^O ne 'linux') { + my $rsp = {}; + push @{ $rsp->{data}}, "The bmcdiscovery command is only supported on Linux.\n"; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); + return 1; + } + + ########################################## + # Option -h for Help + ########################################## + if ( defined($::opt_h) ) { + return 2; + } + + ######################################### + # Option -v for version + ######################################### + if ( defined($::opt_v) ) { + create_version_response('bmcdiscover'); + # no usage - just exit + return 1; + } + + ######################################### + # Option -m -r are must + ######################################33 + if ( defined($::opt_M) && defined($::opt_R) ) { + print "This is framework!" + } + + ######################################### + # Other attributes are not allowed + ######################################### + my $more_input = shift(@ARGV); + if ( defined($more_input) ) { + create_error_response("Invalid input: $more_input \n"); + return 3; + } + + return 0; +} + +#---------------------------------------------------------------------------- + +=head3 split_comma_delim_str + + Split comma-delimited list of strings into an array. + + Arguments: comma-delimited string + Returns: Returns list of strings (ref) + +=cut + +#----------------------------------------------------------------------------- +sub split_comma_delim_str { + my $input_str = shift; + + my @result = split(/,/, $input_str); + return \@result; +} + +#---------------------------------------------------------------------------- + +=head3 create_version_response + + Create a response containing the command name and version +=cut + +#----------------------------------------------------------------------------- +sub create_version_response { + my $command = shift; + my $rsp; + my $version = xCAT::Utils->Version(); + push @{ $rsp->{data} }, "$command - xCAT $version"; + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); +} + + +#---------------------------------------------------------------------------- + +=head3 create_error_response + + Create a response containing a single error message + Arguments: error message +=cut + +#----------------------------------------------------------------------------- +sub create_error_response { + my $error_msg = shift; + my $rsp; + push @{ $rsp->{data} }, $error_msg; + xCAT::MsgUtils->message( "E", $rsp, $::CALLBACK ); +} + + +#---------------------------------------------------------------------------- + +=head3 bmcdiscovery + + Support for discovering bmc + Returns: + 0 - OK + 1 - help + 2 - error +=cut + +#----------------------------------------------------------------------------- +sub bmcdiscovery { + + my $request = shift; + my $callback = shift; + my $request_command = shift; + + my $rc = 0; + # process the command line + # 0=success, 1=version, 2=help, 3=error + + $rc = bmcdiscovery_processargs(@_); + if ( $rc != 0 ) { + if ( $rc != 1) { + bmcdiscovery_usage(@_); + } + return ( $rc - 1 ); + } + + + return 0; + +} + + + + + +#---------------------------------------------------------------------------- + +=head3 bmcdiscovery_nmap + + Support for discovering bmc using nmap + + Arguments: + Returns: + 0 - OK + 1 - help + 2 - error +=cut + +#----------------------------------------------------------------------------- + +sub bmcdiscovery_namp { + + print "hello world"; + +} + + + +1; From a3e365003c4e8922398c7e2c53df093742f3e9e6 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 8 May 2015 03:25:24 -0400 Subject: [PATCH 19/40] modify xCATreg --- xCAT-server/share/xcat/tools/xCATreg | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index 954d14438..822899547 100644 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -595,19 +595,16 @@ sub install_xcat { $arch="x86_64" if($mn !~ /aix/ && $mn =~ /x/); if($mn =~ /rh/){ - if($os =~ /rhels7/){ - system("xdsh $confkeys{$mn} \"cd /xcat-dep/rh7.0/$arch && ./mklocalrepo.sh\" >/dev/null 2>&1"); + $os =~ /(\D+)(\d+)\.?(\d?)/; + system("xdsh $confkeys{$mn} \"cd /xcat-dep/rh$2/$arch && ./mklocalrepo.sh\" >/dev/null 2>&1"); system("xdsh $confkeys{$mn} \"rpm --import /RPM-GPG-KEY-redhat-release\" >/dev/null 2>&1"); system("xdsh $confkeys{$mn} \"yum -y install xCAT xCAT-test > /var/log/xcat/install_xcat.log 2>&1\" >/dev/null 2>&1"); + if($os =~ /rhels7/){ system("xdsh $confkeys{$mn} \"yum -y install mariadb-devel-5.5.35-3.el7 mariadb-libs-5.5.35-3.el7 mariadb-server-5.5.35-3.el7 mariadb-bench-5.5.35-3.el7 mariadb-5.5.35-3.el7 perl-DBD-MySQL mysql-connector-odbc unixODBC\" >/dev/null 2>&1"); }elsif($os =~ /rhels6/){ - $os =~ /(\D+)(\d+)\.?(\d?)/; - system("xdsh $confkeys{$mn} \"cd /xcat-dep/rh$2/$arch && ./mklocalrepo.sh\" >/dev/null 2>&1"); - system("xdsh $confkeys{$mn} \"rpm --import /RPM-GPG-KEY-redhat-release\" >/dev/null 2>&1"); - system("xdsh $confkeys{$mn} \"yum -y install xCAT xCAT-test > /var/log/xcat/install_xcat.log 2>&1\" >/dev/null 2>&1"); system("xdsh $confkeys{$mn} \"yum -y install mysql-server mysql mysql-bench mysql-devel mysql-connector-odbc\" >/dev/null 2>&1"); - system("xdsh $confkeys{$mn} \"source /etc/profile.d/xcat.sh\" >/dev/null 2>&1"); } + system("xdsh $confkeys{$mn} \"source /etc/profile.d/xcat.sh\" >/dev/null 2>&1"); if($mn =~ /rhx/){ system("xdsh $confkeys{$mn} \"yum install -y perl-Sys-Virt\" >/dev/null 2>&1"); } From 2c0b4d218229e18ca29317d0ce25147604f574d5 Mon Sep 17 00:00:00 2001 From: amy0701 Date: Fri, 8 May 2015 05:57:06 -0400 Subject: [PATCH 20/40] add nmap scan process framework, ipmi scan TBD --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 248 +++++++++++++++++--- 1 file changed, 219 insertions(+), 29 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 3797ac0a0..de8225003 100755 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -14,6 +14,16 @@ BEGIN } use lib "$::XCATROOT/lib/perl"; +use IO::Socket; +use Thread qw(yield); +use POSIX "WNOHANG"; +use Storable qw(store_fd fd_retrieve); +use strict; +use warnings "all"; +use Getopt::Long; + + + use xCAT::Table; use xCAT::Utils; use xCAT::MsgUtils; @@ -29,7 +39,7 @@ my $tempstring = xCAT::Utils->osver(); if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){ $debianflag = 1; } - +my $parent_fd; #------------------------------------------------------- =head3 handled_commands @@ -65,6 +75,15 @@ sub process_request $::CALLBACK = $callback; $::args = $request->{arg}; + unless(defined($request->{arg})){ + bmcdiscovery_usage(); + return 2; + } + @ARGV = @{$request->{arg}}; + if($#ARGV eq -1){ + return 2; + } + my $command = $request->{command}->[0]; my $rc; @@ -113,6 +132,7 @@ sub bmcdiscovery_usage { #----------------------------------------------------------------------------- sub bmcdiscovery_processargs { + if ( defined ($::args) && @{$::args} ){ @ARGV = @{$::args}; } @@ -163,21 +183,201 @@ sub bmcdiscovery_processargs { # Option -m -r are must ######################################33 if ( defined($::opt_M) && defined($::opt_R) ) { - print "This is framework!" + #$::method = split_comma_delim_str($::opt_M); + #$::range = split_comma_delim_str ($::opt_R); + return 0; } ######################################### # Other attributes are not allowed ######################################### - my $more_input = shift(@ARGV); - if ( defined($more_input) ) { - create_error_response("Invalid input: $more_input \n"); - return 3; - } - return 0; + return 3; } +#---------------------------------------------------------------------------- + +=head3 scan_process + + Process the bmcdiscovery command line + Returns: + 0 - OK + 1 - just print version + 2 - just print help + 3 - error +=cut + +#----------------------------------------------------------------------------- + +sub scan_process{ + + my $method = shift; + my $range = shift; + my $callback = $::CALLBACK; + my $children; # The number of child process + my %sp_children; # Record the pid of child process + my $sub_fds = new IO::Select; # Record the parent fd for each child process + + + + my $ip_list; + ############################################################ + # get live ip list + ########################################################### + if ( $method eq "nmap" ) { + my $bcmd = "/usr/bin/nmap -sn $range | grep for |cut -d ' ' -f5 |tr -s '\n' ' ' "; + $ip_list = xCAT::Utils->runcmd("$bcmd", -1); + if ($::RUNCMD_RC != 0) { + my $rsp = {}; + push @{ $rsp->{data} }, "Nmap scan is failed.\n"; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); + return 2; + } + + } + else + { + my $rsp = {}; + push @{ $rsp->{data}}, "The bmcdiscover method should be nmap.\n"; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); + return 2; + } + + my $live_ip=split_comma_delim_str($ip_list); + + if (defined($live_ip)){ + + if ( scalar (@{$live_ip}) > 0 ) + { + ############################### + # Set the signal handler for ^c + ############################### + $SIG{TERM} = $SIG{INT} = sub { + foreach (keys %sp_children) { + kill 2, $_; + } + $SIG{ALRM} = sub { + while (wait() > 0) { + yield; + } + exit @_; + }; + alarm(1); # wait 1s for grace exit + }; + + ###################################################### + # Set the singal handler for child process finished it's work + ###################################################### + $SIG{CHLD} = sub { + my $cpid; + while (($cpid = waitpid(-1, WNOHANG)) > 0) { + if ($sp_children{$cpid}) { + delete $sp_children{$cpid}; + $children--; + } + } + }; + + for (my $i = 0; $i < scalar (@{$live_ip}); $i ++) { + + # fork a sub process to handle the communication with service processor + $children++; + my $cfd; + + # the $parent_fd will be used by &send_rep() to send response from child process to parent process + socketpair($parent_fd, $cfd,AF_UNIX,SOCK_STREAM,PF_UNSPEC) or die "socketpair: $!"; + $cfd->autoflush(1); + $parent_fd->autoflush(1); + my $child = xCAT::Utils->xfork; + if ($child == 0) { + close($cfd); + $callback = \&send_rep; + #sleep(5); + xCAT::MsgUtils->message("I", {data => ["${$live_ip}[$i]"]}, $callback); + exit 0; + } else { + + # in the main process, record the created child process and add parent fd for the child process to an IO:Select object + # the main process will check all the parent fd and receive response + $sp_children{$child}=1; + close ($parent_fd); + $sub_fds->add($cfd); + } + do { + sleep(1); + } until ($children < 32); + + } + + ################################################# + # receive data from child processes + ################################################ + while ($sub_fds->count > 0 or $children > 0) { + forward_data($callback,$sub_fds); + } + while (forward_data($callback,$sub_fds)) { + } + } + } +} + +#---------------------------------------------------------------------------- + +=head3 send_rep + + DESCRIPTION: + Send date from forked child process to parent process. + This subroutine will be replace the original $callback in the forked child process + + ARGUMENTS: + $resp - The response which generated in xCAT::Utils->message(); + +=cut + +#---------------------------------------------------------------------------- + +sub send_rep { + my $resp=shift; + + unless ($resp) { return; } + store_fd($resp,$parent_fd); +} + +#---------------------------------------------------------------------------- + +=head3 forward_data + + DESCRIPTION: + Receive data from forked child process and call the original $callback to forward data to xcat client + +=cut +#---------------------------------------------------------------------------- + +sub forward_data { + my $callback = shift; + my $fds = shift; + my @ready_fds = $fds->can_read(1); + my $rfh; + my $rc = @ready_fds; + foreach $rfh (@ready_fds) { + my $data; + my $responses; + eval { + $responses = fd_retrieve($rfh); + }; + if ($@ and $@ =~ /^Magic number checking on storable file/) { #this most likely means we ran over the end of available input + $fds->remove($rfh); + close($rfh); + } else { + eval { print $rfh "ACK\n"; }; #Ignore ack loss due to child giving up and exiting, we don't actually explicitly care about the acks + $callback->($responses); + } + } + yield; #Try to avoid useless iterations as much as possible + return $rc; +} + + #---------------------------------------------------------------------------- =head3 split_comma_delim_str @@ -193,7 +393,7 @@ sub bmcdiscovery_processargs { sub split_comma_delim_str { my $input_str = shift; - my @result = split(/,/, $input_str); + my @result = split(/ /, $input_str); return \@result; } @@ -245,14 +445,16 @@ sub create_error_response { #----------------------------------------------------------------------------- sub bmcdiscovery { - my $request = shift; - my $callback = shift; - my $request_command = shift; + #my $request = shift; + #my $callback = shift; + #my $request_command = shift; my $rc = 0; + + ############################################################## # process the command line # 0=success, 1=version, 2=help, 3=error - + ############################################################## $rc = bmcdiscovery_processargs(@_); if ( $rc != 0 ) { if ( $rc != 1) { @@ -260,37 +462,25 @@ sub bmcdiscovery { } return ( $rc - 1 ); } - + scan_process($::opt_M,$::opt_R); return 0; } - - - #---------------------------------------------------------------------------- -=head3 bmcdiscovery_nmap +=head3 bmcdiscovery_ipmi Support for discovering bmc using nmap - Arguments: - Returns: - 0 - OK - 1 - help - 2 - error =cut #----------------------------------------------------------------------------- -sub bmcdiscovery_namp { - - print "hello world"; - +sub bmcdiscovery_ipmi { + my $ip = shift; } - - 1; From d123aab564748d8473eb12f25767441078c446e8 Mon Sep 17 00:00:00 2001 From: jjohnson2 Date: Fri, 8 May 2015 10:53:18 -0400 Subject: [PATCH 21/40] Fix lenovo utility usage of pasu Lenovo uses the same asu utility, but a different path. Try to use the lenovo utility, falling back to the IBM location if not found. --- xCAT-client/bin/pasu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/pasu b/xCAT-client/bin/pasu index 03dc6260c..ee4694cc0 100755 --- a/xCAT-client/bin/pasu +++ b/xCAT-client/bin/pasu @@ -20,7 +20,10 @@ use xCAT::Utils; use Getopt::Long; use POSIX qw(:signal_h :errno_h :sys_wait_h); use Thread qw(yield); -$::asucmd = '/opt/ibm/toolscenter/asu/asu64'; +$::asucmd = '/opt/lenovo/toolscenter/asu/asu64'; +if (! -x $::asucmd) { + $::asucmd = '/opt/ibm/toolscenter/asu/asu64'; +} my $interface; my $username; my $passwd; From 9fcf4085fee543592aeefedda61f55cf0d88aeb3 Mon Sep 17 00:00:00 2001 From: ligc Date: Sun, 10 May 2015 21:55:45 -0400 Subject: [PATCH 22/40] Add IBM Power RAID configuration tool iprutils into genesis-base -ppc64 --- xCAT-genesis-builder/buildrpm | 9 +++++++++ xCAT-genesis-builder/install | 1 + xCAT-genesis-builder/installkernel | 1 + 3 files changed, 11 insertions(+) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 364b4cdcc..67434a538 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -23,6 +23,15 @@ fi mkdir -p $DRACUTMODDIR cp $DIR/* $DRACUTMODDIR +# Remove the ipr(IBM Power RAID) stuff when building on x86_64 +if [ $BUILDARCH = "x86_64" ]; then + sed -i 's/dracut_install \/lib64\/libform.so.5//' $DRACUTMODDIR/install + sed -i 's/\/lib64\/libpanel.so.5//' $DRACUTMODDIR/install + sed -i 's/\/lib64\/libmenu.so.5//' $DRACUTMODDIR/install + sed -i 's/\/lib64\/libsysfs.so.2//' $DRACUTMODDIR/install + sed -i 's/\/usr\/sbin\/iprconfig//' $DRACUTMODDIR/install + sed -i 's/instmods ipr//' $DRACUTMODDIR/installkernel +fi if [ "$HOSTOS" = "mcp" ]; then #Special handlings for MCP PPC64 platform building. if [ $BUILDARCH = "ppc64" ]; then diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 94388f243..46e278201 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -623,3 +623,4 @@ dracut_install /lib/udev/rules.d/11-dm-lvm.rules dracut_install /lib/udev/rules.d/13-dm-disk.rules dracut_install /lib/udev/rules.d/69-dm-lvm-metad.rules dracut_install /lib/udev/rules.d/95-dm-notify.rules +dracut_install /lib64/libform.so.5 /lib64/libpanel.so.5 /lib64/libmenu.so.5 /lib64/libsysfs.so.2 /usr/sbin/iprconfig # iprconfig for IBM Power RAID configuration diff --git a/xCAT-genesis-builder/installkernel b/xCAT-genesis-builder/installkernel index 47a529097..cc540165e 100755 --- a/xCAT-genesis-builder/installkernel +++ b/xCAT-genesis-builder/installkernel @@ -10,3 +10,4 @@ instmods ibmvscsi # ppc64 virtual disk instmods ehea # ppc64 hea ethernet instmods dm-mod #support LVM for sysclone instmods sg # Lenovo thinkserver firmware update support +instmods ipr # IBM Power RAID From cfd42a36a8d8cf3553a57f3b0943d5c5e8a2227e Mon Sep 17 00:00:00 2001 From: ligc Date: Sun, 10 May 2015 22:06:31 -0400 Subject: [PATCH 23/40] update the genesis-base version from 2.9 to 2.10 --- xCAT-genesis-builder/xCAT-genesis-base.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index 64dafcb51..a75c72cc9 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,4 +1,4 @@ -%define version 2.9 +%define version 2.10 %ifarch i386 i586 i686 x86 %define tarch x86 %endif From 328c04da8130cc036e52fda8f83dd89c128134fa Mon Sep 17 00:00:00 2001 From: WangXiaoPeng Date: Mon, 11 May 2015 04:24:11 -0400 Subject: [PATCH 24/40] defect 4665: for ubuntu diskfull install, if the /dev/disk/by-path is not created, will use list-devices command to select the first available disk --- xCAT-server/share/xcat/install/ubuntu/compute.tmpl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index bb784ca26..8f725c850 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -59,7 +59,14 @@ d-i partman/early_command string \ rm /tmp/devs-with-boot 2>/dev/null || true; \ else \ DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*[s|h|v]d[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o '[s|h|v]d.*$'`; \ - if [[ "$DEV" == "" ]]; then DEV="sda"; fi; \ + if [[ "$DEV" == "" ]]; then \ + for line in $(list-devices disk); do \ + DEV=$line; DEV=${DEV##/dev/}; break; \ + done; \ + if [[ "$DEV" == "" ]]; then \ + DEV="sda"; \ + fi \ + fi; \ echo "/dev/$DEV" > /tmp/boot_disk; \ fi; \ debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" From 2d6869521bd6fb4e3a8ec0dc14306dd6b92153aa Mon Sep 17 00:00:00 2001 From: WangXiaoPeng Date: Mon, 11 May 2015 04:32:26 -0400 Subject: [PATCH 25/40] merged the checkin 76a9da1e87dea03f9307d3438fe13f09546ef3ca; defect 4571 /etc/network/interfaces overwriten after firstboot --- xCAT-server/share/xcat/install/ubuntu/compute.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index 8f725c850..336c15872 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -148,5 +148,6 @@ d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoin mount -o bind /dev /target/dev; \ mount -o bind /dev/pts /target/dev/pts -t devpts; \ mount -o bind /sys /target/sys; \ - chroot /target /root/post.script + chroot /target /root/post.script; \ + cp /target/etc/network/interfaces /etc/network/interfaces From cc4dbdf8a3b2f28ef86cb62a1436e68c0e55113f Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 11 May 2015 04:51:13 -0400 Subject: [PATCH 26/40] change the nodeset install/netboot/statelite message from warning to error, and then exit --- xCAT-server/lib/xcat/plugins/anaconda.pm | 12 ++++++------ xCAT-server/lib/xcat/plugins/debian.pm | 8 ++++---- xCAT-server/lib/xcat/plugins/sles.pm | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 49a7f7e43..c49db5658 100755 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -260,11 +260,11 @@ sub mknetboot if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm $callback->( { - warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset osimage=\" instead."], + error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset osimage=\" instead."], errorcode => [1] } ); # Do not print this warning message multiple times - last; + exit(1); } } } @@ -981,11 +981,11 @@ sub mkinstall if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm $callback->( { - warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset osimage=\" instead."], + error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset osimage=\" instead."], errorcode => [1] } ); # Do not print this warning message multiple times - last; + exit(1); } } } @@ -1629,11 +1629,11 @@ sub mksysclone if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm $callback->( { - warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset osimage=\" instead."], + error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset osimage=\" instead."], errorcode => [1] } ); # Do not print this warning message multiple times - last; + exit(1); } } } diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 2a0c68cdc..f8d6d836d 100755 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -489,9 +489,9 @@ sub mkinstall { my $site_ent = $ents[0]; if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/)) { - $callback->( { warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset osimage=\" instead."], }); + $callback->( { error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset osimage=\" instead."], errorcode => [1] }); # Do not print this warning message multiple times - last; + exit(1); } } } @@ -982,11 +982,11 @@ sub mknetboot { $callback->( { - warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset osimage=\" instead."], + error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset osimage=\" instead."], errorcode => [1] } ); # Do not print this warning message multiple times - last; + exit(1); } } } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 836c72c53..5e0f491d1 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -129,11 +129,11 @@ sub mknetboot { $callback->( { - warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset osimage=\" instead."], + error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset osimage=\" instead."], errorcode => [1] } ); # Do not print this warning message multiple times - last; + exit(1); } } } @@ -776,11 +776,11 @@ sub mkinstall { $callback->( { - warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset osimage=\" instead."], + error => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated, use \"nodeset osimage=\" instead."], errorcode => [1] } ); # Do not print this warning message multiple times - last; + exit(1); } } } From 8ed200c0290dcd3b1806228c5a0f53f36a42ca51 Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 11 May 2015 21:14:40 -0400 Subject: [PATCH 27/40] add the new object type "switch" --- perl-xCAT/xCAT/Schema.pm | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 87745f7e8..71274bfb9 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1739,6 +1739,7 @@ foreach my $tabname (keys(%xCAT::ExtTab::ext_tabspec)) { osdistro=> { attrs => [], attrhash => {}, objkey => 'osdistroname' }, osdistroupdate=> { attrs => [], attrhash => {}, objkey => 'osupdatename' }, zone=> { attrs => [], attrhash => {}, objkey => 'zonename' }, + switch=> { attrs => [], attrhash => {}, objkey => 'switch' }, ); @@ -3760,6 +3761,67 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs); ); + +############################# +# switch object # +############################# +# switch table # +############################# +@{$defspec{switch}->{'attrs'}} = ( + {attr_name => 'switch', + tabentry => 'switches.switch', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'snmpusername', + tabentry => 'switches.username', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'snmppassword', + tabentry => 'switches.password', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'snmpversion', + tabentry => 'switches.snmpversion', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'privacy', + tabentry => 'switches.privacy', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'auth', + tabentry => 'switches.auth', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'linkports', + tabentry => 'switches.linkports', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'sshusername', + tabentry => 'switches.sshusername', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'sshpassword', + tabentry => 'switches.sshpassword', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'protocol', + tabentry => 'switches.protocol', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'switchtype', + tabentry => 'switches.switchtype', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'comments', + tabentry => 'switches.comments', + access_tabentry => 'switches.switch=attr:switch', + }, + {attr_name => 'disable', + tabentry => 'switches.disable', + access_tabentry => 'switches.switch=attr:switch', + }, + ); + ################################################### ################################################### From 095f7e14745f34f565d6991c42ae10b3ac0b315d Mon Sep 17 00:00:00 2001 From: WangXiaoPeng Date: Mon, 11 May 2015 23:26:52 -0400 Subject: [PATCH 28/40] remove template files kvm.tmpl and service.tmpl for ubuntu diskfull and make them to be a link to compute.tmpl since we did not see the necessary to have sperated template file --- .../share/xcat/install/ubuntu/kvm.tmpl | 139 +---------------- .../share/xcat/install/ubuntu/service.tmpl | 147 +----------------- 2 files changed, 2 insertions(+), 284 deletions(-) mode change 100644 => 120000 xCAT-server/share/xcat/install/ubuntu/kvm.tmpl mode change 100644 => 120000 xCAT-server/share/xcat/install/ubuntu/service.tmpl diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl deleted file mode 100644 index 01c1c74ac..000000000 --- a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl +++ /dev/null @@ -1,138 +0,0 @@ - -### Localization -d-i debian-installer/locale string en_US -d-i localechooser/supported-locales multiselect en_US.UTF-8 - -# Keyboard Selection -d-i console-setup/ask_detect boolean false -d-i keyboard-configuration/layoutcode string en - -### Network Configuration - -d-i netcfg/get_hostname string unassigned-hostname -d-i netcfg/get_domain string unassigned-domain -d-i netcfg/wireless_wep string -d-i netcfg/dhcp_timeout string 120 -### Mirror settings -# If you select ftp, the mirror/country string does not need to be set. - -d-i mirror/country string manual -d-i mirror/protocol string http -d-i mirror/http/directory string #INCLUDE_OSIMAGE_PKGDIR# -d-i mirror/http/proxy string - -# Suite to install. -#d-i mirror/suite string testing -# Suite to use for loading installer components (optional). -#d-i mirror/udeb/suite string testing - - -### Partitioning -# This creates a small /boot partition, suitable -# swap, and uses the rest of the space for the root partition: - -d-i partman-auto/method string regular -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true - -#create the /tmp/partitioning based on the uefi or legacy bios -d-i partman/early_command string \ - set -x; \ - rm /tmp/devs-with-boot 2>/dev/null || true; \ - for d in $(list-devices partition); do \ - mkdir -p /tmp/mymount; \ - rc=0; \ - mount $d /tmp/mymount || rc=$?; \ - if [[ $rc -eq 0 ]]; then \ - [[ -d /tmp/mymount/boot ]] && echo $d >>/tmp/devs-with-boot; \ - umount /tmp/mymount; \ - fi \ - done; \ - if [[ -e /tmp/devs-with-boot ]]; then \ - head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \ - rm /tmp/devs-with-boot 2>/dev/null || true; \ - else \ - DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \ - if [[ "$DEV" == "" ]]; then DEV="sda"; fi; \ - echo "/dev/$DEV" > /tmp/boot_disk; \ - fi; \ - debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" -d-i partman-auto/expert_recipe_file string /tmp/partitioning - -# This makes partman automatically partition without confirmation, provided -# that you told it what to do using one of the methods above. - -d-i partman/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -### Account setup - -d-i passwd/root-login boolean true -d-i passwd/make-user boolean false - -d-i passwd/root-password-crypted password #CRYPT:passwd:key=system,username=root:password# - -### Clock and time zone setup - -d-i clock-setup/ntp boolean true -d-i clock-setup/ntp-server string #TABLE:site:key=master:value# -d-i clock-setup/utc boolean true -d-i time/zone string #TABLE:site:key=timezone:value# - -### Apt setup - -d-i apt-setup/multiverse boolean false -d-i apt-setup/universe boolean false -d-i apt-setup/backports boolean false -d-i apt-setup/updates boolean false - - -### Boot loader installation - -d-i grub-installer/only_debian boolean true - -### Package selection - -tasksel tasksel/first multiselect standard - -# gawk required for the xCAT scripts to work -# Otherwise it installs mawk, which doesn't work - -d-i pkgsel/include string #INCLUDE_DEFAULT_PKGLIST_PRESEED# - -d-i debian-installer/allow_unauthenticated string true -d-i pkgsel/update-policy select none -d-i pkgsel/updatedb boolean false - -### Finishing up the installation -d-i finish-install/reboot_in_progress note - -### X configuration -xserver-xorg xserver-xorg/autodetect_monitor boolean true - -xserver-xorg xserver-xorg/config/monitor/selection-method \ - select medium - -xserver-xorg xserver-xorg/config/monitor/mode-list \ - select 1024x768 @ 60 Hz - - -d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.pre; \ - chmod u+x #HOSTNAME#.pre; \ - ./#HOSTNAME#.pre - -# To workaround the "Unmount partitions that are in use?" question -d-i preseed/early_command string umount /media || true - -d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.post; \ - chmod u+x #HOSTNAME#.post; \ - cp ./#HOSTNAME#.post /target/root/post.script; \ - mount -o bind /proc /target/proc -t proc; \ - mount -o bind /dev /target/dev; \ - mount -o bind /dev/pts /target/dev/pts -t devpts; \ - mount -o bind /sys /target/sys; \ - chroot /target /root/post.script - diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl new file mode 120000 index 000000000..9fde7dbaf --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl @@ -0,0 +1 @@ +compute.tmpl \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/ubuntu/service.tmpl b/xCAT-server/share/xcat/install/ubuntu/service.tmpl deleted file mode 100644 index 5561fb2e7..000000000 --- a/xCAT-server/share/xcat/install/ubuntu/service.tmpl +++ /dev/null @@ -1,146 +0,0 @@ - -### Localization -d-i debian-installer/locale string en_US -d-i localechooser/supported-locales multiselect en_US.UTF-8 - -# Keyboard Selection -d-i console-setup/ask_detect boolean false -d-i keyboard-configuration/layoutcode string en - -### Network Configuration - -d-i netcfg/get_hostname string unassigned-hostname -d-i netcfg/get_domain string unassigned-domain -d-i netcfg/wireless_wep string -d-i netcfg/dhcp_timeout string 120 -### Mirror settings -# If you select ftp, the mirror/country string does not need to be set. - -#MIRRORSPEC# - -# Suite to install. -#d-i mirror/suite string testing -# Suite to use for loading installer components (optional). -#d-i mirror/udeb/suite string testing - - -# Use the following option to add additional boot parameters for the -# installed system (if supported by the bootloader installer). -# Note: options passed to the installer will be added automatically. -d-i debian-installer/add-kernel-opts string #XCATVAR:PERSKCMDLINE# - -### Partitioning -# This creates a small /boot partition, suitable -# swap, and uses the rest of the space for the root partition: - -d-i partman-auto/method string regular -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true - -#create the /tmp/partitionfile based on the uefi or legacy bios -d-i partman/early_command string \ - set -x; \ - if [ -f /tmp/boot_disk ]; then \ - debconf-set partman-auto/disk "$(cat /tmp/boot_disk)"; \ - exit; \ - fi; \ - rm /tmp/devs-with-boot 2>/dev/null || true; \ - for d in $(list-devices partition); do \ - mkdir -p /tmp/mymount; \ - rc=0; \ - mount $d /tmp/mymount || rc=$?; \ - if [[ $rc -eq 0 ]]; then \ - [[ -d /tmp/mymount/boot ]] && echo $d >>/tmp/devs-with-boot; \ - umount /tmp/mymount; \ - fi \ - done; \ - if [[ -e /tmp/devs-with-boot ]]; then \ - head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \ - rm /tmp/devs-with-boot 2>/dev/null || true; \ - else \ - DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*[s|h|v]d[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o '[s|h|v]d.*$'`; \ - if [[ "$DEV" == "" ]]; then DEV="sda"; fi; \ - echo "/dev/$DEV" > /tmp/boot_disk; \ - fi; \ - debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" -d-i partman-auto/expert_recipe_file string /tmp/partitionfile - -# This makes partman automatically partition without confirmation, provided -# that you told it what to do using one of the methods above. - -d-i partman/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -#XCA_PARTMAN_ADDITIONAL_CFG# - -### Account setup - -d-i passwd/root-login boolean true -d-i passwd/make-user boolean false - -d-i passwd/root-password-crypted password #CRYPT:passwd:key=system,username=root:password# - -### Clock and time zone setup - -d-i clock-setup/ntp boolean true -d-i clock-setup/ntp-server string #TABLE:site:key=master:value# -d-i clock-setup/utc boolean true -d-i time/zone string #TABLE:site:key=timezone:value# - -### Apt setup - -d-i apt-setup/multiverse boolean false -d-i apt-setup/universe boolean false -d-i apt-setup/backports boolean false -d-i apt-setup/updates boolean false - - -### Boot loader installation - -d-i grub-installer/only_debian boolean true - -### Package selection - -tasksel tasksel/first multiselect standard - -# gawk required for the xCAT scripts to work -# Otherwise it installs mawk, which doesn't work - -d-i pkgsel/include string #INCLUDE_DEFAULT_PKGLIST_PRESEED# - -d-i debian-installer/allow_unauthenticated boolean true -d-i pkgsel/update-policy select none -d-i pkgsel/updatedb boolean false - -### Finishing up the installation -d-i finish-install/reboot_in_progress note - -### X configuration -xserver-xorg xserver-xorg/autodetect_monitor boolean true - -xserver-xorg xserver-xorg/config/monitor/selection-method \ - select medium - -xserver-xorg xserver-xorg/config/monitor/mode-list \ - select 1024x768 @ 60 Hz - - -# To workaround the "Unmount partitions that are in use?" question, -# run the "umount /media" after the preseed is read in -d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.pre; \ - chmod u+x #HOSTNAME#.pre; \ - ./#HOSTNAME#.pre; \ - umount /media || true - -d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.post; \ - chmod u+x #HOSTNAME#.post; \ - cp ./#HOSTNAME#.post /target/root/post.script; \ - mount -o bind /proc /target/proc -t proc; \ - mount -o bind /dev /target/dev; \ - mount -o bind /dev/pts /target/dev/pts -t devpts; \ - mount -o bind /sys /target/sys; \ - chroot /target /root/post.script; \ - cp /target/etc/network/interfaces /etc/network/interfaces - diff --git a/xCAT-server/share/xcat/install/ubuntu/service.tmpl b/xCAT-server/share/xcat/install/ubuntu/service.tmpl new file mode 120000 index 000000000..9fde7dbaf --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/service.tmpl @@ -0,0 +1 @@ +compute.tmpl \ No newline at end of file From 13dc03bdea4f9ac7bf68f552eddec6010b2ebcab Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 12 May 2015 01:21:12 -0400 Subject: [PATCH 29/40] modify statelite installation testcase --- .../testcase/installation/reg_linux_statelite_installation_flat | 2 +- .../installation/reg_linux_statelite_installation_hierarchy | 2 +- 2 files changed, 2 insertions(+), 2 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 dcb2303b3..8aa74ba8a 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -57,7 +57,7 @@ check:rc==0 cmd:liteimg __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 -cmd:nodeset $$CN statelite +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:lsdef $$CN |grep provmethod check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy index 06a5f66f1..ddbd24ebc 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy @@ -69,7 +69,7 @@ check:rc==0 cmd:prsync /install $$SN:/ check:rc==0 -cmd:nodeset $$CN statelite +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:lsdef $$CN |grep provmethod check:rc==0 From e20703010f53a2c8f70cb9e68b3e14cede44d8aa Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 12 May 2015 01:30:07 -0400 Subject: [PATCH 30/40] upate the description of node attribute "netboot", to be more explict for the different netboot values --- perl-xCAT/xCAT/Schema.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 71274bfb9..b449c781c 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -643,7 +643,7 @@ noderes => { descriptions => { node => 'The node name or group name.', servicenode => 'A comma separated list of node names (as known by the management node) that provides most services for this node. The first service node on the list that is accessible will be used. The 2nd node on the list is generally considered to be the backup service node for this node when running commands like snmove.', - netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture, grub2-tftp and grub2-http for RHEL7 on Power and all the os deployment on Power LE. Notice: yaboot is not supported from rhels7 on Power,use grub2-tftp or grub2-http instead, the difference between the 2 is the file transfer protocol(i.e, http or tftp)', + netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for ppc64 RHEL 6 and SLES 11, grub2 for ppc64 RHEL7 and all the Little-Endian os deployment on PowerKVM guests, petiboot for the PowerNV deployment', tftpserver => 'The TFTP server for this node (as known by this node). If not set, it defaults to networks.tftpserver.', tftpdir => 'The directory that roots this nodes contents from a tftp and related perspective. Used for NAS offload by using different mountpoints.', nfsserver => 'The NFS or HTTP server for this node (as known by this node).', From a84a9e655bb955ec3071bb3fed93478205008913 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 12 May 2015 01:36:55 -0400 Subject: [PATCH 31/40] appending "statement" within makedhcp rather than from nodeset, this commit include grub2,petitboot and nimol netboot method --- xCAT-server/lib/xcat/plugins/dhcp.pm | 8 +++++++ xCAT-server/lib/xcat/plugins/grub2.pm | 23 +++++++++++++------ xCAT-server/lib/xcat/plugins/nimol.pm | 27 +++++++++++++---------- xCAT-server/lib/xcat/plugins/petitboot.pm | 25 +++++++++------------ 4 files changed, 49 insertions(+), 34 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 1dd8406a1..8f79aed18 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -616,6 +616,14 @@ sub addnode $lstatements = 'if option vendor-class-identifier = \"ScaleMP\" { filename = \"vsmp/pxelinux.0\"; } else { filename = \"pxelinux.0\"; }'.$lstatements; } } + } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'yaboot') { + $lstatements = 'filename = \"/yb/node/yaboot-'.$node.'\";'.$lstatements; + } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'grub2') { + $lstatements = 'filename = \"/boot/grub2/grub2-'.$node.'\";'.$lstatements; + } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'petitboot') { + $lstatements = 'option conf-file \"http://'.$nxtsrv.'/tftpboot/petitboot/'.$node.'\";'.$lstatements; + } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'nimol') { + $lstatements = 'supersede server.filename=\"/vios/nodes/'.$node.'\"'.$lstatements; } diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 1b75a24a0..c3b128b48 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -580,27 +580,36 @@ sub process_request { xCAT::MsgUtils->message("E", $rsp, $callback); return; } + chdir("$tftpdir/boot/grub2/"); + foreach my $tmp_node (@{$osimagenodehash{$osimage}}) { + unless (-e "grub2-$tmp_node") { + symlink("grub2.".$validarch, "grub2-$tmp_node"); + } + } if ($do_dhcpsetup) { if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command $sub_req->({command=>['makedhcp'], - node=>\@{$osimagenodehash{$osimage}}, - arg=>['-l','-s','filename = \"'.$grub2.'\";']},$callback); + node=>\@{$osimagenodehash{$osimage}}}, $callback); } else { $sub_req->({command=>['makedhcp'], - node=>\@{$osimagenodehash{$osimage}}, - arg=>['-s','filename = \"'.$grub2.'\";']},$callback); + node=>\@{$osimagenodehash{$osimage}}},$callback); } } } #end of foreach osimagenodehash + + foreach my $tmp_node (@breaknetboot) { + if (-e "$tftpdir/boot/grub2/grub2-$tmp_node") { + unlink("$tftpdir/boot/grub2/grub2-$tmp_node"); + } + } if ($do_dhcpsetup) { if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command $sub_req->({command=>['makedhcp'], node=>\@breaknetboot, - arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback); + arg=>['-l']},$callback); } else { $sub_req->({command=>['makedhcp'], - node=>\@breaknetboot, - arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback); + node=>\@breaknetboot},$callback); } } } diff --git a/xCAT-server/lib/xcat/plugins/nimol.pm b/xCAT-server/lib/xcat/plugins/nimol.pm index 46f206364..ae02590fc 100644 --- a/xCAT-server/lib/xcat/plugins/nimol.pm +++ b/xCAT-server/lib/xcat/plugins/nimol.pm @@ -409,8 +409,13 @@ sub create_imgconf_file { my $subreq = shift; my $nim_root = shift; my $bootimg_root = shift; - my $relative_path = $bootimg_root; + my $bootimg_link = "/tftpboot/vios/nodes"; + my $relative_path = $bootimg_link; $relative_path =~ s/^\/tftpboot//; + # check the dir where the bootimage link file and bootimage configuration file stored + unless (-e $bootimg_link) { + mkpath($bootimg_link); + } # Get nodes network information my %nethash = (); %nethash = xCAT::DBobjUtils->getNetwkInfo($nodes); @@ -428,7 +433,7 @@ sub create_imgconf_file { unless (-e $bootimg_root."/viobootimg") { return "Unable to find VIOS bootimg file"; } - chdir($bootimg_root); + chdir($bootimg_link); foreach my $node (@$nodes) { my $bootimg_conf_fd; my $gateway = $nethash{$node}{gateway}; @@ -438,18 +443,17 @@ sub create_imgconf_file { my $master = xCAT::NetworkUtils->gethostname($master_node); my $master_ip = xCAT::NetworkUtils->getipaddr($master); my $node_ip = xCAT::NetworkUtils->getipaddr($node); - my $relative_bootfile = $relative_path."/viobootimg-$node"; - unless (-e "viobootimg-$node") { - symlink("viobootimg", "viobootimg-$node"); + unless (-e "$node") { + symlink($bootimg_root."/viobootimg", "$node"); } - if (-e $bootimg_root."/viobootimg-$node.info") { - unlink($bootimg_root."/viobootimg-$node.info"); + if (-e $bootimg_link."/$node.info") { + unlink($bootimg_link."/$node.info"); } - open ($bootimg_conf_fd, ">", $bootimg_root."/viobootimg-$node.info"); + open ($bootimg_conf_fd, ">", $bootimg_link."/$node.info"); print $bootimg_conf_fd "export NIM_SERVER_TYPE=linux\n"; print $bootimg_conf_fd "export NIM_SYSLOG_PORT=514\n"; print $bootimg_conf_fd "export NIM_SYSLOG_FACILITY=local2\n"; - print $bootimg_conf_fd "export NIM_NAME=viobootimg-$node\n"; + print $bootimg_conf_fd "export NIM_NAME=$node\n"; print $bootimg_conf_fd "export NIM_HOSTNAME=$node\n"; print $bootimg_conf_fd "export NIM_CONFIGURATION=standalone\n"; print $bootimg_conf_fd "export NIM_MASTER_HOSTNAME=$master\n"; @@ -472,8 +476,7 @@ sub create_imgconf_file { close($bootimg_conf_fd); $subreq->({command=>['makedhcp'], - node=>[$node], - arg=>['-s', 'supersede server.filename=\"'.$relative_bootfile.'\";']}, $global_callback); + node=>[$node]}, $global_callback); } } @@ -506,7 +509,7 @@ sub nodeset { if ($ref) { if ($ref->{provmethod} and $ref->{provmethod} eq 'nimol' and $ref->{osdistroname}) { $nim_root = $installroot."/nim/".$ref->{osdistroname}; - $bootimg_root = "/tftpboot/".$ref->{osdistroname}."/nodes"; + $bootimg_root = "/tftpboot/".$ref->{osdistroname}; } else { $callback->({error=>["The 'provmethod' for OS image $osimage can only be 'nimol'."], errorcode=>[1]}); return; diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index 21ab4c9ce..789eaf385 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -472,24 +472,19 @@ sub process_request { if (defined($t_entry) ) { if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; } } - if ($do_dhcpsetup) { foreach my $node (@normalnodeset) { - my $server = xCAT::TableUtils->GetMasterNodeName($node); - my $ipfn = xCAT::NetworkUtils->my_ip_facing($server); - if(($server != 1) and defined($ipfn)) { - my $fpath = "http://$ipfn/tftpboot/petitboot/$node"; - if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command - $sub_req->({command=>['makedhcp'], - node=> [$node], - arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback); - } else { - $sub_req->({command=>['makedhcp'], - node=> [$node], - arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback); - } + if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command + $sub_req->({command=>['makedhcp'], + node=> [$node], + arg=>['-l']},$callback); + #arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback); + } else { + $sub_req->({command=>['makedhcp'], + node=> [$node]}, $callback); + #arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback); } - } + } } } From 8e5ddbd556ddd2c27cebb56b53a530ee5cb1caa5 Mon Sep 17 00:00:00 2001 From: amy0701 Date: Tue, 12 May 2015 03:22:58 -0400 Subject: [PATCH 32/40] use ipmitool-xcat to find bmc --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 28 +++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index de8225003..88b7aa3fd 100755 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -21,9 +21,6 @@ use Storable qw(store_fd fd_retrieve); use strict; use warnings "all"; use Getopt::Long; - - - use xCAT::Table; use xCAT::Utils; use xCAT::MsgUtils; @@ -114,6 +111,11 @@ sub bmcdiscovery_usage { push @{ $rsp->{data} }, "\tbmcdiscover [-h|--help|-?]\n"; push @{ $rsp->{data} }, "\tbmcdiscover [-v|--version]\n "; push @{ $rsp->{data} }, "\tbmcdiscover [-m|--method] scan_method [-r|--range] ip_range \n "; + push @{ $rsp->{data} }, "\tFor example: \n "; + push @{ $rsp->{data} }, "\tbmcdiscover -m nmap -r \"10.4.23.100-254 50.3.15.1-2\" \n "; + push @{ $rsp->{data} }, "\tNote : ip_range should be a string, can pass hostnames, IP addresses, networks, etc. \n "; + push @{ $rsp->{data} }, "\tIf there is bmc,bmcdiscover returns bmc ip or hostname, or else, it returns null. \n "; + push @{ $rsp->{data} }, "\tEx: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254 \n "; xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); return 0; } @@ -292,8 +294,7 @@ sub scan_process{ if ($child == 0) { close($cfd); $callback = \&send_rep; - #sleep(5); - xCAT::MsgUtils->message("I", {data => ["${$live_ip}[$i]"]}, $callback); + bmcdiscovery_ipmi(${$live_ip}[$i]); exit 0; } else { @@ -303,6 +304,8 @@ sub scan_process{ close ($parent_fd); $sub_fds->add($cfd); } + + do { sleep(1); } until ($children < 32); @@ -427,7 +430,7 @@ sub create_error_response { my $error_msg = shift; my $rsp; push @{ $rsp->{data} }, $error_msg; - xCAT::MsgUtils->message( "E", $rsp, $::CALLBACK ); + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); } @@ -473,7 +476,10 @@ sub bmcdiscovery { =head3 bmcdiscovery_ipmi - Support for discovering bmc using nmap + Support for discovering bmc using ipmi + Returns: + if it is bmc, it returns bmc ip or host; + if it is not bmc, it returns nothing; =cut @@ -481,6 +487,14 @@ sub bmcdiscovery { sub bmcdiscovery_ipmi { my $ip = shift; + my $bmcstr = "BMC Session ID"; + my $icmd = "/opt/xcat/bin/ipmitool-xcat -vv -I lanplus -U USERID -P PASSW0RD -H $ip chassis status "; + my $output = xCAT::Utils->runcmd("$icmd", -1); + if ( $output =~ $bmcstr ){ + my $rsp = {}; + push @{ $rsp->{data} }, "$ip"; + xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); + } } 1; From 2107c99f2a28f36672330a8c50cc9c673aa89268 Mon Sep 17 00:00:00 2001 From: amy0701 Date: Tue, 12 May 2015 04:31:59 -0400 Subject: [PATCH 33/40] check if there is nmap or not --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 88b7aa3fd..22136d279 100755 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -30,6 +30,7 @@ use File::Basename; use File::Path; use Cwd; +my $nmap_path; my $debianflag = 0; my $tempstring = xCAT::Utils->osver(); @@ -155,6 +156,26 @@ sub bmcdiscovery_processargs { return 3; } + ###################################### + # check if there is nmap or not + ###################################### + if ( -x '/usr/bin/nmap' ) + { + $nmap_path="/usr/bin/nmap"; + } + elsif ( -x '/usr/local/bin/nmap' ) + { + $nmap_path="/usr/local/bin/nmap"; + } + else + { + my $rsp; + push @{ $rsp->{data} }, "\tThere is no nmap in /usr/bin/ or /usr/local/bin/. \n "; + xCAT::MsgUtils->message( "E", $rsp, $::CALLBACK ); + return 1; + + } + ######################################### # This command is for linux ######################################### @@ -227,7 +248,7 @@ sub scan_process{ # get live ip list ########################################################### if ( $method eq "nmap" ) { - my $bcmd = "/usr/bin/nmap -sn $range | grep for |cut -d ' ' -f5 |tr -s '\n' ' ' "; + my $bcmd = join(" ",$nmap_path," -sn $range | grep for |cut -d ' ' -f5 |tr -s '\n' ' ' "); $ip_list = xCAT::Utils->runcmd("$bcmd", -1); if ($::RUNCMD_RC != 0) { my $rsp = {}; From 3441bc337a6b89f28d99cb24f979b7396bdeb0a3 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 12 May 2015 04:58:13 -0400 Subject: [PATCH 34/40] appending "statement" within makedhcp rather than from nodeset, this commit is for yaboot --- xCAT-server/lib/xcat/plugins/yaboot.pm | 37 +++++++++++++++++++++----- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 91321c6fb..319d363bd 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -655,6 +655,12 @@ sub process_request { xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback); return; } + } elsif ($osv !~ /fedora/i) { + my $rsp; + push @{$rsp->{data}}, + "stop configuration because yaboot DOES NOT work for $os provision, please change noderes.netboot=grub2 instead.\n"; + xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback); + return; } } #end of foreach osimagenodehash @@ -671,10 +677,13 @@ sub process_request { if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; } } #} - if ($do_dhcpsetup) { if (%osimagenodehash) { + chdir("$tftpdir"); foreach my $osimage (keys %osimagenodehash) { + unless (-e "$tftpdir/yb/node") { + system("mkdir -p $tftpdir/yb/node"); + } my $osimgent = $osimagetab->getAttribs({imagename => $osimage },'osvers'); my $osentry = $osimgent->{'osvers'}; @@ -694,16 +703,26 @@ sub process_request { if (($osv =~ /rh/ and int($osn) >= 6) or ($osv =~ /sles/ and int($osn) >= 11)) { my $fpath = "/yb/". $osentry."/yaboot"; + foreach my $tmp_node (@{$osimagenodehash{$osimage}}) { + unless (-e "yb/node/yaboot-$tmp_node") { + symlink("yb/$osentry/yaboot", "yb/node/yaboot-$tmp_node"); + } + } if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command $sub_req->({command=>['makedhcp'], node=>\@{$osimagenodehash{$osimage}}, - arg=>['-l','-s','filename = \"'.$fpath.'\";']},$::YABOOT_callback); + arg=>['-l']},$::YABOOT_callback); } else { $sub_req->({command=>['makedhcp'], - node=>\@{$osimagenodehash{$osimage}}, - arg=>['-s','filename = \"'.$fpath.'\";']},$::YABOOT_callback); + node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback); } } else { + foreach my $tmp_node (@{$osimagenodehash{$osimage}}) { + unless (-e "yb/node/yaboot-$tmp_node") { + symlink("yaboot", "yb/node/yaboot-$tmp_node"); + } + } + if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed $sub_req->({command=>['makedhcp'],arg=>['-l'], node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback); @@ -722,14 +741,18 @@ sub process_request { node=>\@normalnodeset},$::YABOOT_callback); } } + foreach my $tmp_node (@breaknetboot) { + if (-e "$tftpdir/yb/node/yaboot-$tmp_node") { + unlink("$tftpdir/yb/node/yaboot-$tmp_node"); + } + } if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command $sub_req->({command=>['makedhcp'], node=>\@breaknetboot, - arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback); + arg=>['-l']},$::YABOOT_callback); } else { $sub_req->({command=>['makedhcp'], - node=>\@breaknetboot, - arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback); + node=>\@breaknetboot}, $::YABOOT_callback); } } } From 05339e823e40daeecb219ba278e36533c5e806aa Mon Sep 17 00:00:00 2001 From: billwajda Date: Thu, 2 Apr 2015 09:14:10 -0400 Subject: [PATCH 35/40] updated dhcp.pm to put out a warning message when subnet/netmask for network in network table does not match network configured --- xCAT-server/lib/xcat/plugins/dhcp.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 8f79aed18..a63e2e6fd 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -2166,21 +2166,21 @@ sub addnet while ($idx <= $#dhcpconf) { if ($dhcpconf[$idx] =~ /\} # $nic nic_end\n/) - { - last; - } - $idx++; + { + last; + } + $idx++; } unless ($dhcpconf[$idx] =~ /\} # $nic nic_end\n/) { - $callback->( - { - error => - ["Could not add the subnet $net/$mask for nic $nic into $dhcpconffile."], + $callback->( + { + error => + ["Could not add the subnet $net/$mask for nic $nic into $dhcpconffile.\nPlease verify the xCAT database matches networks defined on this system."], errorcode => [1] - } - ); - return 1; #TODO: this is an error condition + } + ); + return 1; } } From a2c5a0be5833d24b7f5c812c5613c46250e54859 Mon Sep 17 00:00:00 2001 From: billwajda Date: Thu, 2 Apr 2015 15:04:24 -0400 Subject: [PATCH 36/40] dhcp.pm: moved authoritative statement inside the network stanza --- xCAT-server/lib/xcat/plugins/dhcp.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index a63e2e6fd..c2ac08bac 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -2041,7 +2041,14 @@ sub addnet6 $idx++; } unless ($dhcp6conf[$idx] =~ /\} # $iface nic_end\n/) { - return 1; #TODO: this is an error condition + $callback->( + { + error => + ["Could not add the subnet $net/$mask for nic $nic into $dhcpconffile.\nPlease verify the xCAT database matches networks defined on this system."], + errorcode => [1] + } + ); + return 1; } } @@ -2053,6 +2060,7 @@ sub addnet6 my @netent = ( " subnet6 $net {\n", + " authoritative;\n", " max-lease-time $dhcplease;\n", " min-lease-time $dhcplease;\n", " default-lease-time $dhcplease;\n", @@ -2334,6 +2342,7 @@ sub addnet } @netent = ( " subnet $net netmask $mask {\n", + " authoritative;\n", " max-lease-time $dhcplease;\n", " min-lease-time $dhcplease;\n", " default-lease-time $dhcplease;\n" @@ -2692,7 +2701,6 @@ sub newconfig my $passtab = xCAT::Table->new('passwd', -create => 1); push @dhcpconf, "#xCAT generated dhcp configuration\n"; push @dhcpconf, "\n"; - push @dhcpconf, "authoritative;\n"; push @dhcpconf, "option conf-file code 209 = text;\n"; push @dhcpconf, "option space isan;\n"; push @dhcpconf, "option isan-encap-opts code 43 = encapsulate isan;\n"; From f62bdf31219c12f8657c2c414d34e3392313b4e3 Mon Sep 17 00:00:00 2001 From: billwajda Date: Thu, 16 Apr 2015 13:35:59 -0400 Subject: [PATCH 37/40] fixed a syntax error in dhcp.pm --- xCAT-server/lib/xcat/plugins/dhcp.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index c2ac08bac..57dbe376e 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -2044,7 +2044,7 @@ sub addnet6 $callback->( { error => - ["Could not add the subnet $net/$mask for nic $nic into $dhcpconffile.\nPlease verify the xCAT database matches networks defined on this system."], + ["Could not add the subnet $net for interface $iface into $dhcpconffile.\nPlease verify the xCAT database matches networks defined on this system."], errorcode => [1] } ); @@ -2184,7 +2184,7 @@ sub addnet $callback->( { error => - ["Could not add the subnet $net/$mask for nic $nic into $dhcpconffile.\nPlease verify the xCAT database matches networks defined on this system."], + ["Could not add the subnet $net for interface $nic into $dhcpconffile.\nPlease verify the xCAT database matches networks defined on this system."], errorcode => [1] } ); From 6155642aeef98e8684e0b0ec0842533fe1df49a6 Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 12 May 2015 14:47:52 -0400 Subject: [PATCH 38/40] Allow switchdiscover command call corresponding subroutines --- .../lib/xcat/plugins/switchdiscover.pm | 192 ++++++++++++++++-- 1 file changed, 170 insertions(+), 22 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index f0c9b6cca..95e3a606b 100755 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1,23 +1,48 @@ +#!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT_plugin::switchdiscover; -use lib "/opt/xcat/lib/perl"; +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + use strict; use Getopt::Long; use xCAT::Usage; use xCAT::NodeRange; use xCAT::Utils; -####################################### -# Power methods -####################################### +#global variables for this module my %globalopt; my @filternodes; +my %global_scan_type = ( + lldp => "lldp_scan", + nmap => "nmap_scan", + snmp => "snmp_scan" +); + +#------------------------------------------------------------------------------- +=head1 xCAT_plugin:switchdiscover +=head2 Package Description + Handles switch discovery functions. It uses lldp, nmap or snmap to scan + the network to find out the switches attached to the network. +=cut +#------------------------------------------------------------------------------- -########################################################################## -# Invokes the callback with the specified message -########################################################################## +#-------------------------------------------------------------------------------- +=head3 send_msg + Invokes the callback with the specified message + Arguments: + request: request structure for plguin calls + ecode: error code. 0 for succeful. + msg: messages to be displayed. + Returns: + none +=cut +#-------------------------------------------------------------------------------- sub send_msg { my $request = shift; @@ -48,16 +73,31 @@ sub send_msg { } -########################################################################## -# Command handler method from tables -########################################################################## +#-------------------------------------------------------------------------------- +=head3 handled_commands + It returns a list of commands handled by this plugin. + Arguments: + none + Returns: + a list of commands. +=cut +#-------------------------------------------------------------------------------- sub handled_commands { return( {switchdiscover=>"switchdiscover"} ); } -########################################################################## -# Parse the command line options and operands -########################################################################## + +#-------------------------------------------------------------------------------- +=head3 parse_args + Parse the command line options and operands. + Arguments: + request: the request structure for plugin + Returns: + Usage string or error message. + 0 if no user promp needed. + +=cut +#-------------------------------------------------------------------------------- sub parse_args { my $request = shift; @@ -125,11 +165,21 @@ sub parse_args { } ############################################# - # Check for unsupported service type + # Check for unsupported scan types ############################################# if ( exists( $opt{s} )) { - $globalopt{service} = $opt{s}; - } + my @stypes = split ',', $opt{s}; + my $error; + foreach my $st (@stypes) { + if (! exists($global_scan_type{$st})) { + $error = $error . "Invalide scan type: $st\n"; + } + } + if ($error) { + return usage($error); + } + $globalopt{scan_types} = \@stypes; + } ############################################# # Check the validation of -i option @@ -186,9 +236,12 @@ sub parse_args { } -############################################################################# -# Preprocess request from xCAT daemon -############################################################################# +#-------------------------------------------------------------------------------- +=head3 preprocess_request + Parse the arguments and display the usage or the version string. + +=cut +#-------------------------------------------------------------------------------- sub preprocess_request { my $req = shift; if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; } @@ -212,9 +265,13 @@ sub preprocess_request { return \@result; } -########################################################################## -# Process request from xCat daemon -########################################################################## +#-------------------------------------------------------------------------------- +=head3 process_request + Pasrse the arguments and call the correspondent functions + to do switch discovery. + +=cut +#-------------------------------------------------------------------------------- sub process_request { my $req = shift; my $callback = shift; @@ -231,6 +288,7 @@ sub process_request { # Process command-specific options #################################### my $result = parse_args( \%request ); + #################################### # Return error @@ -240,9 +298,99 @@ sub process_request { return(1); } + # call the relavant functions to start the scan + my @scan_types = ("lldp"); + if (exists($globalopt{scan_types})) { + @scan_types = @{$globalopt{scan_types}}; + } + foreach my $st (@scan_types) { + no strict; + my $fn = $global_scan_type{$st}; + my $result = &$fn(\%request, $callback); + } + + return; } +#-------------------------------------------------------------------------------- +=head3 lldp_scan + Use lldpd to scan the subnets to do switch discovery. + Arguments: + request: request structure with callback pointer. + Returns: + A hash containing the swithes discovered. + Each element is a hash of switch attributes. For examples: + { + "1.2.3.5" =>{name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA"}, + "1.2.4.6" =>{name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF"} + } +=cut +#-------------------------------------------------------------------------------- +sub lldp_scan { + my $request = shift; + + send_msg($request, 0, "Discovering switches using lldpd..."); + my %switches = ( + "1.2.3.5" => { name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA" }, + "1.2.4.6" => { name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF" } + ); + return %switches +} + + +#-------------------------------------------------------------------------------- +=head3 nmap_scan + Use nmap to scan the subnets to do switch discovery. + Arguments: + request: request structure with callback pointer. + Returns: + A hash containing the swithes discovered. + Each element is a hash of switch attributes. For examples: + { + "1.2.3.5" =>{name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA"}, + "1.2.4.6" =>{name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF"} + } +=cut +#-------------------------------------------------------------------------------- +sub nmap_scan { + my $request = shift; + + send_msg($request, 0, "Discovering switches using nmap..."); + my %switches = ( + "1.2.3.5" => { name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA" }, + "1.2.4.6" => { name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF" } + ); + return %switches +} + + + +#-------------------------------------------------------------------------------- +=head3 snmp_scan + Use lldpd to scan the subnets to do switch discovery. + Arguments: + request: request structure with callback pointer. + Returns: + A hash containing the swithes discovered. + Each element is a hash of switch attributes. For examples: + { + "1.2.3.5" =>{name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA"}, + "1.2.4.6" =>{name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF"} + } +=cut +#-------------------------------------------------------------------------------- +sub snmp_scan { + my $request = shift; + + send_msg($request, 0, "Discovering switches using snmp..."); + my %switches = ( + "1.2.3.5" => { name=>"switch1", vendor=>"ibm", mac=>"AABBCCDDEEFA" }, + "1.2.4.6" => { name=>"switch2", vendor=>"cisco", mac=>"AABBCCDDEEFF" } + ); + return %switches +} + 1; From fbb5fca6522019a80799c1ca57251bbc0748f7b3 Mon Sep 17 00:00:00 2001 From: WangXiaoPeng Date: Tue, 12 May 2015 22:46:41 -0400 Subject: [PATCH 39/40] defect 4553: make rinstall only output error message when certain node failed instead of stopping running --- xCAT-server/lib/xcat/plugins/rinstall.pm | 122 +++++++++-------------- 1 file changed, 48 insertions(+), 74 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 62fd73c48..7799577f6 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -146,33 +146,25 @@ sub rinstall # call "nodeset ... osimage= ..." to set the boot state of the noderange to the specified osimage, # "nodeset" will handle the updating of node attributes such as os,arch,profile,provmethod # verify input - &checkoption("[-O|--osimage] $OSIMAGE",$OSVER,$PROFILE,$ARCH,$callback); + &checkoption("[-O|--osimage] $OSIMAGE",$OSVER,$PROFILE,$ARCH,$callback); # run nodeset $noderange osimage=$OSIMAGE - my @osimageargs; - push @osimageargs,"osimage=$OSIMAGE" ; - my $res = - xCAT::Utils->runxcmd( + my @osimageargs; + push @osimageargs,"osimage=$OSIMAGE" ; + my $res = + xCAT::Utils->runxcmd( { command => ["nodeset"], node => \@nodes, arg => \@osimageargs }, $subreq, -1, 1); - - my $rsp = {}; - if ($::RUNCMD_RC ==0 ) { - foreach my $line (@$res) { - $rsp->{data} ->[0] = $line; - xCAT::MsgUtils->message("I", $rsp, $callback); - } - } else { - foreach my $line (@$res) { - $rsp->{error} ->[0] = $line; - xCAT::MsgUtils->message("E", $rsp, $callback); - } - return 1; - } + $rc=$::RUNCMD_RC; + my $rsp = {}; + foreach my $line (@$res) { + $rsp->{data} ->[0] = $line; + xCAT::MsgUtils->message("I", $rsp, $callback); + } } else { @@ -268,19 +260,12 @@ sub rinstall arg => \@nodesetarg }, $subreq, -1, 1); - + + $rc = $::RUNCMD_RC; my $rsp = {}; - $rc=$::RUNCMD_RC; - if ($rc ==0 ) { - foreach my $line (@$res) { + foreach my $line (@$res) { $rsp->{data} ->[0] = $line; xCAT::MsgUtils->message("I", $rsp, $callback); - } - } else { # error - foreach my $line (@$res) { - $rsp->{error} ->[0] = $line; - xCAT::MsgUtils->message("E", $rsp, $callback); - } } } } @@ -300,31 +285,23 @@ sub rinstall arg => \@nodesetarg }, $subreq, -1, 1); - + + $rc = $::RUNCMD_RC; my $rsp = {}; - $rc=$::RUNCMD_RC; - if ($rc ==0 ) { - foreach my $line (@$res) { - $rsp->{data} ->[0] = $line; - xCAT::MsgUtils->message("I", $rsp, $callback); - } - } else { # error - foreach my $line (@$res) { - $rsp->{error} ->[0] = $line; - xCAT::MsgUtils->message("E", $rsp, $callback); - } + foreach my $line (@$res) { + $rsp->{data} ->[0] = $line; + xCAT::MsgUtils->message("I", $rsp, $callback); } } } } # end nodech/nodeset for each group - if ($rc != 0) # we got an error with the nodeset + if ($rc != 0) # we got an error with the nodeset { my $rsp = {}; - $rsp->{error}->[0] = "nodeset failure will not continue "; + $rsp->{error}->[0] = "nodeset failed on certain nodes."; xCAT::MsgUtils->message("E", $rsp, $callback); - return 1; } # call "rsetboot" to set the boot order of the nodehm.mgt=ipmi nodes,for others, @@ -342,28 +319,23 @@ sub rinstall arg => \@rsetbootarg }, $subreq, -1, 1); + + $rc = $::RUNCMD_RC; # fix output it is a hash and you must get error out of the hash. my $rsp = {}; - $rc=$::RUNCMD_RC; - if ($rc ==0 ) { - foreach my $line (@$res) { - $rsp->{data} ->[0] = $line; - xCAT::MsgUtils->message("I", $rsp, $callback); - } - } else { # error - foreach my $line (@$res) { - $rsp->{error} ->[0] = $line; - xCAT::MsgUtils->message("E", $rsp, $callback); - } - } - if ($rc != 0) # we got an error with the rsetboot - { - my $rsp = {}; - $rsp->{error}->[0] = "rsetboot failure will not continue "; - xCAT::MsgUtils->message("E", $rsp, $callback); - return 1; + foreach my $line (@$res) { + $rsp->{data} ->[0] = $line; + xCAT::MsgUtils->message("I", $rsp, $callback); } + if ($rc != 0) # we got an error with the rsetboot + { + my $rsp = {}; + $rsp->{error}->[0] = "rsetboot failed on certain nodes."; + xCAT::MsgUtils->message("E", $rsp, $callback); + } + + # call "rpower" to start the node provision process #run rpower $noderange boot @@ -377,20 +349,22 @@ sub rinstall arg => \@rpowerarg }, $subreq, -1, 1); - + + $rc = $::RUNCMD_RC; my $rsp = {}; - $rc=$::RUNCMD_RC; - if ($rc ==0 ) { - foreach my $line (@$res) { - $rsp->{data} ->[0] = $line; - xCAT::MsgUtils->message("I", $rsp, $callback); - } - } else { # error - foreach my $line (@$res) { - $rsp->{error} ->[0] = $line; - xCAT::MsgUtils->message("E", $rsp, $callback); - } + foreach my $line (@$res) { + $rsp->{data} ->[0] = $line; + xCAT::MsgUtils->message("I", $rsp, $callback); } + + if ($rc != 0) # we got an error with the rsetboot + { + my $rsp = {}; + $rsp->{error}->[0] = "rpower failed on certain nodes."; + xCAT::MsgUtils->message("E", $rsp, $callback); + } + + # Check if they asked to bring up a console ( -c) from rinstall always for winstall $req->{startconsole}->[0] =0; if ($command =~ /rinstall/) From e100a5c19aaf1e64bf48efe97fd47d4c6e373b0f Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 12 May 2015 23:14:44 -0400 Subject: [PATCH 40/40] fix bug 4635: Ubuntu genimage failure leaves bind mounts --- xCAT-server/share/xcat/netboot/ubuntu/genimage | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index ee80ba6ed..603cdfb79 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -369,8 +369,7 @@ unless ($onlyinitrd) { if ($pkglist) { $updates{'pkglist'} = $pkglist if ($tempfile); } else { - print "Unable to find package list for $profile!"; - exit 1; + xdie "Unable to find package list for $profile!"; } my %pkg_hash=imgutils::get_package_names($pkglist); @@ -380,8 +379,7 @@ unless ($onlyinitrd) { my $pkgnames = ""; foreach (keys(%{$pkg_hash{$pass}})) { if($_ eq "INCLUDEBAD") { - print "Unable to open the following pkglist files:\n".join("\n",@{$pkg_hash{$pass}{INCLUDEBAD}}); - exit 1; + xdie "Unable to open the following pkglist files:\n".join("\n",@{$pkg_hash{$pass}{INCLUDEBAD}}); } if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;} @@ -406,8 +404,7 @@ unless ($onlyinitrd) { } } if ($found eq 0) { - print "Cannot find the kernel with version $kernelver.\n"; - exit 1; + xdie "Cannot find the kernel with version $kernelver.\n"; } push @npa, $kernelname; } @@ -434,8 +431,7 @@ unless ($onlyinitrd) { print "$envlist $aptgetcmdby install $pkgnames\n"; my $rc = system("$envlist $aptgetcmdby install --allow-unauthenticated $pkgnames"); if ($rc) { - print "Failed to install packages $pkgnames\n"; - exit 1; + xdie "Failed to install packages $pkgnames\n"; } } @@ -492,9 +488,7 @@ unless ($onlyinitrd) { foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) { foreach (keys(%{$extra_hash{$pass}})) { if($_ eq "INCLUDEBAD") { - #print "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}}); xdie "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}}); - # exit 1; } if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;} @@ -554,8 +548,6 @@ unless ($onlyinitrd) { print "$envlist $aptgetcmd\n"; my $rc = system("$envlist $aptgetcmd"); if ($rc) { - #print "apt-get invocation failed\n"; - #exit 1; xdie "apt-get invocation failed\n"; } } else {