libbxl: add support for pvscsi, iteration 2
cover libbxl: add support for pvscsi, iteration 2
Port vscsi=[] and scsi-{attach,detach,list} commands from xend to libxl.
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.
So far I had no success to configure a pvops backend, which has to be configured independent from libxl. Will continue to poke at that.
Please review. The first two changes could be applied independent from the libxl changes.
Olaf
Olaf Hering (4):
vscsiif.h: remove reference to WWN
docs: add vscsi to xenstore-paths.markdown
docs: add pvscsi.txt
libxl: add support for vscsi
docs/misc/pvscsi.txt | 147 +++++++++++++++ docs/misc/xenstore-paths.markdown | 10 + tools/libxl/Makefile | 1 + tools/libxl/libxl.c | 157 ++++++++++++++++ tools/libxl/libxl.h | 29 +++ tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_device.c | 2 + tools/libxl/libxl_freebsd.c | 8 + tools/libxl/libxl_internal.h | 12 ++ tools/libxl/libxl_linux.c | 60 ++++++ tools/libxl/libxl_netbsd.c | 8 + tools/libxl/libxl_types.idl | 41 +++++ tools/libxl/libxl_types_internal.idl | 1 + tools/libxl/libxl_vscsi.c | 343 +++++++++++++++++++++++++++++++++++ tools/libxl/xl.h | 3 + tools/libxl/xl_cmdimpl.c | 249 ++++++++++++++++++++++++- tools/libxl/xl_cmdtable.c | 15 ++ xen/include/public/io/vscsiif.h | 5 +- 18 files changed, 1088 insertions(+), 4 deletions(-) create mode 100644 docs/misc/pvscsi.txt create mode 100644 tools/libxl/libxl_vscsi.c
PATCH 1/4 vscsiif.h: remove reference to WWN
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
--- xen/include/public/io/vscsiif.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
xen/include/public/io/vscsiif.h +2 -3
@@ -58,9 +58,8 @@* p-dev * Values: string * -* 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"). +* A string specifying the backend device in form of a 4-tuple "h:c:t:l" +* (host, controller, target, lun, all integers). * * v-dev * Values: string
PATCH 2/4 docs: add vscsi to xenstore-paths.markdown
In reply to Olaf Hering---
NOTE: the URLS are still broken because the "unstable" directory does not exist.
docs/misc/xenstore-paths.markdown | 10 ++++++++++ 1 file changed, 10 insertions(+)
docs/misc/xenstore-paths.markdown +10 -0
@@ -232,6 +232,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)
@@ -302,6 +307,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. Described in [pvscsi.txt](pvscsi.txt) + #### ~/backend/console/$DOMID/$DEVID/* [] A PV console backend. Described in [console.txt](console.txt)
@@ -403,6 +412,7 @@ ifb device used by Remus to buffer network output from the associated vif. [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,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
PATCH 3/4 docs: add pvscsi.txt
In reply to Olaf Hering--- docs/misc/pvscsi.txt | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+)
docs/misc/pvscsi.txt new file +147 -0
@@ -0,0 +1,147 @@ +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +PVSCSI + +== Overview == + +PVSCSI allows to assing a "physical" SCSI device from dom0 to a domU. The device +is not limited to be a native SCSI device. Everything visible as SCSI device in +dom0 can be used. Currently PVSCSI is only available in Linux dom0 and domU. + +== TODO === + +How to do live migration? + - pdev will likely be evaluated again on the target host if it came from + domU.cfg. But what about pdev from 'xl scsi-attach pdev vdev'? Its required + to adjust h:c:t:l on the target host. + +Implement checks for duplicate pdev assignments? + - Not sure if SCSI devices can be shared. Will the state be consistent during + concurrent access? Should the host admin assume cooperative access from + multiple domUs? + - The easiest way would be to do nothing and assume the host admin knows what + to do. + +How to handle FIXME in libxl_retrieve_domain_configuration? + - "MERGE(vscsi, vscsis, COMPARE_DEVID, {});", when does this code run? + +Implement libvirt integration. + - Is the API used by xl usable for libvirt? + - How does libvirt assign a raw SCSI device? + Jim said: + > vscsi=[ '/dev/sda,0:1:2:3', '4:3:2:1,1:1:1:1,feature-host' ] + In libvirt-speak, this is SCSI host device assignment + http://libvirt.org/formatdomain.html#elementsHostDev + Here's the SCSI example + <devices> + <hostdev mode='subsystem' type='scsi' sgio='filtered' rawio='yes'> + <source> + <adapter name='scsi_host0'/> + <address type='scsi' bus='0' target='0' unit='0'/> + </source> + <readonly/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </hostdev> + ... + </devices> + I suppose 'feature-host' maps to attributes such as 'sgio' and 'rawio'. + The source element describes the SCSI device as seen from the host. + + +== History == + +Support for PVSCSI was added to the classic xenlinux kernel and to xend in +xen-3.3 in 2008. Support for PVSCSI was added to the upstream pvops kernel 3.18 +in 2014. Backends exists just for Linux. A frontend exists for Linux, and maybe +for FreeBSD according to google. + + +== Config Format == + +The domU.cfg syntax is "vscsi=[ 'pdev,vdev[,option]' ]". pdev is the dom0 device +in either /dev/$device or pHOST:CHANNEL:TARGET:LUN notation. vdev is the domU +device in vHOST:CHANNEL:TARGET:LUN notation. 'option' lists additional flags. +Currently only the value "feature-host" is recognized. SCSI command emulation in +backend driver is bypassed when "feature-host" is specified. + + +== Xenstore Format == + +The backend driver uses a single_host:many_devices notation to manage domU +devices. Everything is stored in /local/domain/0/backend/vscsi/. The xenstore +layout looks like this: + + <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" + <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/ + + +== Interface in xl == + +xl scsi-attach domid <PhysDevice> <VirtDevice>[,<option>] +xl scsi-detach domid <VirtDevice> +xl scsi-list domid [domid, ...] + + +== Interface in libxl == + +To be defined so that both xl and libvirt pass in the same data. + + +== Interface in libvirt == + +Has yet to be found. + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +# vim: tw=80 et ts=4
PATCH 4/4 libxl: add support for vscsi
In reply to Olaf HeringPort pvscsi support from xend to libxl. See pvscsi.txt for details.
Outstanding work is listed in the TODO section.
--- tools/libxl/Makefile | 1 + tools/libxl/libxl.c | 157 ++++++++++++++++ tools/libxl/libxl.h | 29 +++ tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_device.c | 2 + tools/libxl/libxl_freebsd.c | 8 + tools/libxl/libxl_internal.h | 12 ++ tools/libxl/libxl_linux.c | 60 ++++++ tools/libxl/libxl_netbsd.c | 8 + tools/libxl/libxl_types.idl | 41 +++++ tools/libxl/libxl_types_internal.idl | 1 + tools/libxl/libxl_vscsi.c | 343 +++++++++++++++++++++++++++++++++++ tools/libxl/xl.h | 3 + tools/libxl/xl_cmdimpl.c | 249 ++++++++++++++++++++++++- tools/libxl/xl_cmdtable.c | 15 ++ 15 files changed, 929 insertions(+), 1 deletion(-)
tools/libxl/Makefile +1 -0
@@ -91,6 +91,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 \
tools/libxl/libxl.c +157 -0
187 lines not on this page · raw message
tools/libxl/libxl.h +29 -0
@@ -1218,6 +1218,35 @@ int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid, libxl_device_channel *channel, libxl_channelinfo *channelinfo); +/* Virtual SCSI */ +int libxl_device_vscsi_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vscsi *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +int libxl_device_vscsi_remove(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsi *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +int libxl_device_vscsi_destroy(libxl_ctx *ctx, uint32_t domid, + libxl_device_vscsi *vscsi, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; + +libxl_device_vscsi *libxl_device_vscsi_list (libxl_ctx *ctx,uint32_t domid,int *num); +int libxl_device_vscsi_getinfo (libxl_ctx *ctx, +uint32_t domid, +libxl_device_vscsi *vscsi_host, +libxl_vscsi_dev *vscsi_dev, +libxl_vscsiinfo *vscsiinfo); +void libxl_device_vscsi_append_dev (libxl_ctx *ctx,libxl_device_vscsi *hst, +libxl_vscsi_dev *dev); +int libxl_device_vscsi_get_host (libxl_ctx *ctx, +uint32_t domid, +const char *cfg, +libxl_device_vscsi **vscsi_host); +int libxl_device_vscsi_parse (libxl_ctx *ctx,const char *cfg, +libxl_device_vscsi *vscsi_host, +libxl_vscsi_dev *vscsi_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
@@ -1136,6 +1136,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_vscsis (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_vscsis * 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(vscsi) DEFINE_DEVICES_ADD(vtpm)#undef DEFINE_DEVICES_ADD
tools/libxl/libxl_freebsd.c +8 -0
@@ -131,3 +131,11 @@ libxl_device_model_version libxl__default_device_model(libxl__gc *gc) {return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN ; } + +int libxl_device_vscsi_parse_pdev (libxl__gc *gc,char *pdev,unsigned int *hst, +unsigned int *chn,unsigned int *tgt, +unsigned int *lun) +{ + +return ERROR_NOPARAVIRT ; +}
tools/libxl/libxl_internal.h +12 -0
@@ -1794,6 +1794,10 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s); _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);/* Return the system-wide default device model */ _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc); +/* Convert h:c:t:l string to int */ +_hidden int libxl_device_vscsi_parse_hctl(libxl__gc *gc, char *str, libxl_vscsi_hctl *hctl); +/* Convert /dev/scsi to h:c:t:l */ +_hidden int libxl_device_vscsi_parse_pdev(libxl__gc *gc, char *pdev, libxl_vscsi_hctl *hctl);/* Check how executes hotplug script currently */ int libxl__hotplug_settings (libxl__gc *gc,xs_transaction_t t);
@@ -2386,6 +2390,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_vscsi_add(libxl__egc *egc, uint32_t domid, +libxl_device_vscsi *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);
@@ -3005,6 +3013,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_vscsis(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);
tools/libxl/libxl_linux.c +60 -0
63 lines not on this page · raw message
tools/libxl/libxl_netbsd.c +8 -0
@@ -95,3 +95,11 @@ libxl_device_model_version libxl__default_device_model(libxl__gc *gc) {return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; } + +int libxl_device_vscsi_parse_pdev (libxl__gc *gc,char *pdev,unsigned int *hst, +unsigned int *chn,unsigned int *tgt, +unsigned int *lun) +{ + +return ERROR_NOPARAVIRT ; +}
tools/libxl/libxl_types.idl +41 -0
59 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 +343 -0
343 lines not on this page · raw message
tools/libxl/xl.h +3 -0
@@ -83,6 +83,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 +248 -1
267 lines not on this page · raw message
tools/libxl/xl_cmdtable.c +15 -0
@@ -365,6 +365,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",
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
In reply to Olaf HeringQuoted 5 lines
Quoted 1 line
Quoted 1 line · On 02.03.15 at 11:15, <[email protected]> wrote:
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
I'm not sure - even if a particular implementation doesn't support certain functionality, I would say the interface definition can still name this as a possibility.
Jan
Quoted 14 lines
xen/include/public/io/vscsiif.h +2
-3@@ -58,9 +58,8 @@* p-dev * Values: string * -* 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"). +* A string specifying the backend device in form of a 4-tuple "h:c:t:l" +* (host, controller, target, lun, all integers). * * v-dev * Values: string
Re: [PATCH 3/4] docs: add pvscsi.txt
In reply to Olaf Heringdocs/misc/pvscsi.txt line 61
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 02.03.15 at 11:16, <[email protected]> wrote:
+== Config Format ==
docs/misc/pvscsi.txt new file +3
-0+ +The domU.cfg syntax is "vscsi=[ 'pdev,vdev[,option]' ]". pdev is the dom0 device +in either /dev/$device or pHOST:CHANNEL:TARGET:LUN notation. vdev is the domU
Since /dev/... is OS (Linux) specific, I think the text should explicitly say so. For the other notation I simply don't know how OS-agnostic it is...
Jan
Quoted 3 lines
docs/misc/pvscsi.txt new file +3
-0+device in vHOST:CHANNEL:TARGET:LUN notation. 'option' lists additional flags. +Currently only the value "feature-host" is recognized. SCSI command emulation in +backend driver is bypassed when "feature-host" is specified.
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
In reply to Jan BeulichQuoted 8 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 02.03.15 at 11:15, <[email protected]> wrote:
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
I'm not sure - even if a particular implementation doesn't support certain functionality, I would say the interface definition can still name this as a possibility.
It would be misleading to suggest it is available if it is not implemented. Furthermore, Olaf's comment suggests that it cant be supported with this key, at which point the reference should absolutely be removed.
~Andrew
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
Quoted 6 lines · Andrew Cooper
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 02.03.15 at 11:15, <[email protected]> wrote:
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
Quoted 8 lines
Quoted 3 lines
I'm not sure - even if a particular implementation doesn't support certain functionality, I would say the interface definition can still name this as a possibility.
It would be misleading to suggest it is available if it is not implemented. Furthermore, Olaf's comment suggests that it cant be supported with this key, at which point the reference should absolutely be removed.
The pvops backend supports this variant.
Juergen
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
In reply to Andrew CooperQuoted 7 lines
Quoted 1 line
Quoted 1 line · On 02.03.15 at 11:50, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 02.03.15 at 11:15, <[email protected]> wrote:
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
Quoted 8 lines
Quoted 3 lines
I'm not sure - even if a particular implementation doesn't support certain functionality, I would say the interface definition can still name this as a possibility.
It would be misleading to suggest it is available if it is not implemented. Furthermore, Olaf's comment suggests that it cant be supported with this key, at which point the reference should absolutely be removed.
"It's not clear" != "can't" (at least in my understanding of the words). And no, as said I don't think the interface description should be in any way tailored towards a specific implementation. As that aspect is a host local thing only anyway, amending the text to say "in host specific ways" or "as supported by the particular backend implementation" or some such may be desirable.
Jan
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
In reply to Olaf HeringQuoted 4 lines · Olaf Hering
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
The pvops backend driver should support the WWN notation. In case it isn't working this is a bug which should be repaired.
I implemented the WWn version before adding the possibility to use h:c:t:l due to compatibility with xend...
So: NAK.
Juergen
Quoted 33 lines
Signed-off-by Olaf Hering <[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]>--- xen/include/public/io/vscsiif.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)xen/include/public/io/vscsiif.h +2
-3@@ -58,9 +58,8 @@* p-dev * Values: string * -* 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"). +* A string specifying the backend device in form of a 4-tuple "h:c:t:l" +* (host, controller, target, lun, all integers). * * v-dev * Values: string _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
In reply to Jürgen GroßQuoted 13 lines · Jürgen Groß
Quoted 12 lines · Andrew Cooper
Quoted 10 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 02.03.15 at 11:15, <[email protected]> wrote:
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation.
Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store
a config string.I'm not sure - even if a particular implementation doesn't support certain functionality, I would say the interface definition can still name this as a possibility.
Quoted 6 lines
Quoted 4 lines
It would be misleading to suggest it is available if it is not implemented. Furthermore, Olaf's comment suggests that it cant be supported with this key, at which point the reference should absolutely be removed.
The pvops backend supports this variant.
In which case it really should stay.
~Andrew
Re: [PATCH 3/4] docs: add pvscsi.txt
In reply to Olaf HeringQuoted 21 lines · Olaf Hering
Signed-off-by Olaf Hering <[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]>--- docs/misc/pvscsi.txt | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+)docs/misc/pvscsi.txt new file +5
-0@@ -0,0 +1,147 @@ +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +PVSCSI + +== Overview == +
docs/misc/pvscsi.txt line 15
Quoted 10 lines
docs/misc/pvscsi.txt new file +10
-0+PVSCSI allows to assing a "physical" SCSI device from dom0 to a domU. The device +is not limited to be a native SCSI device. Everything visible as SCSI device in +dom0 can be used. Currently PVSCSI is only available in Linux dom0 and domU. + +== TODO === + +How to do live migration? + - pdev will likely be evaluated again on the target host if it came from + domU.cfg. But what about pdev from 'xl scsi-attach pdev vdev'? Its required + to adjust h:c:t:l on the target host.
Use WWN notation? :-)
This was one of the reason the backend should support it.
docs/misc/pvscsi.txt line 20
Quoted 5 lines
docs/misc/pvscsi.txt new file +5
-0+ +Implement checks for duplicate pdev assignments? + - Not sure if SCSI devices can be shared. Will the state be consistent during + concurrent access? Should the host admin assume cooperative access from + multiple domUs?
SCSI does support device sharing. That's the reason for the existence of SCSI commands like "reserve" and "release".
Juergen
Re: [PATCH 4/4] libxl: add support for vscsi
In reply to Olaf HeringQuoted 14 lines · Olaf Hering
+++ b/tools/libxl/libxl_types.idl
tools/libxl/libxl_types.idl +12
-0+libxl_vscsi_hctl = Struct("vscsi_hctl", [ + ("hst", uint32), + ("chn", uint32), + ("tgt", uint32), + ("lun", uint32), + ]) + +libxl_vscsi_dev = Struct("vscsi_dev", [ + ("vscsi_dev_id", libxl_devid), + ("remove", bool), + ("p_devname", string), + ("pdev", libxl_vscsi_hctl),
tools/libxl/libxl_types.idl libxl_device_channel = Struct("device_channel", [ · line 566
Quoted 10 lines
tools/libxl/libxl_types.idl +10
-0+ ("vdev", libxl_vscsi_hctl), + ]) + +libxl_device_vscsi = Struct("device_vscsi", [ + ("backend_domid", libxl_domid), + ("devid", libxl_devid), + ("v_hst", uint32), + ("vscsi_devs", Array(libxl_vscsi_dev, "num_vscsi_devs")), + ("feature_host", bool), + ])
IanC, you made a comment about "vscsi_dev_id" in the pastebin.com comment about libxl_vscsi_hctl:
'- devid is just "devid" in all other places, not "TYPE_dev_id".'
Its used as <domid>/<vhost>/vscsi-devs/dev-<vscsi_dev_id>/. What name should be used to reference the devices? Also just "devid" even if it refers to devices "private" to the vscsi host?
Olaf
Re: [PATCH 4/4] libxl: add support for vscsi
In reply to Olaf Heringtools/libxl/libxl_vscsi.c line 205
Quoted 3 lines · Olaf Hering
tools/libxl/libxl_vscsi.c new file +2
-0+libxl_device_vscsi *libxl_device_vscsi_list (libxl_ctx *ctx,uint32_t domid,int *num) + fe_path =libxl__sprintf (gc,"%s/device/vscsi" ,libxl__xs_get_dompath (gc, domid));
IanC,
last year you made a comment that this path should not be trusted because its guest controlled. Other code does not seem to care much about that fact. What should be done here to have a robust parser?
Olaf
Re: [PATCH 4/4] libxl: add support for vscsi
In reply to Olaf HeringQuoted 31 lines · Olaf Hering
Quoted 14 lines · Olaf Hering
+++ b/tools/libxl/libxl_types.idl
tools/libxl/libxl_types.idl +12
-0+libxl_vscsi_hctl = Struct("vscsi_hctl", [ + ("hst", uint32), + ("chn", uint32), + ("tgt", uint32), + ("lun", uint32), + ]) + +libxl_vscsi_dev = Struct("vscsi_dev", [ + ("vscsi_dev_id", libxl_devid), + ("remove", bool), + ("p_devname", string), + ("pdev", libxl_vscsi_hctl),tools/libxl/libxl_types.idl libxl_device_channel = Struct("device_channel", [ · line 566
Quoted 10 lines
tools/libxl/libxl_types.idl +10
-0+ ("vdev", libxl_vscsi_hctl), + ]) + +libxl_device_vscsi = Struct("device_vscsi", [ + ("backend_domid", libxl_domid), + ("devid", libxl_devid), + ("v_hst", uint32), + ("vscsi_devs", Array(libxl_vscsi_dev, "num_vscsi_devs")), + ("feature_host", bool), + ])IanC, you made a comment about "
vscsi_dev_id" in the pastebin.com comment aboutlibxl_vscsi_hctl:
'- devid is just "devid" in all other places, not "TYPE_dev_id".'
Quoted 3 lines
Its used as <domid>/<vhost>/vscsi-devs/dev-<vscsi_dev_id>/. What name should be used to reference the devices? Also just "devid" even if it refers to devices "private" to the vscsi host?
Not sure. PCI uses vdevfn, which by extension would be vdevid here (assuming I've understood what you are suggesting correctly and therefore the analogy is valid).
Or could it be the case that there is no need to expose this value to the user in the first place and libxl could just make up the index numbers internally? Why would they want to configure it or retrieve it?
Is it actually the same as the offset into the vscsi_devs array?
How is it intended to be different from the vdev field?
Ian.
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
In reply to Juergen GrossQuoted 11 lines · Juergen Gross
Quoted 4 lines · Olaf Hering
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
The pvops backend driver should support the WWN notation. In case it isn't working this is a bug which should be repaired.
I implemented the WWn version before adding the possibility to use h:c:t:l due to compatibility with xend...
This requires changes to the libxl parser. I was not aware of that pvops uses such notation.
Olaf
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Juergen Gross
Quoted 4 lines · Olaf Hering
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
Quoted 8 lines
Quoted 5 lines
The pvops backend driver should support the WWN notation. In case it isn't working this is a bug which should be repaired.
I implemented the WWn version before adding the possibility to use h:c:t:l due to compatibility with xend...
This requires changes to the libxl parser. I was not aware of that pvops uses such notation.
And in fact it expects a colon in scsiback_add_translation_entry(). So my patch is still valid. If another implementation comes along which requires something else than h:c:t:l the comment will be adjusted. But, maybe the comment is just incomplete and the WWN example lacks the colon.
Olaf
Re: [PATCH 1/4] vscsiif.h: remove reference to WWN
Quoted 16 lines · Olaf Hering
Quoted 14 lines · Olaf Hering
Quoted 11 lines · Juergen Gross
Quoted 4 lines · Olaf Hering
The code in xend, xenlinux and pvops 3.18 expects the h:c:t:l notation. Remove incorrect reference to WWN because it was never supported. And its not clear how it could be supported. p-devname can be used to store a config string.
The pvops backend driver should support the WWN notation. In case it isn't working this is a bug which should be repaired.
I implemented the WWn version before adding the possibility to use h:c:t:l due to compatibility with xend...
Quoted 8 lines
Quoted 2 lines
This requires changes to the libxl parser. I was not aware of that pvops uses such notation.
And in fact it expects a colon in
scsiback_add_translation_entry(). So my patch is still valid. If another implementation comes along which requires something else than h:c:t:l the comment will be adjusted. But, maybe the comment is just incomplete and the WWN example lacks the colon.
I was just about to write this. :-)
It should be: WWN:l (with l being the LUN).
To be even more precise: The backend expects name:l. The name is checked against the WWN of the related device entry under /sys/kernel/config/target/core or against the contents of the alias entry under /sys/kernel/config/target/xen-pvscsi/*/tpgt_0/param/alias, so any string could be used as long as there is a match between the alias and the xenstore entry. "l" is in both cases the LUN number.
Juergen
Re: [PATCH 4/4] libxl: add support for vscsi
In reply to Ian CampbellQuoted 7 lines · Ian Campbell
Quoted 3 lines · Olaf Hering
Its used as <domid>/<vhost>/vscsi-devs/dev-<vscsi_dev_id>/. What name should be used to reference the devices? Also just "devid" even if it refers to devices "private" to the vscsi host?
Not sure. PCI uses vdevfn, which by extension would be vdevid here (assuming I've understood what you are suggesting correctly and therefore the analogy is valid).
After a quick grep its not clear what vdevfn represents. Will study that code later. libxl_device_pci indicates that single_host:many_devices is not used for PCI.
Quoted 3 lines
Or could it be the case that there is no need to expose this value to the user in the first place and libxl could just make up the index numbers internally? Why would they want to configure it or retrieve it?
I think the actual number is internal to the backend/frontend. Lets see -- the layout in the backend node is:
<domid>/<N>/vscsi-devs/dev-<M>/{p-dev,v-dev,state}
N is libxl_device_vscsi->devid, just as every other backend. M is libxl_device_vscsi->vscsi_devs->vscsi_dev_id.
One N can have several M (single host, many devices) which is different to all other backends.
I think the issue is that if two M exists and 'scsi-detach' removes M==0 the next time something walks <domid>/<N>/vscsi-devs/ it will find just a single entry with M==1. So this number has to be recorded.
Quoted 1 line
Is it actually the same as the offset into the
vscsi_devsarray?
Per the above it can not be the offset, the code has to handle holes.
Quoted 1 line
How is it intended to be different from the vdev field?
The vdev field is used to group several devices into a virtual controller. The HOST in HOST:CHN:TGT:LUN matters. In this sense the vscsi_dev_id is unrelated to the vdev field.
Olaf
Re: [PATCH 3/4] docs: add pvscsi.txt
In reply to Juergen GrossQuoted 8 lines · Juergen Gross
docs/misc/pvscsi.txt line 15
Quoted 4 lines · Olaf Hering
docs/misc/pvscsi.txt new file +4
-0+How to do live migration? + - pdev will likely be evaluated again on the target host if it came from + domU.cfg. But what about pdev from 'xl scsi-attach pdev vdev'? Its required + to adjust h:c:t:l on the target host.Use WWN notation? :-)
This was one of the reason the backend should support it.
How does it handle WWN internally, given that scsiback_add_translation_entry does not seem to understand it?
Quoted 6 lines
docs/misc/pvscsi.txt line 20
Quoted 4 lines
docs/misc/pvscsi.txt new file +4
-0+Implement checks for duplicate pdev assignments? + - Not sure if SCSI devices can be shared. Will the state be consistent during + concurrent access? Should the host admin assume cooperative access from + multiple domUs?SCSI does support device sharing. That's the reason for the existence of SCSI commands like "reserve" and "release".
In this case the code which checks pdev usage inlibxl_device_vscsi_get_host can just be removed.
Olaf
Re: [PATCH 3/4] docs: add pvscsi.txt
Quoted 7 lines · Olaf Hering
Quoted 5 lines · Juergen Gross
Quoted 4 lines · Olaf Hering
docs/misc/pvscsi.txt new file +4
-0+How to do live migration? + - pdev will likely be evaluated again on the target host if it came from + domU.cfg. But what about pdev from 'xl scsi-attach pdev vdev'? Its required + to adjust h:c:t:l on the target host.
Quoted 6 lines
Quoted 3 lines
Use WWN notation? :-)
This was one of the reason the backend should support it.
How does it handle WWN internally, given that
scsiback_add_translation_entrydoes not seem to understand it?
It does understand it. WWN:l is okay. A pscsi device can have multiple LUNs. The WWN is per target, not per LUN. The target infrastructure allows far more complex configurations (e.g. specific LUN mappings, access control for each LUN).
Quoted 10 lines
Quoted 7 lines
docs/misc/pvscsi.txt line 20
Quoted 5 lines
docs/misc/pvscsi.txt new file +4
-0+Implement checks for duplicate pdev assignments? + - Not sure if SCSI devices can be shared. Will the state be consistent during + concurrent access? Should the host admin assume cooperative access from + multiple domUs?SCSI does support device sharing. That's the reason for the existence of SCSI commands like "reserve" and "release".
In this case the code which checks pdev usage in
libxl_device_vscsi_get_hostcan just be removed.
Hmm, maybe issuing a warning would be a sensible thing to do?
Juergen
Re: [PATCH 3/4] docs: add pvscsi.txt
Quoted 4 lines · Juergen Gross
Quoted 2 lines · Olaf Hering
In this case the code which checks pdev usage in
libxl_device_vscsi_get_hostcan just be removed.Hmm, maybe issuing a warning would be a sensible thing to do?
This gets us back to square #1 with the question how to do
foreach domid ; foreach vscsi
If domains are started parallel a simple check will miss devices. Perhaps not an issue if its just a warning message.
Olaf