Received: from eggs.gnu.org ([2001:4830:134:3::10]:39847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bq2a2-0000Mp-3r for qemu-devel@nongnu.org; Fri, 30 Sep 2016 14:30:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bq2a0-00025e-PW for qemu-devel@nongnu.org; Fri, 30 Sep 2016 14:30:41 -0400 References: From: Eric Blake Message-ID: <2b382eab-5cca-ed14-1a1f-ee25f6d31006@redhat.com> Date: Fri, 30 Sep 2016 13:30:30 -0500 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="q8si2eBm5RmrdepvvAe2H2mVTWdjbGp03" Subject: Re: [Qemu-devel] Transactions, Jobs, and Cancellation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: Qemu-block , qemu-devel This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --q8si2eBm5RmrdepvvAe2H2mVTWdjbGp03 From: Eric Blake To: John Snow Cc: Qemu-block , qemu-devel Message-ID: <2b382eab-5cca-ed14-1a1f-ee25f6d31006@redhat.com> Subject: Re: Transactions, Jobs, and Cancellation References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/30/2016 11:35 AM, John Snow wrote: > Hi Eric (as a proxy for Libvirt); >=20 > I want to make a change to transactions such that they do not actually > start the jobs until the entire transaction is error-checked for validi= ty. >=20 > This would be a change from the current setup where: >=20 > - Some jobs are started > - One job cannot start > - Existing jobs are cancelled, emitting job events > - QMP transaction returns failure. In this case, the number of events emitted is less than the number of events comprising the overall transaction, right? >=20 > to something more like: >=20 > - Some jobs are queued to start > - One job cannot start > - Existing queued jobs are un-created > - No events are emitted, but the QMP transaction fails. Is the failure guaranteed to be synchronous to the QMP command that requested the 'transaction' command? If so, I think you're fine: in general, libvirt is looking for events (and presumably N events for a 'transaction' with N components) _only_ if the 'transaction' command itself succeeded; but if the 'transaction' command fails, then there is no expectation of events. If the failure is asynchronous (and can happen even after 'transaction' returns success), then it gets a bit weirder; but libvirt still tries to operate on the principle that events are best-effort notifications and may be missed, so as long as it is always possible to poll QMP and learn the same information as would have been presented in the omitted events, we are probably still okay. >=20 > If I understand correctly, it's possible for the transaction to fail > even after it has started several jobs because they begin operating > during the prepare phase. >=20 > Then, because the transaction preparation has failed, QEMU will cancel > the transaction instead of proceeding, which will generate some > BLOCK_JOB_CANCELLED events. >=20 > This may affect libvirt and others if I change these semantics. >=20 > Does that sound appropriate to you, or would you from a libvirt > perspective RATHER get events for "uncreated" jobs like you do now? I > could make it do either, but I'd rather prefer to simply not emit event= s > for jobs that didn't truly never start. Avoiding events for jobs that never start makes sense if the transaction itself returns failure. >=20 > I can also begin emitting events for jobs that *actually* start if it > would help to disambiguate the cases between old and new transactions. >=20 > Note: This has nothing to do with the transactional-cancel property, > which only impacts what happens when jobs created by a transaction fail= > AFTER a successful return from qmp_transaction. Ah, so it sounds like this is ALL about the synchronous case (that is, the old behavior was that _even_ when 'transaction' fails, some events were possibly leaked for < N portions of the transaction, if the earlier portions were started to the point that they could emit a cancelled event as a result of the later portions never starting). So I think your idea makes sense. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --q8si2eBm5RmrdepvvAe2H2mVTWdjbGp03 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX7q9GAAoJEKeha0olJ0Nq2LcIAKkijezIkNcujsqSv+oWgxFX nX+f1XdSjSx4hPk6tYwezNYHF+6KNY++YEi2FZpJvyyRXTMqEMJHVrpD7GQH2IN3 qbo9jf8M23v8AtwOJeGtUtue/PN3CA1Kkkg2DyXjVxC50+s2Zk2dfopmhnXDzm/i i+uHFxZGhz5QSQSH3JN4Tz90VWj70Mmu9mroaZOnWUbJZ4WFuHSKmA+AmQG9YHe+ /veQ5yH0kO1mnmVAycHVoKC+u5B0KvrZazIbw/k9Pvv3NBhtxHFmm+QIhM0Wha5Z VXKFx9PGwBrJ8fk12OuPe3RPAcb6Df3zfi1Pwtp/T72TPzLfEVeO1MSvxUesQmI= =U2t0 -----END PGP SIGNATURE----- --q8si2eBm5RmrdepvvAe2H2mVTWdjbGp03--