diff --git a/api/src/com/cloud/api/commands/SetVMOSTypeCmd.java b/api/src/com/cloud/api/commands/SetVMOSTypeCmd.java deleted file mode 100644 index 1ec4e961eb8..00000000000 --- a/api/src/com/cloud/api/commands/SetVMOSTypeCmd.java +++ /dev/null @@ -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 . - * - */ -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"); - } - } -} diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java index 836d784e45e..bc73f6a4d3f 100755 --- a/api/src/com/cloud/vm/UserVmService.java +++ b/api/src/com/cloud/vm/UserVmService.java @@ -28,7 +28,6 @@ import com.cloud.api.commands.DetachVolumeCmd; import com.cloud.api.commands.RebootVMCmd; import com.cloud.api.commands.RecoverVMCmd; import com.cloud.api.commands.ResetVMPasswordCmd; -import com.cloud.api.commands.SetVMOSTypeCmd; import com.cloud.api.commands.StartVMCmd; import com.cloud.api.commands.StopVMCmd; import com.cloud.api.commands.UpdateVMCmd; @@ -64,13 +63,6 @@ public interface UserVmService { */ 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. * @param cmd - the command specifying vmId, password diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index 5011277d6ed..6d526e97c5d 100755 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -34,7 +34,6 @@ listResourceLimits=com.cloud.api.commands.ListResourceLimitsCmd;15 #### VM commands deployVirtualMachine=com.cloud.api.commands.DeployVMCmd;11 -setVMOSType=com.cloud.api.commands.SetVMOSTypeCmd;15 destroyVirtualMachine=com.cloud.api.commands.DestroyVMCmd;15 rebootVirtualMachine=com.cloud.api.commands.RebootVMCmd;15 startVirtualMachine=com.cloud.api.commands.StartVMCmd;15 @@ -240,4 +239,4 @@ listNetworkOfferings=com.cloud.api.commands.ListNetworkOfferingsCmd;15 #### network commands createNetwork=com.cloud.api.commands.CreateNetworkCmd;15 deleteNetwork=com.cloud.api.commands.DeleteNetworkCmd;15 -listNetworks=com.cloud.api.commands.ListNetworksCmd;15 +listNetworks=com.cloud.api.commands.ListNetworksCmd;15 diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 4998cba8419..6e7cda36b36 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -76,7 +76,6 @@ import com.cloud.api.commands.DetachVolumeCmd; import com.cloud.api.commands.RebootVMCmd; import com.cloud.api.commands.RecoverVMCmd; import com.cloud.api.commands.ResetVMPasswordCmd; -import com.cloud.api.commands.SetVMOSTypeCmd; import com.cloud.api.commands.StartVMCmd; import com.cloud.api.commands.StopVMCmd; import com.cloud.api.commands.UpdateVMCmd; @@ -3277,18 +3276,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager } 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 public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {