From 041f60a7b029f382e34c4aedd291a3ebb056db26 Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Sat, 29 Dec 2018 20:57:25 -0600 Subject: [PATCH] Improve service instance module debug logging Change-Id: Ib3a9bebe362609d7198e053afebc6004f3d94baf (cherry picked from commit 2117632c50a676a1782bdbd731b4d02f36a6f047) (cherry picked from commit bb6256b5e84f3900fbdacf8adaf2dd780d3a3a7e) --- manila/network/linux/interface.py | 4 ++-- manila/share/drivers/generic.py | 2 ++ manila/share/drivers/service_instance.py | 6 ++++++ manila/utils.py | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/manila/network/linux/interface.py b/manila/network/linux/interface.py index b5a7f8012c..03d580c126 100644 --- a/manila/network/linux/interface.py +++ b/manila/network/linux/interface.py @@ -143,7 +143,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver): if not ip_lib.device_exists(device_name, namespace=namespace): - + LOG.info("Device %s does not exist - creating ....", device_name) tap_name = self._get_tap_name(device_name) self._ovs_add_port(bridge, tap_name, port_id, mac_address) ns_dev.link.set_address(mac_address) @@ -154,7 +154,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver): namespace_obj.add_device_to_namespace(ns_dev) else: - LOG.warning("Device %s already exists.", device_name) + LOG.info("Device %s already exists.", device_name) if ns_dev.link.address != mac_address: LOG.warning("Reset mac address to %s", mac_address) ns_dev.link.set_address(mac_address) diff --git a/manila/share/drivers/generic.py b/manila/share/drivers/generic.py index f4c88c0ec5..c746ef42cc 100644 --- a/manila/share/drivers/generic.py +++ b/manila/share/drivers/generic.py @@ -141,6 +141,8 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver): driver_config=self.configuration)) def _ssh_exec(self, server, command, check_exit_code=True): + LOG.debug("_ssh_exec - server: %s, command: %s, check_exit_code: %s", + server, command, check_exit_code) connection = self.ssh_connections.get(server['instance_id']) ssh_conn_timeout = self.configuration.ssh_conn_timeout if not connection: diff --git a/manila/share/drivers/service_instance.py b/manila/share/drivers/service_instance.py index 9b3c5841d0..1190877b76 100644 --- a/manila/share/drivers/service_instance.py +++ b/manila/share/drivers/service_instance.py @@ -904,6 +904,8 @@ class NeutronNetworkHelper(BaseNetworkhelper): and setting up required network devices. """ if self.use_service_network: + LOG.debug("Plugging service instance into service network %s.", + self.service_network_id) port = self._get_service_port( self.service_network_id, None, 'manila-share') port = self._add_fixed_ips_to_service_port(port) @@ -912,6 +914,8 @@ class NeutronNetworkHelper(BaseNetworkhelper): self._plug_interface_in_host(interface_name, device, port) if self.use_admin_port: + LOG.debug("Plugging service instance into admin network %s.", + self.admin_network_id) port = self._get_service_port( self.admin_network_id, self.admin_subnet_id, 'manila-admin-share') @@ -926,6 +930,8 @@ class NeutronNetworkHelper(BaseNetworkhelper): external=True) def _plug_interface_in_host(self, interface_name, device, port): + LOG.debug("Plug interface into host - interface_name: %s, " + "device: %s, port: %s", interface_name, device, port) self.vif_driver.plug(interface_name, port['id'], port['mac_address']) ip_cidrs = [] for fixed_ip in port['fixed_ips']: diff --git a/manila/utils.py b/manila/utils.py index bb417ec6b5..63f73de822 100644 --- a/manila/utils.py +++ b/manila/utils.py @@ -31,6 +31,7 @@ import tempfile import time from eventlet import pools +import logging import netaddr from oslo_concurrency import lockutils from oslo_concurrency import processutils @@ -94,6 +95,8 @@ def execute(*cmd, **kwargs): """Convenience wrapper around oslo's execute() function.""" if 'run_as_root' in kwargs and 'root_helper' not in kwargs: kwargs['root_helper'] = _get_root_helper() + if hasattr('CONF', 'debug') and CONF.debug: + kwargs['loglevel'] = logging.DEBUG return processutils.execute(*cmd, **kwargs)