Re: [libvirt] [PATCH 10/10] qemu: report error when shmem have a invalid address
On Wed, Jun 17, 2015 at 11:56:21AM +0800, Luyao Huang wrote: If user pass a invalid address shared memory device to qemu, qemu won't report the error, but will auto assign a pci address to the shared memory device. Signed-off-by: Luyao Huang lhu...@redhat.com --- src/qemu/qemu_command.c | 7 +++ 1 file changed, 7 insertions(+) ACK diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5d55794..9c659fe 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8482,6 +8482,13 @@ qemuBuildShmemDevStr(virDomainDefPtr def, } } +if (shmem-info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(only 'pci' addresses are supported for the + shared memory device)); +goto error; +} + if (qemuBuildDeviceAddressStr(buf, def, shmem-info, qemuCaps) 0) goto error; -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 10/10] qemu: report error when shmem have a invalid address
On Wed, Jul 08, 2015 at 02:22:36PM +0200, Martin Kletzander wrote: On Wed, Jun 17, 2015 at 11:56:21AM +0800, Luyao Huang wrote: If user pass a invalid address shared memory device to qemu, qemu won't report the error, but will auto assign a pci address to the shared memory device. Signed-off-by: Luyao Huang lhu...@redhat.com --- src/qemu/qemu_command.c | 7 +++ 1 file changed, 7 insertions(+) ACK I also added a test case for this particular patch and pushed it along with the other ACK'd ones. The test case diff squashed in: diff --git c/tests/qemuxml2argvdata/qemuxml2argv-shmem-msi-only.xml i/tests/qemuxml2argvdata/qemuxml2argv-shmem-invalid-address.xml similarity index 95% copy from tests/qemuxml2argvdata/qemuxml2argv-shmem-msi-only.xml copy to tests/qemuxml2argvdata/qemuxml2argv-shmem-invalid-address.xml index d70279c21faa..8a4e56d5926a 100644 --- c/tests/qemuxml2argvdata/qemuxml2argv-shmem-msi-only.xml +++ i/tests/qemuxml2argvdata/qemuxml2argv-shmem-invalid-address.xml @@ -18,7 +18,7 @@ controller type='pci' index='0' model='pci-root'/ memballoon model='none'/ shmem name='shmem0' - msi/ + address type='isa'/ /shmem /devices /domain diff --git c/tests/qemuxml2argvtest.c i/tests/qemuxml2argvtest.c index bee66372767b..24c1f301e4b9 100644 --- c/tests/qemuxml2argvtest.c +++ i/tests/qemuxml2argvtest.c @@ -1614,6 +1614,8 @@ mymain(void) DO_TEST_FAILURE(shmem, NONE); DO_TEST_FAILURE(shmem-invalid-size, QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM); +DO_TEST_FAILURE(shmem-invalid-address, QEMU_CAPS_PCIDEVICE, +QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM); DO_TEST_FAILURE(shmem-small-size, QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM); DO_TEST_PARSE_ERROR(shmem-msi-only, NONE); -- signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 10/10] qemu: report error when shmem have a invalid address
On 07/08/2015 10:30 PM, Martin Kletzander wrote: On Wed, Jul 08, 2015 at 02:22:36PM +0200, Martin Kletzander wrote: On Wed, Jun 17, 2015 at 11:56:21AM +0800, Luyao Huang wrote: If user pass a invalid address shared memory device to qemu, qemu won't report the error, but will auto assign a pci address to the shared memory device. Signed-off-by: Luyao Huang lhu...@redhat.com --- src/qemu/qemu_command.c | 7 +++ 1 file changed, 7 insertions(+) ACK I also added a test case for this particular patch and pushed it along with the other ACK'd ones. Thanks a lot for your review and help. Luyao The test case diff squashed in: diff --git c/tests/qemuxml2argvdata/qemuxml2argv-shmem-msi-only.xml i/tests/qemuxml2argvdata/qemuxml2argv-shmem-invalid-address.xml similarity index 95% copy from tests/qemuxml2argvdata/qemuxml2argv-shmem-msi-only.xml copy to tests/qemuxml2argvdata/qemuxml2argv-shmem-invalid-address.xml index d70279c21faa..8a4e56d5926a 100644 --- c/tests/qemuxml2argvdata/qemuxml2argv-shmem-msi-only.xml +++ i/tests/qemuxml2argvdata/qemuxml2argv-shmem-invalid-address.xml @@ -18,7 +18,7 @@ controller type='pci' index='0' model='pci-root'/ memballoon model='none'/ shmem name='shmem0' - msi/ + address type='isa'/ /shmem /devices /domain diff --git c/tests/qemuxml2argvtest.c i/tests/qemuxml2argvtest.c index bee66372767b..24c1f301e4b9 100644 --- c/tests/qemuxml2argvtest.c +++ i/tests/qemuxml2argvtest.c @@ -1614,6 +1614,8 @@ mymain(void) DO_TEST_FAILURE(shmem, NONE); DO_TEST_FAILURE(shmem-invalid-size, QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM); +DO_TEST_FAILURE(shmem-invalid-address, QEMU_CAPS_PCIDEVICE, +QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM); DO_TEST_FAILURE(shmem-small-size, QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_IVSHMEM); DO_TEST_PARSE_ERROR(shmem-msi-only, NONE); -- -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 10/10] qemu: report error when shmem have a invalid address
If user pass a invalid address shared memory device to qemu, qemu won't report the error, but will auto assign a pci address to the shared memory device. Signed-off-by: Luyao Huang lhu...@redhat.com --- src/qemu/qemu_command.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5d55794..9c659fe 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8482,6 +8482,13 @@ qemuBuildShmemDevStr(virDomainDefPtr def, } } +if (shmem-info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(only 'pci' addresses are supported for the + shared memory device)); +goto error; +} + if (qemuBuildDeviceAddressStr(buf, def, shmem-info, qemuCaps) 0) goto error; -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list