最近安装了几十遍CloudStack,安装步骤已经熟练到配置都不用看文档了。在最开始的安装步骤中碰到了需要首先更新Linux才能正确打开CloudStack UI管理界面的问题。而在成功配置后,确发现,无法成功创建Instance。报错如下图:
Unable to create a deployment for VM [User|xxxxxx]
检查日志/var/log/cloudstack/management/management-server.log后,发现如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 2013–07–01 20:21:15,748 DEBUG [cloud.vm.VirtualMachineManagerImpl] (Job–Executor–8:job–8) Allocating entries for VM: VM[DomainRouter|r–4–VM] 2013–07–01 20:21:15,756 DEBUG [cloud.vm.VirtualMachineManagerImpl] (Job–Executor–8:job–8) Allocating nics for VM[DomainRouter|r–4–VM] 2013–07–01 20:21:15,758 DEBUG [cloud.network.NetworkManagerImpl] (Job–Executor–8:job–8) Allocating nic for vm VM[DomainRouter|r–4–VM] in network Ntwk[204|Guest|6] with requested profile NicProfile[0–0–null–null–null 2013–07–01 20:21:15,775 DEBUG [cloud.network.NetworkManagerImpl] (Job–Executor–8:job–8) Allocating nic for vm VM[DomainRouter|r–4–VM] in network Ntwk[202|Control|3] with requested profile null 2013–07–01 20:21:15,787 DEBUG [cloud.vm.VirtualMachineManagerImpl] (Job–Executor–8:job–8) Allocaing disks for VM[DomainRouter|r–4–VM] 2013–07–01 20:21:15,795 DEBUG [cloud.vm.VirtualMachineManagerImpl] (Job–Executor–8:job–8) Allocation completed for VM: VM[DomainRouter|r–4–VM] 2013–07–01 20:21:15,824 DEBUG [network.router.VirtualNetworkApplianceManagerImpl] (Job–Executor–8:job–8) Lock is released for network id 204 as a part of router startup in Dest[Zone(Id)–Pod(Id)–Cluster(Id)–Host(Id)–Storage(Volume(Id|Type—>Pool(Id))] : Dest[Zone(1)–Pod(1)–Cluster(1)–Host(1)–Storage(Volume(3|ROOT—>Pool(200))] 2013–07–01 20:21:15,825 DEBUG [network.router.VirtualNetworkApplianceManagerImpl] (Job–Executor–8:job–8) Starting router VM[DomainRouter|r–4–VM] 2013–07–01 20:21:15,838 DEBUG [cloud.capacity.CapacityManagerImpl] (Job–Executor–8:job–8) VM state transitted from :Stopped to Starting with event: StartRequestedvm‘s original host id: null new host id: null host id before state transition: null 2013-07-01 20:21:15,838 DEBUG [cloud.vm.VirtualMachineManagerImpl] (Job-Executor-8:job-8) Successfully transitioned to start state for VM[DomainRouter|r-4-VM] reservation id = 477dcaca-d664-4f04-8574-3e960316837b 2013-07-01 20:21:15,844 DEBUG [cloud.vm.VirtualMachineManagerImpl] (Job-Executor-8:job-8) Trying to deploy VM, vm has dcId: 1 and podId: 1 2013-07-01 20:21:15,844 DEBUG [cloud.vm.VirtualMachineManagerImpl] (Job-Executor-8:job-8) Deploy avoids pods: null, clusters: null, hosts: null 2013-07-01 20:21:15,847 DEBUG [cloud.deploy.FirstFitPlanner] (Job-Executor-8:job-8) DeploymentPlanner allocation algorithm: random 2013-07-01 20:21:15,848 DEBUG [cloud.deploy.FirstFitPlanner] (Job-Executor-8:job-8) Trying to allocate a host and storage pools from dc:1, pod:1,cluster:null, requested cpu: 500, requested ram: 134217728 2013-07-01 20:21:15,848 DEBUG [cloud.deploy.FirstFitPlanner] (Job-Executor-8:job-8) Is ROOT volume READY (pool already allocated)?: No 2013-07-01 20:21:15,848 DEBUG [cloud.deploy.FirstFitPlanner] (Job-Executor-8:job-8) Searching resources only under specified Pod: 1 2013-07-01 20:21:15,849 DEBUG [cloud.deploy.FirstFitPlanner] (Job-Executor-8:job-8) Listing clusters in order of aggregate capacity, that have (atleast one host with) enough CPU and RAM capacity under this Pod: 1 2013-07-01 20:21:15,851 DEBUG [cloud.deploy.FirstFitPlanner] (Job-Executor-8:job-8) CPUOverprovisioningFactor considered: 1.0 2013-07-01 20:21:15,854 DEBUG [cloud.deploy.FirstFitPlanner] (Job-Executor-8:job-8) No clusters found having a host with enough capacity, returning. 2013-07-01 20:21:15,860 DEBUG [cloud.capacity.CapacityManagerImpl] (Job-Executor-8:job-8) VM state transitted from :Starting to Stopped with event: OperationFailedvm’s original host id: null new host id: null host id before state transition: null 2013–07–01 20:21:15,863 INFO [cloud.vm.VirtualMachineManagerImpl] (Job–Executor–8:job–8) Insufficient capacity com.cloud.exception.InsufficientServerCapacityException: Unable to create a deployment for VM[DomainRouter|r–4–VM]Scope=interface com.cloud.dc.DataCenter; id=1 at com.cloud.vm.VirtualMachineManagerImpl.advanceStart(VirtualMachineManagerImpl.java:728) at com.cloud.vm.VirtualMachineManagerImpl.start(VirtualMachineManagerImpl.java:471) at com.cloud.network.router.VirtualNetworkApplianceManagerImpl.start(VirtualNetworkApplianceManagerImpl.java:2615) at com.cloud.network.router.VirtualNetworkApplianceManagerImpl.startVirtualRouter(VirtualNetworkApplianceManagerImpl.java:1824) at com.cloud.network.router.VirtualNetworkApplianceManagerImpl.startRouters(VirtualNetworkApplianceManagerImpl.java:1924) at com.cloud.network.router.VirtualNetworkApplianceManagerImpl.deployVirtualRouterInGuestNetwork(VirtualNetworkApplianceManagerImpl.java:1902) at com.cloud.network.element.VirtualRouterElement.prepare(VirtualRouterElement.java:208) at com.cloud.network.NetworkManagerImpl.prepareElement(NetworkManagerImpl.java:1541) at com.cloud.network.NetworkManagerImpl.prepareNic(NetworkManagerImpl.java:1658) at com.cloud.network.NetworkManagerImpl.prepare(NetworkManagerImpl.java:1599) at com.cloud.vm.VirtualMachineManagerImpl.advanceStart(VirtualMachineManagerImpl.java:746) at com.cloud.vm.VirtualMachineManagerImpl.start(VirtualMachineManagerImpl.java:471) at org.apache.cloudstack.engine.cloud.entity.api.VMEntityManagerImpl.deployVirtualMachine(VMEntityManagerImpl.java:212) at org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl.deploy(VirtualMachineEntityImpl.java:209) at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:3865) at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:3458) at com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:3444) at com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125) at org.apache.cloudstack.api.command.user.vm.DeployVMCmd.execute(DeployVMCmd.java:379) at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:162) at com.cloud.async.AsyncJobManagerImpl$1.run(AsyncJobManagerImpl.java:437) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) |
重点在这里:
1 | com.cloud.exception.InsufficientServerCapacityException: Unable to create a deployment for VM[DomainRouter|r–4–VM]Scope=interface com.cloud.dc.DataCenter; id=1 |
无法创建r-4-VM,而该VM为CloudStack Virtual Router VM,该VM由于资源不足,部署失败。
然后往回看,我们发现该VM需要500Mhz CPU:
1 | DEBUG [cloud.deploy.FirstFitPlanner] (Job–Executor–8:job–8) Trying to allocate a host and storage pools from dc:1, pod:1,cluster:null, requested cpu: 500, requested ram: 134217728 |
再往回找,我们发现当计算完我们当前创建Instance所需的CPU资源后,剩余已经不够500,无法满足Virtual router VM,所以导致失败。
如下的日志,Host共有1999Mhz,当前Hypervisor以及SSVM,CPVM已经占用1000Mhz,剩余999Mhz,而我们创建的Instance需要500Mhz.
所以VM的资源没有问题,但是当VM的资源去掉以后,实际剩余499Mhz,而上面,我们已经看到,Virtual Router VM还需要500Mhz,所以,最终由于资源不足导致创建失败。
1 2 3 4 | DEBUG [cloud.capacity.CapacityManagerImpl] (Job–Executor–8:job–8) Hosts‘s actual total CPU: 1999 and CPU after applying overprovisioning: 1999 DEBUG [cloud.capacity.CapacityManagerImpl] (Job–Executor–8:job–8) We are allocating VM, increasing the used capacity of this host:1 DEBUG [cloud.capacity.CapacityManagerImpl] (Job–Executor–8:job–8) Current Used CPU: 1000 , Free CPU:999 ,Requested CPU: 500 DEBUG [cloud.capacity.CapacityManagerImpl] (Job–Executor–8:job–8) Current Used RAM: 1342177280 , Free RAM:4504734784 ,Requested RAM: 536870912 |
总结:
由于我目前是使用虚拟机的方式来模拟进行测试安装。而服务器CPU的主频又不够高,低于2Ghz,而又分配了一个vCPU。最终导致,无论如何,创建都会失败。
建议:各位新手做实验的时候,建议XS分配至少4G内存,双核CPU。不能因为单核CPU主频较高就分配一个,我观察到在不同的机器上,hypervisor本身和CS的System VM占用的资源不一定就正好是1Ghz。但是目前主流CPU双核足够了。