Re: [libvirt] [PATCH v2.5 03/10] conf: Introduce scsi hostdev

2013-04-15 Thread Han Cheng
Thanks for your best efforts. I only have one problem. Please find it at the end. 于 2013/4/10 16:59, Osier Yang 写道: On 09/04/13 10:32, Han Cheng wrote: Add scsi hostdev, it looks like: hostdev mode='subsystem' type='scsi' source adapter name='scsi_host0

[libvirt] [PATCH v2.5 02/10] docs/schemas: Move PortNumber and sourceinfoadapter to basictypes.rng

2013-04-08 Thread Han Cheng
The definiton of scsi adapter in storagespool.rng (sourceinfoadapter) can be used by scsi hostdev. Move it to basictypes.rng. PortNumber is defined in both domaincommon.rng and storagespool.rng, simplify it by moving it to basictypes.rng. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com

[libvirt] [PATCH v2.5 00/10] add support for scsi-generic for virtio-scsi

2013-04-08 Thread Han Cheng
finish this. Could you? TODO: change readonly to bool and change related managed and missing for consistency. Han Cheng (10): conf: Change help function docs/schemas: Move PortNumber and sourceinfoadapter to basictypes.rng conf: Introduce scsi hostdev qemu: New cap flag for scsi-generic

[libvirt] [PATCH v2.5 01/10] conf: Change help function

2013-04-08 Thread Han Cheng
The helper function to look up disk controller model may be used by scsi hostdev. But it should be changed to use device info. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/conf/domain_conf.c |8 src/conf/domain_conf.h |6 +++--- src/libvirt_private.syms |2

[libvirt] [PATCH v2.5 09/10] qemu: hotplug support for scsi hostdev

2013-04-08 Thread Han Cheng
This patch adds hotplug for scsi hostdev. And user should hotplug a virtio-scsi controller if doesn't exist. Usb hostdev related codes are in qemuDomainAttachHostDevice, push down to qemuDomainAttachHostUsbDevice. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/qemu/qemu_hotplug.c

[libvirt] [PATCH v2.5 03/10] conf: Introduce scsi hostdev

2013-04-08 Thread Han Cheng
affects scsi-generic is readonly. Introduce readonly/ to hostdevsubsysscsi. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- docs/formatdomain.html.in | 38 +++-- docs/schemas/domaincommon.rng | 29 +++ src/conf/domain_audit.c | 10 +++ src/conf/domain_conf.c

[libvirt] [PATCH v2.5 07/10] qemu: Basic management functions for scsi hostdev

2013-04-08 Thread Han Cheng
Although virtio-scsi support SCSI PR, the device in host may do not support this. To avoid losing data, we only allow one scsi hostdev be passthrough to one live guest. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/qemu/qemu_conf.h|2 + src/qemu/qemu_driver.c |3 + src

[libvirt] [PATCH v2.5 05/10] utils: util functions for scsi hostdev

2013-04-08 Thread Han Cheng
This patch adds util functions for scsi hostdev. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- po/POTFILES.in |1 + src/Makefile.am |1 + src/libvirt_private.syms | 22 +++ src/util/virscsi.c | 392 ++ src

[libvirt] [PATCH v2.5 08/10] qemu: cgroup and selinux for scsi hostdev

2013-04-08 Thread Han Cheng
As libvirt gives guest minimal cgroup, we need to add sg into guest cgroup whitelist for scsi hostdev. And we should set and restore selinux label correctly for scsi hostdev. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/qemu/qemu_cgroup.c | 71

Re: [libvirt] [PATCH v2 01/10] conf: Introduce readonly to hostdev and change helper function

2013-04-07 Thread Han Cheng
On 04/05/2013 07:17 PM, Paolo Bonzini wrote: Il 03/04/2013 05:37, Osier Yang ha scritto: codereadonly/code ddIndicates the device is readonly, only valid for SCSI device. span class=sinceSince 1.0.5/span. /dd dtcodeboot/code/dt ddSpecifies that the device is bootable.

