Skip to content

Commit 383da5a

Browse files
author
jianghuaw
authored
Merge pull request #159 from citrix-openstack/fule-install-suppack
Fuel: add uninstall supplemental pack script
2 parents 4c17716 + 361e8a2 commit 383da5a

File tree

2 files changed

+60
-4
lines changed

2 files changed

+60
-4
lines changed

fuel_test/clear_env.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ function clear_xs {
3737
crontab -l && crontab -r
3838
[ -f /root/rotate_xen_guest_logs.sh ] && rm /root/rotate_xen_guest_logs.sh
3939
40-
yum list installed openstack-neutron-xen-plugins.noarch && yum remove openstack-neutron-xen-plugins.noarch -y
41-
yum list installed openstack-xen-plugins.noarch && yum remove openstack-xen-plugins.noarch -y
42-
yum list installed conntrack-tools.x86_64 && yum remove conntrack-tools.x86_64 -y
43-
4440
COMPUTE_UUIDS=$(xe vm-list name-label=Compute --minimal)
4541
for uuid in $(echo $COMPUTE_UUIDS | sed "s/,/ /g")
4642
do
@@ -63,6 +59,10 @@ function clear_xs {
6359
for i in "${ALL_FUEL_VERSION[@]}"; do
6460
ssh -qo StrictHostKeyChecking=no root@$xs_host '[ -n "$(xe vm-list name-label=Fuel'$i' --minimal)" ] && xe vm-shutdown force=true vm="Fuel'$i'"'
6561
done
62+
63+
ssh -qo StrictHostKeyChecking=no root@$xs_host 'mkdir -p /tmp/fuel_clean'
64+
scp -qo StrictHostKeyChecking=no uninstall-suppack.sh root@$xs_host:/tmp/fuel_clean/
65+
ssh -qo StrictHostKeyChecking=no root@$xs_host '/tmp/fuel_clean/uninstall-suppack.sh'
6666
}
6767

6868
clear_xs "$XS_HOST"

fuel_test/uninstall-suppack.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
set -x
4+
5+
function wait_toolstack_ready {
6+
while ! ls /var/run/xapi_init_complete.cookie; do
7+
sleep 2
8+
done
9+
}
10+
11+
function version_ge() {
12+
test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1";
13+
}
14+
15+
16+
ELY_VER=2.2.0
17+
host_uuid=$(xe host-list --minimal)
18+
xcp_ver=$(xe host-param-get param-name=software-version param-key=platform_version uuid=$host_uuid)
19+
20+
if version_ge $xcp_ver $ELY_VER; then
21+
# Find openstack-xenapi-plugins suppack update uuid
22+
update_uuids=$(xe update-list name-label=openstack-xenapi-plugins --minimal)
23+
if [ -z "$update_uuids" ]; then
24+
exit 0
25+
fi
26+
27+
# Find the correct package and uninstall them
28+
yum list installed openstack-neutron-xen-plugins.noarch && yum remove openstack-neutron-xen-plugins.noarch -y
29+
yum list installed openstack-xen-plugins.noarch && yum remove openstack-xen-plugins.noarch -y
30+
yum list installed conntrack-tools.x86_64 && yum remove conntrack-tools.x86_64 -y
31+
32+
# remove updates
33+
update_uuids=${update_uuids//,/ }
34+
for uuid in $update_uuids
35+
do
36+
if [ -n "$uuid" ]; then
37+
# Remove uuid related folder/file and restart toolstack
38+
rm -rf /var/update/applied/$uuid
39+
rm -f /var/run/xapi_init_complete.cookie
40+
xe-toolstack-restart
41+
wait_toolstack_ready
42+
43+
# Destroy the unapplied update and restart toolstack
44+
xe update-destroy uuid=$uuid
45+
rm -f /var/run/xapi_init_complete.cookie
46+
xe-toolstack-restart
47+
wait_toolstack_ready
48+
fi
49+
done
50+
else
51+
# Find the correct package and uninstall them
52+
yum list installed openstack-neutron-xen-plugins.noarch && yum remove openstack-neutron-xen-plugins.noarch -y
53+
yum list installed openstack-xen-plugins.noarch && yum remove openstack-xen-plugins.noarch -y
54+
yum list installed conntrack-tools.x86_64 && yum remove conntrack-tools.x86_64 -y
55+
fi
56+

0 commit comments

Comments
 (0)