Просмотр исходного кода

Improves logging in OS discovery

Alessandro Pilotti 10 лет назад
Родитель
Сommit
1c5a528b55

+ 5 - 0
coriolis/osmorphing/factory.py

@@ -1,5 +1,7 @@
 import itertools
 
+from oslo_log import log as logging
+
 from coriolis import constants
 from coriolis import exception
 from coriolis.osmorphing import debian
@@ -7,6 +9,8 @@ from coriolis.osmorphing import redhat
 from coriolis.osmorphing import ubuntu
 from coriolis.osmorphing import windows
 
+LOG = logging.getLogger(__name__)
+
 
 def get_os_morphing_tools(conn, os_type, os_root_dir, target_hypervisor,
                           target_platform, event_manager):
@@ -24,6 +28,7 @@ def get_os_morphing_tools(conn, os_type, os_root_dir, target_hypervisor,
             os_type, itertools.chain(*os_morphing_tools_clss.values())):
         tools = cls(conn, os_root_dir, target_hypervisor, target_platform,
                     event_manager)
+        LOG.debug("Testing OS morphing tools: %s", cls.__name__)
         os_info = tools.check_os()
         if os_info:
             return (tools, os_info)

+ 5 - 0
coriolis/osmorphing/osmount/factory.py

@@ -1,10 +1,14 @@
 import itertools
 
+from oslo_log import log as logging
+
 from coriolis import constants
 from coriolis import exception
 from coriolis.osmorphing.osmount import ubuntu
 from coriolis.osmorphing.osmount import windows
 
+LOG = logging.getLogger(__name__)
+
 
 def get_os_mount_tools(os_type, connection_info, event_manager):
     os_mount_tools = {constants.OS_TYPE_LINUX: [ubuntu.UbuntuOSMountTools],
@@ -16,6 +20,7 @@ def get_os_mount_tools(os_type, connection_info, event_manager):
     for cls in os_mount_tools.get(os_type,
                                   itertools.chain(*os_mount_tools.values())):
         tools = cls(connection_info, event_manager)
+        LOG.debug("Testing OS mount tools: %s", cls.__name__)
         if tools.check_os():
             return tools
     raise exception.CoriolisException("OS mount tools not found")

+ 2 - 2
coriolis/osmorphing/windows.py

@@ -31,8 +31,8 @@ class WindowsMorphingTools(base.BaseOSMorphingTools):
              self._installation_type,
              self._product_name) = self._get_image_version_info()
             return ('Windows', self._product_name)
-        except exception.CoriolisException:
-            pass
+        except exception.CoriolisException as ex:
+            LOG.debug("Exception during OS detection: %s", ex)
 
     def pre_packages_install(self):
         if (not self._hypervisor or