summaryrefslogtreecommitdiff
path: root/azurelinuxagent/pa/rdma/centos.py
diff options
context:
space:
mode:
authorƁukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com>2017-01-16 10:10:41 +0100
committerusd-importer <ubuntu-server@lists.ubuntu.com>2017-01-17 17:53:13 +0000
commitdd73af563850762aad64e7ed2a9897377830af10 (patch)
tree33f34ccce29a5a11227741dbe6a8fce20deeeaba /azurelinuxagent/pa/rdma/centos.py
parenta05019d9343d0fde153d75a8e61fb6f99d1d3ff3 (diff)
parent558111e33720eb8f1eaacf571cf4fadae2430286 (diff)
downloadvyos-walinuxagent-dd73af563850762aad64e7ed2a9897377830af10.tar.gz
vyos-walinuxagent-dd73af563850762aad64e7ed2a9897377830af10.zip
Import patches-applied version 2.2.2-0ubuntu1 to applied/ubuntu/zesty-proposed
Imported using git-ubuntu import. Changelog parent: a05019d9343d0fde153d75a8e61fb6f99d1d3ff3 Unapplied parent: 558111e33720eb8f1eaacf571cf4fadae2430286 New changelog entries: * New upstream release (LP: #1651128) - d/patches/fix-auto-update.patch, d/patches/lp1623570-adjust-walinuxagent-service-after-and-wants.patch: - Dropped as changes have been applied upstream - Refreshed debian/patches/disable_import_test.patch
Diffstat (limited to 'azurelinuxagent/pa/rdma/centos.py')
-rw-r--r--azurelinuxagent/pa/rdma/centos.py45
1 files changed, 44 insertions, 1 deletions
diff --git a/azurelinuxagent/pa/rdma/centos.py b/azurelinuxagent/pa/rdma/centos.py
index c527e1b..8ad09c5 100644
--- a/azurelinuxagent/pa/rdma/centos.py
+++ b/azurelinuxagent/pa/rdma/centos.py
@@ -20,6 +20,7 @@
import glob
import os
import re
+import time
import azurelinuxagent.common.logger as logger
import azurelinuxagent.common.utils.shellutil as shellutil
from azurelinuxagent.common.rdma import RDMAHandler
@@ -47,6 +48,17 @@ class CentOSRDMAHandler(RDMAHandler):
Install the KVP daemon and the appropriate RDMA driver package for the
RDMA firmware.
"""
+
+ # Check and install the KVP deamon if it not running
+ time.sleep(10) # give some time for the hv_hvp_daemon to start up.
+ kvpd_running = RDMAHandler.is_kvp_daemon_running()
+ logger.info('RDMA: kvp daemon running: %s' % kvpd_running)
+ if not kvpd_running:
+ self.check_or_install_kvp_daemon()
+ time.sleep(10) # wait for post-install reboot or kvp to come up
+
+ # Find out RDMA firmware version and see if the existing package needs
+ # updating or if the package is missing altogether (and install it)
fw_version = RDMAHandler.get_rdma_version()
if not fw_version:
raise Exception('Cannot determine RDMA firmware version')
@@ -187,12 +199,20 @@ class CentOSRDMAHandler(RDMAHandler):
raise Exception(
"Failed to install RDMA {0} package".format(pkg_type))
+ @staticmethod
+ def is_package_installed(pkg):
+ """Runs rpm -q and checks return code to find out if a package
+ is installed"""
+ return shellutil.run("rpm -q %s" % pkg, chk_err=False) == 0
+
def uninstall_kvp_driver_package_if_exists(self):
+ logger.info('RDMA: deleting existing kvp driver packages')
+
kvp_pkgs = [self.hyper_v_package_name,
self.hyper_v_package_name_new]
for kvp_pkg in kvp_pkgs:
- if shellutil.run("rpm -q %s" % kvp_pkg, chk_err=False) != 0:
+ if not self.is_package_installed(kvp_pkg):
logger.info(
"RDMA: kvp package %s does not exist, skipping" % kvp_pkg)
else:
@@ -201,3 +221,26 @@ class CentOSRDMAHandler(RDMAHandler):
logger.info("RDMA: successfully erased package")
else:
logger.error("RDMA: failed to erase package")
+
+ def check_or_install_kvp_daemon(self):
+ """Checks if kvp daemon package is installed, if not installs the
+ package and reboots the machine.
+ """
+ logger.info("RDMA: Checking kvp daemon packages.")
+ kvp_pkgs = [self.hyper_v_package_name,
+ self.hyper_v_package_name_new]
+
+ for pkg in kvp_pkgs:
+ logger.info("RDMA: Checking if package %s installed" % pkg)
+ installed = self.is_package_installed(pkg)
+ if installed:
+ raise Exception('RDMA: package %s is installed, but the kvp daemon is not running' % pkg)
+
+ kvp_pkg_to_install=self.hyper_v_package_name
+ logger.info("RDMA: no kvp drivers installed, will install '%s'" % kvp_pkg_to_install)
+ logger.info("RDMA: trying to install kvp package '%s'" % kvp_pkg_to_install)
+ if self.install_package(kvp_pkg_to_install) != 0:
+ raise Exception("RDMA: failed to install kvp daemon package '%s'" % kvp_pkg_to_install)
+ logger.info("RDMA: package '%s' successfully installed" % kvp_pkg_to_install)
+ logger.info("RDMA: Machine will now be rebooted.")
+ self.reboot_system() \ No newline at end of file