Hi Jhon,<div><br></div><div>On Tue, May 22, 2012 at 8:44 AM, Jhon Masschelein <span dir="ltr"><<a href="mailto:jhon.masschelein@sara.nl" target="_blank">jhon.masschelein@sara.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>Looking at the template in the sunstone interface (tabs at the bottom), we see both CPU and VCPU listed. However, when I look at the javascript array object used to fill in the vm table in sunstone, CPU nor VCPU were present.<br>



<br>Apparently there is a difference between getting the INFO from a VM and the POOL_INFO from the pool of VMs.<br></blockquote><div><br></div><div>The only difference is that the VM elements inside VM_POOL only include the last HISTORY records, whereas the individual VM info contains all of them.</div>



<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Of course, in our specific case, we would also like to enforce the rule:<br>MEMORY = #CPU * 8GB<br><br>But I do not see how this can be done in a nice way.<br></blockquote></div><div><br></div><div>This can be easily done with a new authorization driver. You would need to create a new 'authorize' script that ignores all actions except VM CREATE or TEMPLATE USE, and check your restriction. Take a look at the quota authorization driver [1] to get started.</div>

<div><br></div><div>Or you could force your users to instantiate only the VM Templates you provide. You just need to remove the CREATE right to all/some of your users, this is done with ACL rules [2]</div><div><br></div>
<div>
<br></div><div>Regards</div><div><br></div><div>[1] <a href="http://dev.opennebula.org/projects/opennebula/repository/revisions/master/show/src/authm_mad/remotes/quota" target="_blank">http://dev.opennebula.org/projects/opennebula/repository/revisions/master/show/src/authm_mad/remotes/quota</a></div>


<div>[2] <a href="http://opennebula.org/documentation:rel3.4:manage_acl">http://opennebula.org/documentation:rel3.4:manage_acl</a></div><div>--</div><div>Carlos Martín, MSc<br>Project Engineer<br>OpenNebula - The Open-source Solution for Data Center Virtualization<div>

<span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"><a href="http://www.OpenNebula.org" target="_blank">www.OpenNebula.org</a> | <a href="mailto:cmartin@opennebula.org" target="_blank">cmartin@opennebula.org</a> | <a href="http://twitter.com/opennebula" target="_blank">@OpenNebula</a></span><span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"><a href="mailto:cmartin@opennebula.org" style="color:rgb(42,93,176)" target="_blank"></a></span></div>



<br>
<br><br><div class="gmail_quote">On Tue, May 22, 2012 at 8:44 AM, Jhon Masschelein <span dir="ltr"><<a href="mailto:jhon.masschelein@sara.nl" target="_blank">jhon.masschelein@sara.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



Hi,<br>
<br>
Sorry for the late reply, I wasn't in the office last week.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The attribute VM/TEMPLATE/CPU should exist if the user defined the CPU<br>
in the template. But CPU is an optional value.<br>
You said that you bill by resource allocation; are you taking into<br>
account this optional attribute?<br>
</blockquote>
<br></div>
We consider 1 cpu core + 8GB of memory to be equal to 1 "cloud unit". Out billing is based on a report that takes this into account. We use the information from the opennebula vm_pool table.<br>
<br>
Looking at the template in the sunstone interface (tabs at the bottom), we see both CPU and VCPU listed. However, when I look at the javascript array object used to fill in the vm table in sunstone, CPU nor VCPU were present.<br>




<br>
Apparently there is a difference between getting the INFO from a VM and the POOL_INFO from the pool of VMs.<br>
<br>
I tried to figure out where in the code this difference was made, but I could not put to much time in this and had to leave it.<br>
<br>
(Please remember this is all 3.2.1. It might be solved in 3.4.)<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If you bill users depending on the CPU and MEMORY attributes, maybe<br>
opennebula should provide a way to make any attribute mandatory... We<br>
could add a new section to oned.conf, similar to the restricted<br>
attributes [2] (introduced in 3.4). For example,<br>
<br>
VM_MANDATORY_ATT = "CPU"<br>
</blockquote>
<br></div>
This would actually not be a bad thing. At this moment, we are making some fields mandatory in sunstone, but when they use for example the xml-rpc, they can work around it. In the end they still get billed since we know from the vm_pool table what they used, but for the users, it might be a surprise. It would be better if an "incomplete" VM template would not instantiate.<br>




<br>
Of course, in our specific case, we would also like to enforce the rule:<br>
MEMORY = #CPU * 8GB<br>
<br>
But I do not see how this can be done in a nice way.<br>
<br>
Anyway, sorry again for the late reply.<br>
<br>
Best regards,<br>
<br>
Jhon<br>
<br>
</blockquote></div><br></div>