You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/01/02 15:36:15 UTC

[23/50] [abbrv] git commit: updated refs/heads/reporter to b26f3fc

CLOUDSTACK-8111. NFS secondary storage repetitively mounted on CS server with ESXi hypervisors.
Fix cleanup of NFS mounts on management server during server starup by correcting how mount points are listed for a management server.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/64753237
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/64753237
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/64753237

Branch: refs/heads/reporter
Commit: 647532376fc090f75e6fa0ad66ee36241084dec9
Parents: 106ec71
Author: Likitha Shetty <li...@citrix.com>
Authored: Thu Mar 20 11:29:57 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Tue Dec 23 13:23:43 2014 +0530

----------------------------------------------------------------------
 core/src/com/cloud/storage/JavaStorageLayer.java      | 14 ++++++++++++++
 core/src/com/cloud/storage/StorageLayer.java          |  3 +++
 .../hypervisor/vmware/manager/VmwareManagerImpl.java  |  4 ++--
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64753237/core/src/com/cloud/storage/JavaStorageLayer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/JavaStorageLayer.java b/core/src/com/cloud/storage/JavaStorageLayer.java
index 6b61ad0..2e5544c 100644
--- a/core/src/com/cloud/storage/JavaStorageLayer.java
+++ b/core/src/com/cloud/storage/JavaStorageLayer.java
@@ -143,6 +143,20 @@ public class JavaStorageLayer implements StorageLayer {
     }
 
     @Override
+    public List<String> listMountPointsByMsHost(String path, long msHostId) {
+        List<String> mountPaths = new ArrayList<String>();
+        File[] files = new File(path).listFiles();
+        if (files == null) {
+            return mountPaths;
+        }
+        for (File file : files) {
+            if (file.getName().startsWith(String.valueOf(msHostId) + "."))
+                mountPaths.add(file.getAbsolutePath());
+        }
+        return mountPaths;
+    }
+
+    @Override
     public boolean mkdir(String path) {
         synchronized (path.intern()) {
             File file = new File(path);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64753237/core/src/com/cloud/storage/StorageLayer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/StorageLayer.java b/core/src/com/cloud/storage/StorageLayer.java
index 8daa392..8421aeb 100644
--- a/core/src/com/cloud/storage/StorageLayer.java
+++ b/core/src/com/cloud/storage/StorageLayer.java
@@ -21,6 +21,7 @@ package com.cloud.storage;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.List;
 
 import com.cloud.utils.component.Manager;
 
@@ -149,4 +150,6 @@ public interface StorageLayer extends Manager {
     boolean setWorldReadableAndWriteable(File file);
 
     boolean deleteDir(String dir);
+
+    List<String> listMountPointsByMsHost(String path, long msHostId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64753237/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 3b2c73f..3416319 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -696,8 +696,8 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
         long mshostId = ManagementServerNode.getManagementServerId();
 
         // cleanup left-over NFS mounts from previous session
-        String[] mounts = _storage.listFiles(parent + File.separator + String.valueOf(mshostId) + ".*");
-        if (mounts != null && mounts.length > 0) {
+        List<String> mounts = _storage.listMountPointsByMsHost(parent, mshostId);
+        if (mounts != null && !mounts.isEmpty()) {
             for (String mountPoint : mounts) {
                 s_logger.info("umount NFS mount from previous session: " + mountPoint);