From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2 15/18] libxl: introduce libxl_retrieve_domain_configuration Date: Wed, 27 Aug 2014 03:13:52 +0100 Message-ID: <1409105632.28009.80.camel@citrix.com> References: <1406744639-28782-1-git-send-email-wei.liu2@citrix.com> <1406744639-28782-16-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1406744639-28782-16-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2014-07-30 at 19:23 +0100, Wei Liu wrote: > + /* Domain name */ > + /* Domain UUID */ Wasn't there a new libxl__update_domain_configuration which does a bunch of this for you already? > + /* "target" */ > + rc = libxl_get_memory_target(ctx, domid, &memory); > + if (rc) { > + LOG(ERROR, "fail to get memory target for domain %d", domid); > + goto out; > + } > + /* If the domain is HVM domain, target memory in xenstore is > + * smaller than what user has asked for. The difference is > + * video_memkb, so add it back. Otherwise domain rebuild will > + * fail. Ahem, lovely. Could you add a note at the point on creation where the opposite happens pointing here for the benefit of anyone who touched it... > + */ > + if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) > + d_config->b_info.target_memkb = > + memory + d_config->b_info.video_memkb; > + > + /* "static-max" */ > + rc = libxl_get_memory_static_max(ctx, domid, &memory); This and the libxl_get_memory_target are implemented in terms of a very handy internal helper that you added which returns both at the same time ;-) Ian.