]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: command: Make RNG backend device IDs unique
authorLuyao Huang <lhuang@redhat.com>
Sat, 17 Jan 2015 05:09:34 +0000 (13:09 +0800)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 10 Feb 2015 12:05:22 +0000 (13:05 +0100)
Libvirt didn't prefix the random number generator backend object alias
with any string thus the device alias and object alias were identical.

To avoid possible problems, rename the alias for the backend object and
tweak tests to comply with the change.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args
tests/qemuxml2argvdata/qemuxml2argv-arm-virt-virtio.args
tests/qemuxml2argvdata/qemuxml2argv-s390-piix-controllers.args
tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-ccw.args
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-egd.args
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-multiple.args
tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args

index 59b0a81ebb6badf9a039fc1e2eb5cf1013f8e330..b2de0974df7bcff7d5f97127672e7a172b9b71ae 100644 (file)
@@ -6177,7 +6177,7 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
             goto cleanup;
         }
 
-        virBufferAsprintf(&buf, "rng-random,id=%s,filename=%s",
+        virBufferAsprintf(&buf, "rng-random,id=obj%s,filename=%s",
                           dev->info.alias, dev->source.file);
 
         virCommandAddArg(cmd, "-object");
@@ -6200,7 +6200,7 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
         virCommandAddArgList(cmd, "-chardev", backend, NULL);
 
         virCommandAddArg(cmd, "-object");
-        virCommandAddArgFormat(cmd, "rng-egd,chardev=char%s,id=%s",
+        virCommandAddArgFormat(cmd, "rng-egd,chardev=char%s,id=obj%s",
                                dev->info.alias, dev->info.alias);
         break;
 
@@ -6233,13 +6233,13 @@ qemuBuildRNGDevStr(virDomainDefPtr def,
     }
 
     if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
-        virBufferAsprintf(&buf, "virtio-rng-ccw,rng=%s", dev->info.alias);
+        virBufferAsprintf(&buf, "virtio-rng-ccw,rng=obj%s,id=%s", dev->info.alias, dev->info.alias);
     else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
-        virBufferAsprintf(&buf, "virtio-rng-s390,rng=%s", dev->info.alias);
+        virBufferAsprintf(&buf, "virtio-rng-s390,rng=obj%s,id=%s", dev->info.alias, dev->info.alias);
     else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
-        virBufferAsprintf(&buf, "virtio-rng-device,rng=%s", dev->info.alias);
+        virBufferAsprintf(&buf, "virtio-rng-device,rng=obj%s,id=%s", dev->info.alias, dev->info.alias);
     else
-        virBufferAsprintf(&buf, "virtio-rng-pci,rng=%s", dev->info.alias);
+        virBufferAsprintf(&buf, "virtio-rng-pci,rng=obj%s,id=%s", dev->info.alias, dev->info.alias);
 
     if (dev->rate > 0) {
         virBufferAsprintf(&buf, ",max-bytes=%u", dev->rate);
index 05f3629803a5f82ef187946c87004426a0fbdc17..d12e6e204bfd900c3d36351852fb3acd470b4d4d 100644 (file)
@@ -11,5 +11,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -net user,vlan=0,name=hostnet0 -serial pty -chardev pty,id=charconsole1 \
 -device virtconsole,chardev=charconsole1,id=console1 \
 -device virtio-balloon-device,id=balloon0 \
--object rng-random,id=rng0,filename=/dev/random \
--device virtio-rng-device,rng=rng0
+-object rng-random,id=objrng0,filename=/dev/random \
+-device virtio-rng-device,rng=objrng0,id=rng0
index 62de9d36bd61c614233888f08d9eac781ae6a42d..dba74e1af77a2a2aae1d7c36f7b7bc636906cabd 100644 (file)
@@ -10,5 +10,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -net user,vlan=0,name=hostnet0 -serial pty -chardev pty,id=charconsole1 \
 -device virtconsole,chardev=charconsole1,id=console1 \
 -device virtio-balloon-device,id=balloon0 \
--object rng-random,id=rng0,filename=/dev/random \
--device virtio-rng-device,rng=rng0
+-object rng-random,id=objrng0,filename=/dev/random \
+-device virtio-rng-device,rng=objrng0,id=rng0
index 5206ad8fb40afe112e6ff71b09a5a737aec1d1c3..c73022b3ad4eff36692d466504a845d96b04f21e 100644 (file)
@@ -10,5 +10,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -net user,vlan=0,name=hostnet0 -serial pty -chardev pty,id=charconsole1 \
 -device virtconsole,chardev=charconsole1,id=console1 \
 -device virtio-balloon-device,id=balloon0 \
--object rng-random,id=rng0,filename=/dev/random \
--device virtio-rng-device,rng=rng0
+-object rng-random,id=objrng0,filename=/dev/random \
+-device virtio-rng-device,rng=objrng0,id=rng0
index c09382ffef86799266f74c8df14470cea4d9afdd..10aecea58ee770c77bf27d495aaef04646aee0a5 100644 (file)
@@ -8,4 +8,5 @@ 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 \
--object rng-random,id=rng0,filename=/dev/hwrng -device virtio-rng-s390,rng=rng0
+-object rng-random,id=objrng0,filename=/dev/hwrng \
+-device virtio-rng-s390,rng=objrng0,id=rng0
index 6d97156866de3098d4763ae99122a3c217085bfa..51fcfa652e16fbf9c39ed37a4525f8d9708ec27c 100644 (file)
@@ -8,4 +8,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
 -chardev pty,id=charconsole0 \
 -device virtconsole,chardev=charconsole0,id=console0 \
--object rng-random,id=rng0,filename=/dev/hwrng -device virtio-rng-s390,rng=rng0
+-object rng-random,id=objrng0,filename=/dev/hwrng \
+-device virtio-rng-s390,rng=objrng0,id=rng0
index a1b2eb6bc956f51c28ca5b9f0b42effaa0639cdf..3a04ed15bc98ac39194feade54f41e0fa18a6f66 100644 (file)
@@ -10,5 +10,5 @@ id=virtio-disk0,bootindex=1 \
 -chardev pty,id=charconsole0 \
 -device virtconsole,chardev=charconsole0,id=console0 \
 -device virtio-balloon-ccw,id=balloon0,devno=fe.0.000a \
--object rng-random,id=rng0,filename=/dev/hwrng \
--device virtio-rng-ccw,rng=rng0,devno=fe.0.0002
+-object rng-random,id=objrng0,filename=/dev/hwrng \
+-device virtio-rng-ccw,rng=objrng0,id=rng0,devno=fe.0.0002
index 58cc473263b05aaa8aa63ae2e0eff60442c7ccf4..84aa5cdb108e0875a035226a61aa9ab110bb2eb0 100644 (file)
@@ -3,5 +3,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -S -M pc -m 214 -smp 1 -nographic -nodefaults \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
--object rng-random,id=rng0,filename=/dev/random \
--device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x7
+-object rng-random,id=objrng0,filename=/dev/random \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x7
index 5530f7ddbeba26160db8fcb77cd9180c86306654..67c5047a3277ad8d17275d7139db5cb4f4981ef4 100644 (file)
@@ -4,5 +4,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -chardev socket,id=charrng0,host=1.2.3.4,port=1234 \
--object rng-egd,chardev=charrng0,id=rng0 \
--device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4
+-object rng-egd,chardev=charrng0,id=objrng0 \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x4
index d1faf09e2acb06046dfe9e9b47ffb2c288ad39c8..aa993847d5d9fb9d9de19d820988799f734a1786 100644 (file)
@@ -3,8 +3,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -M pc -m 214 -smp 1 -nographic -nodefaults \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
--object rng-random,id=rng0,filename=/dev/random \
--device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x7 \
+-object rng-random,id=objrng0,filename=/dev/random \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x7 \
 -chardev socket,id=charrng1,host=1.2.3.4,port=1234 \
--object rng-egd,chardev=charrng1,id=rng1 \
--device virtio-rng-pci,rng=rng1,bus=pci.0,addr=0x4
+-object rng-egd,chardev=charrng1,id=objrng1 \
+-device virtio-rng-pci,rng=objrng1,id=rng1,bus=pci.0,addr=0x4
index ecd510e1c1bd68045c2184e208e2acc1fb6f8f12..7fca0987b62de2fcab4cd6ea757eaa8f078b6bef 100644 (file)
@@ -3,5 +3,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
 -S -M pc -m 214 -smp 1 -nographic -nodefaults \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
--object rng-random,id=rng0,filename=/dev/hwrng \
--device virtio-rng-pci,rng=rng0,max-bytes=123,period=1234,bus=pci.0,addr=0x4
+-object rng-random,id=objrng0,filename=/dev/hwrng \
+-device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,bus=pci.0,addr=0x4