Re: [libvirt] [PATCH 04/17] Add a test for long USB port paths

2016-06-22 Thread Gerd Hoffmann
On Di, 2016-06-21 at 18:19 +0200, Ján Tomko wrote:
> On Mon, Jun 20, 2016 at 08:50:31AM +0200, Gerd Hoffmann wrote:
> >On Fr, 2016-06-17 at 20:07 +0200, Ján Tomko wrote:
> >> For some reason, we support up to four levels of nested USB devices
> >> in the guest.
> >
> >FYI: The reason is simply that usb is specified that way.  You can't
> >chain usb hubs endlessly.
> >
> 
> I was under the impression that 7 is the maximum depth.

5 hubs IIRC (not fully sure whenever that includes the root hub or not).
So, yes, we can do more than 4.  The only use case for that I've seen so
far is QA trying to go to the limits.  For all practical purposes I'd
expect 4 levels is *way* more than you'll ever need.  Especially as the
qemu usb hub supports usb 1.1 only.

cheers,
  Gerd



--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 04/17] Add a test for long USB port paths

2016-06-21 Thread Ján Tomko

On Mon, Jun 20, 2016 at 08:50:31AM +0200, Gerd Hoffmann wrote:

On Fr, 2016-06-17 at 20:07 +0200, Ján Tomko wrote:

For some reason, we support up to four levels of nested USB devices
in the guest.


FYI: The reason is simply that usb is specified that way.  You can't
chain usb hubs endlessly.



I was under the impression that 7 is the maximum depth.

I see that QEMU errors out at 6 levels for a USB hub:
qemu-git: -device usb-hub,port=1.1.1.1.1.1: usb hub chain too deep

So perhaps up to 6 levels could be allowed for regular devices?

Jan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 04/17] Add a test for long USB port paths

2016-06-21 Thread Peter Krempa
On Fri, Jun 17, 2016 at 20:07:06 +0200, Ján Tomko wrote:
> For some reason, we support up to four levels of nested USB devices
> in the guest.

This was explained by Gerd, so please fix it.

> 
> Add a test for a domain using all four and a negative test for a domain
> using five.
> ---

ACK

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 04/17] Add a test for long USB port paths

2016-06-20 Thread Gerd Hoffmann
On Fr, 2016-06-17 at 20:07 +0200, Ján Tomko wrote:
> For some reason, we support up to four levels of nested USB devices
> in the guest.

FYI: The reason is simply that usb is specified that way.  You can't
chain usb hubs endlessly.

cheers,
  Gerd


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 04/17] Add a test for long USB port paths

2016-06-17 Thread Ján Tomko
For some reason, we support up to four levels of nested USB devices
in the guest.

Add a test for a domain using all four and a negative test for a domain
using five.
---
 .../qemuxml2argv-usb-long-port-path.args   | 27 ++
 .../qemuxml2argv-usb-long-port-path.xml| 30 
 ...qemuxml2argv-usb-too-long-port-path-invalid.xml | 33 ++
 tests/qemuxml2argvtest.c   |  5 
 4 files changed, 95 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args 
b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args
new file mode 100644
index 000..d9100f6
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.args
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev 
socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-device usb-hub,id=hub0,bus=usb.0,port=1 \
+-device usb-hub,id=hub1,bus=usb.0,port=1.1 \
+-device usb-hub,id=hub2,bus=usb.0,port=1.1.1 \
+-device usb-hub,id=hub3,bus=usb.0,port=1.1.1.1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml
new file mode 100644
index 000..06967b1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-long-port-path.xml
@@ -0,0 +1,30 @@
+
+  QEMUGuest1
+  c7a5fdbd-edaf-9455-926a-d65c16db1809
+  219136
+  219136
+  1
+  
+hvm
+
+  
+  
+/usr/bin/qemu
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
diff --git 
a/tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml
new file mode 100644
index 000..789628a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-too-long-port-path-invalid.xml
@@ -0,0 +1,33 @@
+
+  QEMUGuest1
+  c7a5fdbd-edaf-9455-926a-d65c16db1809
+  219136
+  219136
+  1
+  
+hvm
+
+  
+  
+/usr/bin/qemu
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d47dc58..2a8f6c4 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2014,6 +2014,11 @@ mymain(void)
 DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);
 
 DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);
+DO_TEST("usb-long-port-path", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
+QEMU_CAPS_USB_HUB);
+DO_TEST_PARSE_FLAGS_ERROR("usb-too-long-port-path-invalid",
+  QEMU_CAPS_CHARDEV,
+  QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_USB_HUB);
 
 DO_TEST("acpi-table", NONE);
 
-- 
2.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list