xcat2 / xcat-extensions

Repos to store scripts for special user cases
4 stars 8 forks source link

Dryrun and display enhancements #12

Closed gurevichmark closed 6 years ago

gurevichmark commented 6 years ago

https://github.com/xcat2/xcat2-task-management/issues/172

Enhancements to --dryrun and display separation for different stages.

whowutwut commented 6 years ago

@gurevichmark can you include the output of the dryrun with the changes you made?

bybai commented 6 years ago

Hi @whowutwut, I tried the --dryrun for setup process using this new code, this node is already standby MN, new output is

[root@bybc0605 ~]# python xcatha.py -s -p /HAtest -v 10.5.106.22 -i eth0:0 -n bymn -m 255.0.0.0 -t mariadb --dryrun
2018-06-07 01:58:41,832 - INFO - Setup this node as xCAT HA standby MN
============================================================================================
2018-06-07 01:58:41,834 - INFO - Check virtual ip stage
2018-06-07 01:58:41,834 - INFO - ping -c 1 -w 10 10.5.106.22 [Dryrun]
2018-06-07 01:58:41,834 - INFO - Check if xCAT data is in shared data directory
2018-06-07 01:58:41,835 - INFO - There is xCAT data /HAtest/install in shared data /HAtest
============================================================================================
2018-06-07 01:58:41,835 - INFO - Check if target dbtype is the same with shared data dbtype stage
2018-06-07 01:58:41,837 - INFO - Database type is 'mariadb' in shared data directory
2018-06-07 01:58:41,837 - INFO - Target database type is matched [Dryrun]
============================================================================================
2018-06-07 01:58:41,837 - INFO - Configure virtual ip as alias ip stage
2018-06-07 01:58:41,837 - INFO - ifconfig eth0:0 10.5.106.22  netmask 255.0.0.0 [Dryrun]
2018-06-07 01:58:41,837 - INFO - Save physical hostname and ip
============================================================================================
2018-06-07 01:58:41,838 - INFO - Configure hostname stage
2018-06-07 01:58:41,838 - INFO - hostname bymn [Dryrun]
2018-06-07 01:58:41,838 - INFO - Check xcatd service status
============================================================================================
2018-06-07 01:58:41,845 - INFO - Install xCAT stage
2018-06-07 01:58:41,845 - INFO - wget https://raw.githubusercontent.com/xcat2/xcat-core/master/xCAT-server/share/xcat/tools/go-xcat -O - >/tmp/go-xcat [Dryrun]
2018-06-07 01:58:41,845 - INFO - chmod +x /tmp/go-xcat [Dryrun]
2018-06-07 01:58:41,845 - INFO - /tmp/go-xcat --yes install [Dryrun]
2018-06-07 01:58:41,845 - INFO - xCAT is installed [Dryrun]
============================================================================================
2018-06-07 01:58:41,845 - INFO - Check database type stage
2018-06-07 01:58:41,845 - INFO - Current xCAT database type: mariadb
2018-06-07 01:58:41,846 - INFO - Target xCAT database type: mariadb
2018-06-07 01:58:41,848 - INFO - ifconfig|grep "inet 10.5.106.5  netmask" > /dev/null [Dryrun]
2018-06-07 01:58:41,864 - INFO - Check if xCAT data is in shared data directory
2018-06-07 01:58:41,864 - INFO - There is xCAT data /HAtest/install in shared data /HAtest
============================================================================================
2018-06-07 01:58:41,864 - INFO - Install database package stage
2018-06-07 01:58:41,867 - INFO - yum -y install perl-DBD-MySQL* mariadb-server-5.* mariadb-5.* mysql-connector-odbc-* [Dryrun]
2018-06-07 01:58:41,867 - INFO - install perl-DBD-MySQL* mariadb-server-5.* mariadb-5.* mysql-connector-odbc-* [Passed]
============================================================================================
2018-06-07 01:58:41,867 - INFO - Configure shared data directory stage
2018-06-07 01:58:41,867 - INFO - systemctl stop mariadb [Dryrun]
2018-06-07 01:58:41,880 - INFO - systemctl stop goconserver [Dryrun]
2018-06-07 01:58:41,881 - INFO - systemctl stop conserver [Dryrun]
2018-06-07 01:58:41,881 - INFO - systemctl stop ntpd [Dryrun]
2018-06-07 01:58:41,881 - INFO - systemctl stop dhcpd [Dryrun]
2018-06-07 01:58:41,881 - INFO - systemctl stop named [Dryrun]
2018-06-07 01:58:41,881 - INFO - systemctl stop xcatd [Dryrun]
2018-06-07 01:58:41,881 - INFO - systemctl stop mariadb [Dryrun]
2018-06-07 01:58:41,881 - INFO - Creating symlink .../install [Dryrun]
2018-06-07 01:58:41,881 - INFO - Creating symlink .../etc/xcat [Dryrun]
2018-06-07 01:58:41,881 - INFO - Creating symlink .../root/.xcat [Dryrun]
2018-06-07 01:58:41,881 - INFO - Creating symlink .../var/lib/mysql [Dryrun]
2018-06-07 01:58:41,881 - INFO - Creating symlink .../tftpboot [Dryrun]
2018-06-07 01:58:41,881 - INFO - cat /tmp/ha_mn >> /etc/xcat/ha_mn [Dryrun]
2018-06-07 01:58:41,882 - INFO - systemctl restart mariadb [Dryrun]
2018-06-07 01:58:41,882 - INFO - Check xcatd service status
2018-06-07 01:58:41,886 - INFO - systemctl restart xcatd [Dryrun]
2018-06-07 01:58:41,887 - INFO - xCAT service has started [Dryrun]
============================================================================================
2018-06-07 01:58:41,887 - INFO - Configure xCAT policy table stage
2018-06-07 01:58:41,887 - INFO - lsdef -t policy -i name|grep bymn [Dryrun]
2018-06-07 01:58:41,887 - INFO - bymn exists in policy table.
############################################################################################
2018-06-07 01:58:41,887 - INFO - Deactivate stage
2018-06-07 01:58:41,890 - INFO - ifconfig|grep "inet 10.5.106.5  netmask" > /dev/null [Dryrun]
2018-06-07 01:58:41,895 - INFO - ifconfig|grep "inet 10.5.106.5  netmask" > /dev/null [Dryrun]
============================================================================================
2018-06-07 01:58:41,898 - INFO - Configure hostname stage
2018-06-07 01:58:41,898 - INFO - hostname bybc0605.cluster.com [Dryrun]
============================================================================================
2018-06-07 01:58:41,898 - INFO - Unconfigure shared data directory stage
2018-06-07 01:58:41,898 - INFO - Removing symlink .../install [Dryrun]
2018-06-07 01:58:41,898 - INFO - Removing symlink .../etc/xcat [Dryrun]
2018-06-07 01:58:41,898 - INFO - Removing symlink .../root/.xcat [Dryrun]
2018-06-07 01:58:41,898 - INFO - Removing symlink .../var/lib/mysql [Dryrun]
2018-06-07 01:58:41,899 - INFO - Removing symlink .../tftpboot [Dryrun]
============================================================================================
2018-06-07 01:58:41,899 - INFO - Remove virtual IP stage
2018-06-07 01:58:41,899 - INFO - ifconfig eth0:0 0.0.0.0 0.0.0.0 &>/dev/null [Dryrun]
2018-06-07 01:58:41,899 - INFO - ip addr show |grep 10.5.106.22 &>/dev/null [Dryrun]
2018-06-07 01:58:41,899 - INFO - systemctl disable goconserver [Dryrun]
2018-06-07 01:58:41,899 - INFO - systemctl disable conserver [Dryrun]
2018-06-07 01:58:41,899 - INFO - systemctl disable ntpd [Dryrun]
2018-06-07 01:58:41,899 - INFO - systemctl disable dhcpd [Dryrun]
2018-06-07 01:58:41,899 - INFO - systemctl disable named [Dryrun]
2018-06-07 01:58:41,899 - INFO - systemctl disable xcatd [Dryrun]
2018-06-07 01:58:41,899 - INFO - systemctl disable mariadb [Dryrun]
2018-06-07 01:58:41,908 - INFO - systemctl stop goconserver [Dryrun]
2018-06-07 01:58:41,908 - INFO - systemctl stop conserver [Dryrun]
2018-06-07 01:58:41,908 - INFO - systemctl stop ntpd [Dryrun]
2018-06-07 01:58:41,908 - INFO - systemctl stop dhcpd [Dryrun]
2018-06-07 01:58:41,908 - INFO - systemctl stop named [Dryrun]
2018-06-07 01:58:41,909 - INFO - systemctl stop xcatd [Dryrun]
2018-06-07 01:58:41,909 - INFO - systemctl stop mariadb [Dryrun]
2018-06-07 01:58:41,909 - INFO - This machine is set to standby management node successfully...
[root@bybc0605 ~]#
bybai commented 6 years ago

