[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-API] exception MEMORY_CONSTRAINT_VIOLATION



Marco Sinhoreli wrote:
I'm using the python xenapi. Above the source code for setup VM memory
dynamic and static:

<code>
[...]
# Configuring the VM memory
memory_size = str(memory_size * 1024 * 1024)
self.master.VM.set_memory_dynamic_max(vm, memory_size)
self.master.VM.set_memory_dynamic_min(vm, memory_size)
self.master.VM.set_memory_static_max(vm, memory_size)
self.master.VM.set_memory_static_min(vm, memory_size)
[...]
</code>

Okay, I think I can see the problem here.

XAPI rejects any API calls that would violate the following
constraint:

    static-min <= dynamic-min <= dynamic-max <= static-max

The section of code you've posted above makes four separate API
calls to update memory properties. XAPI will raise an exception
if any one of those four calls violate the above constraint. To
update memory properties in this way, you'd need to be careful
with the order in which you make the calls...

I recommend instead using the set-memory-limits function, which
allows you to update these four values atomically.

Marco, could you try replacing the above code with:

<code>
[...]
# Configuring the VM memory
memory_size = str(memory_size * 1024 * 1024)
self.master.VM.set_memory_limits(vm, memory_size, memory_size, memory_size, memory_size)
[...]
</code>

And let me know if that works?

Best wishes

Jonathan Knowles

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.