From: Ian Jackson Subject: Re: [PATCH V5 31/32] libxl: update domain configuration when updating memory targets Date: Tue, 20 May 2014 17:03:06 +0100 Message-ID: <21371.31930.497460.561841@mariner.uk.xensource.com> References: <1400018054-26038-1-git-send-email-wei.liu2@citrix.com> <1400018054-26038-32-git-send-email-wei.liu2@citrix.com> <21371.29430.825838.51813@mariner.uk.xensource.com> <1400600103.6946.102.camel@kazak.uk.xensource.com> <21371.30799.888333.410499@mariner.uk.xensource.com> <1400601329.6946.107.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1400601329.6946.107.camel@kazak.uk.xensource.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: Ian Campbell Cc: Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [PATCH V5 31/32] libxl: update domain configuration when updating memory targets"): > On Tue, 2014-05-20 at 16:44 +0100, Ian Jackson wrote: > > Merging the lists from libxl_device_disk_list and the JSON > > configuration shouldn't be too hard and will eliminate a lot of worry > > about races. > > I think the presence of defaults in the libxl API makes it hard. What I'm suggesting for the implementation of "get list of disks for retreived configuration" is something like this: * Read JSON with list of stored disk configs * Iterate over actual devices a la libxl_device_disk_list * For each device, look for corresponding configuration in disk config. * If no such configuration, print a warning and make one up along the lines of libxl_device_disk_getinfo * If there was such a configuration, update the dynamically adjustable fields by copying them from xenstore: * currently, I think this is only the backing device info (which can be modified dynamically for cds at least) * Add resulting disk config to new list of disk configs * Replace stored list of disk configs with new one The effect is that the pre-defaulted configuration takes precedence but that it is safe to write a JSON configuration containing devices which are about to be added. Ian.