From eee7c2c97ec836498d96d31c03692cbe3d1070db Mon Sep 17 00:00:00 2001 From: abhishek Date: Thu, 23 Sep 2010 15:35:36 -0700 Subject: [PATCH] bug 6212: returning a whole bunch of new params in the api response status 6212: resolved fixed --- .../async/executor/DeployVMExecutor.java | 14 +++++++++++- .../async/executor/DeployVMResultObject.java | 22 +++++++++++++++++++ .../async/executor/VMExecutorHelper.java | 11 ++++++++++ .../executor/VMOperationResultObject.java | 22 +++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/async/executor/DeployVMExecutor.java b/server/src/com/cloud/async/executor/DeployVMExecutor.java index 8cf6f7f8ec7..6520fb11d2b 100644 --- a/server/src/com/cloud/async/executor/DeployVMExecutor.java +++ b/server/src/com/cloud/async/executor/DeployVMExecutor.java @@ -37,10 +37,13 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.serializer.GsonHelper; import com.cloud.server.ManagementServer; import com.cloud.service.ServiceOfferingVO; +import com.cloud.storage.StoragePoolVO; import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VolumeVO; import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.uservm.UserVm; +import com.cloud.utils.Pair; import com.cloud.utils.exception.ExecutionException; import com.cloud.vm.InstanceGroupVO; import com.google.gson.Gson; @@ -233,7 +236,16 @@ public class DeployVMExecutor extends VMOperationExecutor { resultObject.setCpuNumber(String.valueOf(offering.getCpu())); resultObject.setCpuSpeed(String.valueOf(offering.getSpeed())); - resultObject.setMemory(String.valueOf(offering.getRamSize())); + resultObject.setMemory(String.valueOf(offering.getRamSize())); + + //root device related + VolumeVO rootVolume = managementServer.findRootVolume(vm.getId()); + if(rootVolume!=null) + { + resultObject.setRootDeviceId(rootVolume.getDeviceId()); + StoragePoolVO storagePool = managementServer.findPoolById(rootVolume.getPoolId()); + resultObject.setRootDeviceType(storagePool.getPoolType().toString()); + } resultObject.setNetworkGroupList(managementServer.getNetworkGroupsNamesForVm(vm.getId())); return resultObject; diff --git a/server/src/com/cloud/async/executor/DeployVMResultObject.java b/server/src/com/cloud/async/executor/DeployVMResultObject.java index 63e202eb182..e58e9c60ae2 100644 --- a/server/src/com/cloud/async/executor/DeployVMResultObject.java +++ b/server/src/com/cloud/async/executor/DeployVMResultObject.java @@ -125,6 +125,28 @@ public class DeployVMResultObject { @Param(name="networkgrouplist") private String networkGroupList; + @Param(name="rootdeviceid") + private Long rootDeviceId; + + @Param(name="rootdevicetype") + private String rootDeviceType; + + public Long getRootDeviceId(){ + return this.rootDeviceId; + } + + public void setRootDeviceId(Long rootDeviceId){ + this.rootDeviceId = rootDeviceId; + } + + public String getRootDeviceType(){ + return this.rootDeviceType; + } + + public void setRootDeviceType(String deviceType){ + this.rootDeviceType = deviceType; + } + public String getNetworkGroupList(){ return this.networkGroupList; } diff --git a/server/src/com/cloud/async/executor/VMExecutorHelper.java b/server/src/com/cloud/async/executor/VMExecutorHelper.java index 3e92248ebaf..4312782e68f 100644 --- a/server/src/com/cloud/async/executor/VMExecutorHelper.java +++ b/server/src/com/cloud/async/executor/VMExecutorHelper.java @@ -21,7 +21,9 @@ package com.cloud.async.executor; import com.cloud.api.BaseCmd; import com.cloud.server.ManagementServer; import com.cloud.service.ServiceOfferingVO; +import com.cloud.storage.StoragePoolVO; import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VolumeVO; import com.cloud.user.Account; import com.cloud.vm.UserVmVO; import com.cloud.vm.InstanceGroupVO; @@ -116,6 +118,15 @@ public class VMExecutorHelper { resultObject.setHostid(vm.getHostId()); resultObject.setHostname(managementServer.getHostBy(vm.getHostId()).getName()); + + //root device related + VolumeVO rootVolume = managementServer.findRootVolume(vm.getId()); + if(rootVolume!=null) + { + resultObject.setRootDeviceId(rootVolume.getDeviceId()); + StoragePoolVO storagePool = managementServer.findPoolById(rootVolume.getPoolId()); + resultObject.setRootDeviceType(storagePool.getPoolType().toString()); + } return resultObject; } diff --git a/server/src/com/cloud/async/executor/VMOperationResultObject.java b/server/src/com/cloud/async/executor/VMOperationResultObject.java index 4bc96135c53..a8a95260e7f 100644 --- a/server/src/com/cloud/async/executor/VMOperationResultObject.java +++ b/server/src/com/cloud/async/executor/VMOperationResultObject.java @@ -120,6 +120,28 @@ public class VMOperationResultObject { @Param(name="networkgrouplist") private String networkGroupList; + @Param(name="rootdeviceid") + private Long rootDeviceId; + + @Param(name="rootdevicetype") + private String rootDeviceType; + + public Long getRootDeviceId(){ + return this.rootDeviceId; + } + + public void setRootDeviceId(Long rootDeviceId){ + this.rootDeviceId = rootDeviceId; + } + + public String getRootDeviceType(){ + return this.rootDeviceType; + } + + public void setRootDeviceType(String deviceType){ + this.rootDeviceType = deviceType; + } + public String getNetworkGroupList(){ return this.networkGroupList; }