From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2 13/18] libxl: make libxl_cd_insert "eject" + "insert" Date: Thu, 28 Aug 2014 19:14:35 +0100 Message-ID: <1409249675.21481.20.camel@citrix.com> References: <1406744639-28782-1-git-send-email-wei.liu2@citrix.com> <1406744639-28782-14-git-send-email-wei.liu2@citrix.com> <1409105086.28009.76.camel@citrix.com> <20140828112527.GK13165@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140828112527.GK13165@zion.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: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2014-08-28 at 12:25 +0100, Wei Liu wrote: > On Wed, Aug 27, 2014 at 03:04:46AM +0100, Ian Campbell wrote: > > On Wed, 2014-07-30 at 19:23 +0100, Wei Liu wrote: > > > A "cdrom insert" is always processed as "eject" + "insert", with JSON > > > config updated in between. So that we can know the correct state of > > > CDROM later when we try to retrieve domain configuration: if xenstore is > > > "empty", then CDROM is "empty"; otherwise use the information presented > > > in JSON. > > > > When you say "empty" do you mean literally that the xenstore nodes do > > not exist or that one of them contains the string "empty"? If, as I > > suspect, you mean the former then writing > > if xenstore nodes are not present then CDROM is "empty" > > would confuse me less. > > > > The xenstore node still exists, just that "params" doesn't point to > media. "doesn't point to" means doesn't exist or contains the empty string? I think it would be good to be explicit there. > I can rephrase this: > > If xenstore entry doesn't point to media file then CDROM is "empty". > > > > + rc = libxl__cdrom_insert(ctx, domid, &empty, NULL); > > > + if (rc) > > > + goto out; > > > + > > > + /* Optimisation: don't insert empty disk twice, and skip > > > + * manipulating JSON. */ > > > > Do we not need to update the JSON in this case to reflect that it is now > > empty? > > > > We could but we don't have to -- xenstore is primary reference. OK.