mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix auto-merge caused issues
This commit is contained in:
parent
0587382265
commit
ac0faeb091
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.vm;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -98,24 +99,35 @@ public class VmWorkJobHandlerProxy implements VmWorkJobHandler {
|
||||
|
||||
Method method = getHandlerMethod(work.getClass());
|
||||
if (method != null) {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Execute VM work job: " + work.getClass().getName() + _gsonLogger.toJson(work));
|
||||
|
||||
Object obj = method.invoke(_target, work);
|
||||
try {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Execute VM work job: " + work.getClass().getName() + _gsonLogger.toJson(work));
|
||||
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Done executing VM work job: " + work.getClass().getName() + _gsonLogger.toJson(work));
|
||||
Object obj = method.invoke(_target, work);
|
||||
|
||||
assert (obj instanceof Pair);
|
||||
return (Pair<JobInfo.Status, String>)obj;
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Done executing VM work job: " + work.getClass().getName() + _gsonLogger.toJson(work));
|
||||
|
||||
assert (obj instanceof Pair);
|
||||
return (Pair<JobInfo.Status, String>)obj;
|
||||
} catch (InvocationTargetException e) {
|
||||
s_logger.error("Invocation exception, caused by: " + e.getCause());
|
||||
|
||||
// legacy CloudStack code relies on checked exception for error handling
|
||||
// we need to re-throw the real exception here
|
||||
if (e.getCause() != null && e.getCause() instanceof Exception) {
|
||||
s_logger.info("Rethrow exception " + e.getCause());
|
||||
throw (Exception)e.getCause();
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
s_logger.error("Unable to find handler for VM work job: " + work.getClass().getName() + _gsonLogger.toJson(work));
|
||||
|
||||
RuntimeException e = new RuntimeException("Unsupported VM work job: " + work.getClass().getName() + _gsonLogger.toJson(work));
|
||||
String exceptionJson = JobSerializerHelper.toSerializedString(e);
|
||||
|
||||
s_logger.error("Serialize exception object into json: " + exceptionJson);
|
||||
return new Pair<JobInfo.Status, String>(JobInfo.Status.FAILED, exceptionJson);
|
||||
RuntimeException ex = new RuntimeException("Unable to find handler for VM work job: " + work.getClass().getName());
|
||||
return new Pair<JobInfo.Status, String>(JobInfo.Status.FAILED, JobSerializerHelper.toObjectSerializedString(ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,6 +165,7 @@ import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.VmWork;
|
||||
import com.cloud.vm.VmWorkConstants;
|
||||
import com.cloud.vm.VmWorkJobHandler;
|
||||
import com.cloud.vm.VmWorkJobHandlerProxy;
|
||||
import com.cloud.vm.VmWorkSerializer;
|
||||
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user