From: Olaf Hering <olaf@aepfle.de>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH v3 4/4] libxl: add support for vscsi
Date: Fri, 6 Mar 2015 16:25:54 +0100 [thread overview]
Message-ID: <20150306152554.GD21639@aepfle.de> (raw)
In-Reply-To: <20150306143125.GX12103@zion.uk.xensource.com>
On Fri, Mar 06, Wei Liu wrote:
> I think you need to fix some overly long lines. I won't mention them
> individually inline.
Some are just copy&paste from other places. I will check what can be
trimmed.
> Regarding all the parsing stuffs, you haven't defined vscsispec so I
> cannot review it. You might want to look at
> docs/misc/xl-disk-configuration.txt.
Its in pvscsi.txt, not complete yet.
> I'm not suggesting you have to write something like that, but
> considering all the compatibility issues you might have you might
> actually end up writing up a document like that.
I will check if its needed.
> Then after that, do you consider writing a lexer for vscsispec?
> We have one for diskspec, see libxlu_disk_l.l. That might result in a
> shorter patch?
The bulk is not the parser but using the result of the parsing. Or do
you spot something that is better done with flex?
> On Fri, Mar 06, 2015 at 10:45:56AM +0100, Olaf Hering wrote:
> > Port pvscsi support from xend to libxl. See pvscsi.txt for details.
> > Outstanding work is listed in the TODO section.
> There is no TODO section in this patch. :-)
See the line above, its in pvscsi.txt.
> Better split this patch into two. One for libxl and one for xl.
>
> Or you can even split it into three, one for introducing libxl types,
> one for implementing functionalities in libxl and one for xl.
Would that actually improve things? In another thread it was suggested
to have it all in a single patch to avoid jumping around between mails.
> > +void libxl__device_vscsi_add(libxl__egc *egc, uint32_t domid,
> > + libxl_device_vscsi *vscsi,
> > + libxl__ao_device *aodev)
> You need to update this domain's JSON configuration. Cf.
> libxl__device_vtpm_add and friends. Also look at libxl_internal.h L2310.
So I need to add my function to the comment near DEFINE_DEVICE_ADD()?
Or do you mean something else?
> > +{
> > + STATE_AO_GC(aodev->ao);
> > + libxl_ctx *ctx = libxl__gc_owner(gc);
> > + flexarray_t *front;
> > + flexarray_t *back;
> > + libxl__device *device;
> > + char *be_path;
> > + unsigned int be_dirs = 0, rc, i;
> > +
> > + if (vscsi->devid == -1) {
> > + rc = ERROR_FAIL;
> > + goto out;
> > + }
> > +
> > + /* Prealloc key+value: 4 toplevel + 4 per device */
> > + i = 2 * (4 + (4 * vscsi->num_vscsi_devs));
> > + back = flexarray_make(gc, i, 1);
> > + front = flexarray_make(gc, 2 * 2, 1);
> > +
> > + GCNEW(device);
> > + rc = libxl__device_from_vscsi(gc, domid, vscsi, device);
> > + if ( rc != 0 ) goto out;
> > +
> Coding style. No space after ( and before ). You can even just use
> if (!rc) goto out;
Copy&paste from some similar code from staging-4.4:
libxl__device_vtpm_add
> > + /* Check if backend device path is already present */
> > + be_path = libxl__device_backend_path(gc, device);
> > + if (!libxl__xs_directory(gc, XBT_NULL, be_path, &be_dirs) || !be_dirs) {
> > + /* backend does not exist, create a new one */
> > + flexarray_append_pair(back, "frontend-id", GCSPRINTF("%d", domid));
> > + flexarray_append_pair(back, "online", "1");
> > + flexarray_append_pair(back, "state", "1");
> > + flexarray_append_pair(back, "feature-host", GCSPRINTF("%d", !!vscsi->feature_host));
> > +
> > + flexarray_append_pair(front, "backend-id", GCSPRINTF("%d", vscsi->backend_domid));
> > + flexarray_append_pair(front, "state", "1");
> > + }
> > +
> > + for (i = 0; i < vscsi->num_vscsi_devs; i++) {
> > + libxl_vscsi_dev *v = vscsi->vscsi_devs + i;
> > + /* Trigger removal, otherwise create new device */
> Why do you want to trigger removal in "add" function?
Because the vscsi is a single_host:many_devices, contrary to
single_host:singe_device for other backends.
> Please avoid using goto to retry transaction.
Just copy&paste from other code, just grep for "retry_transaction".
> > +void libxl_device_vscsi_append_dev(libxl_ctx *ctx, libxl_device_vscsi *hst,
> > + libxl_vscsi_dev *dev)
> > +{
>
> Can this only be an internal function? I.e. use libxl__ namespace.
Ok, will add the underscore.
Olaf
next prev parent reply other threads:[~2015-03-06 15:25 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 9:45 [PATCH v3 0/4] libbxl: add support for pvscsi, iteration 3 Olaf Hering
2015-03-06 9:45 ` [PATCH v3 1/4] vscsiif.h: fix WWN notation for p-dev property Olaf Hering
2015-03-06 9:45 ` [PATCH v3 2/4] docs: add vscsi to xenstore-paths.markdown Olaf Hering
2015-03-06 13:55 ` Wei Liu
2015-03-06 15:07 ` Olaf Hering
2015-03-06 9:45 ` [PATCH v3 3/4] docs: add pvscsi.txt Olaf Hering
2015-03-06 13:55 ` Wei Liu
2015-03-06 15:11 ` Olaf Hering
2015-03-06 15:37 ` Wei Liu
2015-03-11 15:23 ` Ian Campbell
2015-03-06 9:45 ` [PATCH v3 4/4] libxl: add support for vscsi Olaf Hering
2015-03-06 14:31 ` Wei Liu
2015-03-06 15:25 ` Olaf Hering [this message]
2015-03-06 15:53 ` Wei Liu
2015-03-09 16:08 ` Olaf Hering
2015-03-09 16:46 ` Wei Liu
2015-03-11 15:24 ` Ian Campbell
2015-03-11 15:33 ` Ian Campbell
2015-03-11 16:02 ` Olaf Hering
2015-03-11 16:09 ` Ian Campbell
2015-03-13 13:49 ` Olaf Hering
2015-03-11 16:06 ` Olaf Hering
2015-03-12 16:07 ` Olaf Hering
2015-03-12 16:47 ` Ian Campbell
2015-03-13 13:45 ` Olaf Hering
2015-03-13 15:10 ` Wei Liu
2015-03-16 8:16 ` Olaf Hering
2015-03-16 11:30 ` Wei Liu
2015-03-12 16:20 ` Olaf Hering
2015-03-12 16:46 ` Ian Campbell
2015-03-13 13:44 ` Olaf Hering
2015-03-13 14:18 ` Ian Campbell
2015-03-26 12:55 ` Olaf Hering
2015-03-26 13:46 ` Ian Campbell
2015-03-27 7:38 ` Olaf Hering
2015-04-10 9:23 ` wating for backend changes (was Re: [PATCH v3 4/4] libxl: add support for vscsi) Olaf Hering
2015-04-14 15:55 ` Olaf Hering
2015-04-15 11:50 ` Ian Jackson
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=20150306152554.GD21639@aepfle.de \
--to=olaf@aepfle.de \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.