[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/2] 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 <mihajlov linux vnet ibm com>
---
 src/qemu/qemu_domain.c                             |    8 ++++++++
 .../qemuxml2argv-console-sclp.args                 |    2 +-
 .../qemuxml2argv-console-virtio-ccw.args           |    2 +-
 .../qemuxml2argv-console-virtio-s390.args          |    2 +-
 .../qemuxml2argv-disk-virtio-ccw-many.args         |    2 +-
 .../qemuxml2argv-disk-virtio-ccw.args              |    2 +-
 .../qemuxml2argv-disk-virtio-s390.args             |    2 +-
 .../qemuxml2argv-disk-virtio-scsi-ccw.args         |    2 +-
 .../qemuxml2argv-net-virtio-ccw.args               |    2 +-
 .../qemuxml2argv-net-virtio-s390.args              |    2 +-
 .../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 d927716..62c3382 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 7dc1c49..86bd82d 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 6660a30..3e6f9f1 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 bf7b180..7b7f8f3 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 ca0c157..92fa433 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 ec901bb..a682bb3 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 2ac1810..725f4a5 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 1b2603e..9ef68de 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 f874afe..4a98280 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 a69596d..59c53e6 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 5f9cef5..bf88b2c 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 \
-- 
1.7.9.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]