You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by Jorge Luiz Correa <jo...@embrapa.br.INVALID> on 2022/09/05 19:33:50 UTC

createServiceOffering: problems in web UI and cgroup version.

Hi! I'm having some problems related to the creation of a new service
offering. I need to create one using the "Custom constrained" option to
limit CPUs and memory. But, when "Custom constrained" is selected "CPU (in
MHz)" is required.

(1) The first problem is that "CPU (in MHz)" has nothing to do with the CPU
speed, right? The value configured as "CPU (in MHz)" is mapped to "shares"
element in the cputune section of libvirt configuration of domain (KVM).
Apparently this mapping is done using (N. CPUs) * CPU (in MHz). So, if I
have a 1000 Mhz value in service offering and try to launch a VM with 80
CPUs, I will get 80000 configured as 'shares' value. 'Shares' is a relative
value that defines how much CPU time a VM will have when compared to
others. This description in MHz is very confusing. Could this be changed?

(2) The second problem is why is this value required? Why couldn't we just
inform the number of CPUs and memory to limit the ranges that service
offering permits? In UI the value is required. Looking at
createServiceOffering API definition the only two required parameters are
displaytext and name. But trying to create I have:

create serviceoffering name="Custom VM" displaytext="Custom VM"
storagetype=shared provisioningtype=fat mincpunumber=2 maxcpunumber=80
minmemory=1000 maxmemory=1000000 offerha=true dynamicscalingenabled=true
Error: (HTTP 431, error code 4350) For creating a custom compute offering
min/max cpu and min/max memory/cpu speed should all be null or all specified

(3) The third problem is about the value of "CPU (in MHz)". According to (
libvirt.org/formatdomain.html) the value should be in range [2, 262144].
But, for operating systems using cgroup v2 the maximum value is 10000. I
know that Ubuntu 22.04 I'm using here is not supported yet. But this will
be an issue as other OSs adopt cgroup v2 too. So, I think this parameter
deserves attention. If the value of (N. CPU) * CPU (in MHz) is greater than
10000 I get "Value specified in CPUWeight is out of range" in hypervisor.

As a workaround I configured service offering with 1 Mhz. This implies that
VMs with more CPUs have much more chance to get the CPU than VMs with lower
number of CPUs, because besides having more CPUs, they have more chance to
get the host' CPUs.

VM1 10 CPU * 1 MHz -> shares = 10
VM2 80 CPU * 1 MHz -> shares = 80

If we look at 1 CPU of VM2, it will have 8 times more chance to get the
host's CPU than 1 CPU of VM1, right?

Thank you!
:)

-- 
Jorge Luiz Corrêa
Embrapa Agricultura Digital

echo "CkpvcmdlIEx1aXogQ29ycmVhCkFu
YWxpc3RhIGRlIFJlZGVzIGUgU2VndXJhbm
NhCkVtYnJhcGEgQWdyaWN1bHR1cmEgRGln
aXRhbCAtIE5USQpBdi4gQW5kcmUgVG9zZW
xsbywgMjA5IChCYXJhbyBHZXJhbGRvKQpD
RVAgMTMwODMtODg2IC0gQ2FtcGluYXMsIF
NQClRlbGVmb25lOiAoMTkpIDMyMTEtNTg4
Mgpqb3JnZS5sLmNvcnJlYUBlbWJyYXBhLm
JyCgo="|base64 -d

-- 
__________________________
Aviso de confidencialidade

Esta mensagem da 
Empresa  Brasileira de Pesquisa  Agropecuaria (Embrapa), empresa publica 
federal  regida pelo disposto  na Lei Federal no. 5.851,  de 7 de dezembro 
de 1972,  e  enviada exclusivamente  a seu destinatario e pode conter 
informacoes  confidenciais, protegidas  por sigilo profissional.  Sua 
utilizacao desautorizada  e ilegal e  sujeita o infrator as penas da lei. 
Se voce  a recebeu indevidamente, queira, por gentileza, reenvia-la ao 
emitente, esclarecendo o equivoco.

Confidentiality note

This message from 
Empresa  Brasileira de Pesquisa  Agropecuaria (Embrapa), a government 
company  established under  Brazilian law (5.851/72), is directed 
exclusively to  its addressee  and may contain confidential data,  
protected under  professional secrecy  rules. Its unauthorized  use is 
illegal and  may subject the transgressor to the law's penalties. If you 
are not the addressee, please send it back, elucidating the failure.

Re: createServiceOffering: problems in web UI and cgroup version.

Posted by Ruben Bosch <ru...@cldin.eu>.
Hi Jorge,

Just looking at question 1, you are correct, but it also takes into account CPU overcommit ratio: https://github.com/apache/cloudstack/blob/731a83babfb371b9ee9bb18af9bd33ade7f2c774/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java#L4522 <https://github.com/apache/cloudstack/blob/731a83babfb371b9ee9bb18af9bd33ade7f2c774/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java#L4522>

If you have a suggestion to fix this or want to bring more attention to it, you're more than welcome to create an issue on the project page: https://github.com/apache/cloudstack/issues <https://github.com/apache/cloudstack/issues>

