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: @@ -11028,6 +11154,18 @@ virDomainDefParseXML

[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 --- src/qemu/qemu_cgroup.c | 71 ++ src/qemu

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

2013-04-08 Thread Han Cheng
and the qdev properties are(channel should always be 0): bus=scsi.0 scsi-id= lun= Signed-off-by: Han Cheng --- src/qemu/qemu_command.c | 130 +- src/qemu/qemu_command.h |6 ++ 2 files changed, 133 insertions(+), 3 deletions(-) diff --git a

[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 --- po/POTFILES.in |1 + src/Makefile.am |1 + src/libvirt_private.syms | 22 +++ src/util/virscsi.c | 392 ++ src/util/virscsi.h

[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 --- src/qemu/qemu_conf.h|2 + src/qemu/qemu_driver.c |3 + src/qemu/qemu_hostdev.c

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

2013-04-08 Thread Han Cheng
Add scsi hostdev, it looks like: The only parameter in -drive affects scsi-generic is readonly. Introduce to . Signed-off-by: Han Cheng --- docs/formatdomain.html.in | 38 +++-- docs/schemas/domaincommon.rng | 29 +++ src/conf

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

2013-04-08 Thread Han Cheng
This patch adds tests for scsi hostdev. Signed-off-by: Han Cheng --- .../qemuxml2argv-hostdev-scsi-boot.args| 10 ++ .../qemuxml2argv-hostdev-scsi-boot.xml | 34 +++ .../qemuxml2argv-hostdev-scsi-readonly.args| 10

[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 --- src/qemu/qemu_hotplug.c |

[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 --- src/conf/domain_conf.c |8 src/conf/domain_conf.h |6 +++--- src/libvirt_private.syms |2 +- src/qemu

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

2013-04-08 Thread Han Cheng
Adding two caps to support scsi-generic: QEMU_CAPS_SCSI_GENERIC QEMU_CAPS_SCSI_GENERIC_BOOTINDEX Signed-off-by: Han Cheng --- src/qemu/qemu_capabilities.c | 14 -- src/qemu/qemu_capabilities.h |2 ++ tests/qemuhelpdata/qemu-1.0-device | 10

[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 --- docs/schemas

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

2013-04-08 Thread Han Cheng
to help me 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 sc

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: readonly Indicates the device is readonly, only valid for SCSI device. Since 1.0.5. boot Specifies that the device is bootable. Theorder attribute determines the order in which

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 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 09/10] qemu: hotplug support for scsi hostdev

2013-04-04 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

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 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: hostdev The hostdev element is the main container for describing host devices. For usb device passthrough mode is always - "subsystem" and type is "usb"

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 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 = N

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 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_

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

2013-04-02 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 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

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 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 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.t

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 @@ id attribute that specifies the USB vendor and product id. The ids can be given in decimal

[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 --- tests/qemuhelpdata/qemu-1.0-device | 10 ++ tests/qemuhelpdata/qemu-1.1.0-device | 10 ++ tests/qemuhelpdata/qemu-1.2.0-device |5 +++ tests/qemuhelpdata/qemu-kvm

[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 --- src/qemu/qemu_hotplug.c |

[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 --- src/qemu/qemu_conf.h|2 + src/qemu/qemu_driver.c |3 + src/qemu/qemu_hostdev.c | 227

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

2013-04-01 Thread Han Cheng
Adding scsi hostdev, it should like: Signed-off-by: Han Cheng --- docs/formatdomain.html.in | 34 ++-- docs/schemas/domaincommon.rng | 24 + src/conf/domain_audit.c | 10 ++ src/conf/domain_conf.c| 192

[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 --- po/POTFILES.in |1 + src/Makefile.am |1 + src/libvirt_private.syms | 22 +++ src/util/virscsi.c | 399 ++ src/util/virscsi.h | 83

[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=scsi.0 scsi-id= lun= Signed-off-by: Han Cheng --- src/qemu/qemu_command.c | 133 +-- src/qemu/qemu_command.h |6 ++ 2 files changed, 134 insertions(+), 5 deletions(-) diff --git a

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

2013-04-01 Thread Han Cheng
: Han Cheng --- 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/storagepoolcommon.rng

[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 --- src/qemu/qemu_capabilities.c | 15 +-- src/qemu/qemu_capabilities.h |2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src

[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 --- src/qemu/qemu_cgroup.c | 67 +++--- src/qemu

[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 to . 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 --- docs/formatdomain.html.in |3 +++ docs/schemas

[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

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 >> +virDomainHostdevSubsysScsi

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 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 P

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: >> >> >> >> >> >> >> >> >> @@ -3893,4 +3921,9 @@

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

2013-03-06 Thread Han Cheng
dvice). 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 >>to. >> The helper function to look up disk controller model may

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

2013-03-06 Thread Han Cheng
virDomainDeviceInfoPtr src); void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info); void virDomainDefClearPCIAddresses(virDomainDefPtr def); +void virDomainDefClearCCWAddresses(virDomainDefPtr def); void virDomainDefClearDeviceAliases(virDomainDefPtr def); typedef int (*virDomainDeviceIn

[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 b/src/qem

[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 +++ tests/qemuhelpdata/qe

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

2013-03-03 Thread Han Cheng
Adding scsi hostdev, it should like: --- docs/schemas/domaincommon.rng | 33 + src/conf/domain_audit.c | 10 +++ src/conf/domain_conf.c| 149 +++-- src/conf/domain_conf.h|7

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

2013-03-03 Thread Han Cheng
s may 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.ht

[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 to . 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| 18 ++-

[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 propert

[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