Re: [libvirt] [PATCH v2 09/10] qemu: hotplug support for scsi hostdev

2013-04-05 Thread Han Cheng
On 04/03/2013 06:20 PM, Osier Yang wrote: On 01/04/13 20:01, Han Cheng wrote: And user should hotplug a virtio-scsi controller if doesn't exist. I'm wondering if it could be implicitly added. As I know, adding controller implicitly is for back compatibility. New codes don't need to do

Re: [libvirt] [PATCH v2 10/10] tests: tests for scsi hostdev

2013-04-05 Thread Han Cheng
On 04/03/2013 06:26 PM, Osier Yang wrote: On 01/04/13 20:01, Han Cheng wrote: diff --git a/tests/qemuhelpdata/qemu-1.0-device b/tests/qemuhelpdata/qemu-1.0-device index 0bdfbbd..d557f0e 100644 --- a/tests/qemuhelpdata/qemu-1.0-device +++ b/tests/qemuhelpdata/qemu-1.0-device @@ -136,3 +136,13

Re: [libvirt] [PATCH v2 01/10] conf: Introduce readonly to hostdev and change helper function

2013-04-05 Thread Han Cheng
On 04/02/2013 10:15 AM, Hu Tao wrote: On Mon, Apr 01, 2013 at 08:00:53PM +0800, Han Cheng wrote: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index edddf25..f8e3973 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -439,6 +439,8 @@ struct _virDomainHostdevDef

Re: [libvirt] [PATCH v2 05/10] utils: util functions for scsi hostdev

