libbxl: add support for pvscsi, iteration 8
v8 cover libbxl: add support for pvscsi, iteration 8
Port vscsi=[] and scsi-{attach,detach,list} commands from xend to libxl.
libvirt uses its existing SCSI support:
http://lists.xenproject.org/archives/html/xen-devel/2015-04/msg02963.html
targetcli/rtslib has to be aware of xen-scsiback (upstream unresponsive):
http://article.gmane.org/gmane.linux.scsi.target.devel/8146
TODO:
- comply with tools/libxl/CODING_STYLE everywhere
- document pvscsi in xen wiki
Changes between v7 and v8:
- Make be_path const in libxl__device_vscsictrl_add
- Adjust years in Copyright
- Whitespace in libxl_device_vscsictrl idl
- Implement libxl_device_vscsictrl_destroy
- Set backend_devid
- Reorder assignments in libxl__device_vscsictrl_add
- Whitespace changes for libxl__device_vscsi_reconfigure_add
- Register watch unconditionally in libxl__device_vscsidev_rm
- Wait for StateClosing for unconnected frontends in detach
- Adjust logic in libxl__vscsi_fill_dev
- Rework scsi-detach
- Increase swap partition from 12 to 96 blocks for mkswap
- Update MERGE macro for vscsictrls
Changes between v6 and v7:
- rebase to 'staging' (3b971de)
- Introduce libxl_device_vscsictrl_append_vscsidev
- Add libxl__vscsi_collect_ctrls and used it in libxl_device_vscsictrl_list
- Convert type of lun from u32 to u64 per SCSI spec
- Use vscsi_saved in libxl__device_vscsictrl_add
- Assign unique vscsidev_id per vscsictrl
- Rename vscsi_dev to vscsidev in function names
- Rename variables in libxl_vscsiinfo
- Rename locals to refer to ctrl/dev
- Rename various strings from host to ctrl
- Rename local variables vscsi_ctrl to vscsictrl
- Rename libxl_device_vscsictrl->vscsi_devs to vscsidevs
- Remove libxl_device_vscsidev->remove, rework detach
- Rename libxl_device_vscsidev->vscsi_dev_id to vscsidev_id
- Rename local variables vscsi_host to vscsi_ctrl
- Rename local variables v_hst to v_ctrl
- Remove libxl_device_vscsictrl->v_hst
- Rename libxl_vscsi_dev to libxl_device_vscsidev
- Rename libxl_device_vscsi to libxl_device_vscsictrl
http://lists.xenproject.org/archives/html/xen-devel/2016-02/msg00884.html
Changes between v5 and v6:
- rebase to 'staging' (a7b39c8 and b7e7ad8)
- Fix off-by-one in xlu__vscsi_compare_udev
- xl.cfg: use options instead of option
- xl.cfg: fix grammar for pdev/options
- xl.cfg: fix Usually typo
- Remove next_vscsi_dev_id from libxl_device_vscsi
- Use XLU_WWN_LEN also in libxl_vscsi.c
http://lists.xenproject.org/archives/html/xen-devel/2015-11/msg01446.html
Changes between v4 and v5:
- vscsiif.h: refer to backend_domid
- Set update_json in libxl_device_vscsi_remove
- Remove comment from libxl__device_vscsi_add
- Remove debug LOG from libxl__device_vscsi_reconfigure
- Move local nb variable in libxl__device_vscsi_reconfigure
- Make be_path const in libxl__device_vscsi_reconfigure
- Adjust libxl__device_vscsi_dev_backend_set to avoid long lines
- Adjust libxl__device_vscsi_dev_backend_rm to avoid long lines
- Use CTX in libxl__device_vscsi_dev_backend_rm
- Make be_path const in libxl__device_vscsi_dev_backend_rm
- xl.cfg: Its typo
- xl.cfg: Use persistent instead of persistant
- Rename feature_host to scsi_raw_cmds
- target-create-xen-scsiback.sh: detect pvops and xenlinux
- Wrap long lines in main_vscsilist
- Call libxl_vscsiinfo_dispose unconditional
- Let scsi-list print p-dev instead of p-devname
- Handle broken vscsi device entry in xenstore
- Split libxl__vscsi_fill_host from libxl_device_vscsi_list
- Make xlu_vscsi_append_dev static
- Remove reference to pvscsi.txt from xenstore-paths.markdown
- xl.cfg: update Linux and xenlinux
- xl.cfg: refer to backend domain instead of dom0
- xl.cfg: be more verbose what persistant format is
- return if libxl__device_vscsi_dev_backend_set fails in libxl__device_vscsi_new_backend
- target-create-xen-scsiback.sh: set also alias for libvirt
http://lists.xenproject.org/archives/html/xen-devel/2015-05/msg00523.html
Changes between v3 and v4:
- Use libxl__device_nextid in libxl__device_vscsi_add
- Remove check for duplicate pdev assignment from libxl_device_vscsi_get_host
- Caller provides libxl_device_vscsi to libxl_device_vscsi_get_host
- Define LIBXL_HAVE_VSCSI
- Remove init_val from libxl_vscsi_pdev_type
- Move some functions from libxl to libxlu
- Introduce libxl_device_vscsi->next_vscsi_dev_id to handle holes
- Use Struct in KeyedUnion for ocaml idl
- docs: Mention pvscsi in xl and xl.cfg
- Turn feature_host into a defbool and add checking
- Support pvops and /dev/ nodes in config
- Wrap entire libxlu_vscsi.c with ifdef linux
- Set remove flag in libxl_device_vscsi_list
- Fix vscsiif path in xenstore-paths.markdown
- vscsiif.h: add some notes about xenstore layout
- Add copyright to libxlu_vscsi.c and libxl_vscsi.c
- Scripts to create and delete xen-scsiback nodes in Linux target framework
- Remove pvscsi.txt
http://lists.xenproject.org/archives/html/xen-devel/2015-04/msg01949.html
Changes between v2 and v3:
- Adjust change for vscsiif.h
- Support "naa.wwn:lun" notation in pvops kernel
- Add example for pvops kernel using targetcli
patch required for python-rtslib:
http://article.gmane.org/gmane.linux.scsi.target.devel/8146
- Use vdev variable in libxl_device_vscsi_parse
http://lists.xenproject.org/archives/html/xen-devel/2015-03/msg00734.html
Changes between v1 and v2:
- ported to current staging
http://lists.xenproject.org/archives/html/xen-devel/2015-03/msg00030.html
Initial attempt was sent a year ago:
http://lists.xenproject.org/archives/html/xen-devel/2014-04/msg03958.html
Most comments are addressed.
This version has been tested with SLES as backend and frontend. This version has been tested with pvops as backend and SLES as frontend.
Olaf Hering (5):
vscsiif.h: fix WWN notation for p-dev property
docs: add vscsi to xenstore-paths.markdown
libxl: add support for vscsi
vscsiif.h: add some notes about xenstore layout Scripts to create and delete xen-scsiback nodes in Linux target
framework
docs/man/xl.cfg.pod.5 | 55 +++ docs/man/xl.pod.1 | 18 + docs/misc/xenstore-paths.markdown | 10 + tools/libxl/Makefile | 2 + tools/libxl/libxl.c | 420 +++++++++++++++++++ tools/libxl/libxl.h | 35 ++ tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_device.c | 2 + tools/libxl/libxl_internal.h | 19 + tools/libxl/libxl_types.idl | 53 +++ tools/libxl/libxl_types_internal.idl | 1 + tools/libxl/libxl_vscsi.c | 615 +++++++++++++++++++++++++++ tools/libxl/libxlu_vscsi.c | 697 +++++++++++++++++++++++++++++++ tools/libxl/libxlutil.h | 18 + tools/libxl/xl.h | 3 + tools/libxl/xl_cmdimpl.c | 208 ++++++++- tools/libxl/xl_cmdtable.c | 15 + tools/misc/Makefile | 4 + tools/misc/target-create-xen-scsiback.sh | 135 ++++++ tools/misc/target-delete-xen-scsiback.sh | 41 ++ xen/include/public/io/vscsiif.h | 70 +++- 21 files changed, 2420 insertions(+), 2 deletions(-) create mode 100644 tools/libxl/libxl_vscsi.c create mode 100644 tools/libxl/libxlu_vscsi.c create mode 100755 tools/misc/target-create-xen-scsiback.sh create mode 100755 tools/misc/target-delete-xen-scsiback.sh
PATCH v8 1/5 vscsiif.h: fix WWN notation for p-dev property
The pvops kernel expects either "naa.WWN:LUN" or "h:c:t:l" in the p-dev property. Add the missing :LUN part to the comment.
--- xen/include/public/io/vscsiif.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/public/io/vscsiif.h +1 -1
@@ -60,7 +60,7 @@* * A string specifying the backend device: either a 4-tuple "h:c:t:l" * (host, controller, target, lun, all integers), or a WWN (e.g. -* "naa.60014054ac780582"). +* "naa.60014054ac780582:0"). * * v-dev * Values: string
Re: [PATCH v8 1/5] vscsiif.h: fix WWN notation for p-dev property
Quoted 10 lines · Olaf Hering
The pvops kernel expects either "naa.WWN:LUN" or "h:c:t:l" in the p-dev property. Add the missing :LUN part to the comment.
Signed-off-by Olaf Hering <[email protected]>Acked-by Ian Campbell <[email protected]>Cc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc Tim Deegan <[email protected]>
PATCH v8 2/5 docs: add vscsi to xenstore-paths.markdown
In reply to Olaf Hering--- docs/misc/xenstore-paths.markdown | 10 ++++++++++ 1 file changed, 10 insertions(+)
docs/misc/xenstore-paths.markdown +10 -0
@@ -265,6 +265,11 @@ A virtual keyboard device frontend. Described by A virtual network device frontend. Described by [xen/include/public/io/netif.h][NETIF] +#### ~/device/vscsi/$DEVID/* [] + +A virtual scsi device frontend. Described by +[xen/include/public/io/vscsiif.h][SCSIIF] + #### ~/console/* [] The primary PV console device. Described in [console.txt](console.txt)
@@ -335,6 +340,10 @@ A virtual keyboard device backend. Described by A virtual network device backend. Described by [xen/include/public/io/netif.h][NETIF] +#### ~/backend/vscsi/$DOMID/$DEVID/* [] + +A PV SCSI backend. + #### ~/backend/console/$DOMID/$DEVID/* [] A PV console backend. Described in [console.txt](console.txt)
@@ -525,6 +534,7 @@ domain instead of a daemon in dom0. [KBDIF]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,kbdif.h.html [LIBXLMEM]: http://xenbits.xen.org/docs/unstable/misc/libxl_memory.txt [NETIF]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,netif.h.html +[SCSIIF]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,vscsiif.h.html [SI]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,xen.h.html#Struct_start_info [VCPU]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,vcpu.h.html [XSWIRE]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,xs_wire.h.html
Re: [PATCH v8 2/5] docs: add vscsi to xenstore-paths.markdown
Quoted 7 lines · Olaf Hering
Signed-off-by Olaf Hering <[email protected]>Acked-by Ian Campbell <[email protected]>Cc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc Tim Deegan <[email protected]>
Quoted 44 lines
--- docs/misc/xenstore-paths.markdown | 10 ++++++++++ 1 file changed, 10 insertions(+)docs/misc/xenstore-paths.markdown +10
-0@@ -265,6 +265,11 @@ A virtual keyboard device frontend. Described by A virtual network device frontend. Described by [xen/include/public/io/netif.h][NETIF] +#### ~/device/vscsi/$DEVID/* [] + +A virtual scsi device frontend. Described by +[xen/include/public/io/vscsiif.h][SCSIIF] + #### ~/console/* [] The primary PV console device. Described in [console.txt](console.txt)@@ -335,6 +340,10 @@ A virtual keyboard device backend. Described by A virtual network device backend. Described by [xen/include/public/io/netif.h][NETIF] +#### ~/backend/vscsi/$DOMID/$DEVID/* [] + +A PV SCSI backend. + #### ~/backend/console/$DOMID/$DEVID/* [] A PV console backend. Described in [console.txt](console.txt)@@ -525,6 +534,7 @@ domain instead of a daemon in dom0. [KBDIF]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,kbdif.h.html [LIBXLMEM]: http://xenbits.xen.org/docs/unstable/misc/libxl_memory.txt [NETIF]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,netif.h.html +[SCSIIF]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,vscsiif.h.html [SI]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,xen.h.html#Struct_start_info [VCPU]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,vcpu.h.html [XSWIRE]: http://xenbits.xen.org/docs/unstable/hypercall/include,public,io,xs_wire.h.html_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v8 3/5 libxl: add support for vscsi
In reply to Olaf HeringPort pvscsi support from xend to libxl:
vscsi=['pdev,vdev{,options}']
xl scsi-attach
xl scsi-detach
xl scsi-list
--- docs/man/xl.cfg.pod.5 | 55 +++ docs/man/xl.pod.1 | 18 + tools/libxl/Makefile | 2 + tools/libxl/libxl.c | 420 +++++++++++++++++++++ tools/libxl/libxl.h | 35 ++ tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_device.c | 2 + tools/libxl/libxl_internal.h | 19 + tools/libxl/libxl_types.idl | 53 +++ tools/libxl/libxl_types_internal.idl | 1 + tools/libxl/libxl_vscsi.c | 615 +++++++++++++++++++++++++++++++ tools/libxl/libxlu_vscsi.c | 697 +++++++++++++++++++++++++++++++++++ tools/libxl/libxlutil.h | 18 + tools/libxl/xl.h | 3 + tools/libxl/xl_cmdimpl.c | 208 ++++++++++- tools/libxl/xl_cmdtable.c | 15 + 16 files changed, 2161 insertions(+), 1 deletion(-)
docs/man/xl.cfg.pod.5 +55 -0
@@ -517,6 +517,61 @@ value is optional if this is a guest domain. =back +=item B<vscsi=[ "VSCSI_SPEC_STRING", "VSCSI_SPEC_STRING", ...]> + +Specifies the PVSCSI devices to be provided to the guest. PVSCSI passes +SCSI devices from the backend domain to the guest. + +Each VSCSI_SPEC_STRING consists of "pdev,vdev[,options]". +'pdev' describes the physical device, preferable in a persistent format such as /dev/disk/by-*/*. +'vdev' is the domU device in vHOST:CHANNEL:TARGET:LUN notation, all integers. +'options' lists additional flags which a backend may recognize. + +The supported values for "pdev" and "options" depends on the backend driver used: + +=over 4 + +=item B<Linux> + +=over 4 + +=item C<pdev> + +The backend driver in the pvops kernel is part of the Linux-IO Target framework +(LIO). As such the SCSI devices have to be configured first with the tools +provided by this framework, such as a xen-scsiback aware targetcli. The "pdev" +in domU.cfg has to refer to a config item in that framework instead of the raw +device. Usually this is a WWN in the form of "na.WWN:LUN". + +=item C<options> + +No options recognized. + +=back + +=item B<Linux based on classic Xen kernel> + +=over 4 + +=item C<pdev> + +The dom0 device in either /dev/scsidev or pHOST:CHANNEL:TARGET:LUN notation. + +It's recommended to use persistent names "/dev/disk/by-*/*" to refer to a "pdev". +The toolstack will translate this internally to "h:c:t:l" notation, which is how +the backend driver will access the device. Using the "h:c:t:l" notation for +"pdev" in domU.cfg is discouraged because this value will change across reboots, +depending on the detection order in the OS. + +=item C<options> + +Currently only the option value "feature-host" is recognized. SCSI command +emulation in backend driver is bypassed when "feature-host" is specified. + +=back + +=back + =item B<vfb=[ "VFB_SPEC_STRING", "VFB_SPEC_STRING", ...]> Specifies the paravirtual framebuffer devices which should be supplied
docs/man/xl.pod.1 +18 -0
@@ -1293,6 +1293,24 @@ List virtual trusted platform modules for a domain. =back +=head2 PVSCSI DEVICES + +=over 4 + +=item B<scsi-attach> I<domain-id> I<pdev> I<vdev>,I<[feature-host]> + +Creates a new vscsi device in the domain specified by I<domain-id>. + +=item B<scsi-detach> I<domain-id> I<vdev> + +Removes the vscsi device from domain specified by I<domain-id>. + +=item B<scsi-list> I<domain-id> I<[domain-id] ...> + +List vscsi devices for the domain specified by I<domain-id>. + +=back + =head1 PCI PASS-THROUGH =over 4
tools/libxl/Makefile +2 -0
@@ -99,6 +99,7 @@ endif LIBXL_LIBS += -lyajl LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \ + libxl_vscsi.o \ libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \ libxl_internal.o libxl_utils.o libxl_uuid.o \ libxl_json.o libxl_aoutils.o libxl_numa.o libxl_vnuma.o \
@@ -141,6 +142,7 @@ AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \ AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c AUTOSRCS += _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \ + libxlu_vscsi.o \ libxlu_disk_l.o libxlu_disk.o libxlu_vif.o libxlu_pci.o $(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
tools/libxl/libxl.c +420 -0
444 lines not on this page · raw message
tools/libxl/libxl.h +35 -0
@@ -836,6 +836,13 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src);#define LIBXL_HAVE_PCITOPOLOGY 1/* +* LIBXL_HAVE_VSCSI +* +* If this is defined, the PV SCSI feature is supported. +*/ +#define LIBXL_HAVE_VSCSI 1 + +/* * LIBXL_HAVE_SOCKET_BITMAP * * If this is defined, then libxl_socket_bitmap_alloc and
@@ -1539,6 +1546,34 @@ int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid, libxl_device_channel *channel, libxl_channelinfo *channelinfo); +/* Virtual SCSI */ +int libxl_device_vscsictrl_add(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsictrl *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +int libxl_device_vscsictrl_remove(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsictrl *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +int libxl_device_vscsictrl_destroy(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsictrl *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; + +libxl_device_vscsictrl *libxl_device_vscsictrl_list (libxl_ctx *ctx,uint32_t domid,int *num); +int libxl_device_vscsictrl_getinfo (libxl_ctx *ctx,uint32_t domid, +libxl_device_vscsictrl *vscsictrl, +libxl_device_vscsidev *vscsidev, +libxl_vscsiinfo *vscsiinfo); +/* Remove vscsidev connected to vscsictrl */ +int libxl_device_vscsidev_remove(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsidev *dev, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +void libxl_device_vscsictrl_append_vscsidev (libxl_ctx *ctx, +libxl_device_vscsictrl *ctrl, +libxl_device_vscsidev *dev); +/* Virtual TPMs */ int libxl_device_vtpm_add (libxl_ctx *ctx,uint32_t domid,libxl_device_vtpm *vtpm,const libxl_asyncop_how *ao_how)
tools/libxl/libxl_create.c +1 -0
@@ -1166,6 +1166,7 @@ static void domcreate_rebuild_done(libxl__egc *egc,libxl__multidev_begin (ao, &dcs->multidev); dcs->multidev.callback = domcreate_launch_dm;libxl__add_disks (egc, ao, domid, d_config, &dcs->multidev); +libxl__add_vscsictrls (egc, ao, domid, d_config, &dcs->multidev);libxl__multidev_prepared (egc, &dcs->multidev,0 );return ;
tools/libxl/libxl_device.c +2 -0
@@ -543,6 +543,7 @@ void libxl__multidev_prepared(libxl__egc *egc,* The following functions are defined: * libxl__add_disks * libxl__add_nics +* libxl__add_vscsictrls * libxl__add_vtpms */
@@ -562,6 +563,7 @@ void libxl__multidev_prepared(libxl__egc *egc, DEFINE_DEVICES_ADD(disk) DEFINE_DEVICES_ADD(nic) +DEFINE_DEVICES_ADD(vscsictrl) DEFINE_DEVICES_ADD(vtpm)#undef DEFINE_DEVICES_ADD
tools/libxl/libxl_internal.h +19 -0
@@ -2576,6 +2576,10 @@ _hidden void libxl__device_nic_add(libxl__egc *egc, uint32_t domid, libxl_device_nic *nic, libxl__ao_device *aodev); +_hidden void libxl__device_vscsictrl_add(libxl__egc *egc, uint32_t domid, +libxl_device_vscsictrl *vscsi, +libxl__ao_device *aodev); + _hidden void libxl__device_vtpm_add(libxl__egc *egc, uint32_t domid,libxl_device_vtpm *vtpm,libxl__ao_device *aodev);
@@ -3294,6 +3298,10 @@ _hidden void libxl__add_nics(libxl__egc *egc, libxl__ao *ao, uint32_t domid, libxl_domain_config *d_config, libxl__multidev *multidev); +_hidden void libxl__add_vscsictrls(libxl__egc *egc, libxl__ao *ao, uint32_t domid, +libxl_domain_config *d_config, +libxl__multidev *multidev); + _hidden void libxl__add_vtpms(libxl__egc *egc, libxl__ao *ao, uint32_t domid,libxl_domain_config *d_config,libxl__multidev *multidev);
@@ -3506,7 +3514,17 @@ _hidden void libxl__domain_suspend(libxl__egc *egc,/* used by libxc to suspend the guest during migration */ _hidden void libxl__domain_suspend_callback(void *data); +/* return an array of vscsictrls with num elements */ +_hidden int libxl__vscsi_collect_ctrls(libxl__gc *gc, +uint32_t domid, +libxl_device_vscsictrl **ctrls, +int *num); +_hidden int libxl__device_vscsictrl_remove(libxl_ctx *ctx, +uint32_t domid, +libxl_device_vscsictrl *vscsictrl, +const libxl_asyncop_how *ao_how, +int force);/* * Convenience macros. */
@@ -3963,6 +3981,7 @@ static inline void libxl__update_config_vtpm(libxl__gc *gc,* devices have same identifier. */ #define COMPARE_DEVID (a, b) ((a)->devid == (b)->devid)#define COMPARE_DISK (a, b) (!strcmp((a)->vdev, (b)->vdev)) +#define COMPARE_VSCSI (a, b) ((a)->devid == (b)->devid)#define COMPARE_PCI (a, b) ((a)->func == (b)->func && \ (a)->bus == (b)->bus && \ (a)->dev == (b)->dev)
tools/libxl/libxl_types.idl +53 -0
71 lines not on this page · raw message
tools/libxl/libxl_types_internal.idl +1 -0
@@ -22,6 +22,7 @@ libxl__device_kind = Enumeration("device_kind", [ (6, "VKBD"), (7, "CONSOLE"), (8, "VTPM"), + (9, "VSCSI"), ]) libxl__console_backend = Enumeration("console_backend", [
tools/libxl/libxl_vscsi.c new file +615 -0
615 lines not on this page · raw message
tools/libxl/libxlu_vscsi.c new file +697 -0
697 lines not on this page · raw message
tools/libxl/libxlutil.h +18 -0
@@ -118,6 +118,24 @@ int xlu_rdm_parse(XLU_Config *cfg, libxl_rdm_reserve *rdm, const char *str);int xlu_vif_parse_rate (XLU_Config *cfg,const char *rate,libxl_device_nic *nic); +/* Fill vscsictrl with device described in str (pdev,vdev[,options]) */ +int xlu_vscsi_get_ctrl (XLU_Config *config, +libxl_ctx *ctx, +uint32_t domid, +const char *str, +libxl_device_vscsictrl *vscsictrl); +/* Parse config string and fill provided vscsi ctrl and vscsi device */ +int xlu_vscsi_parse (XLU_Config *cfg,libxl_ctx *ctx,const char *str, +libxl_device_vscsictrl *new_ctrl, +libxl_device_vscsidev *new_dev); +/* Detach vscsi device described in config string (pdev,vdev[,options]) */ +int xlu_vscsi_detach (XLU_Config *cfg,libxl_ctx *ctx,uint32_t domid,char *str); +/* Add vscsi device described in config string (pdev,vdev[,options]) to d_config */ +int xlu_vscsi_config_add (XLU_Config *cfg, +libxl_ctx *ctx, +const char *str, +int *num_vscsis, +libxl_device_vscsictrl **vscsis);#endif /* LIBXLUTIL_H */ /*
tools/libxl/xl.h +3 -0
@@ -89,6 +89,9 @@ int main_channellist(int argc, char **argv);int main_blockattach (int argc,char **argv);int main_blocklist (int argc,char **argv);int main_blockdetach (int argc,char **argv); +int main_vscsiattach (int argc,char **argv); +int main_vscsilist (int argc,char **argv); +int main_vscsidetach (int argc,char **argv);int main_vtpmattach (int argc,char **argv);int main_vtpmlist (int argc,char **argv);int main_vtpmdetach (int argc,char **argv);
tools/libxl/xl_cmdimpl.c +207 -1
226 lines not on this page · raw message
tools/libxl/xl_cmdtable.c +15 -0
@@ -351,6 +351,21 @@ struct cmd_spec cmd_table[] = {"Destroy a domain's virtual block device" ,"<Domain> <DevId>" , }, + { "scsi-attach", + &main_vscsiattach,1 ,1 , +"Attach a dom0 SCSI device to a domain." , +"<Domain> <PhysDevice> <VirtDevice>" , + }, + { "scsi-list", + &main_vscsilist,0 ,0 , +"List all dom0 SCSI devices currently attached to a domain." , +"<Domain(s)>" , + }, + { "scsi-detach", + &main_vscsidetach,0 ,1 , +"Detach a specified SCSI device from a domain." , +"<Domain> <VirtDevice>" , + }, { "vtpm-attach", &main_vtpmattach,1 ,1 , "Create a new virtual TPM device",
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v8 3/5] libxl: add support for vscsi
I notice you posted several enquiries in your previous patch, but I'm not sure if any of them still requires answers because you seemed to have posted answers to your own enquiries. I skip all of them and start from this version.
There seems to be a lot of places in this patch where the lines are longer than 80 characters. I'm not going to point them out one by one. Can you fix as many of those as you can where sensible?
Because VSCSI is similar to PVUSB and PVUSB has mostly been reviewed, I basically did a side by side comparison between these two. My goal is to keep them as close as possible.
I'm also aware VSCSI is not complete the same as PVUSB. If my comments are made based on wrong assumptions, please let me know.
Quoted 36 lines · Olaf Hering
Port pvscsi support from xend to libxl:
vscsi=['pdev,vdev{,options}']
xl scsi-attach
xl scsi-detach
xl scsi-listSigned-off-by Olaf Hering <[email protected]>Cc Ian Jackson <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Ian Campbell <[email protected]>Cc Wei Liu <[email protected]>--- docs/man/xl.cfg.pod.5 | 55 +++ docs/man/xl.pod.1 | 18 + tools/libxl/Makefile | 2 + tools/libxl/libxl.c | 420 +++++++++++++++++++++ tools/libxl/libxl.h | 35 ++ tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_device.c | 2 + tools/libxl/libxl_internal.h | 19 + tools/libxl/libxl_types.idl | 53 +++ tools/libxl/libxl_types_internal.idl | 1 + tools/libxl/libxl_vscsi.c | 615 +++++++++++++++++++++++++++++++ tools/libxl/libxlu_vscsi.c | 697 +++++++++++++++++++++++++++++++++++ tools/libxl/libxlutil.h | 18 + tools/libxl/xl.h | 3 + tools/libxl/xl_cmdimpl.c | 208 ++++++++++- tools/libxl/xl_cmdtable.c | 15 + 16 files changed, 2161 insertions(+), 1 deletion(-)docs/man/xl.cfg.pod.5 +0
-0
docs/man/xl.cfg.pod.5 value is optional if this is a guest domain. · line 526
Quoted 10 lines
docs/man/xl.cfg.pod.5 +7
-0@@ -517,6 +517,61 @@ value is optional if this is a guest domain. =back +=item B<vscsi=[ "VSCSI_SPEC_STRING", "VSCSI_SPEC_STRING", ...]> + +Specifies the PVSCSI devices to be provided to the guest. PVSCSI passes +SCSI devices from the backend domain to the guest. + +Each VSCSI_SPEC_STRING consists of "pdev,vdev[,options]". +'pdev' describes the physical device, preferable in a persistent format such as /dev/disk/by-*/*.
Small nit: please wrap this line a bit.
Quoted 9 lines
docs/man/xl.cfg.pod.5 +9
-0+'vdev' is the domU device in vHOST:CHANNEL:TARGET:LUN notation, all integers. +'options' lists additional flags which a backend may recognize. + +The supported values for "pdev" and "options" depends on the backend driver used: + +=over 4 + +=item B<Linux> +
docs/man/xl.cfg.pod.5 value is optional if this is a guest domain. · line 545
Quoted 10 lines
docs/man/xl.cfg.pod.5 +10
-0+=over 4 + +=item C<pdev> + +The backend driver in the pvops kernel is part of the Linux-IO Target framework +(LIO). As such the SCSI devices have to be configured first with the tools +provided by this framework, such as a xen-scsiback aware targetcli. The "pdev" +in domU.cfg has to refer to a config item in that framework instead of the raw +device. Usually this is a WWN in the form of "na.WWN:LUN". +
naa
Quoted 12 lines
docs/man/xl.cfg.pod.5 +12
-0+=item C<options> + +No options recognized. + +=back + +=item B<Linux based on classic Xen kernel> + +=over 4 + +=item C<pdev> +
[...]
tools/libxl/libxl.c static int libxl__resolve_domid(libxl__gc *gc, const char *name, · line 2065
Quoted 13 lines
tools/libxl/libxl.c +4
-0@@ -2059,6 +2059,417 @@ static int libxl__resolve_domid(libxl__gc *gc, const char *name, }/******************************************************************************/ + +static int libxl__device_vscsidev_backend_set_add (libxl__gc *gc, +libxl_device_vscsidev *v, +flexarray_t *back)
Indentation.
Quoted 14 lines
tools/libxl/libxl.c +14
-0+{ +int rc; +char *dir; +unsigned int hst, chn, tgt; +unsigned long long lun; + + + dir =GCSPRINTF ("vscsi-devs/dev-%u" , v->vscsidev_id); +switch (v->pdev.type) { +case LIBXL_VSCSI_PDEV_TYPE_WWN : +flexarray_append_pair (back, +GCSPRINTF ("%s/p-dev" , dir), + v->pdev.u.wwn.m); +break ;
tools/libxl/libxl.c static int libxl__resolve_domid(libxl__gc *gc, const char *name, · line 2089
Quoted 10 lines
tools/libxl/libxl.c +10
-0+case LIBXL_VSCSI_PDEV_TYPE_HCTL : + hst = v->pdev.u.hctl.m.hst; + chn = v->pdev.u.hctl.m.chn; + tgt = v->pdev.u.hctl.m.tgt; + lun = v->pdev.u.hctl.m.lun; +flexarray_append_pair (back, +GCSPRINTF ("%s/p-dev" , dir), +GCSPRINTF ("%u:%u:%u:%llu" , hst, chn, tgt, lun)); +break ; +case LIBXL_VSCSI_PDEV_TYPE_INVALID :
Please add /* fallthrough */ here, otherwise Coverity scan might complain. :-/
Quoted 39 lines
tools/libxl/libxl.c +39
-0+default : + rc =ERROR_FAIL ; + goto out; + } +flexarray_append_pair (back, +GCSPRINTF ("%s/p-devname" , dir), + v->pdev.p_devname); + hst = v->vdev.hst; + chn = v->vdev.chn; + tgt = v->vdev.tgt; + lun = v->vdev.lun; +flexarray_append_pair (back, +GCSPRINTF ("%s/v-dev" , dir), +GCSPRINTF ("%u:%u:%u:%llu" , hst, chn, tgt, lun)); +flexarray_append_pair (back, +GCSPRINTF ("%s/state" , dir), +GCSPRINTF ("%d" , XenbusStateInitialising)); + rc =0 ; +out: +return rc; +} + +static int libxl__device_vscsi_new_backend (libxl__egc *egc, +libxl__ao_device *aodev, +libxl_device_vscsictrl *vscsi, +libxl_domain_config *d_config) +{ +STATE_AO_GC (aodev->ao); +int rc, i; +flexarray_t *back; +flexarray_t *front; +libxl_device_vscsidev *v; +xs_transaction_t t =XBT_NULL ; + +/* Prealloc key+value: 4 toplevel + 4 per device */ + i =2 * (4 + (4 * vscsi->num_vscsidevs)); + back =flexarray_make (gc, i,1 ); + front =flexarray_make (gc,2 *2 ,1 ); +
tools/libxl/libxl.c static int libxl__resolve_domid(libxl__gc *gc, const char *name, · line 2138
Quoted 10 lines
tools/libxl/libxl.c +10
-0+flexarray_append_pair (back,"frontend-id" ,GCSPRINTF ("%d" , aodev->dev->domid)); +flexarray_append_pair (back,"online" ,"1" ); +flexarray_append_pair (back,"state" ,GCSPRINTF ("%d" , XenbusStateInitialising)); +flexarray_append_pair (back,"feature-host" , +libxl_defbool_val (vscsi->scsi_raw_cmds) ? +"1" :"0" ); + +flexarray_append_pair (front,"backend-id" ,GCSPRINTF ("%d" , vscsi->backend_domid)); +flexarray_append_pair (front,"state" ,GCSPRINTF ("%d" , XenbusStateInitialising)); +
Wrap long lines please.
tools/libxl/libxl.c static int libxl__resolve_domid(libxl__gc *gc, const char *name, · line 2142
Quoted 4 lines
tools/libxl/libxl.c +4
-0+for (i =0 ; i < vscsi->num_vscsidevs; i++) { + v = vscsi->vscsidevs + i; + rc =libxl__device_vscsidev_backend_set_add (gc, v, back); +if (rc)return rc;
goto out please.
Quoted 39 lines
tools/libxl/libxl.c +39
-0+ } + +for (;;) { + rc =libxl__xs_transaction_start (gc, &t); +if (rc) goto out; + + rc =libxl__device_exists (gc, t, aodev->dev); +if (rc <0 ) goto out; +if (rc ==1 ) {/* already exists in xenstore */ +LOG (ERROR ,"device already exists in xenstore" ); + rc =ERROR_DEVICE_EXISTS ; + goto out; + } + +if (aodev->update_json) { + rc =libxl__set_domain_configuration (gc, aodev->dev->domid, d_config); +if (rc) goto out; + } + +libxl__device_generic_add (gc, t, aodev->dev, +libxl__xs_kvs_of_flexarray (gc, back, + back->count), +libxl__xs_kvs_of_flexarray (gc, front, + front->count), +NULL ); + + rc =libxl__xs_transaction_commit (gc, &t); +if (!rc)break ; +if (rc <0 ) goto out; + } + +libxl__wait_device_connection (egc, aodev); + rc =0 ; + +out: +libxl__xs_transaction_abort (gc, &t); +return rc; +} +
[...]
Quoted 45 lines
tools/libxl/libxl.c +45
-0+} +void libxl__device_vscsictrl_add (libxl__egc *egc,uint32_t domid, +libxl_device_vscsictrl *vscsi, +libxl__ao_device *aodev) +{ +STATE_AO_GC (aodev->ao); +libxl__device *device; +const char *be_path; +unsigned int be_dirs =0 ; +int rc; +libxl_domain_config d_config; +libxl_device_vscsictrl vscsi_saved; +libxl__domain_userdata_lock *lock =NULL ; + +libxl_domain_config_init (&d_config); + +libxl_device_vscsictrl_init (&vscsi_saved); +libxl_device_vscsictrl_copy (CTX , &vscsi_saved, vscsi); + +if (vscsi->devid ==-1 ) { +LOGE (ERROR ,"new vscsictrl for domid %u has uninitialized devid" , domid); + rc =ERROR_FAIL ; + goto out; + } + +GCNEW (device); + rc =libxl__device_from_vscsictrl (gc, domid, vscsi, device); +if (rc) goto out; + + aodev->dev = device; + be_path =libxl__device_backend_path (gc, aodev->dev); + + rc =libxl__vscsi_assign_vscsidev_ids (gc, domid, &vscsi_saved); +if (rc) goto out; + +if (aodev->update_json) { + lock =libxl__lock_domain_userdata (gc, domid); +if (!lock) { + rc =ERROR_LOCK_FAIL ; + goto out; + } + + rc =libxl__get_domain_configuration (gc, domid, &d_config); +if (rc) goto out; +
tools/libxl/libxl.c static int libxl__resolve_domid(libxl__gc *gc, const char *name, · line 2413
Quoted 10 lines
tools/libxl/libxl.c +10
-0+/* Replace or append the copy to the domain config */ +DEVICE_ADD (vscsictrl, vscsictrls, domid, &vscsi_saved,COMPARE_VSCSI , &d_config); + } + +if (libxl__xs_directory (gc,XBT_NULL , be_path, &be_dirs)) { + rc =libxl__device_vscsi_reconfigure_add (egc, aodev, &vscsi_saved, &d_config, be_path); +if (rc) + goto out; +/* Notify that this is done */ + aodev->callback (egc, aodev);
Wouldn't it be better if you call aodev->callback unconditionally at the end of this function? BTW you seem to have forgotten to set aodev->rc.
Quoted 17 lines
tools/libxl/libxl.c +17
-0+ }else { + rc =libxl__device_vscsi_new_backend (egc, aodev, &vscsi_saved, &d_config); +if (rc) + goto out; + } + + rc =0 ; +out: +if (lock)libxl__unlock_domain_userdata (lock); +libxl_device_vscsictrl_dispose (&vscsi_saved); +libxl_domain_config_dispose (&d_config); + aodev->rc = rc; +if (rc) aodev->callback (egc, aodev); +return ; +} + +
[...]
Quoted 14 lines
tools/libxl/libxl.c +14
-0+/* Virtual SCSI */ +int libxl_device_vscsictrl_add(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsictrl *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +int libxl_device_vscsictrl_remove(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsictrl *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +int libxl_device_vscsictrl_destroy(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsictrl *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +
tools/libxl/libxl.c
Quoted 10 lines
tools/libxl/libxl.c +10
-0+libxl_device_vscsictrl *libxl_device_vscsictrl_list (libxl_ctx *ctx,uint32_t domid,int *num); +int libxl_device_vscsictrl_getinfo (libxl_ctx *ctx,uint32_t domid, +libxl_device_vscsictrl *vscsictrl, +libxl_device_vscsidev *vscsidev, +libxl_vscsiinfo *vscsiinfo); +/* Remove vscsidev connected to vscsictrl */ +int libxl_device_vscsidev_remove(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsidev *dev, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY;
Where is libxl_device_vscsidev_add?
Quoted 12 lines
tools/libxl/libxl.c +4
-0+void libxl_device_vscsictrl_append_vscsidev (libxl_ctx *ctx, +libxl_device_vscsictrl *ctrl, +libxl_device_vscsidev *dev); +/* Virtual TPMs */ int libxl_device_vtpm_add (libxl_ctx *ctx,uint32_t domid,libxl_device_vtpm *vtpm,const libxl_asyncop_how *ao_how)tools/libxl/libxl_create.c +0
-0
tools/libxl/libxl_create.c static void domcreate_rebuild_done(libxl__egc *egc, · line 1169
Quoted 4 lines
tools/libxl/libxl_create.c +1
-0@@ -1166,6 +1166,7 @@ static void domcreate_rebuild_done(libxl__egc *egc,libxl__multidev_begin (ao, &dcs->multidev); dcs->multidev.callback = domcreate_launch_dm;libxl__add_disks (egc, ao, domid, d_config, &dcs->multidev); +libxl__add_vscsictrls (egc, ao, domid, d_config, &dcs->multidev);
This is because you need vscsi disk early?
Quoted 3 lines
tools/libxl/libxl_create.c +0
-0libxl__multidev_prepared (egc, &dcs->multidev,0 );return ;
[...]
Quoted 2 lines
libxl__console_backend= Enumeration("console_backend", [tools/libxl/libxl_vscsi.c +0
-0
[...]
Quoted 38 lines
tools/libxl/libxl_vscsi.c +38
-0+static bool libxl__vscsi_fill_dev (libxl__gc *gc, +xs_transaction_t t, +const char *devs_path, +const char *dev_dir, +libxl_device_vscsidev *dev) +{ +char *path, *c, *p, *v, *s; +unsigned int devid; +int r; + + r =sscanf (dev_dir,"dev-%u" , &devid); +if (r !=1 ) { +LOG (ERROR ,"expected dev-N, got '%s'" , dev_dir); +return false; + } + dev->vscsidev_id = devid; + + path =GCSPRINTF ("%s/%s" , devs_path, dev_dir); + c =libxl__xs_read (gc, t,GCSPRINTF ("%s/p-devname" , path)); + p =libxl__xs_read (gc, t,GCSPRINTF ("%s/p-dev" , path)); + v =libxl__xs_read (gc, t,GCSPRINTF ("%s/v-dev" , path)); + s =libxl__xs_read (gc, t,GCSPRINTF ("%s/state" , path)); +LOG (DEBUG ,"%s/state is %s" , path, s); +if (!(c && p && v && s)) { +LOG (ERROR ,"p-devname '%s' p-dev '%s' v-dev '%s'" , c, p, v); +return false; + } + +if (!vscsi_parse_pdev (gc, dev, c, p, v)) { +LOG (ERROR ,"failed to parse %s: %s %s %s %s" , path, c, p, v, s); +return false; + } + +switch (atoi (s)) { +case XenbusStateUnknown: +case XenbusStateInitialising: +case XenbusStateInitWait: +case XenbusStateInitialised:
tools/libxl/libxl_vscsi.c line 148
Quoted 10 lines
tools/libxl/libxl_vscsi.c +10
-0+case XenbusStateConnected: +case XenbusStateReconfiguring: +case XenbusStateReconfigured: +break ; +case XenbusStateClosing: +case XenbusStateClosed: +LOG (DEBUG ,"unexpected state in %s: %s" , path, s); +break ; + } +
This doesn't seem useful in the context of this function.
Quoted 9 lines
tools/libxl/libxl_vscsi.c +9
-0+return true; +} + +static bool libxl__vscsi_fill_ctrl (libxl__gc *gc, +xs_transaction_t t, +const char *fe_path, +const char *dir, +libxl_device_vscsictrl *ctrl) +{
tools/libxl/libxl_vscsi.c line 167
Quoted 10 lines
tools/libxl/libxl_vscsi.c +10
-0+libxl_device_vscsidev dev; +char *tmp, *be_path, *devs_path; +char **dev_dirs; +unsigned int ndev_dirs, dev_dir; +bool parsed_ok; + + ctrl->devid =atoi (dir); + + be_path =libxl__xs_read (gc, t,GCSPRINTF ("%s/%s/backend" , fe_path, dir)); +/* FIXME what if xenstore is broken? */
I'm not sure what kind of "broken" you referred to, but it is most likely we can't recover from such state.
It's reasonable to assume xenstore is robust.
Quoted 30 lines
tools/libxl/libxl_vscsi.c +30
-0+if (!be_path) { +libxl_defbool_set (&ctrl->scsi_raw_cmds, false); +return false; + } + + tmp =libxl__xs_read (gc, t,GCSPRINTF ("%s/%s/backend-id" , fe_path, dir)); +/* FIXME what if xenstore is broken? */ +if (tmp) + ctrl->backend_domid =atoi (tmp); + + parsed_ok = false; + tmp =libxl__xs_read (gc, t,GCSPRINTF ("%s/feature-host" , be_path)); +if (tmp) + parsed_ok =atoi (tmp) !=0 ; +libxl_defbool_set (&ctrl->scsi_raw_cmds, parsed_ok); + + parsed_ok = true; + devs_path =GCSPRINTF ("%s/vscsi-devs" , be_path); + dev_dirs =libxl__xs_directory (gc, t, devs_path, &ndev_dirs); +for (dev_dir =0 ; dev_dirs && dev_dir < ndev_dirs; dev_dir++) { +libxl_device_vscsidev_init (&dev); + parsed_ok =libxl__vscsi_fill_dev (gc, t, devs_path, dev_dirs[dev_dir], &dev); +if (parsed_ok == true) +libxl_device_vscsictrl_append_vscsidev (CTX , ctrl, &dev); +libxl_device_vscsidev_dispose (&dev); +if (parsed_ok == false) +break ; + } + +return parsed_ok;
tools/libxl/libxl_vscsi.c line 207
Quoted 10 lines
tools/libxl/libxl_vscsi.c +10
-0+} + +int libxl__vscsi_collect_ctrls (libxl__gc *gc, +uint32_t domid, +libxl_device_vscsictrl **ctrls, +int *num) +{ +xs_transaction_t t =XBT_NULL ; +libxl_device_vscsictrl ctrl; +char *fe_path;
Hard tab here.
[...]
Quoted 8 lines
tools/libxl/libxl_vscsi.c +8
-0+static void libxl__device_vscsidev_rm (libxl__egc *egc, +libxl__ao_device *aodev) +{ +STATE_AO_GC (aodev->ao); +libxl__vscsidev_rm *vscsidev_rm =CONTAINER_OF (aodev, *vscsidev_rm, aodev); +char *state_path; +int rc, be_wait; +
tools/libxl/libxl_vscsi.c line 509
Quoted 10 lines
tools/libxl/libxl_vscsi.c +10
-0+ vscsidev_rm->be_path =libxl__device_backend_path (gc, aodev->dev); + state_path =GCSPRINTF ("%s/state" , vscsidev_rm->be_path); + + rc =libxl__device_vscsi_reconfigure_rm (aodev, state_path, &be_wait); +if (rc) goto out; + + rc =libxl__ev_devstate_wait (ao, &aodev->backend_ds, + libxl__device_vscsidev_rm_be, + state_path, be_wait, +LIBXL_INIT_TIMEOUT *1000 );
Should be LIBXL_DESTROY_TIMEOUT?
Quoted 13 lines
tools/libxl/libxl_vscsi.c +13
-0+if (rc) { +LOG (ERROR ,"unable to wait for %s" , state_path); + goto out; + } + +return ; + +out: + aodev->rc = rc; +/* Notify that this is done */ + aodev->callback (egc, aodev); +} +
[...]
tools/libxl/libxlu_vscsi.c
Quoted 1 line
tools/libxl/libxlu_vscsi.c +0
-0
I skipped this for now. But please be aware libxlu functions are considered to be stable API, so please don't expose more functions than necessary.
tools/libxl/xl.h int main_channellist(int argc, char **argv); · line 94
Quoted 11 lines
tools/libxl/xl.h +3
-0@@ -89,6 +89,9 @@ int main_channellist(int argc, char **argv);int main_blockattach (int argc,char **argv);int main_blocklist (int argc,char **argv);int main_blockdetach (int argc,char **argv); +int main_vscsiattach (int argc,char **argv); +int main_vscsilist (int argc,char **argv); +int main_vscsidetach (int argc,char **argv);
What about other commands? Looking at PVUSB series:
+int main_usbctrl_attach(int argc, char **argv);
+int main_usbctrl_detach(int argc, char **argv);
+int main_usbdev_attach(int argc, char **argv);
+int main_usbdev_detach(int argc, char **argv);
+int main_usblist(int argc, char **argv);
so we should be able to attach / detach both controller and specific device?
Wei.
Re: [PATCH v8 3/5] libxl: add support for vscsi
Quoted 3 lines · Wei Liu
There seems to be a lot of places in this patch where the lines are longer than 80 characters. I'm not going to point them out one by one. Can you fix as many of those as you can where sensible?
Many lines are slightly longer than 80 chars already, as can be seen with 'set colorcolumn=80'. I already wrapped most of them in my patch.
Quoted 3 lines
Because VSCSI is similar to PVUSB and PVUSB has mostly been reviewed, I basically did a side by side comparison between these two. My goal is to keep them as close as possible.
Unfortnuately they are not comparable. While I have now split the logic into ctrl and dev, the code using a ctrl is just the one doing the xenstore device work.
Quoted 3 lines
tools/libxl/libxl.c static int libxl__resolve_domid(libxl__gc *gc, const char *name, · line 2137
Quoted 2 lines
tools/libxl/libxl.c +2
-0+flexarray_append_pair (front,"backend-id" ,GCSPRINTF ("%d" , vscsi->backend_domid)); +flexarray_append_pair (front,"state" ,GCSPRINTF ("%d" , XenbusStateInitialising));Wrap long lines please.
Done. I dont like the result.
Quoted 9 lines
tools/libxl/libxl.c static int libxl__resolve_domid(libxl__gc *gc, const char *name, · line 2413
Quoted 6 lines
tools/libxl/libxl.c +6
-0+if (libxl__xs_directory (gc,XBT_NULL , be_path, &be_dirs)) { + rc =libxl__device_vscsi_reconfigure_add (egc, aodev, &vscsi_saved, &d_config, be_path); +if (rc) + goto out; +/* Notify that this is done */ + aodev->callback (egc, aodev);Wouldn't it be better if you call
aodev->callbackunconditionally at the end of this function? BTW you seem to have forgotten to setaodev->rc.
I have to rework this code, its still using libxl__wait_for_backend. This is already fixed in the detach case. Somehow I was only concentrating on the detach case this week, and did not notice this.
Quoted 7 lines
tools/libxl/libxl.h int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid, · line 1572
Quoted 5 lines
tools/libxl/libxl.h +5
-0+/* Remove vscsidev connected to vscsictrl */ +int libxl_device_vscsidev_remove(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsidev *dev, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY;Where is
libxl_device_vscsidev_add?
This is done in scsi-attach, via libxl_device_vscsictrl_add. Its not even, compared to the scsi-detach case. I will see if that can be changed.
Quoted 3 lines
Quoted 1 line
+
libxl__add_vscsictrls(egc, ao, domid, d_config, &dcs->multidev);This is because you need vscsi disk early?
I think yes, DEFINE_DEVICES_ADD has to be used somewhere.
Quoted 6 lines
tools/libxl/libxl_vscsi.c line 146
Quoted 4 lines
tools/libxl/libxl_vscsi.c new file +4
-0+case XenbusStateClosing: +case XenbusStateClosed: +LOG (DEBUG ,"unexpected state in %s: %s" , path, s); +break ;This doesn't seem useful in the context of this function.
A few lines up "state" is already printed. Looks like the whole state checking can be removed.
Quoted 23 lines
Quoted 9 lines
tools/libxl/libxl_vscsi.c new file +9
-0+return true; +} + +static bool libxl__vscsi_fill_ctrl (libxl__gc *gc, +xs_transaction_t t, +const char *fe_path, +const char *dir, +libxl_device_vscsictrl *ctrl) +{tools/libxl/libxl_vscsi.c line 167
Quoted 10 lines
tools/libxl/libxl_vscsi.c new file +10
-0+libxl_device_vscsidev dev; +char *tmp, *be_path, *devs_path; +char **dev_dirs; +unsigned int ndev_dirs, dev_dir; +bool parsed_ok; + + ctrl->devid =atoi (dir); + + be_path =libxl__xs_read (gc, t,GCSPRINTF ("%s/%s/backend" , fe_path, dir)); +/* FIXME what if xenstore is broken? */ I'm not sure what kind of "broken" you referred to, but it is most likely we can't recover from such state.
Quoted 1 line
It's reasonable to assume xenstore is robust.
I will remove the FIXME comments ...
Quoted 7 lines
tools/libxl/libxl_vscsi.c line 174
Quoted 7 lines
tools/libxl/libxl_vscsi.c new file +7
-0+if (!be_path) { +libxl_defbool_set (&ctrl->scsi_raw_cmds, false); +return false; + } + + tmp =libxl__xs_read (gc, t,GCSPRINTF ("%s/%s/backend-id" , fe_path, dir)); +/* FIXME what if xenstore is broken? */
... and I will return failure here as well.
Quoted 16 lines
Review
Quoted 7 lines
(quoted diff) +5
-0+ if (tmp) + ctrl->backend_domid = atoi(tmp); +int main_vscsiattach(int argc, char **argv); +int main_vscsilist(int argc, char **argv); +int main_vscsidetach(int argc, char **argv);What about other commands? Looking at PVUSB series:
(quoted diff) +5
-0+int main_usbctrl_attach(int argc, char **argv); +int main_usbctrl_detach(int argc, char **argv); +int main_usbdev_attach(int argc, char **argv); +int main_usbdev_detach(int argc, char **argv); +int main_usblist(int argc, char **argv);
Quoted 2 lines
so we should be able to attach / detach both controller and specific device?
There are no empty scsi controllers, just controllers with at least one device. IMO its not useful to define empty controllers, what would be the point? While toying around I noticed that removing all vscsidevs and leaving the vscsictrl in xenstore the frontend preserved its SCSI controller entry in sysfs.
Olaf
Re: [PATCH v8 3/5] libxl: add support for vscsi
On Fri, Feb 12, 2016 at 07:24:59PM +0100, Olaf Hering wrote:
[...]
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
tools/libxl/libxl.c +6
-0+if (libxl__xs_directory (gc,XBT_NULL , be_path, &be_dirs)) { + rc =libxl__device_vscsi_reconfigure_add (egc, aodev, &vscsi_saved, &d_config, be_path); +if (rc) + goto out; +/* Notify that this is done */ + aodev->callback (egc, aodev);
Quoted 7 lines
Quoted 2 lines
Wouldn't it be better if you call
aodev->callbackunconditionally at the end of this function? BTW you seem to have forgotten to setaodev->rc.I have to rework this code, its still using
libxl__wait_for_backend. This is already fixed in the detach case. Somehow I was only concentrating on the detach case this week, and did not notice this.
OK.
Quoted 14 lines
Quoted 8 lines
tools/libxl/libxl.h int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid, · line 1572
Quoted 6 lines
tools/libxl/libxl.h +5
-0+/* Remove vscsidev connected to vscsictrl */ +int libxl_device_vscsidev_remove(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsidev *dev, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY;Where is
libxl_device_vscsidev_add?This is done in scsi-attach, via
libxl_device_vscsictrl_add. Its not even, compared to the scsi-detach case. I will see if that can be changed.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+
libxl__add_vscsictrls(egc, ao, domid, d_config, &dcs->multidev);This is because you need vscsi disk early?
I think yes,
DEFINE_DEVICES_ADDhas to be used somewhere.
I'm confused. You're joking, right? "Has to be used somewhere" is not a justification for having it in this particular place.
Quoted 14 lines
Quoted 14 lines
tools/libxl/xl.h int main_channellist(int argc, char **argv); · line 94
Quoted 5 lines
tools/libxl/xl.h +3
-0+int main_vscsiattach (int argc,char **argv); +int main_vscsilist (int argc,char **argv); +int main_vscsidetach (int argc,char **argv);What about other commands? Looking at PVUSB series:
(quoted diff) +5
-0+int main_usbctrl_attach(int argc, char **argv); +int main_usbctrl_detach(int argc, char **argv); +int main_usbdev_attach(int argc, char **argv); +int main_usbdev_detach(int argc, char **argv); +int main_usblist(int argc, char **argv);
Quoted 6 lines
Quoted 2 lines
so we should be able to attach / detach both controller and specific device?
There are no empty scsi controllers, just controllers with at least one device. IMO its not useful to define empty controllers, what would be the point?
If it is mandated by hardware that empty scsi controller doesn't exist, that's of course fine. But I don't think it is mandated in reality? I can have no disk attached to a controller and that should be fine.
Quoted 4 lines
While toying around I noticed that removing all vscsidevs and leaving the vscsictrl in xenstore the frontend preserved its SCSI controller entry in sysfs.
That's what I would expect, too.
Wei.
Quoted 1 line
Olaf
Re: [PATCH v8 3/5] libxl: add support for vscsi
Quoted 3 lines · Wei Liu
Quoted 1 line
I think yes,
DEFINE_DEVICES_ADDhas to be used somewhere.I'm confused. You're joking, right? "Has to be used somewhere" is not a justification for having it in this particular place.
What would be the appropriate place? I think its there since I started working on it at 4.4 times.
Olaf
Re: [PATCH v8 3/5] libxl: add support for vscsi
Quoted 9 lines · Olaf Hering
Quoted 3 lines · Wei Liu
Quoted 1 line
I think yes,
DEFINE_DEVICES_ADDhas to be used somewhere.I'm confused. You're joking, right? "Has to be used somewhere" is not a justification for having it in this particular place.
What would be the appropriate place? I think its there since I started working on it at 4.4 times.
Depending on what you want to do.
For example, if you grep for libxl__add_nics (defined with that macro) you can see it being called in libxl_create.c at a later point and libxl_dm.c when configuring backend QEMU for stubdom.
So there is two aspects of this:
1. At which point do you want the attachment to happen?
2. How should this device attachment be done?
For #1, you need to look on a higher level than that function you modified in the patch. In you patch, the attachment is done at the same time disks are attached before creating device model. So my first reply was to ask why you would that to happen at that particular point.
For #2, in you patch you lump disk and vscsi together in one step. I think multidev can handle your changes just fine. But I'm not sure if that's the best practice -- for example, if either of them fails, you can only get error message "unable to add disk devices". You can introduce yet another step in the callback chain.
Wei.
Quoted 1 line
Olaf
Re: [PATCH v8 3/5] libxl: add support for vscsi
In reply to Wei LiuWei Liu writes ("Re: [PATCH v8 3/5] libxl: add support for vscsi"):
Quoted 4 lines
If it is mandated by hardware that empty scsi controller doesn't exist, that's of course fine. But I don't think it is mandated in reality? I can have no disk attached to a controller and that should be fine.
For the avoidance of any doubt: there is no difficulty with "empty" scsi controllers. Such things are entirely normal when talking about physical controllers.
One reason you might define a virtual controller with no devices yet is so that you have a stable and pre-expected device path for any actual targets you choose to hotplug later.
That doesn't mean that the default workflow for a user should be for them to explicitly have to create an empty controller and then hotplug the devices into it. But there is no inherent semantic problem with allowing an empty controller to exist.
Allowing empty controllers to exist is likely to considerably simplify the error handling.
Ian.
Re: [PATCH v8 3/5] libxl: add support for vscsi
Quoted 3 lines · Ian Jackson
One reason you might define a virtual controller with no devices yet is so that you have a stable and pre-expected device path for any actual targets you choose to hotplug later.
Would it be acceptable to reuse the devid as the "group index"? The various vdev in vscsi=['pdev,vdev'] will be assigned to the same vscsictrl if the host part in host:chn:target:lun matches. Right now an empty vscsictrl has no property to store the "host" part. This could be handled by either reusing devid, or by introducing a new xenstore property such as "libxl_vscsictrl_index". The value itself has no meaning other than being an index or label.
Olaf
Re: [PATCH v8 3/5] libxl: add support for vscsi
Olaf Hering writes ("Re: [PATCH v8 3/5] libxl: add support for vscsi"):
Quoted 5 lines · Ian Jackson
Quoted 3 lines
One reason you might define a virtual controller with no devices yet is so that you have a stable and pre-expected device path for any actual targets you choose to hotplug later.
Quoted 7 lines
Would it be acceptable to reuse the devid as the "group index"? The various vdev in vscsi=['pdev,vdev'] will be assigned to the same vscsictrl if the host part in host:chn:target:lun matches. Right now an empty vscsictrl has no property to store the "host" part. This could be handled by either reusing devid, or by introducing a new xenstore property such as "
libxl_vscsictrl_index". The value itself has no meaning other than being an index or label.
I haven't been following this design in detail, but: why is the vscictrl `host' number not part of the xenstore path for the controller, which in turn contains the devices ?
Ian.
Re: [PATCH v8 3/5] libxl: add support for vscsi
Quoted 14 lines · Ian Jackson
Olaf Hering writes ("Re: [PATCH v8 3/5] libxl: add support for vscsi"):
Quoted 5 lines · Ian Jackson
Quoted 3 lines
One reason you might define a virtual controller with no devices yet is so that you have a stable and pre-expected device path for any actual targets you choose to hotplug later.
Quoted 7 lines
Would it be acceptable to reuse the devid as the "group index"? The various vdev in vscsi=['pdev,vdev'] will be assigned to the same vscsictrl if the host part in host:chn:target:lun matches. Right now an empty vscsictrl has no property to store the "host" part. This could be handled by either reusing devid, or by introducing a new xenstore property such as "
libxl_vscsictrl_index". The value itself has no meaning other than being an index or label.
Quoted 3 lines
I haven't been following this design in detail, but: why is the vscictrl `host' number not part of the xenstore path for the controller, which in turn contains the devices ?
Thats exactly what I'm asking, see patch #4 of this series. Each libxl__device has a devid, which is essentially just an unique counter. A vscsictrl is a libxl__device, a vscsidev is something below a vscsictrl. To describe which vscsidev belongs to which vscsictrl the hctl notation is used. The frontend uses 'ctl', the toolstack 'h'. The hctl is stored in vscsi-devs/N/v-dev. An empty vscsictrl has no vscsidev and as a result no 'v-dev' to indicate which 'h' it represents.
During scsi-attach the code has to collect a list of existing vscsictrls. If an existing vscslctrl with the requested group number 'h' exists its clear where the new vscsidev belongs to. Otherwise a new empty vscsictrl has to be created. It needs some property to hold 'h'. This can be either the devid, or a new xenstore property.
I will use a new xenstore property.
Olaf
PATCH v8 4/5 vscsiif.h: add some notes about xenstore layout
In reply to Olaf Hering--- xen/include/public/io/vscsiif.h | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
xen/include/public/io/vscsiif.h +68 -0
@@ -104,6 +104,74 @@* response structures. */ +/* +* Xenstore format in practice +* =========================== +* +* The backend driver uses a single_host:many_devices notation to manage domU +* devices. Everything is stored in /local/domain/<backend_domid>/backend/vscsi/. +* The xenstore layout looks like this (dom0 is assumed to be the backend_domid): +* +* <domid>/<vhost>/feature-host = "0" +* <domid>/<vhost>/frontend = "/local/domain/<domid>/device/vscsi/0" +* <domid>/<vhost>/frontend-id = "<domid>" +* <domid>/<vhost>/online = "1" +* <domid>/<vhost>/state = "4" +* <domid>/<vhost>/vscsi-devs/dev-0/p-dev = "8:0:2:1" or "naa.wwn:lun" +* <domid>/<vhost>/vscsi-devs/dev-0/state = "4" +* <domid>/<vhost>/vscsi-devs/dev-0/v-dev = "0:0:0:0" +* <domid>/<vhost>/vscsi-devs/dev-1/p-dev = "8:0:2:2" +* <domid>/<vhost>/vscsi-devs/dev-1/state = "4" +* <domid>/<vhost>/vscsi-devs/dev-1/v-dev = "0:0:1:0" +* +* The frontend driver maintains its state in +* /local/domain/<domid>/device/vscsi/. +* +* <vhost>/backend = "/local/domain/0/backend/vscsi/<domid>/<vhost>" +* <vhost>/backend-id = "0" +* <vhost>/event-channel = "20" +* <vhost>/ring-ref = "43" +* <vhost>/state = "4" +* <vhost>/vscsi-devs/dev-0/state = "4" +* <vhost>/vscsi-devs/dev-1/state = "4" +* +* In addition to the entries for backend and frontend these flags are stored +* for the toolstack: +* +* <domid>/<vhost>/vscsi-devs/dev-1/p-devname = "/dev/$device" +* +* +* Backend/frontend protocol +* ========================= +* +* To create a vhost along with a device: +* <domid>/<vhost>/feature-host = "0" +* <domid>/<vhost>/frontend = "/local/domain/<domid>/device/vscsi/0" +* <domid>/<vhost>/frontend-id = "<domid>" +* <domid>/<vhost>/online = "1" +* <domid>/<vhost>/state = "1" +* <domid>/<vhost>/vscsi-devs/dev-0/p-dev = "8:0:2:1" +* <domid>/<vhost>/vscsi-devs/dev-0/state = "1" +* <domid>/<vhost>/vscsi-devs/dev-0/v-dev = "0:0:0:0" +* Wait for <domid>/<vhost>/state + <domid>/<vhost>/vscsi-devs/dev-0/state become 4 +* +* To add another device to a vhost: +* <domid>/<vhost>/state = "7" +* <domid>/<vhost>/vscsi-devs/dev-1/p-dev = "8:0:2:2" +* <domid>/<vhost>/vscsi-devs/dev-1/state = "1" +* <domid>/<vhost>/vscsi-devs/dev-1/v-dev = "0:0:1:0" +* Wait for <domid>/<vhost>/state + <domid>/<vhost>/vscsi-devs/dev-1/state become 4 +* +* To remove a device from a vhost: +* <domid>/<vhost>/state = "7" +* <domid>/<vhost>/vscsi-devs/dev-1/state = "5" +* Wait for <domid>/<vhost>/state to become 4 +* Wait for <domid>/<vhost>/vscsi-devs/dev-1/state become 6 +* Remove <domid>/<vhost>/vscsi-devs/dev-1/{state,p-dev,v-dev,p-devname} +* Remove <domid>/<vhost>/vscsi-devs/dev-1/ +* +*/ +/* Requests from the frontend to the backend */ /*
Re: [PATCH v8 4/5] vscsiif.h: add some notes about xenstore layout
Quoted 7 lines · Olaf Hering
Signed-off-by Olaf Hering <[email protected]>Acked-by Ian Campbell <[email protected]>Cc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc Tim Deegan <[email protected]>
PATCH v8 5/5 Scripts to create and delete xen-scsiback nodes in Linux target framework
In reply to Olaf HeringJust to make them public, not meant for merging:
The scripts used during development to create a bunch of SCSI devices in dom0 using the Linux target framework. targetcli3 and rtslib3 is used.
A patch is required for python-rtslib:
http://article.gmane.org/gmane.linux.scsi.target.devel/8146
--- tools/misc/Makefile | 4 + tools/misc/target-create-xen-scsiback.sh | 135 +++++++++++++++++++++++++++++++ tools/misc/target-delete-xen-scsiback.sh | 41 ++++++++++ 3 files changed, 180 insertions(+)
tools/misc/Makefile +4 -0
@@ -35,6 +35,8 @@ INSTALL_SBIN += $(INSTALL_SBIN-y) # Everything to be installed in a private bin/ INSTALL_PRIVBIN += xenpvnetboot +INSTALL_PRIVBIN += target-create-xen-scsiback.sh +INSTALL_PRIVBIN += target-delete-xen-scsiback.sh # Everything to be installed TARGETS_ALL := $(INSTALL_BIN) $(INSTALL_SBIN) $(INSTALL_PRIVBIN)
@@ -45,6 +47,8 @@ TARGETS_COPY += xen-ringwatch TARGETS_COPY += xencons TARGETS_COPY += xencov_split TARGETS_COPY += xenpvnetboot +TARGETS_COPY += target-create-xen-scsiback.sh +TARGETS_COPY += target-delete-xen-scsiback.sh # Everything which needs to be built TARGETS_BUILD := $(filter-out $(TARGETS_COPY),$(TARGETS_ALL))
tools/misc/target-create-xen-scsiback.sh new file +135 -0
135 lines not on this page · raw message
tools/misc/target-delete-xen-scsiback.sh new file +41 -0
41 lines not on this page · raw message
Re: [PATCH v8 5/5] Scripts to create and delete xen-scsiback nodes in Linux target framework
Quoted 1 line · Olaf Hering
Just to make them public, not meant for merging:
I might be mistaken, but if you don't provide a hotplug script or some sort for Xen how do you expect user to make use vscsi?
Wei.
Re: [PATCH v8 5/5] Scripts to create and delete xen-scsiback nodes in Linux target framework
Quoted 5 lines · Wei Liu
Quoted 1 line · Olaf Hering
Just to make them public, not meant for merging:
I might be mistaken, but if you don't provide a hotplug script or some sort for Xen how do you expect user to make use vscsi?
The xenlinux backend uses existing SCSI devices. The pvops backend uses devices provided by xen-scsiback which in turn is a frontend in the SCSI target framework. This has to be configured manually before usage. I have to document all this in the wiki.
Jürgen suggested to check if libxl could do the configuration in configfs, as a replacement for targetcli. Not sure if thats doable. It would require yet another syntax in vscsi=[]. I will look at this later.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v8 5/5] Scripts to create and delete xen-scsiback nodes in Linux target framework
Quoted 8 lines · Olaf Hering
Quoted 5 lines · Wei Liu
Quoted 1 line · Olaf Hering
Just to make them public, not meant for merging:
I might be mistaken, but if you don't provide a hotplug script or some sort for Xen how do you expect user to make use vscsi?
Quoted 8 lines
The xenlinux backend uses existing SCSI devices. The pvops backend uses devices provided by xen-scsiback which in turn is a frontend in the SCSI target framework. This has to be configured manually before usage. I have to document all this in the wiki.
Jürgen suggested to check if libxl could do the configuration in configfs, as a replacement for targetcli. Not sure if thats doable. It would require yet another syntax in vscsi=[]. I will look at this later.
Hmm, I don't see why this would require another syntax. When adding e.g. /dev/sr0 to a domain via targetcli I need to call:
targetcli /xen-pvscsi create naa.3ccc1c11088e4086
targetcli /backstores/pscsi create "dev=/dev/sr0" ps_0 targetcli /xen-pvscsi/naa.3ccc1c11088e4086/tpg1/luns create "/backstores/pscsi/ps_0" 0
targetcli /xen-pvscsi/naa.3ccc1c11088e4086/tpg1 set parameter alias=2:0:0
The WWN (naa.3ccc1c11088e4086) is just generated via /dev/random. The alias for xen-pvscsi (2:0:0) is taken from lsscsi by omitting the LUN:
# lsscsi [0:0:0:0] disk ATA WDC WD5000AAKX-7 1H19 /dev/sda [2:0:0:0] cd/dvd HL-DT-ST DVD+-RW GHB0N A100 /dev/sr0
The pscsi backstore name (ps_0) is just a name which can be chosen.
The need to use this kind of configuration is a feature of the current system which can be easily detected by trying to create the xen-pvscsi directory in configfs: if it succeeds you need to do it.
So all information for deciding to do the configfs related configuration and all the data needed for doing it are already present. As this is specific to Linux I'd add a system specific function which will be a nop for non-Linux systems and could do the check and possibly the configfs work on Linux.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel