xcat2 / xcat-extensions

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

Wrongly implemented method xcat_ha_utils.check_software_installed() #17

Closed neo954 closed 6 years ago

neo954 commented 6 years ago

This bug is against xcatha.py commit 7c57e774bb4f240603ebc9b042d86e56b182f975.

How to reproduce the problem

# ./xcatha.py -s -p /media/u/gongjie/ha-test -i eth0:99 -v 10.3.1.99 -m 255.0.0.0 -n c910f03c01p99 -t sqlite
2018-06-11 00:08:16,569 - INFO - Setup this node as xCAT HA standby MN
============================================================================================
2018-06-11 00:08:16,572 - INFO - Check virtual ip stage
2018-06-11 00:08:16,572 - INFO - ping -c 1 -w 10 10.3.1.99
PING 10.3.1.99 (10.3.1.99) 56(84) bytes of data.
From 10.3.1.7 icmp_seq=1 Destination Host Unreachable
From 10.3.1.7 icmp_seq=2 Destination Host Unreachable
From 10.3.1.7 icmp_seq=3 Destination Host Unreachable

--- 10.3.1.99 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2003ms
pipe 3
2018-06-11 00:08:19,568 - INFO - virtual ip can be used.
2018-06-11 00:08:19,568 - INFO - Check if xCAT data is in shared data directory
2018-06-11 00:08:19,571 - INFO - There is xCAT data /media/u/gongjie/ha-test/install in shared data /media/u/gongjie/ha-test
============================================================================================
2018-06-11 00:08:19,571 - INFO - Check if target dbtype is the same with shared data dbtype stage
2018-06-11 00:08:19,572 - INFO - Database type is 'sqlite' in shared data directory
2018-06-11 00:08:19,572 - INFO - Target database type is matched [Passed]
============================================================================================
2018-06-11 00:08:19,572 - INFO - Configure virtual ip as alias ip stage
2018-06-11 00:08:19,574 - INFO - ifconfig eth0:99 10.3.1.99  netmask 255.0.0.0 [Passed]
2018-06-11 00:08:19,574 - INFO - Save physical hostname and ip
============================================================================================
2018-06-11 00:08:19,575 - INFO - Configure hostname stage
2018-06-11 00:08:19,576 - INFO - hostname c910f03c01p99 [Passed]
2018-06-11 00:08:19,577 - INFO - Check xcatd service status
Unit xcatd.service could not be found.
============================================================================================
2018-06-11 00:08:19,581 - INFO - Install xCAT stage
2018-06-11 00:08:19,581 - INFO - Checking if xCAT is installed ...
2018-06-11 00:08:20,379 - INFO - xCAT already installed
============================================================================================
2018-06-11 00:08:20,379 - INFO - Check database type stage
2018-06-11 00:08:20,379 - INFO - Current xCAT database type: sqlite
2018-06-11 00:08:20,379 - INFO - Target xCAT database type: sqlite
2018-06-11 00:08:20,379 - INFO - No need to switch database
============================================================================================
2018-06-11 00:08:20,379 - INFO - Configure shared data directory stage
2018-06-11 00:08:20,404 - INFO - systemctl stop goconserver [Passed]
Warning: conserver.service changed on disk. Run 'systemctl daemon-reload' to reload units.
2018-06-11 00:08:20,416 - INFO - systemctl stop conserver [Passed]
2018-06-11 00:08:20,427 - INFO - systemctl stop ntpd [Passed]
2018-06-11 00:08:20,439 - INFO - systemctl stop dhcpd [Passed]
2018-06-11 00:08:20,452 - INFO - systemctl stop named [Passed]
Failed to stop xcatd.service: Unit xcatd.service not loaded.
2018-06-11 00:08:23,466 - INFO - Retry 1 ... ...systemctl stop xcatd
Failed to stop xcatd.service: Unit xcatd.service not loaded.
2018-06-11 00:08:26,481 - INFO - Retry 2 ... ...systemctl stop xcatd
Failed to stop xcatd.service: Unit xcatd.service not loaded.
2018-06-11 00:08:26,492 - ERROR - systemctl stop xcatd [Failed]
Failed to stop mariadb.service: Unit mariadb.service not loaded.
2018-06-11 00:08:29,506 - INFO - Retry 1 ... ...systemctl stop mariadb
Failed to stop mariadb.service: Unit mariadb.service not loaded.
2018-06-11 00:08:32,521 - INFO - Retry 2 ... ...systemctl stop mariadb
Failed to stop mariadb.service: Unit mariadb.service not loaded.
2018-06-11 00:08:32,533 - ERROR - systemctl stop mariadb [Failed]
Failed to stop postgresql.service: Unit postgresql.service not loaded.
2018-06-11 00:08:35,547 - INFO - Retry 1 ... ...systemctl stop postgresql
Failed to stop postgresql.service: Unit postgresql.service not loaded.
2018-06-11 00:08:38,561 - INFO - Retry 2 ... ...systemctl stop postgresql
Failed to stop postgresql.service: Unit postgresql.service not loaded.
2018-06-11 00:08:38,573 - ERROR - systemctl stop postgresql [Failed]
2018-06-11 00:08:38,573 - INFO - Creating symlink .../install
2018-06-11 00:08:38,573 - INFO - Creating symlink .../etc/xcat
2018-06-11 00:08:38,574 - INFO - Creating symlink .../root/.xcat
2018-06-11 00:08:38,574 - INFO - Creating symlink .../var/lib/pgsql
2018-06-11 00:08:38,574 - INFO - Creating symlink .../var/lib/mysql
2018-06-11 00:08:38,574 - INFO - Creating symlink .../tftpboot
2018-06-11 00:08:38,579 - INFO - cat /tmp/ha_mn >> /etc/xcat/ha_mn [Passed]
2018-06-11 00:08:38,580 - INFO - Check xcatd service status
Unit xcatd.service could not be found.
Failed to restart xcatd.service: Unit not found.
2018-06-11 00:08:41,598 - INFO - Retry 1 ... ...systemctl restart xcatd
Failed to restart xcatd.service: Unit not found.
2018-06-11 00:08:44,612 - INFO - Retry 2 ... ...systemctl restart xcatd
Failed to restart xcatd.service: Unit not found.
2018-06-11 00:08:44,624 - ERROR - systemctl restart xcatd [Failed]
2018-06-11 00:08:44,624 - ERROR - xCAT service did not start [Failed]
2018-06-11 00:08:44,624 - ERROR - Error: Check xcatd service status
2018-06-11 00:08:44,624 - ERROR - Error encountered, starting to clean up the environment
============================================================================================
2018-06-11 00:08:44,641 - INFO - Configure hostname stage
2018-06-11 00:08:44,643 - INFO - hostname c910f03c01p07 [Passed]
============================================================================================
2018-06-11 00:08:44,643 - INFO - Unconfigure shared data directory stage
2018-06-11 00:08:44,643 - INFO - Removing symlink .../install
2018-06-11 00:08:44,643 - INFO - Restoring local directory .../install
2018-06-11 00:08:44,643 - INFO - Removing symlink .../etc/xcat
2018-06-11 00:08:44,643 - INFO - Restoring local directory .../etc/xcat
2018-06-11 00:08:44,643 - INFO - Removing symlink .../root/.xcat
2018-06-11 00:08:44,643 - INFO - Restoring local directory .../root/.xcat
2018-06-11 00:08:44,644 - INFO - Removing symlink .../var/lib/pgsql
2018-06-11 00:08:44,644 - INFO - Restoring local directory .../var/lib/pgsql
2018-06-11 00:08:44,644 - INFO - Removing symlink .../var/lib/mysql
2018-06-11 00:08:44,644 - INFO - Restoring local directory .../var/lib/mysql
2018-06-11 00:08:44,644 - INFO - Removing symlink .../tftpboot
2018-06-11 00:08:44,644 - INFO - Restoring local directory .../tftpboot
============================================================================================
2018-06-11 00:08:44,644 - INFO - Remove virtual IP stage
2018-06-11 00:08:44,646 - INFO - ifconfig eth0:99 0.0.0.0 0.0.0.0 &>/dev/null [Failed, OK to ignore]
2018-06-11 00:08:44,649 - INFO - ip addr show |grep 10.3.1.99 &>/dev/null [Failed, OK to ignore]
2018-06-11 00:08:44,649 - INFO - Remove virtual IP [Passed]

What is actually happened

The package xCAT-test is installed. But all remain xCAT packages are not.

# rpm -qa | grep xCAT-test
xCAT-test-2.14.1-snap201806010300.noarch

In method xcat_ha_utils.install_xcat(), it calls xcat_ha_utils.check_software_installed(). And method xcat_ha_utils.check_software_installed() runs rpm -qa | grep xCAT to check if package xCAT is installed. It is implemented wrongly.

The correct method is use command rpm -q xCAT to check if package xCAT is installed. Rather than use grep.

robin2008 commented 6 years ago

Need in 2.14.2

neo954 commented 6 years ago

Refer to xcat2/xcat2-task-management#163