xcat2 / xcat-extensions

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

Support interactive deactivate #27

Closed bybai closed 6 years ago

bybai commented 6 years ago

enhance:

  1. Support interactive|activate deactivate process for https://github.com/xcat2/xcat2-task-management/issues/184 and https://github.com/xcat2/xcat2-task-management/issues/185
  2. During deactivate process, if user use "python xcatha.py -d -v 10.5.106.22 -i eth0:0", this means he want to remove vip, we can keep the original process. But unlink share data is no need in deactivate process, so I delete it.
  3. During non-interactive activate process, we do not need to re-link the share data, so I delete this part.
  4. fix https://github.com/xcat2/xcat-extensions/issues/20
  5. fix https://github.com/xcat2/xcat-extensions/issues/29

UT

[root@bybc0607 ~]# python xcatha.py -d
2018-06-14 04:54:15,960 - INFO - [xCAT] Shutting down services:
... goconserver
... conserver
... ntpd
... dhcpd
... named
... xcatd
... postgresql
Continue? [[Y]es/[N]o/[D]ryrun]:
Y
2018-06-14 04:54:21,809 - DEBUG - systemctl stop goconserver [Passed]
2018-06-14 04:54:21,821 - DEBUG - systemctl stop conserver [Passed]
2018-06-14 04:54:21,837 - DEBUG - systemctl stop ntpd [Passed]
2018-06-14 04:54:21,850 - DEBUG - systemctl stop dhcpd [Passed]
2018-06-14 04:54:21,862 - DEBUG - systemctl stop named [Passed]
2018-06-14 04:54:22,391 - DEBUG - systemctl stop xcatd [Passed]
2018-06-14 04:54:23,419 - DEBUG - systemctl stop postgresql [Passed]
[xCAT] Disabling services from starting on reboot:
... goconserver
... conserver
... ntpd
... dhcpd
... named
... xcatd
... postgresql
Continue? [[Y]es/[N]o/[D]ryrun]:
Y
2018-06-14 04:54:26,627 - DEBUG - systemctl disable goconserver [Passed]
conserver.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig conserver off
2018-06-14 04:54:26,689 - DEBUG - systemctl disable conserver [Passed]
2018-06-14 04:54:26,742 - DEBUG - systemctl disable ntpd [Passed]
2018-06-14 04:54:26,794 - DEBUG - systemctl disable dhcpd [Passed]
2018-06-14 04:54:26,847 - DEBUG - systemctl disable named [Passed]
xcatd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig xcatd off
2018-06-14 04:54:26,905 - DEBUG - systemctl disable xcatd [Passed]
2018-06-14 04:54:26,958 - DEBUG - systemctl disable postgresql [Passed]
2018-06-14 04:54:26,958 - INFO - This machine is set to standby management node successfully...
[root@bybc0607 ~]# python xcatha.py -a -v 10.5.106.70
[Admin] Enter DB type [postgresql/mariadb/sqlite]:
postgrepsql
Enter DB type [postgresql/mariadb/sqlite]
postgresql
[Admin] Verify VIP10.5.106.70 is configured in node
Continue? [[Y]es/[N]o]:
Y
[Admin] Verify that the following is configured to be saved in shared storage and accessible from this node:
... /install
... /etc/xcat
... /root/.xcat
... /var/lib/pgsql
... /tftpboot
Continue? [[Y]es/[N]o]:
Y
[xCAT] Starting up services:
... postgresql
... xcatd
... named
... dhcpd
... ntpd
... conserver
... goconserver
Continue? [[Y]es/[N]o/[D]ryrun]:
Y
2018-06-14 04:56:17,819 - INFO - ===> Start all services stage <===
2018-06-14 04:56:18,955 - DEBUG - systemctl start postgresql [Passed]
2018-06-14 04:56:21,706 - DEBUG - systemctl start xcatd [Passed]
    domain=cluster.com
2018-06-14 04:56:22,077 - DEBUG - lsdef -t site -i domain|grep domain [Passed]
2018-06-14 04:56:22,077 - WARNING - Long hostname is not in "/etc/hosts". "named" service will not be started
Renamed existing dhcp configuration file to  /etc/dhcp/dhcpd.conf.xcatbak

The dhcp server must be restarted for OMAPI function to work
Warning: No dynamic range specified for 10.0.0.0. If hardware discovery is being used, a dynamic range is required.
2018-06-14 04:56:22,545 - DEBUG - makedhcp -n [Passed]
2018-06-14 04:56:22,793 - DEBUG - makedhcp -a [Passed]
2018-06-14 04:56:22,856 - DEBUG - systemctl start ntpd [Passed]