This commit is contained in:
NIKITA 2010-10-21 17:57:38 -07:00
parent 1d752b1508
commit 2f70032972

39
server/src/com/cloud/api/commands/DeployVMCmd.java Executable file → Normal file
View File

@ -16,8 +16,8 @@
*
*/
package com.cloud.api.commands;
package com.cloud.api.commands;
import java.util.List;
import org.apache.log4j.Logger;
@ -25,6 +25,7 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.BaseCmd.Manager;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.response.UserVmResponse;
@ -37,12 +38,12 @@ import com.cloud.user.UserContext;
import com.cloud.uservm.UserVm;
import com.cloud.vm.InstanceGroupVO;
@Implementation(method="deployVirtualMachine", description="Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.")
public class DeployVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeployVMCmd.class.getName());
@Implementation(createMethod="createVirtualMachine", method="startVirtualMachine", manager=Manager.UserVmManager, description="Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.")
public class DeployVmCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(DeployVMCmd.class.getName());
private static final String s_name = "deployvirtualmachineresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@ -153,17 +154,17 @@ public class DeployVMCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
@Override
public String getName() {
return s_name;
}
public static String getResultObjectName() {
return "virtualmachine";
}
public String getName() {
return s_name;
}
public static String getResultObjectName() {
return "virtualmachine";
}
@Override
public long getAccountId() {
Account account = (Account)UserContext.current().getAccount();
Account account = UserContext.current().getAccount();
if ((account == null) || isAdmin(account.getType())) {
if ((domainId != null) && (accountName != null)) {
Account userAccount = ApiDBUtils.findAccountByNameDomain(accountName, domainId);
@ -195,7 +196,6 @@ public class DeployVMCmd extends BaseAsyncCmd {
UserVm userVm = (UserVm)getResponseObject();
UserVmResponse response = new UserVmResponse();
response.setResponseName(getResultObjectName());
response.setId(userVm.getId());
response.setName(userVm.getName());
response.setCreated(userVm.getCreated());
@ -293,6 +293,7 @@ public class DeployVMCmd extends BaseAsyncCmd {
response.setNetworkGroupList(ApiDBUtils.getNetworkGroupsNamesForVm(userVm.getId()));
response.setResponseName(getName());
return response;
}
}
}
}