Re: [libvirt] [PATCH] support vhost-scsi controller
On 13:18 Sat 19 Jul , Zhang Min wrote: libvirt support vhost-scsi controller. The way to config the vhost-scsi controller is edit the xml file, Format is as follows: controller type='scsi' index='0' model='vhost-scsi' source wwpn='naa.6001405f5e3acbba' event_idx='on'/ /controller the tag of wwpn is necessary, the 'model' must be 'vhost-scsi' 'event_idx' is optional. Signed-off-by: Zhang Min rudy.zhang...@huawei.com This patch will not work without passing a pre-opened file descriptor to vhost-scsi, so that the child qemu process can interact with the vhost-scsi character device. Please take a look at the following patch for further progress on this: https://www.redhat.com/archives/libvir-list/2014-July/msg01235.html -- Mike Perez -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] support vhost-scsi controller
On Sat, Jul 19, 2014 at 01:18:55PM +0800, Zhang Min wrote: libvirt support vhost-scsi controller. The way to config the vhost-scsi controller is edit the xml file, Format is as follows: controller type='scsi' index='0' model='vhost-scsi' source wwpn='naa.6001405f5e3acbba' event_idx='on'/ /controller the tag of wwpn is necessary, the 'model' must be 'vhost-scsi' 'event_idx' is optional. Signed-off-by: Zhang Min rudy.zhang...@huawei.com This design to XML modelling is flawed for the reasons I describe here, so NACK to this https://www.redhat.com/archives/libvir-list/2014-July/msg01390.html Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] support vhost-scsi controller
libvirt support vhost-scsi controller. The way to config the vhost-scsi controller is edit the xml file, Format is as follows: controller type='scsi' index='0' model='vhost-scsi' source wwpn='naa.6001405f5e3acbba' event_idx='on'/ /controller the tag of wwpn is necessary, the 'model' must be 'vhost-scsi' 'event_idx' is optional. Signed-off-by: Zhang Min rudy.zhang...@huawei.com --- src/conf/domain_conf.c | 64 +++-- src/conf/domain_conf.h | 10 ++ src/qemu/qemu_capabilities.c |2 + src/qemu/qemu_capabilities.h |1 + src/qemu/qemu_command.c | 21 - src/vmx/vmx.c|3 +- 6 files changed, 94 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 54925ba..e42ede7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -306,7 +306,8 @@ VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAS vmpvscsi, ibmvscsi, virtio-scsi, - lsisas1078); + lsisas1078, + vhost-scsi); VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST, piix3-uhci, @@ -1290,6 +1291,10 @@ void virDomainControllerDefFree(virDomainControllerDefPtr def) if (!def) return; +if (def-vhostscsi.wwpn) +VIR_FREE(def-vhostscsi.wwpn); +memset(def-vhostscsi, 0, sizeof(def-vhostscsi)); + virDomainDeviceInfoClear(def-info); VIR_FREE(def); @@ -6051,6 +6056,9 @@ virDomainControllerDefParseXML(xmlNodePtr node, char *max_sectors = NULL; xmlNodePtr saved = ctxt-node; int rc; +char *wwpn = NULL; +char *event_idx = NULL; +int event_idx_num = 0; ctxt-node = node; @@ -6087,13 +6095,42 @@ virDomainControllerDefParseXML(xmlNodePtr node, def-model = -1; } +def-vhostscsi.wwpn = NULL; cur = node-children; while (cur != NULL) { if (cur-type == XML_ELEMENT_NODE) { if (xmlStrEqual(cur-name, BAD_CAST driver)) queues = virXMLPropString(cur, queues); -cmd_per_lun = virXMLPropString(cur, cmd_per_lun); -max_sectors = virXMLPropString(cur, max_sectors); +else if(xmlStrEqual(cur-name, BAD_CAST source)) { +switch (def-model) { +case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI: +wwpn = virXMLPropString(cur, wwpn); +if (wwpn !STREQ(wwpn,)) { +def-vhostscsi.wwpn = wwpn; +wwpn = NULL; +} else { +virReportError(VIR_ERR_XML_ERROR, +_(vhost-scsi:wwpn can't be null)); +goto error; +} + +event_idx = virXMLPropString(cur, event_idx); +if (event_idx) { +if ((event_idx_num = virDomainVirtioEventIdxTypeFromString(event_idx)) = 0) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(unknown vhost-scsi event_idx mode '%s'), + event_idx); +goto error; +} +def-vhostscsi.event_idx = event_idx_num; +} +break; +default: +break; +} +} +cmd_per_lun = virXMLPropString(cur, cmd_per_lun); +max_sectors = virXMLPropString(cur, max_sectors); } cur = cur-next; } @@ -6216,6 +6253,12 @@ virDomainControllerDefParseXML(xmlNodePtr node, goto error; } +if (def-model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI +def-vhostscsi.wwpn == NULL) { +virReportError(VIR_ERR_XML_ERROR,_(vhost-scsi:wwpn can't be null)); +goto error; +} + cleanup: ctxt-node = saved; VIR_FREE(type); @@ -6224,6 +6267,8 @@ virDomainControllerDefParseXML(xmlNodePtr node, VIR_FREE(queues); VIR_FREE(cmd_per_lun); VIR_FREE(max_sectors); +VIR_FREE(wwpn); +VIR_FREE(event_idx); return def; @@ -15300,10 +15345,21 @@ virDomainControllerDefFormat(virBufferPtr buf, break; } -if (def-queues || def-cmd_per_lun || def-max_sectors || +if (def-queues || def-cmd_per_lun || def-max_sectors || def-vhostscsi.wwpn virDomainDeviceInfoIsSet(def-info, flags) || pcihole64) { virBufferAddLit(buf, \n); virBufferAdjustIndent(buf, 2); + +if (def-vhostscsi.wwpn) { +virBufferAsprintf(buf, source wwpn='%s', def-vhostscsi.wwpn); + + if
[libvirt] [PATCH] support vhost-scsi controller
libvirt support vhost-scsi controller. The way to config the vhost-scsi controller is edit the xml file, Format is as follows: controller type='scsi' index='0' model='vhost-scsi' source wwpn='naa.6001405f5e3acbba' event_idx='on'/ /controller the tag of wwpn is necessary, the 'model' must be 'vhost-scsi' 'event_idx' is optional. Signed-off-by: Zhang Min rudy.zhang...@huawei.com --- src/conf/domain_conf.c | 64 +++-- src/conf/domain_conf.h | 10 ++ src/qemu/qemu_capabilities.c |2 + src/qemu/qemu_capabilities.h |1 + src/qemu/qemu_command.c | 21 - src/vmx/vmx.c|3 +- 6 files changed, 94 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 54925ba..e42ede7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -306,7 +306,8 @@ VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAS vmpvscsi, ibmvscsi, virtio-scsi, - lsisas1078); + lsisas1078, + vhost-scsi); VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST, piix3-uhci, @@ -1290,6 +1291,10 @@ void virDomainControllerDefFree(virDomainControllerDefPtr def) if (!def) return; +if (def-vhostscsi.wwpn) +VIR_FREE(def-vhostscsi.wwpn); +memset(def-vhostscsi, 0, sizeof(def-vhostscsi)); + virDomainDeviceInfoClear(def-info); VIR_FREE(def); @@ -6051,6 +6056,9 @@ virDomainControllerDefParseXML(xmlNodePtr node, char *max_sectors = NULL; xmlNodePtr saved = ctxt-node; int rc; +char *wwpn = NULL; +char *event_idx = NULL; +int event_idx_num = 0; ctxt-node = node; @@ -6087,13 +6095,42 @@ virDomainControllerDefParseXML(xmlNodePtr node, def-model = -1; } +def-vhostscsi.wwpn = NULL; cur = node-children; while (cur != NULL) { if (cur-type == XML_ELEMENT_NODE) { if (xmlStrEqual(cur-name, BAD_CAST driver)) queues = virXMLPropString(cur, queues); -cmd_per_lun = virXMLPropString(cur, cmd_per_lun); -max_sectors = virXMLPropString(cur, max_sectors); +else if(xmlStrEqual(cur-name, BAD_CAST source)) { +switch (def-model) { +case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI: +wwpn = virXMLPropString(cur, wwpn); +if (wwpn !STREQ(wwpn,)) { +def-vhostscsi.wwpn = wwpn; +wwpn = NULL; +} else { +virReportError(VIR_ERR_XML_ERROR, +_(vhost-scsi:wwpn can't be null)); +goto error; +} + +event_idx = virXMLPropString(cur, event_idx); +if (event_idx) { +if ((event_idx_num = virDomainVirtioEventIdxTypeFromString(event_idx)) = 0) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(unknown vhost-scsi event_idx mode '%s'), + event_idx); +goto error; +} +def-vhostscsi.event_idx = event_idx_num; +} +break; +default: +break; +} +} +cmd_per_lun = virXMLPropString(cur, cmd_per_lun); +max_sectors = virXMLPropString(cur, max_sectors); } cur = cur-next; } @@ -6216,6 +6253,12 @@ virDomainControllerDefParseXML(xmlNodePtr node, goto error; } +if (def-model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI +def-vhostscsi.wwpn == NULL) { +virReportError(VIR_ERR_XML_ERROR,_(vhost-scsi:wwpn can't be null)); +goto error; +} + cleanup: ctxt-node = saved; VIR_FREE(type); @@ -6224,6 +6267,8 @@ virDomainControllerDefParseXML(xmlNodePtr node, VIR_FREE(queues); VIR_FREE(cmd_per_lun); VIR_FREE(max_sectors); +VIR_FREE(wwpn); +VIR_FREE(event_idx); return def; @@ -15300,10 +15345,21 @@ virDomainControllerDefFormat(virBufferPtr buf, break; } -if (def-queues || def-cmd_per_lun || def-max_sectors || +if (def-queues || def-cmd_per_lun || def-max_sectors || def-vhostscsi.wwpn virDomainDeviceInfoIsSet(def-info, flags) || pcihole64) { virBufferAddLit(buf, \n); virBufferAdjustIndent(buf, 2); + +if (def-vhostscsi.wwpn) { +virBufferAsprintf(buf, source wwpn='%s', def-vhostscsi.wwpn); + + if