Updated Branches: refs/heads/4.1 c47f685b1 -> c3a37dd7f
CLOUDSTACK-1293 resetpasswordforVm shows "passsd reset to undefined" Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/c3a37dd7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/c3a37dd7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/c3a37dd7 Branch: refs/heads/4.1 Commit: c3a37dd7ff526955ea3f9f6690813b3c0d3e0391 Parents: c47f685 Author: Harikrishna Patnala <[email protected]> Authored: Tue Feb 26 15:10:38 2013 +0530 Committer: Harikrishna Patnala <[email protected]> Committed: Tue Feb 26 17:18:30 2013 +0530 ---------------------------------------------------------------------- .../cloud/entity/api/VirtualMachineEntity.java | 4 +- .../engine/cloud/entity/api/VMEntityManager.java | 37 ++++--- .../cloud/entity/api/VMEntityManagerImpl.java | 4 +- .../cloud/entity/api/VirtualMachineEntityImpl.java | 83 ++++++++------- server/src/com/cloud/vm/UserVmManagerImpl.java | 22 ++-- 5 files changed, 78 insertions(+), 72 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c3a37dd7/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java ---------------------------------------------------------------------- diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java index 1fd4e54..8640b63 100755 --- a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.engine.cloud.entity.api; import java.util.List; +import java.util.Map; import javax.ws.rs.BeanParam; import javax.ws.rs.GET; @@ -26,6 +27,7 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.xml.bind.annotation.XmlRootElement; +import com.cloud.vm.VirtualMachineProfile; import org.apache.cloudstack.engine.entity.api.CloudStackEntity; @@ -104,7 +106,7 @@ public interface VirtualMachineEntity extends CloudStackEntity { * @param reservationId reservation id from reserve call. * */ - void deploy(String reservationId, String caller) throws InsufficientCapacityException, ResourceUnavailableException; + void deploy(String reservationId, String caller, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException; /** * Stop the virtual machine http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c3a37dd7/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java index 8e58e73..0d97771 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java @@ -1,21 +1,22 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.cloudstack.engine.cloud.entity.api; +import com.cloud.vm.VirtualMachineProfile; import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; import com.cloud.deploy.DeploymentPlan; @@ -26,6 +27,8 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.OperationTimedoutException; import com.cloud.exception.ResourceUnavailableException; +import java.util.Map; + public interface VMEntityManager { VMEntityVO loadVirtualMachine(String vmId); @@ -34,7 +37,7 @@ public interface VMEntityManager { String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan plan, ExcludeList exclude) throws InsufficientCapacityException, ResourceUnavailableException; - void deployVirtualMachine(String reservationId, String caller) throws InsufficientCapacityException, ResourceUnavailableException; + void deployVirtualMachine(String reservationId, String caller, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException; boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c3a37dd7/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java index 7d27e3e..6bfe953 100755 --- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java @@ -189,7 +189,7 @@ public class VMEntityManagerImpl implements VMEntityManager { } @Override - public void deployVirtualMachine(String reservationId, String caller) throws InsufficientCapacityException, ResourceUnavailableException{ + public void deployVirtualMachine(String reservationId, String caller, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException{ //grab the VM Id and destination using the reservationId. VMReservationVO vmReservation = _reservationDao.findByReservationId(reservationId); @@ -209,7 +209,7 @@ public class VMEntityManagerImpl implements VMEntityManager { DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vmReservation.getPodId(), vmReservation.getClusterId(), vmReservation.getHostId(), poolId , null); - VMInstanceVO vmDeployed = _itMgr.start(vm, null, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), plan); + VMInstanceVO vmDeployed = _itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), plan); } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c3a37dd7/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java index 13358d8..bb32e5a 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java @@ -1,19 +1,19 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.cloudstack.engine.cloud.entity.api; import java.lang.reflect.Method; @@ -23,8 +23,9 @@ import java.util.Map; import javax.inject.Inject; +import com.cloud.vm.VirtualMachineProfile; import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; -import org.springframework.stereotype.Component; +import org.springframework.stereotype.Component; import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlanner.ExcludeList; @@ -33,33 +34,33 @@ import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.OperationTimedoutException; import com.cloud.exception.ResourceUnavailableException; - -@Component + +@Component public class VirtualMachineEntityImpl implements VirtualMachineEntity { @Inject private VMEntityManager manager; private VMEntityVO vmEntityVO; - - public VirtualMachineEntityImpl() { - } - - public void init(String vmId) { - this.vmEntityVO = this.manager.loadVirtualMachine(vmId); - } - - public void init(String vmId, String owner, String hostName, String displayName, int cpu, int speed, long memory, List<String> computeTags, List<String> rootDiskTags, List<String> networks) { - init(vmId); - this.vmEntityVO.setOwner(owner); - this.vmEntityVO.setHostname(hostName); - this.vmEntityVO.setDisplayname(displayName); - this.vmEntityVO.setSpeed(speed); - this.vmEntityVO.setComputeTags(computeTags); - this.vmEntityVO.setRootDiskTags(rootDiskTags); - this.vmEntityVO.setNetworkIds(networks); - - manager.saveVirtualMachine(vmEntityVO); - } + + public VirtualMachineEntityImpl() { + } + + public void init(String vmId) { + this.vmEntityVO = this.manager.loadVirtualMachine(vmId); + } + + public void init(String vmId, String owner, String hostName, String displayName, int cpu, int speed, long memory, List<String> computeTags, List<String> rootDiskTags, List<String> networks) { + init(vmId); + this.vmEntityVO.setOwner(owner); + this.vmEntityVO.setHostname(hostName); + this.vmEntityVO.setDisplayname(displayName); + this.vmEntityVO.setSpeed(speed); + this.vmEntityVO.setComputeTags(computeTags); + this.vmEntityVO.setRootDiskTags(rootDiskTags); + this.vmEntityVO.setNetworkIds(networks); + + manager.saveVirtualMachine(vmEntityVO); + } public VirtualMachineEntityImpl(String vmId, VMEntityManager manager) { this.manager = manager; @@ -204,8 +205,8 @@ public class VirtualMachineEntityImpl implements VirtualMachineEntity { } @Override - public void deploy(String reservationId, String caller) throws InsufficientCapacityException, ResourceUnavailableException{ - manager.deployVirtualMachine(reservationId, caller); + public void deploy(String reservationId, String caller, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException{ + manager.deployVirtualMachine(reservationId, caller, params); } @Override http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c3a37dd7/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 7e64cea..7bf04ec 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -389,7 +389,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use protected GuestOSCategoryDao _guestOSCategoryDao; @Inject UsageEventDao _usageEventDao; - @Inject + @Inject List<DeployPlannerSelector> plannerSelectors; protected ScheduledExecutorService _executor = null; @@ -3150,7 +3150,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use } } } - + if (template.getHypervisorType() != null && template.getHypervisorType() != HypervisorType.BareMetal) { // check if we have available pools for vm deployment long availablePools = _storagePoolDao.countPoolsByStatus(StoragePoolStatus.Up); @@ -3844,20 +3844,20 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use } VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid()); - - String plannerName = null; - for (DeployPlannerSelector dps : plannerSelectors) { - plannerName = dps.selectPlanner(vm); - if (plannerName != null) { + + String plannerName = null; + for (DeployPlannerSelector dps : plannerSelectors) { + plannerName = dps.selectPlanner(vm); + if (plannerName != null) { break; } - } - if (plannerName == null) { + } + if (plannerName == null) { throw new CloudRuntimeException(String.format("cannot find DeployPlannerSelector for vm[uuid:%s, hypervisorType:%s]", vm.getUuid(), vm.getHypervisorType())); - } + } String reservationId = vmEntity.reserve(plannerName, plan, new ExcludeList(), new Long(callerUser.getId()).toString()); - vmEntity.deploy(reservationId, new Long(callerUser.getId()).toString()); + vmEntity.deploy(reservationId, new Long(callerUser.getId()).toString(), params); Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> vmParamPair = new Pair(vm, params); if (vm != null && vm.isUpdateParameters()) {