Current deactivate process --dryrun:

[root@bybc0605 ~]# python xcatha.py -d -v 10.5.106.22 -i eth0:0 --dryrun
2018-06-07 03:59:03,487 - INFO - Deactivating this node as xCAT standby MN
############################################################################################
2018-06-07 03:59:03,487 - INFO - Deactivate stage
============================================================================================
2018-06-07 03:59:03,505 - INFO - Configure hostname stage
2018-06-07 03:59:03,505 - INFO - hostname bybc0605.cluster.com [Dryrun]
============================================================================================
2018-06-07 03:59:03,505 - INFO - Unconfigure shared data directory stage
2018-06-07 03:59:03,505 - INFO - Removing symlink .../install [Dryrun]
2018-06-07 03:59:03,506 - INFO - Removing symlink .../etc/xcat [Dryrun]
2018-06-07 03:59:03,506 - INFO - Removing symlink .../root/.xcat [Dryrun]
2018-06-07 03:59:03,506 - INFO - Removing symlink .../var/lib/mysql [Dryrun]
2018-06-07 03:59:03,506 - INFO - Removing symlink .../tftpboot [Dryrun]
============================================================================================
2018-06-07 03:59:03,506 - INFO - Remove virtual IP stage
2018-06-07 03:59:03,506 - INFO - ifconfig eth0:0 0.0.0.0 0.0.0.0 &>/dev/null [Dryrun]
2018-06-07 03:59:03,506 - INFO - ip addr show |grep 10.5.106.22 &>/dev/null [Dryrun]
2018-06-07 03:59:03,506 - INFO - systemctl disable goconserver [Dryrun]
2018-06-07 03:59:03,506 - INFO - systemctl disable conserver [Dryrun]
2018-06-07 03:59:03,506 - INFO - systemctl disable ntpd [Dryrun]
2018-06-07 03:59:03,506 - INFO - systemctl disable dhcpd [Dryrun]
2018-06-07 03:59:03,506 - INFO - systemctl disable named [Dryrun]
2018-06-07 03:59:03,506 - INFO - systemctl disable xcatd [Dryrun]
2018-06-07 03:59:03,507 - INFO - systemctl disable mariadb [Dryrun]
2018-06-07 03:59:03,517 - INFO - systemctl stop goconserver [Dryrun]
2018-06-07 03:59:03,517 - INFO - systemctl stop conserver [Dryrun]
2018-06-07 03:59:03,517 - INFO - systemctl stop ntpd [Dryrun]
2018-06-07 03:59:03,517 - INFO - systemctl stop dhcpd [Dryrun]
2018-06-07 03:59:03,517 - INFO - systemctl stop named [Dryrun]
2018-06-07 03:59:03,517 - INFO - systemctl stop xcatd [Dryrun]
2018-06-07 03:59:03,517 - INFO - systemctl stop mariadb [Dryrun]
2018-06-07 03:59:03,518 - INFO - This machine is set to standby management node successfully...
bybai commented 6 years ago

