mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Revert "add new api SetVMOSTypeCmd"
This reverts commit 543b2615db627b108867cbdba59a4d0f04b01895. Conflicts: api/src/com/cloud/api/commands/SetVMOSTypeCmd.java
This commit is contained in:
parent
f6f1d38724
commit
dcb40b5b15
@ -1,85 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under the GNU General Public License v3 or later.
|
|
||||||
*
|
|
||||||
* It is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.cloud.api.commands;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import com.cloud.api.ApiConstants;
|
|
||||||
import com.cloud.api.BaseCmd;
|
|
||||||
import com.cloud.api.Implementation;
|
|
||||||
import com.cloud.api.Parameter;
|
|
||||||
import com.cloud.api.ServerApiException;
|
|
||||||
import com.cloud.api.response.UserVmResponse;
|
|
||||||
import com.cloud.uservm.UserVm;
|
|
||||||
|
|
||||||
@Implementation(description="Set VM OS Type.", responseObject=UserVmResponse.class)
|
|
||||||
public class SetVMOSTypeCmd extends BaseCmd {
|
|
||||||
public static final Logger s_logger = Logger.getLogger(SetVMOSTypeCmd.class.getName());
|
|
||||||
|
|
||||||
private static final String s_name = "SetVMOSTypeResponse";
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
|
||||||
//////////////// API parameters /////////////////////
|
|
||||||
/////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine")
|
|
||||||
private Long virtualMachineId;
|
|
||||||
|
|
||||||
@Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, required=true, description="the ID of the OS Type that best represents the OS of this template.")
|
|
||||||
private Long osTypeId;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
|
||||||
/////////////////// Accessors ///////////////////////
|
|
||||||
/////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
public Long getOsTypeId() {
|
|
||||||
return osTypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getVirtualMachineId() {
|
|
||||||
return virtualMachineId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
|
||||||
/////////////// API Implementation///////////////////
|
|
||||||
/////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCommandName() {
|
|
||||||
return s_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(){
|
|
||||||
boolean result = _userVmService.setVMOSType(this);
|
|
||||||
if (result) {
|
|
||||||
UserVm userVm = _responseGenerator.findUserVmById(virtualMachineId);
|
|
||||||
if (userVm != null) {
|
|
||||||
UserVmResponse response = _responseGenerator.createUserVmResponse(userVm);
|
|
||||||
response.setResponseName(DeployVMCmd.getResultObjectName());
|
|
||||||
this.setResponseObject(response);
|
|
||||||
} else {
|
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to set VM OS type");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to set VM OS type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -28,7 +28,6 @@ import com.cloud.api.commands.DetachVolumeCmd;
|
|||||||
import com.cloud.api.commands.RebootVMCmd;
|
import com.cloud.api.commands.RebootVMCmd;
|
||||||
import com.cloud.api.commands.RecoverVMCmd;
|
import com.cloud.api.commands.RecoverVMCmd;
|
||||||
import com.cloud.api.commands.ResetVMPasswordCmd;
|
import com.cloud.api.commands.ResetVMPasswordCmd;
|
||||||
import com.cloud.api.commands.SetVMOSTypeCmd;
|
|
||||||
import com.cloud.api.commands.StartVMCmd;
|
import com.cloud.api.commands.StartVMCmd;
|
||||||
import com.cloud.api.commands.StopVMCmd;
|
import com.cloud.api.commands.StopVMCmd;
|
||||||
import com.cloud.api.commands.UpdateVMCmd;
|
import com.cloud.api.commands.UpdateVMCmd;
|
||||||
@ -64,13 +63,6 @@ public interface UserVmService {
|
|||||||
*/
|
*/
|
||||||
UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException;
|
UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys one virtual machine
|
|
||||||
* @param VMId the id of virtual machine
|
|
||||||
* @param OSTypeId the id of guest OS type
|
|
||||||
*/
|
|
||||||
boolean setVMOSType(SetVMOSTypeCmd cmd);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the password of a virtual machine.
|
* Resets the password of a virtual machine.
|
||||||
* @param cmd - the command specifying vmId, password
|
* @param cmd - the command specifying vmId, password
|
||||||
|
|||||||
@ -34,7 +34,6 @@ listResourceLimits=com.cloud.api.commands.ListResourceLimitsCmd;15
|
|||||||
|
|
||||||
#### VM commands
|
#### VM commands
|
||||||
deployVirtualMachine=com.cloud.api.commands.DeployVMCmd;11
|
deployVirtualMachine=com.cloud.api.commands.DeployVMCmd;11
|
||||||
setVMOSType=com.cloud.api.commands.SetVMOSTypeCmd;15
|
|
||||||
destroyVirtualMachine=com.cloud.api.commands.DestroyVMCmd;15
|
destroyVirtualMachine=com.cloud.api.commands.DestroyVMCmd;15
|
||||||
rebootVirtualMachine=com.cloud.api.commands.RebootVMCmd;15
|
rebootVirtualMachine=com.cloud.api.commands.RebootVMCmd;15
|
||||||
startVirtualMachine=com.cloud.api.commands.StartVMCmd;15
|
startVirtualMachine=com.cloud.api.commands.StartVMCmd;15
|
||||||
|
|||||||
@ -76,7 +76,6 @@ import com.cloud.api.commands.DetachVolumeCmd;
|
|||||||
import com.cloud.api.commands.RebootVMCmd;
|
import com.cloud.api.commands.RebootVMCmd;
|
||||||
import com.cloud.api.commands.RecoverVMCmd;
|
import com.cloud.api.commands.RecoverVMCmd;
|
||||||
import com.cloud.api.commands.ResetVMPasswordCmd;
|
import com.cloud.api.commands.ResetVMPasswordCmd;
|
||||||
import com.cloud.api.commands.SetVMOSTypeCmd;
|
|
||||||
import com.cloud.api.commands.StartVMCmd;
|
import com.cloud.api.commands.StartVMCmd;
|
||||||
import com.cloud.api.commands.StopVMCmd;
|
import com.cloud.api.commands.StopVMCmd;
|
||||||
import com.cloud.api.commands.UpdateVMCmd;
|
import com.cloud.api.commands.UpdateVMCmd;
|
||||||
@ -3278,18 +3277,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||||||
return _vmDao.findById(id);
|
return _vmDao.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setVMOSType(SetVMOSTypeCmd cmd) {
|
|
||||||
long id = cmd.getVirtualMachineId();
|
|
||||||
UserVmVO vmInstance = _vmDao.findById(id);
|
|
||||||
if (vmInstance == null) {
|
|
||||||
throw new CloudRuntimeException("Unable to find virtual machine with id " + id + ", internal error.");
|
|
||||||
}
|
|
||||||
vmInstance.setGuestOSId(cmd.getOsTypeId());
|
|
||||||
_vmDao.update(id, vmInstance);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||||
if (_useNewNetworking) {
|
if (_useNewNetworking) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user