-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from schubergphilis/add-custom-patch-script
Handle XenServer patching automatically
- Loading branch information
Showing
7 changed files
with
266 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
*.swp | ||
config | ||
*.iml | ||
.idea/ | ||
.idea/ | ||
xenserver_patches/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "This is the post_empty script you could customise." | ||
|
||
#echo "Downgrading openvswitch RPM to the XenServer default" | ||
rpm -Uvh http://10.200.10.10/software/xenserver/openvswitch-1.4.6-143.9926.i386.rpm --force --nodeps | ||
|
||
echo "Applying patches" | ||
HOST_UUID=$(xe host-list name-label=${HOSTNAME} --minimal) | ||
|
||
# Check for 6.5 | ||
cat /etc/redhat-release | grep "6.5" | ||
if [ $? -eq 0 ]; then | ||
SERVICE_PACK_PATCH=XS65ESP1 | ||
fi | ||
# Check for 6.2 | ||
cat /etc/redhat-release | grep "6.2" | ||
if [ $? -eq 0 ]; then | ||
SERVICE_PACK_PATCH=XS62ESP1 | ||
fi | ||
|
||
# First apply SP1 | ||
xe patch-list name-label=${SERVICE_PACK_PATCH} params=hosts --minimal | tr ',' '\n' | grep ${HOST_UUID} | ||
if [ $? -eq 0 ]; then | ||
echo Service Pack ${SERVICE_PACK_PATCH} is already installed, skipping. | ||
else | ||
echo Installing ${SERVICE_PACK_PATCH}... | ||
PATCH_UUID=$(xe patch-list name-label=${SERVICE_PACK_PATCH} | grep uuid | sed -e 's/^.*: //g') | ||
if [ ${PATCH_UUID} ]; then | ||
xe patch-apply uuid=${PATCH_UUID} host-uuid=${HOST_UUID} | ||
fi | ||
fi | ||
|
||
# Apply any other available patch | ||
XEN_ALL_PATCHES=$(xe patch-list params=name-label --minimal | tr ',' '\n' ) | ||
XEN_INSTALLED_PATCHES=$(xe patch-list hosts:contains=${HOST_UUID} params=name-label --minimal | tr ',' '\n' ) | ||
|
||
for patch in ${XEN_ALL_PATCHES}; do | ||
echo "Checking patch " ${patch} | ||
|
||
# Check if already included | ||
echo ${XEN_INSTALLED_PATCHES} | grep ${patch} 2>&1 >/dev/null | ||
if [ $? -eq 0 ]; then | ||
echo Patch ${patch} is already installed, skipping. | ||
else | ||
echo Installing $patch... | ||
PATCH_UUID=$(xe patch-list name-label=${patch}| grep uuid | sed -e 's/^.*: //g') | ||
if [ ${PATCH_UUID} ]; then | ||
xe patch-apply uuid=${PATCH_UUID} host-uuid=${HOST_UUID} | ||
fi | ||
fi | ||
done | ||
|
||
echo "Upgrading drivers" | ||
yum -y install bnx2x-* fnic* qla2* glnic* qlge* tg3* openvswitch-modules-xen* | ||
if [ $? -eq 0 ]; then | ||
echo "Yum commnand returned non-zero" | ||
exit 1 | ||
fi | ||
|
||
SYSTEM_HARDWARE=$(dmidecode -s system-product-name | grep -v "#") | ||
if [[ "${SYSTEM_HARDWARE}" == "ProLiant DL380 G7" ]]; then | ||
echo "Skip HPSA on HP ProLiant DL380 G7 or else the box won't boot" | ||
else | ||
yum -y install hpsa* | ||
if [ $? -eq 0 ]; then | ||
echo "Yum commnand returned non-zero" | ||
exit 1 | ||
fi | ||
fi | ||
yum -y upgrade nicira-ovs-hypervisor-node | ||
if [ $? -eq 0 ]; then | ||
echo "Yum commnand returned non-zero" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "This is the pre_empty script you could customise." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.