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