diff --git a/api/src/com/cloud/api/commands/DestroySystemVmCmd.java b/api/src/com/cloud/api/commands/DestroySystemVmCmd.java index 87305be1fe0..07308dd5b61 100644 --- a/api/src/com/cloud/api/commands/DestroySystemVmCmd.java +++ b/api/src/com/cloud/api/commands/DestroySystemVmCmd.java @@ -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; diff --git a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java b/api/src/com/cloud/api/commands/ListSystemVMsCmd.java index b736671d51e..d4acd506080 100644 --- a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java +++ b/api/src/com/cloud/api/commands/ListSystemVMsCmd.java @@ -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; diff --git a/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java b/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java index 9b36af45da8..1bab6294f91 100644 --- a/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java +++ b/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java @@ -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; diff --git a/api/src/com/cloud/api/commands/RebootSystemVmCmd.java b/api/src/com/cloud/api/commands/RebootSystemVmCmd.java index aefa42a59c7..f901651a7d2 100644 --- a/api/src/com/cloud/api/commands/RebootSystemVmCmd.java +++ b/api/src/com/cloud/api/commands/RebootSystemVmCmd.java @@ -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; diff --git a/api/src/com/cloud/api/commands/StartSystemVMCmd.java b/api/src/com/cloud/api/commands/StartSystemVMCmd.java index 9661ca992fe..c7177040e9f 100644 --- a/api/src/com/cloud/api/commands/StartSystemVMCmd.java +++ b/api/src/com/cloud/api/commands/StartSystemVMCmd.java @@ -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; diff --git a/api/src/com/cloud/api/commands/StopSystemVmCmd.java b/api/src/com/cloud/api/commands/StopSystemVmCmd.java index a7e6b0f1e73..c7bac542226 100644 --- a/api/src/com/cloud/api/commands/StopSystemVmCmd.java +++ b/api/src/com/cloud/api/commands/StopSystemVmCmd.java @@ -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; diff --git a/api/src/com/cloud/api/response/SystemVmResponse.java b/api/src/com/cloud/api/response/SystemVmResponse.java index 890f9c14d87..dc599aabfde 100644 --- a/api/src/com/cloud/api/response/SystemVmResponse.java +++ b/api/src/com/cloud/api/response/SystemVmResponse.java @@ -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; } diff --git a/server/.classpath b/server/.classpath index 77a010dd9da..f17a8521ae4 100755 --- a/server/.classpath +++ b/server/.classpath @@ -1,14 +1,14 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index c8bb7d28323..6fda783396a 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -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());