Activate process --dryrun process output:

[root@bybc0605 ~]# python xcatha.py -a -p /HAtest -v 10.5.106.22 -i eth0:0 -m 255.0.0.0 -t mariadb --dryrun
2018-06-07 04:00:08,492 - INFO - Activating this node as xCAT primary MN
############################################################################################
2018-06-07 04:00:08,492 - INFO - Activate stage
============================================================================================
2018-06-07 04:00:08,493 - INFO - Check virtual ip stage
2018-06-07 04:00:08,493 - INFO - ping -c 1 -w 10 10.5.106.22 [Dryrun]
============================================================================================
2018-06-07 04:00:08,493 - INFO - Configure virtual ip as alias ip stage
2018-06-07 04:00:08,493 - INFO - ifconfig eth0:0 10.5.106.22  netmask 255.0.0.0 [Dryrun]
============================================================================================
2018-06-07 04:00:08,497 - INFO - Configure hostname stage
2018-06-07 04:00:08,497 - INFO - hostname bymn [Dryrun]
2018-06-07 04:00:08,497 - INFO - Check if xCAT data is in shared data directory
2018-06-07 04:00:08,498 - INFO - There is xCAT data /HAtest/install in shared data /HAtest
============================================================================================
2018-06-07 04:00:08,498 - INFO - Configure shared data directory stage
2018-06-07 04:00:08,498 - INFO - systemctl stop mariadb [Dryrun]
2018-06-07 04:00:08,509 - INFO - systemctl stop goconserver [Dryrun]
2018-06-07 04:00:08,509 - INFO - systemctl stop conserver [Dryrun]
2018-06-07 04:00:08,510 - INFO - systemctl stop ntpd [Dryrun]
2018-06-07 04:00:08,510 - INFO - systemctl stop dhcpd [Dryrun]
2018-06-07 04:00:08,510 - INFO - systemctl stop named [Dryrun]
2018-06-07 04:00:08,510 - INFO - systemctl stop xcatd [Dryrun]
2018-06-07 04:00:08,510 - INFO - systemctl stop mariadb [Dryrun]
2018-06-07 04:00:08,511 - INFO - Creating symlink .../install [Dryrun]
2018-06-07 04:00:08,511 - INFO - Creating symlink .../etc/xcat [Dryrun]
2018-06-07 04:00:08,511 - INFO - Creating symlink .../root/.xcat [Dryrun]
2018-06-07 04:00:08,511 - INFO - Creating symlink .../var/lib/mysql [Dryrun]
2018-06-07 04:00:08,511 - INFO - Creating symlink .../tftpboot [Dryrun]
2018-06-07 04:00:08,511 - INFO - cat /tmp/ha_mn >> /etc/xcat/ha_mn [Dryrun]
============================================================================================
2018-06-07 04:00:08,511 - INFO - Start all services stage
2018-06-07 04:00:08,512 - INFO - systemctl start mariadb [Dryrun]
2018-06-07 04:00:08,512 - INFO - systemctl start xcatd [Dryrun]
2018-06-07 04:00:08,512 - INFO - lsdef -t site -i domain|grep domain [Dryrun]
2018-06-07 04:00:08,512 - WARNING - Long hostname is not in "/etc/hosts". "named" service will not be started
2018-06-07 04:00:08,512 - INFO - makedhcp -n [Dryrun]
2018-06-07 04:00:08,512 - INFO - makedhcp -a [Dryrun]
2018-06-07 04:00:08,512 - INFO - systemctl start ntpd [Dryrun]
2018-06-07 04:00:08,512 - INFO - This machine is set to primary management node successfully...
bybai commented 6 years ago

Hi @whowutwut, --dryrun information does not break any function, so I merged --dryrun enhancement for these stage first, and based on this PR, I will create another PR to do some improvements to fix some bugs from FVT. More --dryrun enhancements can be added later, thanks @gurevichmark