Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E885BF13F for ; Thu, 11 Apr 2013 22:13:16 +0000 (UTC) Received: (qmail 94825 invoked by uid 500); 11 Apr 2013 22:13:11 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 94736 invoked by uid 500); 11 Apr 2013 22:13:10 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 94542 invoked by uid 99); 11 Apr 2013 22:13:10 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Apr 2013 22:13:10 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 738F0880EA0; Thu, 11 Apr 2013 22:13:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Date: Thu, 11 Apr 2013 22:13:29 -0000 Message-Id: <368b41e59d5344779a4a852b3b788d34@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [21/48] git commit: updated refs/heads/ui-vm-affinity to 96999be Not using entity factory Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cf7d40c6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cf7d40c6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cf7d40c6 Branch: refs/heads/ui-vm-affinity Commit: cf7d40c6cd4c340aa71df959fad06e8b69070d06 Parents: e9300d2 Author: Prachi Damle Authored: Mon Mar 18 11:09:29 2013 -0700 Committer: Prachi Damle Committed: Thu Apr 11 13:22:54 2013 -0700 ---------------------------------------------------------------------- .../platform/orchestration/CloudOrchestrator.java | 63 +++++++-------- 1 files changed, 31 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf7d40c6/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java index c07931b..963e4d7 100755 --- a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java @@ -51,7 +51,6 @@ import com.cloud.user.dao.AccountDao; import com.cloud.utils.Pair; import com.cloud.utils.component.ComponentContext; import com.cloud.vm.NicProfile; -import com.cloud.vm.UserVmVO; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachineManager; import com.cloud.vm.dao.UserVmDao; @@ -66,25 +65,25 @@ public class CloudOrchestrator implements OrchestrationService { @Inject private VirtualMachineManager _itMgr; - + @Inject protected VMTemplateDao _templateDao = null; - + @Inject protected VMInstanceDao _vmDao; - + @Inject protected UserVmDao _userVmDao = null; - + @Inject protected ServiceOfferingDao _serviceOfferingDao; - + @Inject protected DiskOfferingDao _diskOfferingDao = null; - + @Inject protected NetworkDao _networkDao; - + @Inject protected AccountDao _accountDao = null; @@ -147,17 +146,17 @@ public class CloudOrchestrator implements OrchestrationService { @Override public VirtualMachineEntity createVirtualMachine( - String id, - String owner, - String templateId, - String hostName, + String id, + String owner, + String templateId, + String hostName, String displayName, String hypervisor, - int cpu, - int speed, + int cpu, + int speed, long memory, Long diskSize, - List computeTags, + List computeTags, List rootDiskTags, Map networkNicMap, DeploymentPlan plan) throws InsufficientCapacityException { @@ -173,22 +172,22 @@ public class CloudOrchestrator implements OrchestrationService { VirtualMachineEntityImpl vmEntity = ComponentContext.inject(VirtualMachineEntityImpl.class); vmEntity.init(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, new ArrayList(networkNicMap.keySet())); - - + + HypervisorType hypervisorType = HypervisorType.valueOf(hypervisor); //load vm instance and offerings and call virtualMachineManagerImpl VMInstanceVO vm = _vmDao.findByUuid(id); - + // If the template represents an ISO, a disk offering must be passed in, and will be used to create the root disk // Else, a disk offering is optional, and if present will be used to create the data disk Pair rootDiskOffering = new Pair(null, null); List> dataDiskOfferings = new ArrayList>(); - + ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getServiceOfferingId()); rootDiskOffering.first(offering); - + if(vm.getDiskOfferingId() != null){ DiskOfferingVO diskOffering = _diskOfferingDao.findById(vm.getDiskOfferingId()); if (diskOffering == null) { @@ -205,32 +204,32 @@ public class CloudOrchestrator implements OrchestrationService { } dataDiskOfferings.add(new Pair(diskOffering, size)); } - - - + + + if (_itMgr.allocate(_userVmDao.findById(vm.getId(), true), _templateDao.findById(new Long(templateId)), offering, rootDiskOffering, dataDiskOfferings, networkIpMap, null, plan, hypervisorType, _accountDao.findById(new Long(owner))) == null) { return null; } - + return vmEntity; } @Override public VirtualMachineEntity createVirtualMachineFromScratch(String id, String owner, String isoId, String hostName, String displayName, String hypervisor, String os, int cpu, int speed, long memory,Long diskSize, List computeTags, List rootDiskTags, Map networkNicMap, DeploymentPlan plan) throws InsufficientCapacityException { - + // VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, networks, vmEntityManager); VirtualMachineEntityImpl vmEntity = ComponentContext.inject(VirtualMachineEntityImpl.class); vmEntity.init(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, new ArrayList(networkNicMap.keySet())); //load vm instance and offerings and call virtualMachineManagerImpl VMInstanceVO vm = _vmDao.findByUuid(id); - - + + Pair rootDiskOffering = new Pair(null, null); ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getServiceOfferingId()); rootDiskOffering.first(offering); - + List> dataDiskOfferings = new ArrayList>(); Long diskOfferingId = vm.getDiskOfferingId(); if (diskOfferingId == null) { @@ -251,7 +250,7 @@ public class CloudOrchestrator implements OrchestrationService { } rootDiskOffering.first(diskOffering); rootDiskOffering.second(size); - + List> networkIpMap = new ArrayList>(); for (String uuid : networkNicMap.keySet()) { NetworkVO network = _networkDao.findByUuid(uuid); @@ -259,13 +258,13 @@ public class CloudOrchestrator implements OrchestrationService { networkIpMap.add(new Pair(network, networkNicMap.get(uuid))); } } - + HypervisorType hypervisorType = HypervisorType.valueOf(hypervisor); - + if (_itMgr.allocate(_userVmDao.findById(vm.getId(), true), _templateDao.findById(new Long(isoId)), offering, rootDiskOffering, dataDiskOfferings, networkIpMap, null, plan, hypervisorType, _accountDao.findById(new Long(owner))) == null) { return null; } - + return vmEntity; }