提交 49cc0340 编写于 作者: F Felipe Franciosi 提交者: Paolo Bonzini

vhost-user-scsi: Introduce a vhost-user-scsi sample application

This commit introduces a vhost-user-scsi backend sample application. It
must be linked with libiscsi and libvhost-user.

To use it, compile with:
  $ make vhost-user-scsi

And run as follows:
  $ ./vhost-user-scsi -u vus.sock -i iscsi://uri_to_target/
  $ qemu-system-x86_64 --enable-kvm -m 512 \
      -object memory-backend-file,id=mem,size=512m,share=on,mem-path=guestmem \
      -numa node,memdev=mem \
      -chardev socket,id=vhost-user-scsi,path=vus.sock \
      -device vhost-user-scsi-pci,chardev=vhost-user-scsi \

The application is currently limited at one LUN only and it processes
requests synchronously (therefore only achieving QD1). The purpose of
the code is to show how a backend can be implemented and to test the
vhost-user-scsi Qemu implementation.

If a different instance of this vhost-user-scsi application is executed
at a remote host, a VM can be live migrated to such a host.
Signed-off-by: NFelipe Franciosi <felipe@nutanix.com>
Message-Id: <1488479153-21203-5-git-send-email-felipe@nutanix.com>
上级 f12c1ebd
...@@ -269,6 +269,7 @@ dummy := $(call unnest-vars,, \ ...@@ -269,6 +269,7 @@ dummy := $(call unnest-vars,, \
ivshmem-client-obj-y \ ivshmem-client-obj-y \
ivshmem-server-obj-y \ ivshmem-server-obj-y \
libvhost-user-obj-y \ libvhost-user-obj-y \
vhost-user-scsi-obj-y \
qga-vss-dll-obj-y \ qga-vss-dll-obj-y \
block-obj-y \ block-obj-y \
block-obj-m \ block-obj-m \
...@@ -473,6 +474,8 @@ ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS) ...@@ -473,6 +474,8 @@ ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
$(call LINK, $^) $(call LINK, $^)
ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS) ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
$(call LINK, $^) $(call LINK, $^)
vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y)
$(call LINK, $^)
module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
$(call quiet-command,$(PYTHON) $< $@ \ $(call quiet-command,$(PYTHON) $< $@ \
......
...@@ -110,6 +110,10 @@ qga-vss-dll-obj-y = qga/ ...@@ -110,6 +110,10 @@ qga-vss-dll-obj-y = qga/
ivshmem-client-obj-y = contrib/ivshmem-client/ ivshmem-client-obj-y = contrib/ivshmem-client/
ivshmem-server-obj-y = contrib/ivshmem-server/ ivshmem-server-obj-y = contrib/ivshmem-server/
libvhost-user-obj-y = contrib/libvhost-user/ libvhost-user-obj-y = contrib/libvhost-user/
vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS)
vhost-user-scsi.o-libs := $(LIBISCSI_LIBS)
vhost-user-scsi-obj-y = contrib/vhost-user-scsi/
vhost-user-scsi-obj-y += contrib/libvhost-user/libvhost-user.o
###################################################################### ######################################################################
trace-events-subdirs = trace-events-subdirs =
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <sys/poll.h>
#include <linux/vhost.h> #include <linux/vhost.h>
#include "standard-headers/linux/virtio_ring.h" #include "standard-headers/linux/virtio_ring.h"
...@@ -192,11 +193,11 @@ typedef struct VuVirtq { ...@@ -192,11 +193,11 @@ typedef struct VuVirtq {
} VuVirtq; } VuVirtq;
enum VuWatchCondtion { enum VuWatchCondtion {
VU_WATCH_IN = 1 << 0, VU_WATCH_IN = POLLIN,
VU_WATCH_OUT = 1 << 1, VU_WATCH_OUT = POLLOUT,
VU_WATCH_PRI = 1 << 2, VU_WATCH_PRI = POLLPRI,
VU_WATCH_ERR = 1 << 3, VU_WATCH_ERR = POLLERR,
VU_WATCH_HUP = 1 << 4, VU_WATCH_HUP = POLLHUP,
}; };
typedef void (*vu_panic_cb) (VuDev *dev, const char *err); typedef void (*vu_panic_cb) (VuDev *dev, const char *err);
......
vhost-user-scsi-obj-y = vhost-user-scsi.o
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册