mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
set kvm HA heartbeat log level to warn
This commit is contained in:
parent
b1376e1f04
commit
a7daf4b9b4
@ -19,18 +19,15 @@
|
||||
package com.cloud.agent.resource.computing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libvirt.Connect;
|
||||
|
||||
import com.cloud.utils.script.Script;
|
||||
|
||||
public class KVMHAMonitor extends KVMHABase implements Runnable{
|
||||
private static final Logger s_logger = Logger.getLogger(KVMHAMonitor.class);
|
||||
private Map<String, NfsStoragePool> _storagePool = new HashMap<String, NfsStoragePool>();
|
||||
private Map<String, NfsStoragePool> _storagePool = new ConcurrentHashMap<String, NfsStoragePool>();
|
||||
|
||||
private String _hostIP; /*private ip address*/
|
||||
|
||||
@ -49,9 +46,9 @@ public class KVMHAMonitor extends KVMHABase implements Runnable{
|
||||
}
|
||||
}
|
||||
|
||||
public void removeStoragePool(NfsStoragePool pool) {
|
||||
public void removeStoragePool(String uuid) {
|
||||
synchronized (_storagePool) {
|
||||
this._storagePool.remove(pool._poolUUID);
|
||||
this._storagePool.remove(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,14 +73,14 @@ public class KVMHAMonitor extends KVMHABase implements Runnable{
|
||||
cmd.add("-h", _hostIP);
|
||||
result = cmd.execute();
|
||||
if (result != null) {
|
||||
s_logger.debug("write heartbeat failed: " + result + ", retry: " + i);
|
||||
s_logger.warn("write heartbeat failed: " + result + ", retry: " + i);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
s_logger.debug("write heartbeat failed: " + result + "; reboot the host");
|
||||
s_logger.warn("write heartbeat failed: " + result + "; reboot the host");
|
||||
Script cmd = new Script(_heartBeatPath, _heartBeatUpdateTimeout, s_logger);
|
||||
cmd.add("-i", primaryStoragePool._poolIp);
|
||||
cmd.add("-p", primaryStoragePool._poolMountSourcePath);
|
||||
|
||||
@ -441,7 +441,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
throw new ConfigurationException("Unable to find class " + "com.cloud.storage.JavaStorageLayer");
|
||||
}
|
||||
|
||||
_storagePoolMgr = new KVMStoragePoolManager(_storage);
|
||||
|
||||
|
||||
_virtRouterResource = new VirtualRoutingResource();
|
||||
|
||||
@ -659,6 +659,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
_monitor = new KVMHAMonitor(null, info[0], _heartBeatPath);
|
||||
Thread ha = new Thread(_monitor);
|
||||
ha.start();
|
||||
|
||||
_storagePoolMgr = new KVMStoragePoolManager(_storage, _monitor);
|
||||
|
||||
_sysvmISOPath = (String)params.get("systemvm.iso.path");
|
||||
if (_sysvmISOPath == null) {
|
||||
|
||||
@ -2,12 +2,16 @@ package com.cloud.agent.storage;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.cloud.agent.resource.computing.KVMHABase;
|
||||
import com.cloud.agent.resource.computing.KVMHABase.PoolType;
|
||||
import com.cloud.agent.resource.computing.KVMHAMonitor;
|
||||
import com.cloud.agent.storage.KVMPhysicalDisk.PhysicalDiskFormat;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.StorageLayer;
|
||||
|
||||
public class KVMStoragePoolManager {
|
||||
private StorageAdaptor _storageAdaptor;
|
||||
private KVMHAMonitor _haMonitor;
|
||||
private final Map<String, Object> _storagePools = new ConcurrentHashMap<String, Object>();
|
||||
|
||||
private void addStoragePool(String uuid) {
|
||||
@ -17,8 +21,9 @@ public class KVMStoragePoolManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
public KVMStoragePoolManager(StorageLayer storagelayer) {
|
||||
public KVMStoragePoolManager(StorageLayer storagelayer, KVMHAMonitor monitor) {
|
||||
this._storageAdaptor = new LibvirtStorageAdaptor(storagelayer);
|
||||
this._haMonitor = monitor;
|
||||
}
|
||||
|
||||
public KVMStoragePool getStoragePool(String uuid) {
|
||||
@ -31,21 +36,20 @@ public class KVMStoragePoolManager {
|
||||
|
||||
public KVMStoragePool createStoragePool(String name, String host, String path, StoragePoolType type) {
|
||||
KVMStoragePool pool = this._storageAdaptor.createStoragePool(name, host, path, type);
|
||||
if (type == StoragePoolType.NetworkFilesystem || type == StoragePoolType.SharedMountPoint) {
|
||||
/*
|
||||
KVMHABase.NfsStoragePool pool = new KVMHABase.NfsStoragePool(spt.getUuid(),
|
||||
spt.getHost(),
|
||||
spt.getPath(),
|
||||
_mountPoint + File.separator + spt.getUuid(),
|
||||
if (type == StoragePoolType.NetworkFilesystem) {
|
||||
KVMHABase.NfsStoragePool nfspool = new KVMHABase.NfsStoragePool(pool.getUuid(),
|
||||
host,
|
||||
path,
|
||||
pool.getLocalPath(),
|
||||
PoolType.PrimaryStorage);
|
||||
_monitor.addStoragePool(pool);
|
||||
*/
|
||||
_haMonitor.addStoragePool(nfspool);
|
||||
}
|
||||
addStoragePool(pool.getUuid());
|
||||
return pool;
|
||||
}
|
||||
|
||||
public boolean deleteStoragePool(String uuid) {
|
||||
_haMonitor.removeStoragePool(uuid);
|
||||
this._storageAdaptor.deleteStoragePool(uuid);
|
||||
_storagePools.remove(uuid);
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user