From 9766383d682616b3b38984f1f2c8ecc4e42ecbdf Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 29 Apr 2014 10:30:21 -0500 Subject: [PATCH 1/6] add vlan support for configeth, could use the syntax eth1.2 to specify vlan tagging --- xCAT/postscripts/configeth | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index c9e73068c..85994e869 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -27,6 +27,10 @@ function configipv4(){ echo "NETWORK_${num_v4num}=${str_v4net}" >> $str_conf_file echo "LABEL_${num_v4num}=${num_v4num}" >> $str_conf_file fi + + if [[ ${str_if_name} == [a-zA-Z0-9]*.[0-9]* ]]; then + echo "VLAN=yes" >> $str_conf_file + fi #debian ubuntu elif [ "$str_os_type" = "debian" ];then str_conf_file="/etc/network/interfaces.d/${str_if_name}" @@ -40,6 +44,10 @@ function configipv4(){ echo " address ${str_v4ip}" >> $str_conf_file echo " netmask ${str_v4mask}" >> $str_conf_file echo " network ${str_v4net}" >> $str_conf_file + if [[ ${str_if_name} == [a-zA-Z0-9]*.[0-9]* ]]; then + parent_device=`echo ${str_if_name} | sed -e 's/\([a-zA-Z0-9]*\)\.[0-9]*/\1/g'` + echo " vlan-raw-device ${parent_device}" >> $str_conf_file + fi else # Write the info to the ifcfg file for redhat str_conf_file="" @@ -56,6 +64,9 @@ function configipv4(){ echo "IPADDR=${str_v4ip}" >> $str_conf_file echo "NETMASK=${str_v4mask}" >> $str_conf_file echo "ONBOOT=yes" >> $str_conf_file + if [[ ${str_if_name} == [a-zA-Z0-9]*.[0-9]* ]]; then + echo "VLAN=yes" >> $str_conf_file + fi fi } From 7112eaed3fe5056bd22607c921ac98c83c98c9e0 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Mon, 28 Apr 2014 22:13:31 -0700 Subject: [PATCH 2/6] fix bug 3934: mkdef/chdef -u needs better doc and 1 fix --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 34 ++++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index a5a75d23b..e18a5f707 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -2464,15 +2464,21 @@ sub defch # give results my $rsp; - $rsp->{data}->[0] = - "The database was updated for the following objects:"; - xCAT::MsgUtils->message("I", $rsp, $::callback); + my $nodenum = scalar(keys %::FINALATTRS); + if ($nodenum) { + $rsp->{data}->[0] = + "The database was updated for the following objects:"; + xCAT::MsgUtils->message("I", $rsp, $::callback); - my $n = 1; - foreach my $o (sort(keys %::FINALATTRS)) - { - $rsp->{data}->[$n] = "$o\n"; - $n++; + my $n = 1; + foreach my $o (sort(keys %::FINALATTRS)) + { + $rsp->{data}->[$n] = "$o\n"; + $n++; + } + } else { + $rsp->{data}->[0] = + "No database was updated"; } xCAT::MsgUtils->message("I", $rsp, $::callback); } @@ -2480,8 +2486,13 @@ sub defch { my $rsp; my $nodenum = scalar(keys %::FINALATTRS); - $rsp->{data}->[0] = - "$nodenum object definitions have been created or modified."; + if ($nodenum) { + $rsp->{data}->[0] = + "$nodenum object definitions have been created or modified."; + } else { + $rsp->{data}->[0] = + "No object definitions have been created or modified."; + } xCAT::MsgUtils->message("I", $rsp, $::callback); if (scalar(keys %newobjects) > 0) { @@ -2629,6 +2640,9 @@ sub setFINALattrs { # special case for the nic* attributes # merge nic*.eth0, nic*.eth1 + unless(exists($::CLIATTRS{$objname})) { + next; + } if ($::CLIATTRS{$objname}{objtype} eq 'node') { # Even if only the nicips.eth0 is specified with CLI, From 71ed00d1a4bda588ec6795adae251783e81fd9e0 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 29 Apr 2014 00:18:59 -0700 Subject: [PATCH 3/6] fix defect #3997 node reinstall loop when site.nodestatus=0 Edit --- xCAT-server/share/xcat/install/scripts/post.xcat | 7 ++++--- xCAT/postscripts/runxcatpost | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 50c298e51..61dbd8379 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -182,9 +182,10 @@ addsiteyum /xcatpost/mypostscript sed -i 's/^serial/#serial/' /boot/grub/grub.conf sed -i 's/^terminal/#terminal/' /boot/grub/grub.conf -if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then - updateflag.awk $MASTER 3002 -fi + +#the following command should always be run to prevent infinite installation loops +updateflag.awk $MASTER 3002 + cd / #rm -Rf /xcatpost #rm -f /xcatpost/mypostscript diff --git a/xCAT/postscripts/runxcatpost b/xCAT/postscripts/runxcatpost index 83284ca55..508c13f14 100644 --- a/xCAT/postscripts/runxcatpost +++ b/xCAT/postscripts/runxcatpost @@ -68,6 +68,4 @@ echo "$TMP" > /tmp/xcatenv . /tmp/xcatenv /xcatpost/addsiteyum -if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then - /xcatpost/updateflag.awk $MASTER 3002 -fi +/xcatpost/updateflag.awk $MASTER 3002 From 99ef9718622c3c5eb55da24bc142c7c959dac80a Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 29 Apr 2014 09:05:33 -0400 Subject: [PATCH 4/6] Defect 4061 --- perl-xCAT/xCAT/DSHCLI.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 02db73961..e6a3ab178 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -6039,11 +6039,11 @@ sub run_always_rsync_postscripts # if on the service node need to add the $syncdir directory # to the path if (xCAT::Utils->isServiceNode()) { - my $tmpp=$syncdir . $ps; - $ps=$tmpp; + my $tmps=$syncdir . $ps; + push @args, $tmps; + } else{ + push @args, $ps; } - push @args, $ps; - push (@nodes, @{$$dshparms{'postscripts'}{$ps}}); $out=xCAT::Utils->runxcmd( { command => ['xdsh'], From 7b5aa8aed1f23c7d9835ab07d47a0bb60749a17e Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 29 Apr 2014 10:10:45 -0400 Subject: [PATCH 5/6] support MariaDB defect 4097 --- xCAT-client/bin/mysqlsetup | 87 ++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 28 deletions(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index fb782c4d7..4b00497d8 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -8,10 +8,9 @@ - This is script is called after the installation or upgrade of MySQL - on xCAT. It will automate the setup of the MySQL and xCAT to run - xCAT on the MySQL DB. - Note: if will setup an xcatdb,a xcatadmin, and a MySQL root password. + This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run + xCAT on MySQL/MariaDB. + Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password. It will interact for the password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW env variables are set to the admin and mysql root password, resp. @@ -150,8 +149,8 @@ $::linuxos = xCAT::Utils->osver(); # # check to see if mysql is installed -# -my $cmd = "rpm -qa | grep mysql"; + # +my $cmd = "rpm -qa | grep -i perl-DBD-mysql"; if ( $::debianflag ){ $cmd = "dpkg -l | grep mysql-server"; } @@ -159,10 +158,17 @@ xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) { my $message = - "\nMySQL is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs."; + "\nMySQL perl DBD is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs."; xCAT::MsgUtils->message("E", " $cmd failed. $message"); exit(1); } +# is this MariaDB or MySQL +$::MariaDB=0; +$cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL +xCAT::Utils->runcmd($cmd, 0); +if ($::RUNCMD_RC == 0) { + $::MariaDB=1; +} # check to see if MySQL is running $::mysqlrunning = 0; @@ -328,7 +334,6 @@ if (($::INIT) && ($::xcatrunningmysql == 0)) # MySQL not running, then initialize the database if ($::mysqlrunning == 0) { - # Add mysql user and group for AIX # Correct directory permissions # @@ -436,7 +441,7 @@ sub usage { xCAT::MsgUtils->message( 'I', - "Usage:\nmysqlsetup - Performs the setup of MySQL for xCAT to use as its database. See man mysqlsetup for more information." + "Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information." ); my $msg = "mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]"; @@ -870,14 +875,20 @@ sub mysqlstart } else { - if ($::linuxos =~ /rh.*/) - { + if ($::MariaDB==1) { # running MariaDB + $cmd = "service mariadb start"; + + } else { # it is mysql + + if ($::linuxos =~ /rh.*/) + { $cmd = "service mysqld start"; - } - else - { # sles + } + else + { # sles $cmd = "service mysql start"; - } + } + } } xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) @@ -973,16 +984,21 @@ sub mysqlreboot } else # linux { - if ($::linuxos =~ /rh.*/) - { - $cmd = "chkconfig mysqld on"; - } - else - { # sles - $cmd = "chkconfig mysql on"; - if ( $::debianflag ){ - $cmd = "update-rc.d mysql defaults"; - } + if ($::MariaDB==1 ) { # MariaDB not MySQL + + $cmd = "chkconfig mariadb on"; + } else { # mysql + if ($::linuxos =~ /rh.*/) + { + $cmd = "chkconfig mysqld on"; + } + else + { # sles + $cmd = "chkconfig mysql on"; + if ( $::debianflag ){ + $cmd = "update-rc.d mysql defaults"; + } + } } xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) @@ -1058,7 +1074,12 @@ sub setupxcatdb my $timeout = 10; # sets Expect default timeout, 0 accepts immediately my $pwd_sent = 0; my $pwd_prompt = 'Enter password: '; - my $mysql_prompt = 'mysql> '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } my $expect_log = undef; my $debug = 0; #if ($::VERBOSE) @@ -1178,7 +1199,12 @@ sub setupLL my $timeout = 10; # sets Expect default timeout, 0 accepts immediately my $pwd_sent = 0; my $pwd_prompt = 'Enter password: '; - my $mysql_prompt = 'mysql> '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } my $expect_log = undef; my $debug = 0; #if ($::VERBOSE) @@ -1308,7 +1334,12 @@ sub addhosts my $timeout = 10; # sets Expect default timeout, 0 accepts immediately my $pwd_sent = 0; my $pwd_prompt = 'Enter password: '; - my $mysql_prompt = 'mysql> '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } my $expect_log = undef; foreach my $host (@hosts) From e43e18ba9bfd36e399078fd3a9ca056e20010af6 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 29 Apr 2014 10:20:50 -0400 Subject: [PATCH 6/6] support MariaDB defect 4097 --- xCAT-client/pods/man1/mysqlsetup.1.pod | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xCAT-client/pods/man1/mysqlsetup.1.pod b/xCAT-client/pods/man1/mysqlsetup.1.pod index 2ac3be44a..fc6addb57 100644 --- a/xCAT-client/pods/man1/mysqlsetup.1.pod +++ b/xCAT-client/pods/man1/mysqlsetup.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Sets up the MySQL database for xCAT to use. +B - Sets up the MySQL or MariaDB database for xCAT to use. =head1 SYNOPSIS @@ -19,9 +19,10 @@ B {B<-L>|B<--LL>} [-V|--verbose] =head1 DESCRIPTION -B - Sets up the MySQL database for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code has been installed. Before running the init option, the MySQL server should be stopped. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in +B - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code or MariaDB code has been installed. Before running the init option, the MySQL server should be stopped, if it is running. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables XCATMYSQLADMIN_PW and XCATMYSQLROOT_PW are set to the passwords for the xcatadmin id and root id in the database,resp. +Note below we refer to MySQL but it works the same for MariaDB. =head1 OPTIONS @@ -41,8 +42,8 @@ Displays verbose messages. =item B<-i|--init> -The init option is used to setup an installed MySQL database so that xCAT can use the database. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database. -On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init. +The init option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The mysqlsetup script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database. +On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init. =item B<-u|--update>