Create a gist now

Instantly share code, notes, and snippets.

@andyhky /ovs_kmod.sh Secret
Created Jul 21, 2014

What would you like to do?
#!/usr/bin/env bash
RUNNING_XEN_KERNEL=`uname -r | sed s/xen//`
PENDING_XEN_KERNEL=`readlink /boot/vmlinuz-2.6-xen | sed s/xen// | sed s/vmlinuz-//`
OVS_BUILD=`/etc/init.d/openvswitch version | grep ovs-vswitchd | awk '{print $NF}'`
rpm -q openvswitch-modules-xen-$RUNNING_XEN_KERNEL-$OVS_BUILD > /dev/null
if [[ $? == 0 ]]
then
echo "Current kernel and OVS modules match"
else
CURRENT_MISMATCH=1
echo "Current kernel and OVS modules do not match"
fi
rpm -q openvswitch-modules-xen-$PENDING_XEN_KERNEL-$OVS_BUILD > /dev/null
if [[ $? == 0 ]]
then
echo "Pending kernel and OVS modules match"
else
PENDING_MISMATCH=1
echo "Pending kernel and OVS will not match after reboot. This can cause system instability."
fi
if [[ $CURRENT_MISMATCH == 1 || $PENDING_MISMATCH == 1 ]]
then
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment