From: Eduardo Habkost <ehabkost@redhat.com>
To: Cleber Rosa <crosa@redhat.com>
Cc: "Amador Pahim" <amador@pahim.org>, "Fam Zheng" <famz@redhat.com>,
qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [Qemu-devel] [PATCH v3 3/5] Acceptance tests: add quick VNC tests
Date: Wed, 30 May 2018 18:31:22 -0300 [thread overview]
Message-ID: <20180530213122.GA3184@localhost.localdomain> (raw)
In-Reply-To: <8a92255d-51b7-89b0-59e5-2ac60cf026b1@redhat.com>
On Wed, May 30, 2018 at 05:03:56PM -0400, Cleber Rosa wrote:
> On 05/30/2018 04:00 PM, Eduardo Habkost wrote:
[...]
> [...] Now, in addition to this very personal, and thus
> insignificant botheration, it restricts API design. By signaling to
> users that this is valid:
>
> self.vm.add_args(...).launch(...).shutdown()
>
> We'd be restricted on the design of, say, migrate(). Even if it sounds
> sensible to return a boolean indicating migration success, for
> consistency, it'd require a "return self".
[...]
> > I don't see why this would be an argument against making this
> > possible:
> >
> > self.vm.add_args('-nodefaults', '-S').launch()
>
> Right, it's *mostly* style. But, it suggests that all methods work
> similarly and thus restricts API design as mentioned before.
[...]
> > They are more readable than the complex method chaining examples
> > you have shown, but I don't see any argument against:
> >
> > self.vm.add_args(...).launch()
>
> Right. This one looks nice indeed. *My* issues are related to
> expectations (all methods support this?), consistency (all methods
> should support this!) and the design limitations it brings.
>
These are good points.
I believe it would be a reasonable convention to make methods
that change QEMU configuration return self (because they are
often called one after another), but other methods like launch()
migrate(), and shutdown() don't have to.
So this would work:
self.vm.add_args(...).add_drive(...).launch()
But this doesn't have to:
self.vm.add_args(...).launch().migrate().shutdown()
--
Eduardo
next prev parent reply other threads:[~2018-05-30 21:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 19:37 [Qemu-devel] [PATCH v3 0/5] Acceptance/functional tests Cleber Rosa
2018-05-29 19:37 ` [Qemu-devel] [PATCH v3 1/5] Add functional/acceptance tests infrastructure Cleber Rosa
2018-05-30 12:54 ` Stefan Hajnoczi
2018-05-30 18:15 ` Cleber Rosa
2018-05-29 19:37 ` [Qemu-devel] [PATCH v3 2/5] scripts/qemu.py: allow adding to the list of extra arguments Cleber Rosa
2018-05-30 12:54 ` Stefan Hajnoczi
2018-05-29 19:37 ` [Qemu-devel] [PATCH v3 3/5] Acceptance tests: add quick VNC tests Cleber Rosa
2018-05-30 12:57 ` Stefan Hajnoczi
2018-05-30 13:04 ` Fam Zheng
2018-05-30 16:29 ` Eduardo Habkost
2018-05-30 18:00 ` Cleber Rosa
2018-05-30 20:00 ` Eduardo Habkost
2018-05-30 21:03 ` Cleber Rosa
2018-05-30 21:31 ` Eduardo Habkost [this message]
2018-05-30 22:28 ` Cleber Rosa
2018-05-30 12:57 ` Stefan Hajnoczi
2018-05-29 19:37 ` [Qemu-devel] [PATCH v3 4/5] scripts/qemu.py: introduce set_console() method Cleber Rosa
2018-05-30 19:17 ` Stefan Hajnoczi
2018-05-29 19:37 ` [Qemu-devel] [PATCH v3 5/5] Acceptance tests: add Linux kernel boot and console checking test Cleber Rosa
2018-05-30 19:20 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180530213122.GA3184@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=amador@pahim.org \
--cc=crosa@redhat.com \
--cc=f4bug@amsat.org \
--cc=famz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).