mirror of https://github.com/apache/cloudstack.git
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.
This commit is contained in:
parent
106ec718fc
commit
647532376f
|
|
@ -142,6 +142,20 @@ public class JavaStorageLayer implements StorageLayer {
|
|||
return paths;
|
||||
}
|
||||
|
||||
@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()) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue