From 3a82f628a964f9bfaf0d3bdc69550672e8f9bdfb Mon Sep 17 00:00:00 2001 From: Viktor Mihajlovski Date: Mon, 29 Apr 2013 18:11:29 +0200 Subject: [PATCH] S390: Do not generate a default USB controller For s390 we don't want to have a default USB device generated even if QEMU is silently tolerating -usb on the command line. This may change in the future. Another reason to avoid the USB controller is that it implies a PCI bus which might cause a regression at some later point in time. The following change will set the USB controller model to 'none' unless a model or address has been specified, which can be the case if a legacy definition is loaded or the XML writer knows what she/he's doing. Requiring the user to explicitly disable USB on systems not supporting it seems cumbersome. Signed-off-by: Viktor Mihajlovski --- src/qemu/qemu_domain.c | 8 ++++++++ tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args | 2 +- .../qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args | 2 +- .../qemuxml2argv-console-virtio-s390.args | 2 +- .../qemuxml2argv-disk-virtio-ccw-many.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args | 2 +- .../qemuxml2argv-disk-virtio-scsi-ccw.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args | 2 +- 11 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d927716a0a..62c3382031 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -784,6 +784,14 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X)) dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; + /* set the default USB model to none for s390 unless an address is found */ + if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER && + dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && + dev->data.controller->model == -1 && + dev->data.controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X)) + dev->data.controller->model = VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE; + ret = 0; cleanup: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args b/tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args index 7dc1c4964a..86bd82d55c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-sclp.args @@ -2,7 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 -device \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 -device \ virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 \ -chardev pty,id=charconsole0 \ -device sclpconsole,chardev=charconsole0,id=console0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args index 6660a30fa4..3e6f9f16e8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-ccw.args @@ -3,7 +3,7 @@ s390-ccw -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ chardev=charmonitor,id=monitor,mode=readline -no-acpi \ -device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0001 \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -chardev pty,id=charconsole0 \ -device virtconsole,chardev=charconsole0,id=console0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args index bf7b180695..7b7f8f399c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args @@ -3,7 +3,7 @@ s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ chardev=charmonitor,id=monitor,mode=readline -no-acpi \ -device virtio-serial-s390,id=virtio-serial0 \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -chardev pty,id=charconsole0 \ -device virtconsole,chardev=charconsole0,id=console0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw-many.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw-many.args index ca0c157b52..92fa433c9f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw-many.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw-many.args @@ -1,7 +1,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-ccw -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=0.0.0007,drive=drive-virtio-disk0,id=virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest4,if=none,id=drive-virtio-disk1 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk1,id=virtio-disk1 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args index ec901bb545..a682bb30ec 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-ccw.args @@ -1,7 +1,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-ccw -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-virtio-disk1 \ -device virtio-blk-ccw,devno=0.0.0007,drive=drive-virtio-disk1,id=virtio-disk1 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args index 2ac1810d5d..725f4a5d97 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args @@ -1,5 +1,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-virtio -m 214 -smp 1 -nographic -nodefaults \ --monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ccw.args index 1b2603e752..9ef68de200 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ccw.args @@ -2,7 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-ccw -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -device virtio-scsi-ccw,id=scsi0,devno=fe.0.0001 \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0 \ -drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-scsi0-0-4-0 \ -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=4,lun=0,drive=drive-scsi0-0-4-0,id=scsi0-0-4-0 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args index f874afec7a..4a98280094 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-ccw.args @@ -1,7 +1,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-ccw -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ --usb -device virtio-net-ccw,vlan=0,id=net0,mac=00:11:22:33:44:55,devno=fe.0.0001 \ +-device virtio-net-ccw,vlan=0,id=net0,mac=00:11:22:33:44:55,devno=fe.0.0001 \ -net user,vlan=0,name=hostnet0 \ -device virtio-net-ccw,vlan=1,id=net1,mac=00:11:22:33:44:54,devno=fe.0.0000 \ -net user,vlan=1,name=hostnet1 \ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args index a69596d71e..59c53e6680 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args @@ -1,5 +1,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ -M s390-virtio -m 214 -smp 1 -nographic -nodefaults \ --monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -device virtio-net-s390,vlan=0,id=net0,mac=00:11:22:33:44:55 \ -net user,vlan=0,name=hostnet0 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args index 5f9cef5471..bf88b2c8b6 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args @@ -3,7 +3,7 @@ s390-ccw -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ chardev=charmonitor,id=monitor,mode=readline -no-acpi \ -device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0001 \ --usb -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ -device virtio-blk-ccw,devno=fe.0.0000,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -chardev pty,id=charconsole0 \ -device virtconsole,chardev=charconsole0,id=console0 \ -- 2.47.2