[jump] Enable jumbo frames for vnet devices
[fuel.git] / mcp / scripts / lib.sh
index c9c1bbd..c566cc9 100644 (file)
@@ -407,6 +407,7 @@ function create_vms {
 
   # create vms with specified options
   for serialized_vnode_data in "${vnodes[@]}"; do
+    if [ -z "${serialized_vnode_data}" ]; then continue; fi
     IFS=',' read -r -a vnode_data <<< "${serialized_vnode_data}"
 
     # prepare network args
@@ -452,6 +453,23 @@ function update_mcpcontrol_network {
     "<host mac='${amac}' name='mas01' ip='${MAAS_IP}'/>" --live --config
 }
 
+function reset_vms {
+  local vnodes=("$@")
+  local cmd_str="ssh ${SSH_OPTS} ${SSH_SALT}"
+
+  # reset non-infrastructure vms, wait for them to come back online
+  for node in "${vnodes[@]}"; do
+    if [[ ! "${node}" =~ (cfg01|mas01) ]]; then
+      virsh reset "${node}"
+    fi
+  done
+  for node in "${vnodes[@]}"; do
+    if [[ ! "${node}" =~ (cfg01|mas01) ]]; then
+      wait_for 20.0 "${cmd_str} sudo salt -C '${node}*' saltutil.sync_all"
+    fi
+  done
+}
+
 function start_vms {
   local vnodes=("$@")
 
@@ -528,6 +546,13 @@ function wait_for {
   )
 }
 
+function do_udev_cfg {
+  local _conf='/etc/udev/rules.d/99-opnfv-fuel-vnet-mtu.rules'
+  # http://linuxaleph.blogspot.com/2013/01/how-to-network-jumbo-frames-to-kvm-guest.html
+  echo 'SUBSYSTEM=="net", ACTION=="add", KERNEL=="vnet*", RUN+="/sbin/ip link set mtu 9000 dev '"'"%k"'"'"' |& sudo tee "${_conf}"
+  sudo udevadm control --reload || true
+}
+
 function do_sysctl_cfg {
   local _conf='/etc/sysctl.d/99-opnfv-fuel-bridge.conf'
   # https://wiki.libvirt.org/page/Net.bridge.bridge-nf-call_and_sysctl.conf