<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 25, 2017 at 8:29 PM, Michal Skrivanek <span dir="ltr"><<a href="mailto:michal.skrivanek@redhat.com" target="_blank">michal.skrivanek@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-4237286733358952036HOEnZb"><div class="m_-4237286733358952036h5"><br>
<br>
> On 25 Dec 2017, at 18:41, Juan Hernández <<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>> wrote:<br>
><br>
> On 12/25/2017 05:46 PM, Yaniv Kaul wrote:<br>
>> While trying to add an instance type, I fail with the error:<br>
>> Operation Failed". Fault detail is "[Cannot add Template. Memory size<br>
>> (1024MB) cannot exceed maximum memory size (0MB).]<br>
>> The code is taken from the example in the SDK, so I'm not sure what I'm<br>
>> doing wrong here.<br>
>> Code:<br>
>> instance_types_service.add(<br>
>> types.InstanceType(<br>
>> name='myinstancetype',<br>
>> description='My instance type',<br>
>> memory=1 * 2**30,<br>
>> high_availability=types.HighA<wbr>vailability(<br>
>> enabled=True,<br>
>> ),<br>
>> cpu=types.Cpu(<br>
>> topology=types.CpuTopology(<br>
>> cores=2,<br>
>> sockets=2,<br>
>> ),<br>
>> ),<br>
>> ),<br>
>> )<br>
>> engine.log:<br>
>> 2017-12-25 10:58:19,825-05 INFO<br>
>> [org.ovirt.engine.core.bll.Add<wbr>VmTemplateCommand] (default task-13)<br>
>> [265ff704-d89f-471b-8207-fc0e1<wbr>b8816fd] Lock Acquired to object<br>
>> 'EngineLock:{exclusiveLocks='[<wbr>myinstancetype=TEMPLATE_NAME,<br>
>> 703e1265-e160-4a76-82e6-069741<wbr>56b7b9=TEMPLATE]', sharedLocks='[]'}'<br>
>> 2017-12-25 10:58:19,831-05 WARN<br>
>> [org.ovirt.engine.core.bll.Add<wbr>VmTemplateCommand] (default task-13)<br>
>> [265ff704-d89f-471b-8207-fc0e1<wbr>b8816fd] Validation of action 'AddVmTemplate'<br>
>> failed for user admin@internal-authz. Reasons:<br>
>> VAR__ACTION__ADD,VAR__TYPE__VM<wbr>_TEMPLATE,ACTION_TYPE_FAILED_<wbr>MAX_MEMORY_CANNOT_BE_SMALLER_<wbr>THAN_MEMORY_SIZE,$maxMemory<br>
>> 0,$memory 1024<br>
>> 2017-12-25 10:58:19,832-05 INFO<br>
>> [org.ovirt.engine.core.bll.Add<wbr>VmTemplateCommand] (default task-13)<br>
>> [265ff704-d89f-471b-8207-fc0e1<wbr>b8816fd] Lock freed to object<br>
>> 'EngineLock:{exclusiveLocks='[<wbr>myinstancetype=TEMPLATE_NAME,<br>
>> 703e1265-e160-4a76-82e6-069741<wbr>56b7b9=TEMPLATE]', sharedLocks='[]'}'<br>
>> 2017-12-25 10:58:19,839-05 DEBUG<br>
>> [org.ovirt.engine.core.common.<wbr>di.interceptor.DebugLoggingInt<wbr>erceptor]<br>
>> (default task-13) [265ff704-d89f-471b-8207-fc0e1<wbr>b8816fd] method: runAction,<br>
>> params: [AddVmTemplate,<br>
>> AddVmTemplateParameters:{comma<wbr>ndId='179df9ed-209c-4882-a19a-<wbr>b76a4fe1adb8',<br>
>> user='null', commandType='Unknown'}], timeElapsed: 33ms<br>
>> 2017-12-25 10:58:19,846-05 ERROR<br>
>> [org.ovirt.engine.api.restapi.<wbr>resource.AbstractBackendResour<wbr>ce] (default<br>
>> task-13) [] Operation Failed: [Cannot add Template. Memory size (1024MB)<br>
>> cannot exceed maximum memory size (0MB).]<br>
>> TIA,<br>
>> Y.<br>
><br>
> I think this is related to the new `memory_policy.max` attribute that was introduced in 4.1. I think that for virtual machines it has a default value so that it isn't necessary to explicitly provide it. It may not have a default value fro instance types. Can you try adding this to the request to create the instance type?<br>
><br>
> memory_policy=types.MemoryPoli<wbr>cy(<br>
> max=1 * 2**30<br>
> )<br>
><br>
> Then try again. If it works I think that we need to fix the engine so that it assigns a default value, like it does for virtual machines.<br></div></div></blockquote><div><br></div><div>Thanks, that worked.</div><div>We also need to fix the example in the SDK...</div><div>Y.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-4237286733358952036HOEnZb"><div class="m_-4237286733358952036h5">
<br>
</div></div>The default for VMs comes from the Blank template. There’s no template for instance types, so it always needs to be provided<br>
<br>
> ______________________________<wbr>_________________<br>
> Devel mailing list<br>
> <a href="mailto:Devel@ovirt.org" target="_blank">Devel@ovirt.org</a><br>
> <a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman<wbr>/listinfo/devel</a><br>
><br>
><br>
<br>
</blockquote></div><br></div></div>