modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java
| 52 ++++------
modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
| 7 -
2 files changed, 27 insertions(+), 32 deletions(-)
New commits:
commit c9ea7f80a610d0ce22376f76723f8445c6d9cfd7
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Jan 30 14:37:33 2014 +0100
Bug 1026513 - File systems that are offline or not available are still being reported
as UP
Return AvailabilityType.UP only if the directory name of the FileSystem is the same as
the resource key.
diff --git
a/modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java
b/modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java
index 6d5ada6..372b434 100644
--- a/modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java
+++ b/modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java
@@ -1,25 +1,21 @@
/*
-* RHQ Management Platform
-* Copyright (C) 2005-2012 Red Hat, Inc.
-* All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License, version 2, as
-* published by the Free Software Foundation, and/or the GNU Lesser
-* General Public License, version 2.1, also as published by the Free
-* Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License and the GNU Lesser General Public License
-* for more details.
-*
-* You should have received a copy of the GNU General Public License
-* and the GNU Lesser General Public License along with this program;
-* if not, write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
+ * RHQ Management Platform
+ * Copyright (C) 2005-2014 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
package org.rhq.core.system;
import org.apache.commons.logging.Log;
@@ -36,7 +32,7 @@ import org.hyperic.sigar.SigarProxy;
* @author John Mazzitelli
*/
public class FileSystemInfo {
- private final Log log = LogFactory.getLog(this.getClass());
+ private static final Log LOG = LogFactory.getLog(FileSystemInfo.class);
private final String mountPoint;
private FileSystem fs;
@@ -66,14 +62,14 @@ public class FileSystemInfo {
// this happens when the file system is not available (e.g. if it's a
CD-ROM without a CD loaded in it) or
// if we don't have permission to access the filesystem. we can ignore it
and set the usage data to null.
this.fsUsage = null;
- if (log.isTraceEnabled()) {
- log.trace("Cannot refresh the usage data for file system mounted at
[" + this.mountPoint + "].", e);
- } else {
- log.debug("Cannot refresh the usage data for file system mounted at
[" + this.mountPoint + "]: " + e);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Cannot refresh the usage data for file system mounted at
[" + this.mountPoint + "].", e);
+ } else if (LOG.isDebugEnabled()) {
+ LOG.debug("Cannot refresh the usage data for file system mounted at
[" + this.mountPoint + "]: " + e);
}
} catch (RuntimeException e) {
this.fsUsage = null;
- log.error("An error occurred while refreshing the usage data for file
system mounted at [" + this.mountPoint
+ LOG.error("An error occurred while refreshing the usage data for file
system mounted at [" + this.mountPoint
+ "].", e);
}
}
@@ -110,4 +106,4 @@ public class FileSystemInfo {
", fsUsage=" + fsUsage +
']';
}
-}
\ No newline at end of file
+}
diff --git
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
index 5eae991..02d0b68 100644
---
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
+++
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/FileSystemComponent.java
@@ -59,8 +59,8 @@ public class FileSystemComponent implements
ResourceComponent<PlatformComponent>
public AvailabilityType getAvailability() {
FileSystemInfo fileSystemInfo = getFileSystemInfo();
- // fileSystemInfo can be != null even if the fs is unmounted.
- if (fileSystemInfo != null && fileSystemInfo.getFileSystem() != null) {
+ if (fileSystemInfo != null && fileSystemInfo.getFileSystem() != null
+ &&
this.resourceContext.getResourceKey().equals(fileSystemInfo.getFileSystem().getDirName()))
{
return AvailabilityType.UP;
} else {
return AvailabilityType.DOWN;
@@ -94,5 +94,4 @@ public class FileSystemComponent implements
ResourceComponent<PlatformComponent>
SystemInfo systemInfo = resourceContext.getSystemInformation();
return systemInfo.getFileSystem(resourceContext.getResourceKey());
}
-
-}
\ No newline at end of file
+}
Show replies by date