WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

Re: [Xen-API] exception MEMORY_CONSTRAINT_VIOLATION

To: Marco Sinhoreli <msinhore@xxxxxxxxx>
Subject: Re: [Xen-API] exception MEMORY_CONSTRAINT_VIOLATION
From: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Date: Wed, 25 Nov 2009 11:48:30 +0000
Cc: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 25 Nov 2009 03:48:30 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20fe3cf60911250334j1d5043d8v45ae5c2b4828e40d@xxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <20fe3cf60911242144j6f684c07o2233be697eb14ebf@xxxxxxxxxxxxxx> <4B0D0470.1060402@xxxxxxxxxxxxx> <20fe3cf60911250334j1d5043d8v45ae5c2b4828e40d@xxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.23 (X11/20090817)
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