mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
Comment out code in executors during the transition to the new API framework. The code is being left around for reference during testing/debugging of the new framework and will be removed in the future.
This commit is contained in:
parent
19413d0bec
commit
d7b6ccd056
@ -21,7 +21,8 @@ package com.cloud.vm;
|
||||
* ConsoleProxy is a system VM instance that is used
|
||||
* to proxy VNC traffic
|
||||
*/
|
||||
public interface ConsoleProxy extends SystemVm {
|
||||
public interface ConsoleProxy extends SystemVm {
|
||||
public int getActiveSession();
|
||||
public byte[] getSessionDetails();
|
||||
}
|
||||
|
||||
|
||||
@ -249,9 +249,8 @@ public class SecondaryStorageVmVO extends VMInstanceVO implements SecondaryStora
|
||||
public int getRamSize() {
|
||||
return this.ramSize;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public Date getLastUpdateTime() {
|
||||
return this.lastUpdateTime;
|
||||
}
|
||||
@ -271,7 +270,4 @@ public class SecondaryStorageVmVO extends VMInstanceVO implements SecondaryStora
|
||||
public String getNfsShare() {
|
||||
return nfsShare;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -31,6 +31,5 @@ public interface SystemVm extends VirtualMachine {
|
||||
public String getVlanId();
|
||||
public String getPrivateNetmask();
|
||||
public int getRamSize();
|
||||
public int getActiveSession();
|
||||
public Date getLastUpdateTime();
|
||||
}
|
||||
|
||||
@ -34,7 +34,8 @@ public class AssignToLoadBalancerExecutor extends BaseAsyncJobExecutor {
|
||||
public static final Logger s_logger = Logger.getLogger(AssignToLoadBalancerExecutor.class.getName());
|
||||
|
||||
@Override
|
||||
public boolean execute() {
|
||||
public boolean execute() {
|
||||
/*
|
||||
if (getSyncSource() == null) {
|
||||
Gson gson = GsonHelper.getBuilder().create();
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
@ -58,6 +59,8 @@ public class AssignToLoadBalancerExecutor extends BaseAsyncJobExecutor {
|
||||
LoadBalancerParam param = gson.fromJson(job.getCmdInfo(), LoadBalancerParam.class);
|
||||
// return asyncMgr.getExecutorContext().getNetworkMgr().executeAssignToLoadBalancer(this, param);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ public class AttachISOExecutor extends VMOperationExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
Gson gson = GsonHelper.getBuilder().create();
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
AttachISOParam param = gson.fromJson(job.getCmdInfo(), AttachISOParam.class);
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "AttachISO", param.getVmId());
|
||||
@ -75,6 +76,8 @@ public class AttachISOExecutor extends VMOperationExecutor {
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
public void processAnswer(VMOperationListener listener, long agentId, long seq, Answer answer) {
|
||||
|
||||
@ -50,7 +50,8 @@ public class CompleteMaintenanceExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
Long param = gson.fromJson(job.getCmdInfo(), Long.class);
|
||||
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
boolean result = managementServer.maintenanceCompleted(param.longValue());
|
||||
@ -71,7 +72,8 @@ public class CompleteMaintenanceExecutor extends BaseAsyncJobExecutor {
|
||||
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR,
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -93,16 +95,16 @@ public class CompleteMaintenanceExecutor extends BaseAsyncJobExecutor {
|
||||
hostRO.setType(hostVO.getType().toString());
|
||||
}
|
||||
|
||||
GuestOSCategoryVO guestOSCategory = managementServer.getHostGuestOSCategory(hostVO.getId());
|
||||
if (guestOSCategory != null) {
|
||||
hostRO.setOsCategoryId(guestOSCategory.getId());
|
||||
hostRO.setOsCategoryName(guestOSCategory.getName());
|
||||
}
|
||||
// GuestOSCategoryVO guestOSCategory = managementServer.getHostGuestOSCategory(hostVO.getId());
|
||||
// if (guestOSCategory != null) {
|
||||
// hostRO.setOsCategoryId(guestOSCategory.getId());
|
||||
// hostRO.setOsCategoryName(guestOSCategory.getName());
|
||||
// }
|
||||
|
||||
|
||||
hostRO.setIpAddress(hostVO.getPrivateIpAddress());
|
||||
hostRO.setZoneId(hostVO.getDataCenterId());
|
||||
hostRO.setZoneName(managementServer.getDataCenterBy(hostVO.getDataCenterId()).getName());
|
||||
// hostRO.setZoneName(managementServer.getDataCenterBy(hostVO.getDataCenterId()).getName());
|
||||
|
||||
if (hostVO.getPodId() != null && managementServer.findHostPodById(hostVO.getPodId()) != null) {
|
||||
hostRO.setPodId(hostVO.getPodId());
|
||||
@ -124,31 +126,31 @@ public class CompleteMaintenanceExecutor extends BaseAsyncJobExecutor {
|
||||
int cpu = 0;
|
||||
String cpuAlloc = null;
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||
List<UserVmVO> instances = managementServer.listUserVMsByHostId(hostVO.getId());
|
||||
for (UserVmVO vm : instances) {
|
||||
ServiceOffering so = managementServer.findServiceOfferingById(vm.getServiceOfferingId());
|
||||
cpu += so.getCpu() * so.getSpeed();
|
||||
}
|
||||
// List<UserVmVO> instances = managementServer.listUserVMsByHostId(hostVO.getId());
|
||||
// for (UserVmVO vm : instances) {
|
||||
// ServiceOffering so = managementServer.findServiceOfferingById(vm.getServiceOfferingId());
|
||||
// cpu += so.getCpu() * so.getSpeed();
|
||||
// }
|
||||
cpuAlloc = decimalFormat.format(((float) cpu / (float) (hostVO.getCpus() * hostVO.getSpeed())) * 100f) + "%";
|
||||
hostRO.setCpuAllocated(cpuAlloc);
|
||||
|
||||
// calculate cpu utilized
|
||||
String cpuUsed = null;
|
||||
HostStats hostStats = managementServer.getHostStatistics(hostVO.getId());
|
||||
if (hostStats != null) {
|
||||
float cpuUtil = (float) hostStats.getCpuUtilization();
|
||||
cpuUsed = decimalFormat.format(cpuUtil) + "%";
|
||||
hostRO.setCpuUsed(cpuUsed);
|
||||
|
||||
long avgLoad = (long)hostStats.getAverageLoad();
|
||||
hostRO.setAverageLoad(avgLoad);
|
||||
|
||||
long networkKbsRead = (long)hostStats.getNetworkReadKBs();
|
||||
hostRO.setNetworkKbsRead(networkKbsRead);
|
||||
|
||||
long networkKbsWrite = (long)hostStats.getNetworkWriteKBs();
|
||||
hostRO.setNetworkKbsWrite(networkKbsWrite);
|
||||
}
|
||||
// HostStats hostStats = managementServer.getHostStatistics(hostVO.getId());
|
||||
// if (hostStats != null) {
|
||||
// float cpuUtil = (float) hostStats.getCpuUtilization();
|
||||
// cpuUsed = decimalFormat.format(cpuUtil) + "%";
|
||||
// hostRO.setCpuUsed(cpuUsed);
|
||||
//
|
||||
// long avgLoad = (long)hostStats.getAverageLoad();
|
||||
// hostRO.setAverageLoad(avgLoad);
|
||||
//
|
||||
// long networkKbsRead = (long)hostStats.getNetworkReadKBs();
|
||||
// hostRO.setNetworkKbsRead(networkKbsRead);
|
||||
//
|
||||
// long networkKbsWrite = (long)hostStats.getNetworkWriteKBs();
|
||||
// hostRO.setNetworkKbsWrite(networkKbsWrite);
|
||||
// }
|
||||
}
|
||||
|
||||
if ( hostVO.getType() == Host.Type.Routing ) {
|
||||
|
||||
@ -52,7 +52,7 @@ public class CreateVolumeFromSnapshotExecutor extends BaseAsyncJobExecutor {
|
||||
//SnapshotManager snapshotManager = context.getSnapshotMgr();
|
||||
StorageManager storageManager = context.getStorageMgr();
|
||||
AccountManager accountManager = context.getAccountMgr();
|
||||
|
||||
/*
|
||||
if (getSyncSource() == null) {
|
||||
SnapshotOperationParam param = gson.fromJson(job.getCmdInfo(), SnapshotOperationParam.class);
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Volume", param.getVolumeId());
|
||||
@ -104,6 +104,8 @@ public class CreateVolumeFromSnapshotExecutor extends BaseAsyncJobExecutor {
|
||||
asyncMgr.completeAsyncJob(jobId, result, errorCode, resultObject);
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
private VolumeOperationResultObject composeResultObject(VolumeVO volume)
|
||||
@ -121,9 +123,9 @@ public class CreateVolumeFromSnapshotExecutor extends BaseAsyncJobExecutor {
|
||||
Account account = managementServer.findAccountById(accountId);
|
||||
resultObject.setAccountName(account.getAccountName());
|
||||
resultObject.setDomainId(volume.getDomainId());
|
||||
resultObject.setDomain(managementServer.findDomainIdById(volume.getDomainId()).getName());
|
||||
// resultObject.setDomain(managementServer.findDomainIdById(volume.getDomainId()).getName());
|
||||
resultObject.setZoneId(volume.getDataCenterId());
|
||||
resultObject.setZoneName(getAsyncJobMgr().getExecutorContext().getManagementServer().getDataCenterBy(volume.getDataCenterId()).getName());
|
||||
// resultObject.setZoneName(getAsyncJobMgr().getExecutorContext().getManagementServer().getDataCenterBy(volume.getDataCenterId()).getName());
|
||||
resultObject.setStorageType("shared"); // NOTE: You can never create a local disk volume but if that changes, we need to change this
|
||||
if (volume.getPoolId() != null)
|
||||
resultObject.setStorage(managementServer.findPoolById(volume.getPoolId()).getName());
|
||||
|
||||
@ -37,7 +37,8 @@ public class DeleteDomainExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
DeleteDomainParam param = gson.fromJson(job.getCmdInfo(), DeleteDomainParam.class);
|
||||
|
||||
|
||||
/*
|
||||
try {
|
||||
String result = managementServer.deleteDomain(param.getDomainId(), param.getOwnerId(), param.getCleanup());
|
||||
if (result == null) {
|
||||
@ -48,7 +49,8 @@ public class DeleteDomainExecutor extends BaseAsyncJobExecutor {
|
||||
} catch(Exception e) {
|
||||
s_logger.warn("Unable to delete domain : " + e.getMessage(), e);
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,8 @@ public class DeleteLoadBalancerExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
AsyncJobVO job = getJob();
|
||||
LoadBalancerParam param = gson.fromJson(job.getCmdInfo(), LoadBalancerParam.class);
|
||||
|
||||
|
||||
/*
|
||||
if (getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", param.getDomainRouterId());
|
||||
|
||||
@ -59,6 +60,8 @@ public class DeleteLoadBalancerExecutor extends BaseAsyncJobExecutor {
|
||||
e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,13 +35,15 @@ public class DeleteNetworkRuleConfigExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
Long param = gson.fromJson(job.getCmdInfo(), Long.class);
|
||||
|
||||
|
||||
/*
|
||||
boolean success = managementServer.deleteNetworkRuleConfig(job.getUserId(), param.longValue());
|
||||
if (success) {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_SUCCEEDED, 0, "success");
|
||||
} else {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, 0, "failed");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class DeleteRuleExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
DeleteRuleParam param = gson.fromJson(job.getCmdInfo(), DeleteRuleParam.class);
|
||||
|
||||
/*
|
||||
try {
|
||||
managementServer.deleteRule(param.getRuleId(), param.getUserId(), param.getAccountId());
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_SUCCEEDED, 0,
|
||||
@ -65,7 +65,8 @@ public class DeleteRuleExecutor extends BaseAsyncJobExecutor {
|
||||
s_logger.warn("Unable to delete rule: " + e.getMessage(), e);
|
||||
asyncMgr.completeAsyncJob(getJob().getId(),
|
||||
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ public class DeleteSecurityGroupExecutor extends BaseAsyncJobExecutor {
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
SecurityGroupParam param = gson.fromJson(job.getCmdInfo(), SecurityGroupParam.class);
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
SecurityGroupVO securityGroup = managementServer.findSecurityGroupById(param.getSecurityGroupId());
|
||||
if(securityGroup == null) {
|
||||
@ -46,6 +47,7 @@ public class DeleteSecurityGroupExecutor extends BaseAsyncJobExecutor {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.PARAM_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ public class DeleteSnapshotExecutor extends BaseAsyncJobExecutor {
|
||||
SnapshotManager snapshotManager = asyncMgr.getExecutorContext().getSnapshotMgr();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
SnapshotOperationParam param = gson.fromJson(job.getCmdInfo(), SnapshotOperationParam.class);
|
||||
Snapshot snapshot = managementServer.findSnapshotById(param.getSnapshotId());
|
||||
@ -75,6 +76,8 @@ public class DeleteSnapshotExecutor extends BaseAsyncJobExecutor {
|
||||
asyncMgr.completeAsyncJob(jobId, result, errorCode, resultObject);
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ public class DeleteUserExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
Long param = gson.fromJson(job.getCmdInfo(), Long.class);
|
||||
|
||||
/*
|
||||
try {
|
||||
if(managementServer.deleteUser(param.longValue())) {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_SUCCEEDED, 0,
|
||||
@ -51,7 +51,8 @@ public class DeleteUserExecutor extends BaseAsyncJobExecutor {
|
||||
s_logger.warn("Unable to delete User " + param.longValue() + ": " + e.getMessage(), e);
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR,
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,8 @@ public class DeployVMExecutor extends VMOperationExecutor {
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
AsyncJobVO job = getJob();
|
||||
|
||||
DeployVMParam param = gson.fromJson(job.getCmdInfo(), DeployVMParam.class);
|
||||
DeployVMParam param = gson.fromJson(job.getCmdInfo(), DeployVMParam.class);
|
||||
/*
|
||||
try {
|
||||
UserVm vm = asyncMgr.getExecutorContext().getManagementServer().deployVirtualMachine(
|
||||
param.getUserId(), param.getAccountId(), param.getDataCenterId(),
|
||||
@ -112,7 +113,8 @@ public class DeployVMExecutor extends VMOperationExecutor {
|
||||
saveEvent(param, EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_CREATE, "Unable to deploy VM: INTERNAL_ERROR");
|
||||
asyncMgr.completeAsyncJob(getJob().getId(),
|
||||
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -167,7 +169,7 @@ public class DeployVMExecutor extends VMOperationExecutor {
|
||||
if (acct != null) {
|
||||
resultObject.setAccount(acct.getAccountName());
|
||||
resultObject.setDomainId(acct.getDomainId());
|
||||
resultObject.setDomain(managementServer.findDomainIdById(acct.getDomainId()).getName());
|
||||
// resultObject.setDomain(managementServer.findDomainIdById(acct.getDomainId()).getName());
|
||||
}
|
||||
|
||||
User userExecutingCmd = managementServer.getUser(userId);
|
||||
@ -229,7 +231,7 @@ public class DeployVMExecutor extends VMOperationExecutor {
|
||||
resultObject.setCpuSpeed(String.valueOf(offering.getSpeed()));
|
||||
resultObject.setMemory(String.valueOf(offering.getRamSize()));
|
||||
|
||||
resultObject.setNetworkGroupList(managementServer.getNetworkGroupsNamesForVm(vm.getId()));
|
||||
// resultObject.setNetworkGroupList(managementServer.getNetworkGroupsNamesForVm(vm.getId()));
|
||||
return resultObject;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ public class DestroyConsoleProxyExecutor extends VMOperationExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "ConsoleProxy", param.getVmId());
|
||||
return true;
|
||||
@ -57,7 +57,9 @@ public class DestroyConsoleProxyExecutor extends VMOperationExecutor {
|
||||
e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
public void processAnswer(VMOperationListener listener, long agentId, long seq, Answer answer) {
|
||||
|
||||
@ -52,7 +52,7 @@ public class DestroyVMExecutor extends VMOperationExecutor {
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
OperationResponse response;
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "UserVM", param.getVmId());
|
||||
return true;
|
||||
@ -73,6 +73,7 @@ public class DestroyVMExecutor extends VMOperationExecutor {
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -103,8 +104,8 @@ public class DestroyVMExecutor extends VMOperationExecutor {
|
||||
s_logger.debug("Unable to destroy the vm because it is not in the correct state: " + vm.toString());
|
||||
|
||||
txn.rollback();
|
||||
managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_DESTROY,
|
||||
"Failed to stop VM instance : " + vm.getName(), params, param.getEventId());
|
||||
// managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_DESTROY,
|
||||
// "Failed to stop VM instance : " + vm.getName(), params, param.getEventId());
|
||||
asyncMgr.completeAsyncJob(getJob().getId(),
|
||||
AsyncJobResult.STATUS_FAILED, 0, "Unable to destroy the vm because it is not in the correct state");
|
||||
return;
|
||||
@ -123,8 +124,8 @@ public class DestroyVMExecutor extends VMOperationExecutor {
|
||||
for (VolumeVO volume : volumes) {
|
||||
asyncMgr.getExecutorContext().getVolumeDao().detachVolume(volume.getId());
|
||||
}
|
||||
managementServer.saveEvent(param.getUserId(), vm.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_DESTROY,
|
||||
"Successfully destroyed VM instance : " + vm.getName(), params, param.getEventId());
|
||||
// managementServer.saveEvent(param.getUserId(), vm.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_DESTROY,
|
||||
// "Successfully destroyed VM instance : " + vm.getName(), params, param.getEventId());
|
||||
txn.commit();
|
||||
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_SUCCEEDED, 0, "success");
|
||||
@ -132,10 +133,10 @@ public class DestroyVMExecutor extends VMOperationExecutor {
|
||||
asyncMgr.getExecutorContext().getVmDao().updateIf(vm, Event.OperationFailed, vm.getHostId());
|
||||
asyncMgr.completeAsyncJob(getJob().getId(),
|
||||
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Agent failed to stop VM: " + vm.getName());
|
||||
managementServer.saveEvent(param.getUserId(), vm.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
|
||||
"failed to stop VM instance : " + vm.getName(), params, param.getChildEventId());
|
||||
managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_DESTROY,
|
||||
"failed to stop VM instance : " + vm.getName(), params, param.getEventId());
|
||||
// managementServer.saveEvent(param.getUserId(), vm.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
|
||||
// "failed to stop VM instance : " + vm.getName(), params, param.getChildEventId());
|
||||
// managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_DESTROY,
|
||||
// "failed to stop VM instance : " + vm.getName(), params, param.getEventId());
|
||||
|
||||
}
|
||||
} catch(Exception e) {
|
||||
|
||||
@ -124,7 +124,7 @@ public class DisableAccountExecutor extends BaseAsyncJobExecutor {
|
||||
if(s_logger.isInfoEnabled())
|
||||
s_logger.info("Serialize DisableAccount operation on account " + accountId
|
||||
+ " with previous activities on router " + router.getId());
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", router.getId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "Router", router.getId());
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
|
||||
@ -149,7 +149,7 @@ public class DisableUserExecutor extends BaseAsyncJobExecutor {
|
||||
for(DomainRouterVO router : routers) {
|
||||
if(s_logger.isInfoEnabled())
|
||||
s_logger.info("Serialize DisableUser operation with previous activities on router " + router.getId());
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", router.getId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "Router", router.getId());
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
|
||||
@ -43,7 +43,7 @@ public class DisassociateIpAddressExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
DisassociateIpAddressParam param = gson.fromJson(job.getCmdInfo(), DisassociateIpAddressParam.class);
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
DomainRouterVO router = getRouterSyncSource(param);
|
||||
if(router == null) {
|
||||
@ -81,7 +81,8 @@ public class DisassociateIpAddressExecutor extends BaseAsyncJobExecutor {
|
||||
s_logger.warn("disassociateIpAddress execution failed : Exception, complete async-execution", e);
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.PARAM_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ public class PrepareMaintenanceExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobVO job = getJob();
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
Long param = gson.fromJson(job.getCmdInfo(), Long.class);
|
||||
|
||||
/*
|
||||
try {
|
||||
boolean result = managementServer.prepareForMaintenance(param.longValue());
|
||||
if(result)
|
||||
@ -72,7 +72,8 @@ public class PrepareMaintenanceExecutor extends BaseAsyncJobExecutor {
|
||||
s_logger.warn("Unable to prepare maintenance: " + e.getMessage(), e);
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR,
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -94,16 +95,16 @@ public class PrepareMaintenanceExecutor extends BaseAsyncJobExecutor {
|
||||
hostRO.setType(hostVO.getType().toString());
|
||||
}
|
||||
|
||||
GuestOSCategoryVO guestOSCategory = managementServer.getHostGuestOSCategory(hostVO.getId());
|
||||
if (guestOSCategory != null) {
|
||||
hostRO.setOsCategoryId(guestOSCategory.getId());
|
||||
hostRO.setOsCategoryName(guestOSCategory.getName());
|
||||
}
|
||||
// GuestOSCategoryVO guestOSCategory = managementServer.getHostGuestOSCategory(hostVO.getId());
|
||||
// if (guestOSCategory != null) {
|
||||
// hostRO.setOsCategoryId(guestOSCategory.getId());
|
||||
// hostRO.setOsCategoryName(guestOSCategory.getName());
|
||||
// }
|
||||
|
||||
|
||||
hostRO.setIpAddress(hostVO.getPrivateIpAddress());
|
||||
hostRO.setZoneId(hostVO.getDataCenterId());
|
||||
hostRO.setZoneName(managementServer.getDataCenterBy(hostVO.getDataCenterId()).getName());
|
||||
// hostRO.setZoneName(managementServer.getDataCenterBy(hostVO.getDataCenterId()).getName());
|
||||
|
||||
if (hostVO.getPodId() != null && managementServer.findHostPodById(hostVO.getPodId()) != null) {
|
||||
hostRO.setPodId(hostVO.getPodId());
|
||||
@ -125,31 +126,31 @@ public class PrepareMaintenanceExecutor extends BaseAsyncJobExecutor {
|
||||
int cpu = 0;
|
||||
String cpuAlloc = null;
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||
List<UserVmVO> instances = managementServer.listUserVMsByHostId(hostVO.getId());
|
||||
for (UserVmVO vm : instances) {
|
||||
ServiceOffering so = managementServer.findServiceOfferingById(vm.getServiceOfferingId());
|
||||
cpu += so.getCpu() * so.getSpeed();
|
||||
}
|
||||
// List<UserVmVO> instances = managementServer.listUserVMsByHostId(hostVO.getId());
|
||||
// for (UserVmVO vm : instances) {
|
||||
// ServiceOffering so = managementServer.findServiceOfferingById(vm.getServiceOfferingId());
|
||||
// cpu += so.getCpu() * so.getSpeed();
|
||||
// }
|
||||
cpuAlloc = decimalFormat.format(((float) cpu / (float) (hostVO.getCpus() * hostVO.getSpeed())) * 100f) + "%";
|
||||
hostRO.setCpuAllocated(cpuAlloc);
|
||||
|
||||
// calculate cpu utilized
|
||||
String cpuUsed = null;
|
||||
HostStats hostStats = managementServer.getHostStatistics(hostVO.getId());
|
||||
if (hostStats != null) {
|
||||
float cpuUtil = (float) hostStats.getCpuUtilization();
|
||||
cpuUsed = decimalFormat.format(cpuUtil) + "%";
|
||||
hostRO.setCpuUsed(cpuUsed);
|
||||
|
||||
long avgLoad = (long)hostStats.getAverageLoad();
|
||||
hostRO.setAverageLoad(avgLoad);
|
||||
|
||||
long networkKbsRead = (long)hostStats.getNetworkReadKBs();
|
||||
hostRO.setNetworkKbsRead(networkKbsRead);
|
||||
|
||||
long networkKbsWrite = (long)hostStats.getNetworkWriteKBs();
|
||||
hostRO.setNetworkKbsWrite(networkKbsWrite);
|
||||
}
|
||||
// HostStats hostStats = managementServer.getHostStatistics(hostVO.getId());
|
||||
// if (hostStats != null) {
|
||||
// float cpuUtil = (float) hostStats.getCpuUtilization();
|
||||
// cpuUsed = decimalFormat.format(cpuUtil) + "%";
|
||||
// hostRO.setCpuUsed(cpuUsed);
|
||||
//
|
||||
// long avgLoad = (long)hostStats.getAverageLoad();
|
||||
// hostRO.setAverageLoad(avgLoad);
|
||||
//
|
||||
// long networkKbsRead = (long)hostStats.getNetworkReadKBs();
|
||||
// hostRO.setNetworkKbsRead(networkKbsRead);
|
||||
//
|
||||
// long networkKbsWrite = (long)hostStats.getNetworkWriteKBs();
|
||||
// hostRO.setNetworkKbsWrite(networkKbsWrite);
|
||||
// }
|
||||
}
|
||||
|
||||
if ( hostVO.getType() == Host.Type.Routing ) {
|
||||
|
||||
@ -42,7 +42,7 @@ public class PreparePrimaryStorageMaintenanceExecutor extends BaseAsyncJobExecut
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
Long param = gson.fromJson(job.getCmdInfo(), Long.class);
|
||||
Long userId = job.getUserId();
|
||||
|
||||
/*
|
||||
try {
|
||||
boolean result = managementServer.preparePrimaryStorageForMaintenance(param.longValue(), userId.longValue());
|
||||
if(result)
|
||||
@ -64,6 +64,7 @@ public class PreparePrimaryStorageMaintenanceExecutor extends BaseAsyncJobExecut
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR,
|
||||
e.getMessage());
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -79,7 +80,7 @@ public class PreparePrimaryStorageMaintenanceExecutor extends BaseAsyncJobExecut
|
||||
primaryStorageRO.setState(storagePoolVO.getStatus().toString());
|
||||
primaryStorageRO.setIpAddress(storagePoolVO.getHostAddress());
|
||||
primaryStorageRO.setZoneId(storagePoolVO.getDataCenterId());
|
||||
primaryStorageRO.setZoneName(managementServer.getDataCenterBy(storagePoolVO.getDataCenterId()).getName());
|
||||
// primaryStorageRO.setZoneName(managementServer.getDataCenterBy(storagePoolVO.getDataCenterId()).getName());
|
||||
|
||||
if (storagePoolVO.getPodId() != null && managementServer.findHostPodById(storagePoolVO.getPodId()) != null) {
|
||||
primaryStorageRO.setPodId(storagePoolVO.getPodId());
|
||||
@ -91,25 +92,25 @@ public class PreparePrimaryStorageMaintenanceExecutor extends BaseAsyncJobExecut
|
||||
}
|
||||
primaryStorageRO.setDiskSizeTotal(storagePoolVO.getCapacityBytes());
|
||||
|
||||
StorageStats stats = managementServer.getStoragePoolStatistics(storagePoolVO.getId());
|
||||
// StorageStats stats = managementServer.getStoragePoolStatistics(storagePoolVO.getId());
|
||||
long capacity = storagePoolVO.getCapacityBytes();
|
||||
long available = storagePoolVO.getAvailableBytes() ;
|
||||
long used = capacity - available;
|
||||
|
||||
if (stats != null) {
|
||||
used = stats.getByteUsed();
|
||||
available = capacity - used;
|
||||
}
|
||||
// if (stats != null) {
|
||||
// used = stats.getByteUsed();
|
||||
// available = capacity - used;
|
||||
// }
|
||||
|
||||
primaryStorageRO.setDiskSizeAllocated(used);
|
||||
if (storagePoolVO.getClusterId() != null)
|
||||
{
|
||||
ClusterVO cluster = managementServer.findClusterById(storagePoolVO.getClusterId());
|
||||
// ClusterVO cluster = managementServer.findClusterById(storagePoolVO.getClusterId());
|
||||
primaryStorageRO.setClusterId(storagePoolVO.getClusterId());
|
||||
primaryStorageRO.setClusterName(cluster.getName());
|
||||
// primaryStorageRO.setClusterName(cluster.getName());
|
||||
}
|
||||
|
||||
primaryStorageRO.setTags(managementServer.getStoragePoolTags(storagePoolVO.getId()));
|
||||
// primaryStorageRO.setTags(managementServer.getStoragePoolTags(storagePoolVO.getId()));
|
||||
return primaryStorageRO;
|
||||
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class RebootConsoleProxyExecutor extends VMOperationExecutor {
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "ConsoleProxy", param.getVmId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "ConsoleProxy", param.getVmId());
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
|
||||
@ -42,7 +42,7 @@ public class RebootRouterExecutor extends VMOperationExecutor {
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", param.getVmId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "Router", param.getVmId());
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
|
||||
@ -26,6 +26,7 @@ import com.cloud.async.AsyncJobManager;
|
||||
import com.cloud.async.AsyncJobResult;
|
||||
import com.cloud.async.AsyncJobVO;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.EventUtils;
|
||||
import com.cloud.event.EventVO;
|
||||
import com.cloud.serializer.GsonHelper;
|
||||
import com.cloud.server.ManagementServer;
|
||||
@ -43,7 +44,8 @@ public class RebootVMExecutor extends VMOperationExecutor {
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
UserVmVO vm = managementServer.findUserVMInstanceById(param.getVmId());
|
||||
OperationResponse response;
|
||||
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "UserVM", param.getVmId());
|
||||
|
||||
@ -66,7 +68,9 @@ public class RebootVMExecutor extends VMOperationExecutor {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
public void processAnswer(VMOperationListener listener, long agentId, long seq, Answer answer) {
|
||||
@ -85,14 +89,14 @@ public class RebootVMExecutor extends VMOperationExecutor {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(),
|
||||
AsyncJobResult.STATUS_SUCCEEDED, 0, VMExecutorHelper.composeResultObject(asyncMgr.getExecutorContext().getManagementServer(), vm, null));
|
||||
jobStatusUpdated = true;
|
||||
managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_REBOOT,
|
||||
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_REBOOT,
|
||||
"Successfully rebooted VM instance : " + vm.getName(), params, param.getEventId());
|
||||
} else {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(),
|
||||
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Agent is unable to execute the command");
|
||||
|
||||
jobStatusUpdated = true;
|
||||
managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_REBOOT,
|
||||
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_REBOOT,
|
||||
"Failed to reboot VM instance : " + vm.getName(), params, param.getEventId());
|
||||
|
||||
}
|
||||
|
||||
@ -51,7 +51,8 @@ public class ReconnectExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
Gson gson = GsonHelper.getBuilder().create();
|
||||
AsyncJobVO job = getJob();
|
||||
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
Long param = gson.fromJson(job.getCmdInfo(), Long.class);
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "host", param.longValue());
|
||||
@ -82,7 +83,8 @@ public class ReconnectExecutor extends BaseAsyncJobExecutor {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR,
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -103,16 +105,16 @@ public class ReconnectExecutor extends BaseAsyncJobExecutor {
|
||||
hostRO.setType(hostVO.getType().toString());
|
||||
}
|
||||
|
||||
GuestOSCategoryVO guestOSCategory = managementServer.getHostGuestOSCategory(hostVO.getId());
|
||||
if (guestOSCategory != null) {
|
||||
hostRO.setOsCategoryId(guestOSCategory.getId());
|
||||
hostRO.setOsCategoryName(guestOSCategory.getName());
|
||||
}
|
||||
// GuestOSCategoryVO guestOSCategory = managementServer.getHostGuestOSCategory(hostVO.getId());
|
||||
// if (guestOSCategory != null) {
|
||||
// hostRO.setOsCategoryId(guestOSCategory.getId());
|
||||
// hostRO.setOsCategoryName(guestOSCategory.getName());
|
||||
// }
|
||||
|
||||
|
||||
hostRO.setIpAddress(hostVO.getPrivateIpAddress());
|
||||
hostRO.setZoneId(hostVO.getDataCenterId());
|
||||
hostRO.setZoneName(managementServer.getDataCenterBy(hostVO.getDataCenterId()).getName());
|
||||
// hostRO.setZoneName(managementServer.getDataCenterBy(hostVO.getDataCenterId()).getName());
|
||||
|
||||
if (hostVO.getPodId() != null && managementServer.findHostPodById(hostVO.getPodId()) != null) {
|
||||
hostRO.setPodId(hostVO.getPodId());
|
||||
@ -134,31 +136,31 @@ public class ReconnectExecutor extends BaseAsyncJobExecutor {
|
||||
int cpu = 0;
|
||||
String cpuAlloc = null;
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||
List<UserVmVO> instances = managementServer.listUserVMsByHostId(hostVO.getId());
|
||||
for (UserVmVO vm : instances) {
|
||||
ServiceOffering so = managementServer.findServiceOfferingById(vm.getServiceOfferingId());
|
||||
cpu += so.getCpu() * so.getSpeed();
|
||||
}
|
||||
// List<UserVmVO> instances = managementServer.listUserVMsByHostId(hostVO.getId());
|
||||
// for (UserVmVO vm : instances) {
|
||||
// ServiceOffering so = managementServer.findServiceOfferingById(vm.getServiceOfferingId());
|
||||
// cpu += so.getCpu() * so.getSpeed();
|
||||
// }
|
||||
cpuAlloc = decimalFormat.format(((float) cpu / (float) (hostVO.getCpus() * hostVO.getSpeed())) * 100f) + "%";
|
||||
hostRO.setCpuAllocated(cpuAlloc);
|
||||
|
||||
// calculate cpu utilized
|
||||
String cpuUsed = null;
|
||||
HostStats hostStats = managementServer.getHostStatistics(hostVO.getId());
|
||||
if (hostStats != null) {
|
||||
float cpuUtil = (float) hostStats.getCpuUtilization();
|
||||
cpuUsed = decimalFormat.format(cpuUtil) + "%";
|
||||
hostRO.setCpuUsed(cpuUsed);
|
||||
|
||||
long avgLoad = (long)hostStats.getAverageLoad();
|
||||
hostRO.setAverageLoad(avgLoad);
|
||||
|
||||
long networkKbsRead = (long)hostStats.getNetworkReadKBs();
|
||||
hostRO.setNetworkKbsRead(networkKbsRead);
|
||||
|
||||
long networkKbsWrite = (long)hostStats.getNetworkWriteKBs();
|
||||
hostRO.setNetworkKbsWrite(networkKbsWrite);
|
||||
}
|
||||
// HostStats hostStats = managementServer.getHostStatistics(hostVO.getId());
|
||||
// if (hostStats != null) {
|
||||
// float cpuUtil = (float) hostStats.getCpuUtilization();
|
||||
// cpuUsed = decimalFormat.format(cpuUtil) + "%";
|
||||
// hostRO.setCpuUsed(cpuUsed);
|
||||
//
|
||||
// long avgLoad = (long)hostStats.getAverageLoad();
|
||||
// hostRO.setAverageLoad(avgLoad);
|
||||
//
|
||||
// long networkKbsRead = (long)hostStats.getNetworkReadKBs();
|
||||
// hostRO.setNetworkKbsRead(networkKbsRead);
|
||||
//
|
||||
// long networkKbsWrite = (long)hostStats.getNetworkWriteKBs();
|
||||
// hostRO.setNetworkKbsWrite(networkKbsWrite);
|
||||
// }
|
||||
}
|
||||
|
||||
if ( hostVO.getType() == Host.Type.Routing ) {
|
||||
|
||||
@ -39,7 +39,8 @@ public class RemoveFromLoadBalancerExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
AsyncJobVO job = getJob();
|
||||
LoadBalancerParam param = gson.fromJson(job.getCmdInfo(), LoadBalancerParam.class);
|
||||
|
||||
|
||||
/*
|
||||
if (getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", param.getDomainRouterId());
|
||||
|
||||
@ -64,6 +65,8 @@ public class RemoveFromLoadBalancerExecutor extends BaseAsyncJobExecutor {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class RemoveSecurityGroupExecutor extends BaseAsyncJobExecutor {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED,
|
||||
BaseCmd.NET_INVALID_PARAM_ERROR, "Unable to find router for user vm " + param.getInstanceId() + " when removing security group");
|
||||
} else {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", router.getId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "Router", router.getId());
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@ -37,7 +37,8 @@ public class ResetVMPasswordExecutor extends BaseAsyncJobExecutor {
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
Gson gson = GsonHelper.getBuilder().create();
|
||||
AsyncJobVO job = getJob();
|
||||
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "UserVM", param.getVmId());
|
||||
@ -64,7 +65,8 @@ public class ResetVMPasswordExecutor extends BaseAsyncJobExecutor {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(), AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR,
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ public class RevokeNetworkGroupIngressExecutor extends BaseAsyncJobExecutor {
|
||||
NetworkGroupIngressParam param = gson.fromJson(job.getCmdInfo(), NetworkGroupIngressParam.class);
|
||||
AccountVO account = param.getAccount();
|
||||
|
||||
/*
|
||||
if (getSyncSource() == null) {
|
||||
NetworkGroupVO networkGroup = managementServer.findNetworkGroupByName(param.getAccount().getId(), param.getGroupName());
|
||||
if(networkGroup == null) {
|
||||
@ -49,6 +50,7 @@ public class RevokeNetworkGroupIngressExecutor extends BaseAsyncJobExecutor {
|
||||
"Failed to revoke network group ingress from group: " + param.getGroupName() + " for account: " + account.getAccountName() + " (id: " + account.getId() + ")");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public class RouterExecutorHelper {
|
||||
if (acct != null) {
|
||||
resultObject.setAccount(acct.getAccountName());
|
||||
resultObject.setDomainId(acct.getDomainId());
|
||||
resultObject.setDomain(managementServer.findDomainIdById(acct.getDomainId()).getName());
|
||||
// resultObject.setDomain(managementServer.findDomainIdById(acct.getDomainId()).getName());
|
||||
}
|
||||
|
||||
if (router.getState() != null)
|
||||
|
||||
@ -41,7 +41,7 @@ public class StartConsoleProxyExecutor extends VMOperationExecutor {
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "ConsoleProxy", param.getVmId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "ConsoleProxy", param.getVmId());
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
|
||||
@ -46,7 +46,7 @@ public class StartRouterExecutor extends VMOperationExecutor {
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", param.getVmId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "Router", param.getVmId());
|
||||
return true;
|
||||
} else {
|
||||
boolean success = false;
|
||||
|
||||
@ -36,7 +36,7 @@ public class StartVMExecutor extends VMOperationExecutor {
|
||||
|
||||
if(getSyncSource() == null) {
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "UserVM", param.getVmId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "UserVM", param.getVmId());
|
||||
|
||||
// always true if it does not have sync-source
|
||||
return true;
|
||||
|
||||
@ -41,7 +41,7 @@ public class StopConsoleProxyExecutor extends VMOperationExecutor {
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "ConsoleProxy", param.getVmId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "ConsoleProxy", param.getVmId());
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
|
||||
@ -41,7 +41,7 @@ public class StopRouterExecutor extends VMOperationExecutor {
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", param.getVmId());
|
||||
asyncMgr.syncAsyncJobExecution(job, "Router", param.getVmId());
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
|
||||
@ -26,6 +26,7 @@ import com.cloud.async.AsyncJobManager;
|
||||
import com.cloud.async.AsyncJobResult;
|
||||
import com.cloud.async.AsyncJobVO;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.EventUtils;
|
||||
import com.cloud.event.EventVO;
|
||||
import com.cloud.serializer.GsonHelper;
|
||||
import com.cloud.server.ManagementServer;
|
||||
@ -41,7 +42,8 @@ public class StopVMExecutor extends VMOperationExecutor {
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
AsyncJobVO job = getJob();
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
|
||||
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "UserVM", param.getVmId());
|
||||
|
||||
@ -56,13 +58,14 @@ public class StopVMExecutor extends VMOperationExecutor {
|
||||
String params = "id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
|
||||
|
||||
if (OperationResponse.STATUS_SUCCEEDED == response.getResultCode() ){
|
||||
managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_STOP, "Successfully stopped VM instance : " + param.getVmId(), params, param.getEventId());
|
||||
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_STOP, "Successfully stopped VM instance : " + param.getVmId(), params, param.getEventId());
|
||||
return true;
|
||||
}else if (OperationResponse.STATUS_FAILED == response.getResultCode()){
|
||||
managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP, "Failed to stop VM instance : " + response.getResultDescription(), params, param.getEventId());
|
||||
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP, "Failed to stop VM instance : " + response.getResultDescription(), params, param.getEventId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -94,7 +97,7 @@ public class StopVMExecutor extends VMOperationExecutor {
|
||||
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Agent failed to stop VM");
|
||||
jobStatusUpdated = true;
|
||||
|
||||
managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
|
||||
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
|
||||
"Failed to stop VM instance : " + vm.getName(), params, param.getEventId());
|
||||
}
|
||||
} catch(Exception e) {
|
||||
@ -106,7 +109,7 @@ public class StopVMExecutor extends VMOperationExecutor {
|
||||
} else {
|
||||
asyncMgr.completeAsyncJob(getJob().getId(),
|
||||
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Agent failed to stop VM");
|
||||
managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
|
||||
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
|
||||
"Failed to stop VM instance : " + vm.getName(), params, param.getEventId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,8 @@ public class SystemVmCmdExecutor extends VMOperationExecutor {
|
||||
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
|
||||
VMOperationParam param = gson.fromJson(job.getCmdInfo(), VMOperationParam.class);
|
||||
VmOp oper = param.getOperation();
|
||||
VMInstanceVO vm;
|
||||
VMInstanceVO vm;
|
||||
/*
|
||||
if(getSyncSource() == null) {
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "SystemVm", param.getVmId());
|
||||
return true;
|
||||
@ -99,7 +100,9 @@ public class SystemVmCmdExecutor extends VMOperationExecutor {
|
||||
e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
private Object composeResultObject(ManagementServer managementServer, VMInstanceVO vm) {
|
||||
|
||||
@ -19,6 +19,7 @@ public class UpdateLoadBalancerRuleExecutor extends BaseAsyncJobExecutor {
|
||||
|
||||
@Override
|
||||
public boolean execute() {
|
||||
/*
|
||||
if (getSyncSource() == null) {
|
||||
Gson gson = GsonHelper.getBuilder().create();
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
@ -51,6 +52,8 @@ public class UpdateLoadBalancerRuleExecutor extends BaseAsyncJobExecutor {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
private UpdateLoadBalancerRuleResultObject composeResultObject(ManagementServer ms, LoadBalancerVO loadBalancer) {
|
||||
@ -68,7 +71,7 @@ public class UpdateLoadBalancerRuleExecutor extends BaseAsyncJobExecutor {
|
||||
if (accountTemp != null) {
|
||||
resultObject.setAccountName(accountTemp.getAccountName());
|
||||
resultObject.setDomainId(accountTemp.getDomainId());
|
||||
resultObject.setDomainName(ms.findDomainIdById(accountTemp.getDomainId()).getName());
|
||||
// resultObject.setDomainName(ms.findDomainIdById(accountTemp.getDomainId()).getName());
|
||||
}
|
||||
|
||||
return resultObject;
|
||||
|
||||
@ -23,6 +23,7 @@ public class UpdatePortForwardingRuleExecutor extends BaseAsyncJobExecutor {
|
||||
|
||||
@Override
|
||||
public boolean execute() {
|
||||
/*
|
||||
if (getSyncSource() == null) {
|
||||
Gson gson = GsonHelper.getBuilder().create();
|
||||
AsyncJobManager asyncMgr = getAsyncJobMgr();
|
||||
@ -32,7 +33,7 @@ public class UpdatePortForwardingRuleExecutor extends BaseAsyncJobExecutor {
|
||||
ManagementServer ms = asyncMgr.getExecutorContext().getManagementServer();
|
||||
IPAddressVO ipAddr = ms.findIPAddressById(param.getAddress());
|
||||
DomainRouterVO router = ms.findDomainRouterBy(ipAddr.getAccountId(), ipAddr.getDataCenterId());
|
||||
asyncMgr.syncAsyncJobExecution(job.getId(), "Router", router.getId()); // synchronize on the router
|
||||
asyncMgr.syncAsyncJobExecution(job, "Router", router.getId()); // synchronize on the router
|
||||
|
||||
// always true if it does not have sync-source
|
||||
return true;
|
||||
@ -58,6 +59,8 @@ public class UpdatePortForwardingRuleExecutor extends BaseAsyncJobExecutor {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
private UpdatePortForwardingRuleResultObject composeResultObject(ManagementServer ms, FirewallRuleVO firewallRule) {
|
||||
|
||||
@ -58,7 +58,7 @@ public class VMExecutorHelper {
|
||||
if (acct != null) {
|
||||
resultObject.setAccount(acct.getAccountName());
|
||||
resultObject.setDomainId(acct.getDomainId());
|
||||
resultObject.setDomain(managementServer.findDomainIdById(acct.getDomainId()).getName());
|
||||
// resultObject.setDomain(managementServer.findDomainIdById(acct.getDomainId()).getName());
|
||||
}
|
||||
|
||||
if ( BaseCmd.isAdmin(acct.getType()) && (vm.getHostId() != null)) {
|
||||
@ -109,7 +109,7 @@ public class VMExecutorHelper {
|
||||
resultObject.setMemory(String.valueOf(offering.getRamSize()));
|
||||
|
||||
//Network groups
|
||||
resultObject.setNetworkGroupList(managementServer.getNetworkGroupsNamesForVm(vm.getId()));
|
||||
// resultObject.setNetworkGroupList(managementServer.getNetworkGroupsNamesForVm(vm.getId()));
|
||||
|
||||
return resultObject;
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@ import com.cloud.agent.api.GetVncPortCommand;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StopCommand;
|
||||
import com.cloud.agent.manager.AgentManager;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.commands.DestroyConsoleProxyCmd;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
@ -281,6 +283,11 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu
|
||||
public ConsoleProxyVO startProxy(long proxyVmId, long startEventId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroyConsoleProxy(DestroyConsoleProxyCmd cmd) throws ServerApiException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroyProxy(long proxyVmId, long startEventId) {
|
||||
|
||||
@ -51,7 +51,8 @@ public class TestAsyncJobManager extends ComponentTestCase {
|
||||
public void asyncCall() {
|
||||
ManagementServer mgr = (ManagementServer)ComponentLocator.getComponent("management-server");
|
||||
|
||||
long jobId = mgr.rebootVirtualMachineAsync(1, 1);
|
||||
// long jobId = mgr.rebootVirtualMachineAsync(1, 1);
|
||||
long jobId = 0L;
|
||||
s_logger.info("Async-call job id: " + jobId);
|
||||
|
||||
while(true) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user