Install conntrack in XenServer Dom0

Neutron openvswitch agent running in compute node will control the
actual connection of the VMs in Dom0 via conntrack-tools, but Dom0
doesn't install conntrack-tools RPM by default.
This patch is to add such support with XenServer 7.0 and above.

Change-Id: Iec56db761015d4b7baa5a5f54314f4ff3fa67e02
This commit is contained in:
Huan Xie 2016-08-08 07:23:36 +00:00
parent f73997815e
commit 26edd7b071
2 changed files with 23 additions and 0 deletions

View File

@ -87,6 +87,7 @@ CRONTAB
cat $TOP_DIR/tools/xen/functions
echo "create_directory_for_images"
echo "create_directory_for_kernels"
echo "install_conntrack_tools"
} | $ssh_dom0
}

View File

@ -305,3 +305,25 @@ function get_domid {
xe vm-list name-label="$vm_name_label" params=dom-id minimal=true
}
function install_conntrack_tools {
local xs_host
local xs_ver_major
local centos_ver
local conntrack_conf
xs_host=$(xe host-list --minimal)
xs_ver_major=$(xe host-param-get uuid=$xs_host param-name=software-version param-key=product_version_text_short | cut -d'.' -f 1)
if [ $xs_ver_major -gt 6 ]; then
# Only support conntrack-tools in Dom0 with XS7.0 and above
if [ ! -f /usr/sbin/conntrackd ]; then
sed -i s/#baseurl=/baseurl=/g /etc/yum.repos.d/CentOS-Base.repo
centos_ver=$(yum version nogroups |grep Installed | cut -d' ' -f 2 | cut -d'.' -f1-2 | tr '-' '.')
yum install -y --enablerepo=base --releasever=$centos_ver conntrack-tools
# Backup conntrackd.conf after install conntrack-tools, use the one with statistic mode
mv /etc/conntrackd/conntrackd.conf /etc/conntrackd/conntrackd.conf.back
conntrack_conf=$(find /usr/share/doc -name conntrackd.conf |grep stats)
cp $conntrack_conf /etc/conntrackd/conntrackd.conf
fi
service conntrackd restart
fi
}