The shares option configures the share of CPU time allocated to the guests. This indeed has no relation to the clock speed assigned to the guest.

Question 2 I cannot answer.

Regarding question 3: Ubuntu 22.04 is not supported, indeed. But yes, the way you're configuring this does imply that a guest with 80 shares assigned will receive more CPU time than a guest with 10 shares, although I don't think that this is what you'd want to do. This is also the way CS would do it with any other number configured as CPU in MHz.

Met vriendelijke groet / Kind regards,

Ruben Bosch
CLDIN

> On 5 Sep 2022, at 21:33, Jorge Luiz Correa <jo...@embrapa.br.INVALID> wrote:
> 
> Hi! I'm having some problems related to the creation of a new service
> offering. I need to create one using the "Custom constrained" option to
> limit CPUs and memory. But, when "Custom constrained" is selected "CPU (in
> MHz)" is required.
> 
> (1) The first problem is that "CPU (in MHz)" has nothing to do with the CPU
> speed, right? The value configured as "CPU (in MHz)" is mapped to "shares"
> element in the cputune section of libvirt configuration of domain (KVM).
> Apparently this mapping is done using (N. CPUs) * CPU (in MHz). So, if I
> have a 1000 Mhz value in service offering and try to launch a VM with 80
> CPUs, I will get 80000 configured as 'shares' value. 'Shares' is a relative
> value that defines how much CPU time a VM will have when compared to
> others. This description in MHz is very confusing. Could this be changed?
> 
> (2) The second problem is why is this value required? Why couldn't we just
> inform the number of CPUs and memory to limit the ranges that service
> offering permits? In UI the value is required. Looking at
> createServiceOffering API definition the only two required parameters are
> displaytext and name. But trying to create I have:
> 
> create serviceoffering name="Custom VM" displaytext="Custom VM"
> storagetype=shared provisioningtype=fat mincpunumber=2 maxcpunumber=80
> minmemory=1000 maxmemory=1000000 offerha=true dynamicscalingenabled=true
> Error: (HTTP 431, error code 4350) For creating a custom compute offering
> min/max cpu and min/max memory/cpu speed should all be null or all specified
> 
> (3) The third problem is about the value of "CPU (in MHz)". According to (
> libvirt.org/formatdomain.html) the value should be in range [2, 262144].
> But, for operating systems using cgroup v2 the maximum value is 10000. I
> know that Ubuntu 22.04 I'm using here is not supported yet. But this will
> be an issue as other OSs adopt cgroup v2 too. So, I think this parameter
> deserves attention. If the value of (N. CPU) * CPU (in MHz) is greater than
> 10000 I get "Value specified in CPUWeight is out of range" in hypervisor.
> 
> As a workaround I configured service offering with 1 Mhz. This implies that
> VMs with more CPUs have much more chance to get the CPU than VMs with lower
> number of CPUs, because besides having more CPUs, they have more chance to
> get the host' CPUs.
> 
> VM1 10 CPU * 1 MHz -> shares = 10
> VM2 80 CPU * 1 MHz -> shares = 80
> 
> If we look at 1 CPU of VM2, it will have 8 times more chance to get the
> host's CPU than 1 CPU of VM1, right?
> 
> Thank you!
> :)
> 
> -- 
> Jorge Luiz Corrêa
> Embrapa Agricultura Digital
> 
> echo "CkpvcmdlIEx1aXogQ29ycmVhCkFu
> YWxpc3RhIGRlIFJlZGVzIGUgU2VndXJhbm
> NhCkVtYnJhcGEgQWdyaWN1bHR1cmEgRGln
> aXRhbCAtIE5USQpBdi4gQW5kcmUgVG9zZW
> xsbywgMjA5IChCYXJhbyBHZXJhbGRvKQpD
> RVAgMTMwODMtODg2IC0gQ2FtcGluYXMsIF
> NQClRlbGVmb25lOiAoMTkpIDMyMTEtNTg4
> Mgpqb3JnZS5sLmNvcnJlYUBlbWJyYXBhLm
> JyCgo="|base64 -d
> 
> -- 
> __________________________
> Aviso de confidencialidade
> 
> Esta mensagem da 
> Empresa  Brasileira de Pesquisa  Agropecuaria (Embrapa), empresa publica 
> federal  regida pelo disposto  na Lei Federal no. 5.851,  de 7 de dezembro 
> de 1972,  e  enviada exclusivamente  a seu destinatario e pode conter 
> informacoes  confidenciais, protegidas  por sigilo profissional.  Sua 
> utilizacao desautorizada  e ilegal e  sujeita o infrator as penas da lei. 
> Se voce  a recebeu indevidamente, queira, por gentileza, reenvia-la ao 
> emitente, esclarecendo o equivoco.
> 
> Confidentiality note
> 
> This message from 
> Empresa  Brasileira de Pesquisa  Agropecuaria (Embrapa), a government 
> company  established under  Brazilian law (5.851/72), is directed 
> exclusively to  its addressee  and may contain confidential data,  
> protected under  professional secrecy  rules. Its unauthorized  use is 
> illegal and  may subject the transgressor to the law's penalties. If you 
> are not the addressee, please send it back, elucidating the failure.