From: Wei Liu Subject: Re: [PATCH v2 13/18] libxl: make libxl_cd_insert "eject" + "insert" Date: Thu, 28 Aug 2014 12:25:27 +0100 Message-ID: <20140828112527.GK13165@zion.uk.xensource.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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1409105086.28009.76.camel@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: Ian Campbell Cc: ian.jackson@eu.citrix.com, Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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. 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. Wei. > Ian/