2013-04-04 Thread Han Cheng
On 04/03/2013 01:06 PM, Hu Tao wrote: On Mon, Apr 01, 2013 at 08:00:57PM +0800, Han Cheng wrote: +int +virSCSIDeviceListAdd(virSCSIDeviceListPtr list, + virSCSIDevicePtr dev) +{ +if (virSCSIDeviceListFind(list, dev)) { +virReportError(VIR_ERR_INTERNAL_ERROR

Re: [libvirt] [PATCH v2 05/10] utils: util functions for scsi hostdev

2013-04-04 Thread Han Cheng
On 04/03/2013 05:04 PM, Osier Yang wrote: On 01/04/13 20:00, Han Cheng wrote: + if (virAsprintf(tmp, SCSI_DEVFS /%s/vendor, dev-name) 0) { + virReportOOMError(); + goto out; + } + if (virFileReadAll(tmp, 1024, vendor) 0) + goto out; + VIR_FREE(tmp); + tmp = NULL; + if (virAsprintf(tmp

Re: [libvirt] [PATCH v2 03/10] conf: Introduce scsi hostdev

2013-04-04 Thread Han Cheng
On 04/02/2013 11:19 AM, Hu Tao wrote: On Mon, Apr 01, 2013 at 08:00:55PM +0800, Han Cheng wrote: diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index a776058..2fb5989 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -398,6 +398,16 @@ virDomainAuditHostdev

Re: [libvirt] [PATCH v2 03/10] conf: Introduce scsi hostdev

2013-04-04 Thread Han Cheng
On 04/03/2013 04:32 PM, Osier Yang wrote: On 03/04/13 16:29, Osier Yang wrote: On 01/04/13 20:00, Han Cheng wrote: dtcodehostdev/code/dt ddThe codehostdev/code element is the main container for describing host devices. For usb device passthrough codemode/code is always - subsystem

Re: [libvirt] [PATCH v2 07/10] qemu: Basic management functions for scsi hostdev

2013-04-04 Thread Han Cheng
On 04/03/2013 05:43 PM, Osier Yang wrote: On 01/04/13 20:00, Han Cheng wrote: Although virtio-scsi support SCSI PR, the device in host may do not support this. To avoid losing data, we only allow one scsi hostdev be passthrough to one guest. How about one specify (managed='no|yes

Re: [libvirt] [PATCH v2 05/10] utils: util functions for scsi hostdev

2013-04-03 Thread Han Cheng
On 04/03/2013 01:06 PM, Hu Tao wrote: On Mon, Apr 01, 2013 at 08:00:57PM +0800, Han Cheng wrote: +struct _virSCSIDevice { +unsigned int adapter; +unsigned int bus; +unsigned int target; +unsigned int unit; + +char *name

Re: [libvirt] [PATCH v2 03/10] conf: Introduce scsi hostdev

2013-04-03 Thread Han Cheng
On 04/03/2013 04:29 PM, Osier Yang wrote: On 01/04/13 20:00, Han Cheng wrote: @@ -10773,6 +10911,16 @@ virDomainDefParseXML(virCapsPtr caps, goto error; } + if (hostdev-source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI + hostdev-info-type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE

Re: [libvirt] [PATCH v2 06/10] qemu: Build qemu command line for scsi-generic

2013-04-02 Thread Han Cheng
On 04/01/2013 08:00 PM, Han Cheng wrote: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index eac72c2..e1af64f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -557,7 +557,7 @@ qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def, if (disk-info.type

Re: [libvirt] [PATCH v2 01/10] conf: Introduce readonly to hostdev and change helper function

2013-04-02 Thread Han Cheng
On 04/02/2013 11:02 AM, Han Cheng wrote: On 04/02/2013 10:15 AM, Hu Tao wrote: On Mon, Apr 01, 2013 at 08:00:53PM +0800, Han Cheng wrote: diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f3fca7f..d9d6b9f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c

Re: [libvirt] [PATCH v2 04/10] qemu: New cap flag for scsi-generic

2013-04-02 Thread Han Cheng
On 04/03/2013 11:41 AM, Osier Yang wrote: On 01/04/13 20:00, Han Cheng wrote: diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 7101f67..a3d8595 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -174,6 +174,8 @@ enum virQEMUCapsFlags

Re: [libvirt] [PATCH v2 04/10] qemu: New cap flag for scsi-generic

2013-04-02 Thread Han Cheng
On 04/03/2013 11:51 AM, Osier Yang wrote: On 03/04/13 11:48, Han Cheng wrote: On 04/03/2013 11:41 AM, Osier Yang wrote: On 01/04/13 20:00, Han Cheng wrote: diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 7101f67..a3d8595 100644 --- a/src/qemu

[libvirt] [PATCH v2 00/10] add support for scsi-generic for virtio-scsi

2013-04-01 Thread Han Cheng
support for scsi hostdev. The v1 could be found at: https://www.redhat.com/archives/libvir-list/2013-March/msg00073.html We may do some code refactoring to reduce code in pci/usb/sci hostdev later. Han Cheng (10): conf: Introduce readonly to hostdev and change helper function docs/schemas

[libvirt] [PATCH v2 01/10] conf: Introduce readonly to hostdev and change helper function

2013-04-01 Thread Han Cheng
The only parameter in -drive affect scsi-generic is readonly. Introduce readonly/ to hostdev. The helper function to look up disk controller model may be used by scsi hostdev. But it should be changed to use info. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- docs/formatdomain.html.in

[libvirt] [PATCH v2 08/10] qemu: cgroup and selinux for scsi hostdev

2013-04-01 Thread Han Cheng
As libvirt gives guest minimal cgroup, we need to add sg into guest cgroup whitelist for scsi hostdev. And we should set and restore selinux label correctly for scsi hostdev. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/qemu/qemu_cgroup.c | 67

[libvirt] [PATCH v2 04/10] qemu: New cap flag for scsi-generic

2013-04-01 Thread Han Cheng
Adding two caps to support scsi-generic: QEMU_CAPS_SCSI_GENERIC QEMU_CAPS_SCSI_GENERIC_BOOTINDEX Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/qemu/qemu_capabilities.c | 15 +-- src/qemu/qemu_capabilities.h |2 ++ 2 files changed, 15 insertions(+), 2 deletions

[libvirt] [PATCH v2 02/10] docs/schemas: split storagepool.rng for scsi hostdev

2013-04-01 Thread Han Cheng
-by: Han Cheng hanc.f...@cn.fujitsu.com --- docs/schemas/domaincommon.rng |6 +- docs/schemas/storagepool.rng | 18 ++ docs/schemas/storagepoolcommon.rng | 21 + 3 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 docs/schemas

[libvirt] [PATCH v2 06/10] qemu: Build qemu command line for scsi-generic

2013-04-01 Thread Han Cheng
and the qdev properties are(channel should always be 0): bus=scsicontroller.0 scsi-id=target lun=unit Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/qemu/qemu_command.c | 133 +-- src/qemu/qemu_command.h |6 ++ 2 files changed, 134

[libvirt] [PATCH v2 05/10] utils: util functions for scsi hostdev

2013-04-01 Thread Han Cheng
This patch add util functions for scsi hostdev. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- po/POTFILES.in |1 + src/Makefile.am |1 + src/libvirt_private.syms | 22 +++ src/util/virscsi.c | 399 ++ src

[libvirt] [PATCH v2 03/10] conf: Introduce scsi hostdev

2013-04-01 Thread Han Cheng
Adding scsi hostdev, it should like: hostdev mode='subsystem' type='scsi' source adapter name='scsi_host0'/ address bus='0' target='0' unit='0'/ /source address type='drive' controller='0' bus='0' target='4' unit='8'/ /hostdev Signed-off-by: Han Cheng

[libvirt] [PATCH v2 07/10] qemu: Basic management functions for scsi hostdev

2013-04-01 Thread Han Cheng
Although virtio-scsi support SCSI PR, the device in host may do not support this. To avoid losing data, we only allow one scsi hostdev be passthrough to one guest. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/qemu/qemu_conf.h|2 + src/qemu/qemu_driver.c |3 + src/qemu

[libvirt] [PATCH v2 09/10] qemu: hotplug support for scsi hostdev

2013-04-01 Thread Han Cheng
This patch add hotplug for scsi hostdev. And user should hotplug a virtio-scsi controller if doesn't exist. Usb hostdev related codes are in qemuDomainAttachHostDevice, push down to qemuDomainAttachHostUsbDevice. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- src/qemu/qemu_hotplug.c

[libvirt] [PATCH v2 10/10] tests: tests for scsi hostdev

2013-04-01 Thread Han Cheng
This patch add tests for scsi hostdev. Signed-off-by: Han Cheng hanc.f...@cn.fujitsu.com --- tests/qemuhelpdata/qemu-1.0-device | 10 ++ tests/qemuhelpdata/qemu-1.1.0-device | 10 ++ tests/qemuhelpdata/qemu-1.2.0-device |5 +++ tests

Re: [libvirt] [PATCH v2 01/10] conf: Introduce readonly to hostdev and change helper function

2013-04-01 Thread Han Cheng
On 04/02/2013 10:15 AM, Hu Tao wrote: On Mon, Apr 01, 2013 at 08:00:53PM +0800, Han Cheng wrote: --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2257,6 +2257,9 @@ codeid/code attribute that specifies the USB vendor and product id. The ids can be given

Re: [libvirt] [PATCH RFC 2/5] conf: Introduce scsi hostdev

2013-03-21 Thread Han Cheng
On 03/06/2013 02:24 PM, Osier Yang wrote: On 2013年03月04日 14:01, Han Cheng wrote: @@ -2928,6 +2929,96 @@ virDomainParseLegacyDeviceAddress(char *devaddr, } static int +virDomainHostdevSubsysScsiDefParseXML(const xmlNodePtr node

Re: [libvirt] [PATCHv4 2/5] S390: domain_conf support for CCW

2013-03-06 Thread Han Cheng
; virDomainDefClearDeviceAliases; virDomainDefClearPCIAddresses; virDomainDefCompatibleDevice; -- -- Han Cheng Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST) No. 6 Wenzhu Road, Nanjing, 210012, China TEL: +86+25-86630566-8540 FUJITSU INTERNAL: 79955-8540 FAX: +86+25

Re: [libvirt] [PATCH RFC 1/5] conf: Introduce readonly to hostdev and change helper function

2013-03-06 Thread Han Cheng
by your advice). Other problems will be fixed by next version. On 03/06/2013 01:40 PM, Osier Yang wrote: On 2013年03月04日 14:01, Han Cheng wrote: The only parameter in -drive affect scsi-generic is readonly. Introduce readonly/ tohostdev. The helper function to look up disk controller model may

Re: [libvirt] [PATCH RFC 2/5] conf: Introduce scsi hostdev

2013-03-06 Thread Han Cheng
On 03/06/2013 02:24 PM, Osier Yang wrote: On 2013年03月04日 14:01, Han Cheng wrote: Adding scsi hostdev, it should like: hostdev mode='subsystem' type='scsi' source adapter name='scsi_host0'/ address bus='0' target='0' unit='0'/ /source

Re: [libvirt] [PATCH RFC 2/5] conf: Introduce scsi hostdev

2013-03-06 Thread Han Cheng
Acutally, I've changed xml from Paolo's proposal. I deleted the target as it is not easy to parse for virDomainDeviceInfoParseXML and there is nothing else. And I changed address type from scsi to drive as they are the same. On 03/06/2013 09:09 PM, Han Cheng wrote: On 03/06/2013 02:24 PM, Osier

[libvirt] TEST

2013-03-03 Thread Han Cheng
Sorry, just a test. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] TEST

2013-03-03 Thread Han Cheng
Sorry, just a test. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH RFC 1/5] conf: Introduce readonly to hostdev and change helper function

2013-03-03 Thread Han Cheng
The only parameter in -drive affect scsi-generic is readonly. Introduce readonly/ to hostdev. The helper function to look up disk controller model may be used by scsi hostdev. But it should be changed to use info. --- docs/schemas/domaincommon.rng |5 + src/conf/domain_conf.c|

[libvirt] [PATCH RFC 4/5] qemu: Build qemu command line for scsi-generic

2013-03-03 Thread Han Cheng
For scsi-generic, the command line will be like: -drive file=/dev/sg0,if=none,id=drive-hostdev-scsi0-0-0-0 -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=drive-hostdev-scsi0-0-0-0,id=hostdev-scsi0-0-0-0 The relationship between the libvirt address attrs and the qdev

[libvirt] [PATCH RFC 0/5] add support for scsi-generic for virtio-scsi

2013-03-03 Thread Han Cheng
create some redundant codes. Any ideas? Han Cheng (5): conf: Introduce readonly to hostdev and change helper function conf: Introduce scsi hostdev qemu: New cap flag for scsi-generic qemu: Build qemu command line for scsi-generic tests: tests for scsi hostdev docs/formatdomain.html.in

[libvirt] [PATCH RFC 2/5] conf: Introduce scsi hostdev

2013-03-03 Thread Han Cheng
Adding scsi hostdev, it should like: hostdev mode='subsystem' type='scsi' source adapter name='scsi_host0'/ address bus='0' target='0' unit='0'/ /source address type='drive' controller='0' bus='0' target='4' unit='8'/ /hostdev ---

[libvirt] [PATCH RFC 5/5] tests: tests for scsi hostdev

2013-03-03 Thread Han Cheng
--- docs/formatdomain.html.in | 36 tests/qemuhelpdata/qemu-1.0-device | 10 + tests/qemuhelpdata/qemu-1.1.0-device | 10 + tests/qemuhelpdata/qemu-1.2.0-device |5 +++

[libvirt] [PATCH RFC 3/5] qemu: New cap flag for scsi-generic

2013-03-03 Thread Han Cheng
Adding two caps to support scsi-generic: QEMU_CAPS_SCSI_GENERIC QEMU_CAPS_SCSI_HOST_BOOTINDEX --- src/qemu/qemu_capabilities.c | 15 +-- src/qemu/qemu_capabilities.h |2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c