From 8201c4e52706a2301008ded22a5122977de72015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Tue, 31 Mar 2020 13:08:28 +0100 Subject: [PATCH] Log already activated zFCP and DASD devices --- src/modules/DASDController.rb | 7 +++++-- src/modules/ZFCPController.rb | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/DASDController.rb b/src/modules/DASDController.rb index 40b6e3e2..99b2e583 100644 --- a/src/modules/DASDController.rb +++ b/src/modules/DASDController.rb @@ -801,8 +801,11 @@ def report_error(headline, message, details) # @return [Boolean] Returns an error code (8 means 'unformatted'). def activate_disk_if_needed(channel, diag) disk = find_disks.find { |d| d["channel"] == channel } - return ActivateDisk(channel, diag) unless disk && active_disk?(disk) - disk["formatted"] ? 0 : 8 + if disk && active_disk?(disk) + log.info "Disk #{channel} is already active. Skipping the activation." + return disk["formatted"] ? 0 : 8 + end + ActivateDisk(channel, diag) unless disk && active_disk?(disk) end # Determines whether the disk is activated or not diff --git a/src/modules/ZFCPController.rb b/src/modules/ZFCPController.rb index 3d207f5d..428c6540 100644 --- a/src/modules/ZFCPController.rb +++ b/src/modules/ZFCPController.rb @@ -581,7 +581,7 @@ def activate_controller(channel) def ActivateDisk(channel, wwpn, lun) disk = find_disk(channel, wwpn, lun) if disk - log.info "Disk #{channel}:#{wwpn}:#{lun} is already active. Skipping activation." + log.info "Disk #{channel}:#{wwpn}:#{lun} is already active. Skipping the activation." else activate_controller(channel) end @@ -716,6 +716,7 @@ def activated_controllers io = ctrl.fetch("resource", {}).fetch("io", []).first io && io["active"] end + log.info "Already activated controllers: #{ctrls}" @activated_controllers = ctrls.map { |c| c["sysfs_bus_id"] } end