Hi ZHOU,
哦?你还看过代码?分享下你看代码的经验吧。刚接触cloudstack,想深入学习下源码但一直不知道从哪里入手。谢谢啦!

----
Best regards,
DuJun


2013/11/19 Wei ZHOU <ustcweiz...@gmail.com>

> 是这样的。cloudstack里面有判断。其实看看代码就都清楚了。
>
>
> 2013/11/19 Du Jun <dj199...@gmail.com>
>
> > 经你们提醒,好像这个问题是解释得通的,就是虚拟机CPU每个核的主频必须小于物理机单核的主频。谢谢!恍然大悟!
> >
> >
> > 2013/11/19 Du Jun <dj199...@gmail.com>
> >
> > > Hi Luo,
> > > 你的意思是你可以启动每个核为2GHZ,但核数为n(n>=2)的虚拟机?请问你用的cloudstack是什么版本?谢谢!
> > >
> > > ------
> > > Best regards,
> > > DuJun
> > >
> > >
> > > 2013/11/19 Xuan Luo <465296...@qq.com>
> > >
> > >> 你好!
> > >>
> >
> 我也遇到过这个问题。我发现如果服务器(物理机)的单个核是2G,那就只能做2G的倍数的服务方案,例如2核总共就是4G,3核就是6G。所以你做requested
> > >> cpu:4400就会找不到合适的Host,找的时候会出现
> > >> cpuFreqGood:false,VM也无法启动。把4400改成2000的倍数试试看\(^o^)/~
> > >>
> > >>
> > >>
> > >> ------------------ 原始邮件 ------------------
> > >> 发件人: "Du Jun";
> > >> 发送时间: 2013年11月19日(星期二) 下午5:36
> > >> 收件人: "users-cn";
> > >> 主题: 无法添加CPU频率大于2GHZ的虚拟机
> > >>
> > >>
> > >>
> > >> Hi,
> > >> Cloudstack4.2貌似有一个bug,就是可以添加CPU频率等于2GHZ的双核的compute
> > >> offering,但就是无法用这个compute
> > >>
> > >>
> >
> offering启动虚拟机。但事实上我宿主机的CPU主频远远大于2GHZ。大家有时间的话帮我看看我的log吧,虽然说有点长,但描述了创建虚拟机的全过程,其中我觉得可疑的cpuOverprovisioningFactor:
> > >> 1.0已经红色标记了,有没有人知道原因的帮我解释一下,谢谢啦!:)
> > >> 2013-11-19 17:22:32,651 DEBUG [cloud.api.ApiServlet]
> > >> (catalina-exec-2:null)
> > >> ===END===  10.10.15.18 -- GET
> > >>
> > >>
> >
>  
> command=deployVirtualMachine&zoneId=de6081ca-0f25-44f0-aeec-81d0a844329e&templateId=f4a9b927-247c-429c-a0fe-e660c3f2dd23&hypervisor=KVM&serviceOfferingId=27287f8b-a488-4350-8b70-e57719f22b3b&diskOfferingId=43feaa9e-f7bd-4805-825a-d8527430ec02&networkIds=6d4ca91d-cf83-4d71-9c3c-0b4df343b3bd&displayname=tfxt-222&name=tfxt-222&response=json&sessionkey=kYuQ4zESaE%2FqGV%2Bjat8gMC4vI8Y%3D&_=1384852954050
> > >> 2013-11-19 17:22:32,655 DEBUG [cloud.api.ApiDispatcher]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> InfrastructureEntity name is:com.cloud.offering.ServiceOffering
> > >> 2013-11-19 17:22:32,656 DEBUG [cloud.api.ApiDispatcher]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> ControlledEntity name is:com.cloud.template.VirtualMachineTemplate
> > >> 2013-11-19 17:22:32,659 DEBUG [cloud.api.ApiDispatcher]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> ControlledEntity name is:com.cloud.network.Network
> > >> 2013-11-19 17:22:32,661 DEBUG [cloud.api.ApiDispatcher]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> InfrastructureEntity name is:com.cloud.offering.DiskOffering
> > >> 2013-11-19 17:22:32,678 DEBUG [cloud.network.NetworkModelImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > Service
> > >> SecurityGroup is not supported in the network id=204
> > >> 2013-11-19 17:22:32,681 DEBUG [cloud.network.NetworkModelImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > Service
> > >> SecurityGroup is not supported in the network id=204
> > >> 2013-11-19 17:22:32,695 DEBUG
> > [cloud.deploy.DeploymentPlanningManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > Deploy
> > >> avoids pods: [], clusters: [], hosts: []
> > >> 2013-11-19 17:22:32,697 DEBUG
> > [cloud.deploy.DeploymentPlanningManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> DeploymentPlanner allocation algorithm:
> > >>
> com.cloud.deploy.FirstFitPlanner_EnhancerByCloudStack_1ff4f9d9@303802fb
> > >> 2013-11-19 17:22:32,697 DEBUG
> > [cloud.deploy.DeploymentPlanningManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > Trying
> > >> to allocate a host and storage pools from dc:1, pod:null,cluster:null,
> > >> requested cpu: 4400, requested ram: 2147483648
> > >> 2013-11-19 17:22:32,697 DEBUG
> > [cloud.deploy.DeploymentPlanningManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]) Is
> > ROOT
> > >> volume READY (pool already allocated)?: No
> > >> 2013-11-19 17:22:32,697 DEBUG [cloud.deploy.FirstFitPlanner]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> Searching all possible resources under this Zone: 1
> > >> 2013-11-19 17:22:32,698 DEBUG [cloud.deploy.FirstFitPlanner]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > Listing
> > >> clusters in order of aggregate capacity, that have (atleast one host
> > with)
> > >> enough CPU and RAM capacity under this Zone: 1
> > >> 2013-11-19 17:22:32,700 DEBUG [cloud.deploy.FirstFitPlanner]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> Removing
> > >> from the clusterId list these clusters from avoid set: []
> > >> 2013-11-19 17:22:32,706 DEBUG
> > [cloud.deploy.DeploymentPlanningManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> Checking
> > >> resources in Cluster: 1 under Pod: 1
> > >> 2013-11-19 17:22:32,708 DEBUG [allocator.impl.FirstFitAllocator]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Looking for hosts in dc: 1  pod:1  cluster:1
> > >> 2013-11-19 17:22:32,711 DEBUG [allocator.impl.FirstFitAllocator]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) FirstFitAllocator has 1 hosts to check for
> > >> allocation: [Host[-3-Routing]]
> > >> 2013-11-19 17:22:32,713 DEBUG [allocator.impl.FirstFitAllocator]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Found 1 hosts for allocation after
> > >> prioritization: [Host[-3-Routing]]
> > >> 2013-11-19 17:22:32,713 DEBUG [allocator.impl.FirstFitAllocator]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Looking for speed=4400Mhz, Ram=2048
> > >> 2013-11-19 17:22:32,718 DEBUG [cloud.capacity.CapacityManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Checking if host: 3 has enough capacity for
> > >> requested CPU: 4400 and requested RAM: 2147483648 ,
> > >> cpuOverprovisioningFactor:
> > >> 1.0
> > >> 2013-11-19 17:22:32,720 DEBUG [cloud.capacity.CapacityManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator)
> > >> Hosts's actual total CPU: 64000 and CPU after applying
> overprovisioning:
> > >> 64000
> > >> 2013-11-19 17:22:32,720 DEBUG [cloud.capacity.CapacityManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Free CPU: 44400 , Requested CPU: 4400
> > >> 2013-11-19 17:22:32,720 DEBUG [cloud.capacity.CapacityManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Free RAM: 57892012032 , Requested RAM:
> > >> 2147483648
> > >> 2013-11-19 17:22:32,720 DEBUG [cloud.capacity.CapacityManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Host has enough CPU and RAM available
> > >> 2013-11-19 17:22:32,720 DEBUG [cloud.capacity.CapacityManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) STATS: Can alloc CPU from host: 3, used:
> > 19600,
> > >> reserved: 0, actual total: 64000, total with overprovisioning: 64000;
> > >> requested cpu:4400,alloc_from_last_host?:false
> > ,considerReservedCapacity?:
> > >> true
> > >> 2013-11-19 17:22:32,720 DEBUG [cloud.capacity.CapacityManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) STATS: Can alloc MEM from host: 3, used:
> > >> 26533167104, reserved: 0, total: 84425179136; requested mem:
> > >> 2147483648,alloc_from_last_host?:false ,considerReservedCapacity?:
> true
> > >> 2013-11-19 17:22:32,720 DEBUG [allocator.impl.FirstFitAllocator]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Not using host 3; numCpusGood: true;
> > >> cpuFreqGood:
> > >> false, host has capacity?true
> > >> 2013-11-19 17:22:32,720 DEBUG [allocator.impl.FirstFitAllocator]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]
> > >> FirstFitRoutingAllocator) Host Allocator returning 0 suitable hosts
> > >> 2013-11-19 17:22:32,720 DEBUG
> > [cloud.deploy.DeploymentPlanningManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]) No
> > >> suitable hosts found
> > >> 2013-11-19 17:22:32,720 DEBUG
> > [cloud.deploy.DeploymentPlanningManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]) No
> > >> suitable hosts found under this Cluster: 1
> > >> 2013-11-19 17:22:32,722 DEBUG
> > [cloud.deploy.DeploymentPlanningManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> Could
> > >> not find suitable Deployment Destination for this VM under any
> clusters,
> > >> returning.
> > >> 2013-11-19 17:22:32,722 DEBUG [cloud.deploy.FirstFitPlanner]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> Searching all possible resources under this Zone: 1
> > >> 2013-11-19 17:22:32,723 DEBUG [cloud.deploy.FirstFitPlanner]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > Listing
> > >> clusters in order of aggregate capacity, that have (atleast one host
> > with)
> > >> enough CPU and RAM capacity under this Zone: 1
> > >> 2013-11-19 17:22:32,725 DEBUG [cloud.deploy.FirstFitPlanner]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> Removing
> > >> from the clusterId list these clusters from avoid set: [1]
> > >> 2013-11-19 17:22:32,727 DEBUG [cloud.deploy.FirstFitPlanner]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]) No
> > >> clusters found after removing disabled clusters and clusters in avoid
> > >> list,
> > >> returning.
> > >> 2013-11-19 17:22:32,730 DEBUG [cloud.vm.UserVmManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> Destroying vm VM[User|tfxt-222] as it failed to create on Host with
> > >> Id:null
> > >> 2013-11-19 17:22:32,736 DEBUG [cloud.capacity.CapacityManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]) VM
> > >> state
> > >> transitted from :Stopped to Error with event:
> OperationFailedToErrorvm's
> > >> original host id: null new host id: null host id before state
> > transition:
> > >> null
> > >> 2013-11-19 17:22:32,741 WARN  [apache.cloudstack.alerts]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >>  alertType:: 8 // dataCenterId:: 1 // podId:: null // clusterId:: null
> > //
> > >> message:: Failed to deploy Vm with Id: 24, on Host with Id: null
> > >> 2013-11-19 17:22:32,758 INFO  [user.vm.DeployVMCmd]
> > (Job-Executor-2:job-34
> > >> = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> com.cloud.exception.InsufficientServerCapacityException: Unable to
> > create
> > >> a
> > >> deployment for VM[User|tfxt-222]Scope=interface
> com.cloud.dc.DataCenter;
> > >> id=1
> > >> 2013-11-19 17:22:32,758 INFO  [user.vm.DeployVMCmd]
> > (Job-Executor-2:job-34
> > >> = [ 9b789b8d-055f-4077-a135-481d6d91b831 ]) Unable to create a
> > deployment
> > >> for VM[User|tfxt-222]
> > >> com.cloud.exception.InsufficientServerCapacityException: Unable to
> > create
> > >> a
> > >> deployment for VM[User|tfxt-222]Scope=interface
> com.cloud.dc.DataCenter;
> > >> id=1
> > >>         at
> > >>
> > >>
> >
> org.apache.cloudstack.engine.cloud.entity.api.VMEntityManagerImpl.reserveVirtualMachine(VMEntityManagerImpl.java:209)
> > >>         at
> > >>
> > >>
> >
> org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl.reserve(VirtualMachineEntityImpl.java:198)
> > >>         at
> > >>
> > >>
> >
> com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:3405)
> > >>         at
> > >>
> > >>
> >
> com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:2966)
> > >>         at
> > >>
> > >>
> >
> com.cloud.vm.UserVmManagerImpl.startVirtualMachine(UserVmManagerImpl.java:2952)
> > >>         at
> > >>
> > >>
> >
> com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
> > >>         at
> > >>
> > >>
> >
> org.apache.cloudstack.api.command.user.vm.DeployVMCmd.execute(DeployVMCmd.java:420)
> > >>         at
> com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:158)
> > >>         at
> > >>
> com.cloud.async.AsyncJobManagerImpl$1.run(AsyncJobManagerImpl.java:531)
> > >>         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)
> > >> 2013-11-19 17:22:32,760 DEBUG [cloud.async.AsyncJobManagerImpl]
> > >> (Job-Executor-2:job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ])
> > >> Complete
> > >> async job-34 = [ 9b789b8d-055f-4077-a135-481d6d91b831 ], jobStatus: 2,
> > >> resultCode: 530, result: Error Code: 533 Error text: Unable to create
> a
> > >> deployment for VM[User|tfxt-222]
> > >>
> > >
> > >
> >
>

回复