mirror of https://github.com/apache/cloudstack.git
bug 6745: Using UUID instead of integers - for System VM s
This commit is contained in:
parent
fa2dd8e93a
commit
6f14bdc361
|
|
@ -23,6 +23,7 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
|
|
@ -39,6 +40,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
|
|||
|
||||
private static final String s_name = "destroysystemvmresponse";
|
||||
|
||||
@IdentityMapper(entityTableName="vm_instance")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
|
||||
private Long id;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseListCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ListResponse;
|
||||
|
|
@ -44,6 +45,7 @@ public class ListSystemVMsCmd extends BaseListCmd {
|
|||
@Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the system VM")
|
||||
private Long hostId;
|
||||
|
||||
@IdentityMapper(entityTableName="vm_instance")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the system VM")
|
||||
private Long id;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
|
|
@ -50,6 +51,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
|
|||
@Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, required=true, description="destination Host ID to migrate VM to")
|
||||
private Long hostId;
|
||||
|
||||
@IdentityMapper(entityTableName="vm_instance")
|
||||
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine")
|
||||
private Long virtualMachineId;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
|
|
@ -43,6 +44,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName="vm_instance")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
|
||||
private Long id;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
|
|
@ -43,6 +44,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName="vm_instance")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
|
||||
private Long id;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.IdentityMapper;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
|
|
@ -45,6 +46,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@IdentityMapper(entityTableName="vm_instance")
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
|
||||
private Long id;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import com.google.gson.annotations.SerializedName;
|
|||
|
||||
public class SystemVmResponse extends BaseResponse {
|
||||
@SerializedName("id") @Param(description="the ID of the system VM")
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
@SerializedName("systemvmtype") @Param(description="the system VM type")
|
||||
private String systemVmType;
|
||||
|
|
@ -105,15 +105,22 @@ public class SystemVmResponse extends BaseResponse {
|
|||
@SerializedName("activeviewersessions") @Param(description="the number of active console sessions for the console proxy system vm")
|
||||
private Integer activeViewerSessions;
|
||||
|
||||
private Long objectId;
|
||||
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
// return getId();
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(Long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/utils"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/tools"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/vmware-base"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/agent"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/utils"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/tools"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/vmware-base"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/agent"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
|
|
@ -1263,7 +1263,11 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy) {
|
||||
// SystemVm vm = (SystemVm) systemVM;
|
||||
|
||||
vmResponse.setId(vm.getId());
|
||||
if(vm.getUuid() != null && !vm.getUuid().isEmpty())
|
||||
vmResponse.setId(vm.getUuid());
|
||||
else
|
||||
vmResponse.setId(String.valueOf(vm.getId()));
|
||||
vmResponse.setObjectId(vm.getId());
|
||||
vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
|
||||
vmResponse.setZoneId(vm.getDataCenterIdToDeployIn());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue