[PATCH 074/103] qemuBuildSCSIHostdevDevProps: Reorder 'drive', 'id' and 'bootindex' after address

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

 



Simplify the generator by shuffling around few fields.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_command.c                            | 10 +++-------
 .../hostdev-scsi-lsi.x86_64-4.1.0.args             | 12 ++++++------
 .../hostdev-scsi-lsi.x86_64-latest.args            | 12 ++++++------
 .../hostdev-scsi-virtio-scsi.x86_64-4.1.0.args     | 14 +++++++-------
 .../hostdev-scsi-virtio-scsi.x86_64-latest.args    | 14 +++++++-------
 tests/qemuxml2argvdata/name-escape.args            |  2 +-
 6 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5bea3991a9..008700cc5f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5077,19 +5077,15 @@ qemuBuildSCSIHostdevDevProps(const virDomainDef *def,

     if (virJSONValueObjectCreate(&props,
                                  "s:driver", "scsi-generic",
+                                 "s:drive", backendAlias,
+                                 "s:id", dev->info->alias,
+                                 "p:bootindex", dev->info->bootIndex,
                                  NULL) < 0)
         return NULL;

     if (qemuBuildDeviceAddressProps(props, def, dev->info) < 0)
         return NULL;

-    if (virJSONValueObjectAdd(props,
-                              "s:drive", backendAlias,
-                              "s:id", dev->info->alias,
-                              "p:bootindex", dev->info->bootIndex,
-                              NULL) < 0)
-        return NULL;
-
     return g_steal_pointer(&props);
 }

diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-4.1.0.args b/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-4.1.0.args
index f4745a5f4f..66ebe317ec 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-4.1.0.args
+++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-4.1.0.args
@@ -30,19 +30,19 @@ QEMU_AUDIO_DRV=none \
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
 -drive file=/dev/sg0,if=none,format=raw,id=drive-hostdev0 \
--device scsi-generic,bus=scsi0.0,scsi-id=7,drive=drive-hostdev0,id=hostdev0 \
+-device scsi-generic,drive=drive-hostdev0,id=hostdev0,bus=scsi0.0,scsi-id=7 \
 -drive file=/dev/sg0,if=none,format=raw,id=drive-hostdev1,readonly=on \
--device scsi-generic,bus=scsi0.0,scsi-id=6,drive=drive-hostdev1,id=hostdev1 \
+-device scsi-generic,drive=drive-hostdev1,id=hostdev1,bus=scsi0.0,scsi-id=6 \
 -drive file.driver=iscsi,file.portal=example.org:3260,file.target=iqn.1992-01.com.example,file.lun=0,file.transport=tcp,if=none,format=raw,id=drive-hostdev2 \
--device scsi-generic,bus=scsi0.0,scsi-id=4,drive=drive-hostdev2,id=hostdev2 \
+-device scsi-generic,drive=drive-hostdev2,id=hostdev2,bus=scsi0.0,scsi-id=4 \
 -drive file.driver=iscsi,file.portal=example.org:3260,file.target=iqn.1992-01.com.example,file.lun=1,file.transport=tcp,if=none,format=raw,id=drive-hostdev3 \
--device scsi-generic,bus=scsi0.0,scsi-id=5,drive=drive-hostdev3,id=hostdev3 \
+-device scsi-generic,drive=drive-hostdev3,id=hostdev3,bus=scsi0.0,scsi-id=5 \
 -object secret,id=hostdev4-secret0,data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
 -drive file.driver=iscsi,file.portal=example.org:3260,file.target=iqn.1992-01.com.example:storage,file.lun=1,file.transport=tcp,file.user=myname,file.password-secret=hostdev4-secret0,if=none,format=raw,id=drive-hostdev4 \
--device scsi-generic,bus=scsi0.0,scsi-id=3,drive=drive-hostdev4,id=hostdev4 \
+-device scsi-generic,drive=drive-hostdev4,id=hostdev4,bus=scsi0.0,scsi-id=3 \
 -object secret,id=hostdev5-secret0,data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
 -drive file.driver=iscsi,file.portal=example.org:3260,file.target=iqn.1992-01.com.example:storage,file.lun=2,file.transport=tcp,file.user=myname,file.password-secret=hostdev5-secret0,if=none,format=raw,id=drive-hostdev5 \
--device scsi-generic,bus=scsi0.0,scsi-id=2,drive=drive-hostdev5,id=hostdev5 \
+-device scsi-generic,drive=drive-hostdev5,id=hostdev5,bus=scsi0.0,scsi-id=2 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args b/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args
index edfcca6ded..eeec33fe98 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args
@@ -33,19 +33,19 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest2/.config \
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
 -audiodev id=audio1,driver=none \
 -blockdev '{"driver":"host_device","filename":"/dev/sg0","node-name":"libvirt-2-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,scsi-id=7,drive=libvirt-2-backend,id=hostdev0 \
+-device scsi-generic,drive=libvirt-2-backend,id=hostdev0,bus=scsi0.0,scsi-id=7 \
 -blockdev '{"driver":"host_device","filename":"/dev/sg0","node-name":"libvirt-3-backend","read-only":true}' \
--device scsi-generic,bus=scsi0.0,scsi-id=6,drive=libvirt-3-backend,id=hostdev1 \
+-device scsi-generic,drive=libvirt-3-backend,id=hostdev1,bus=scsi0.0,scsi-id=6 \
 -blockdev '{"driver":"iscsi","portal":"example.org:3260","target":"iqn.1992-01.com.example","lun":0,"transport":"tcp","node-name":"libvirt-4-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,scsi-id=4,drive=libvirt-4-backend,id=hostdev2 \
+-device scsi-generic,drive=libvirt-4-backend,id=hostdev2,bus=scsi0.0,scsi-id=4 \
 -blockdev '{"driver":"iscsi","portal":"example.org:3260","target":"iqn.1992-01.com.example","lun":1,"transport":"tcp","node-name":"libvirt-5-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,scsi-id=5,drive=libvirt-5-backend,id=hostdev3 \
+-device scsi-generic,drive=libvirt-5-backend,id=hostdev3,bus=scsi0.0,scsi-id=5 \
 -object '{"qom-type":"secret","id":"libvirt-6-backend-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \
 -blockdev '{"driver":"iscsi","portal":"example.org:3260","target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp","user":"myname","password-secret":"libvirt-6-backend-secret0","node-name":"libvirt-6-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,scsi-id=3,drive=libvirt-6-backend,id=hostdev4 \
+-device scsi-generic,drive=libvirt-6-backend,id=hostdev4,bus=scsi0.0,scsi-id=3 \
 -object '{"qom-type":"secret","id":"libvirt-7-backend-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \
 -blockdev '{"driver":"iscsi","portal":"example.org:3260","target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp","user":"myname","password-secret":"libvirt-7-backend-secret0","node-name":"libvirt-7-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,scsi-id=2,drive=libvirt-7-backend,id=hostdev5 \
+-device scsi-generic,drive=libvirt-7-backend,id=hostdev5,bus=scsi0.0,scsi-id=2 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.args b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.args
index 91deda1cd8..3ce8f3fea1 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.args
+++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.args
@@ -30,21 +30,21 @@ QEMU_AUDIO_DRV=none \
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
 -drive file=/dev/sg0,if=none,format=raw,id=drive-hostdev0 \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=drive-hostdev0,id=hostdev0 \
+-device scsi-generic,drive=drive-hostdev0,id=hostdev0,bus=scsi0.0,channel=0,scsi-id=4,lun=8 \
 -drive file=/dev/sg0,if=none,format=raw,id=drive-hostdev1,readonly=on \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=7,drive=drive-hostdev1,id=hostdev1 \
+-device scsi-generic,drive=drive-hostdev1,id=hostdev1,bus=scsi0.0,channel=0,scsi-id=4,lun=7 \
 -drive file=/dev/sg0,if=none,format=raw,id=drive-ua-7996c8dc-a4fa-4012-b76f-043d20144263 \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=6,drive=drive-ua-7996c8dc-a4fa-4012-b76f-043d20144263,id=ua-7996c8dc-a4fa-4012-b76f-043d20144263 \
+-device scsi-generic,drive=drive-ua-7996c8dc-a4fa-4012-b76f-043d20144263,id=ua-7996c8dc-a4fa-4012-b76f-043d20144263,bus=scsi0.0,channel=0,scsi-id=4,lun=6 \
 -drive file.driver=iscsi,file.portal=example.org:3260,file.target=iqn.1992-01.com.example,file.lun=0,file.transport=tcp,if=none,format=raw,id=drive-hostdev2 \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=4,drive=drive-hostdev2,id=hostdev2 \
+-device scsi-generic,drive=drive-hostdev2,id=hostdev2,bus=scsi0.0,channel=0,scsi-id=2,lun=4 \
 -drive file.driver=iscsi,file.portal=example.org:3260,file.target=iqn.1992-01.com.example,file.lun=1,file.transport=tcp,if=none,format=raw,id=drive-hostdev3,readonly=on \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=5,drive=drive-hostdev3,id=hostdev3 \
+-device scsi-generic,drive=drive-hostdev3,id=hostdev3,bus=scsi0.0,channel=0,scsi-id=2,lun=5 \
 -object secret,id=hostdev4-secret0,data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
 -drive file.driver=iscsi,file.portal=example.org:3260,file.target=iqn.1992-01.com.example:storage,file.lun=1,file.transport=tcp,file.user=myname,file.password-secret=hostdev4-secret0,if=none,format=raw,id=drive-hostdev4 \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=3,lun=4,drive=drive-hostdev4,id=hostdev4 \
+-device scsi-generic,drive=drive-hostdev4,id=hostdev4,bus=scsi0.0,channel=0,scsi-id=3,lun=4 \
 -object secret,id=hostdev5-secret0,data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
 -drive file.driver=iscsi,file.portal=example.org:3260,file.target=iqn.1992-01.com.example:storage,file.lun=2,file.transport=tcp,file.user=myname,file.password-secret=hostdev5-secret0,file.initiator-name=iqn.2020-07.com.example:test,if=none,format=raw,id=drive-hostdev5 \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=3,lun=5,drive=drive-hostdev5,id=hostdev5 \
+-device scsi-generic,drive=drive-hostdev5,id=hostdev5,bus=scsi0.0,channel=0,scsi-id=3,lun=5 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args
index a2985ddad5..ad2cde5171 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args
@@ -33,21 +33,21 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest2/.config \
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
 -audiodev id=audio1,driver=none \
 -blockdev '{"driver":"host_device","filename":"/dev/sg0","node-name":"libvirt-2-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,drive=libvirt-2-backend,id=hostdev0 \
+-device scsi-generic,drive=libvirt-2-backend,id=hostdev0,bus=scsi0.0,channel=0,scsi-id=4,lun=8 \
 -blockdev '{"driver":"host_device","filename":"/dev/sg0","node-name":"libvirt-3-backend","read-only":true}' \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=7,drive=libvirt-3-backend,id=hostdev1 \
+-device scsi-generic,drive=libvirt-3-backend,id=hostdev1,bus=scsi0.0,channel=0,scsi-id=4,lun=7 \
 -blockdev '{"driver":"host_device","filename":"/dev/sg0","node-name":"libvirt-4-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=6,drive=libvirt-4-backend,id=ua-7996c8dc-a4fa-4012-b76f-043d20144263 \
+-device scsi-generic,drive=libvirt-4-backend,id=ua-7996c8dc-a4fa-4012-b76f-043d20144263,bus=scsi0.0,channel=0,scsi-id=4,lun=6 \
 -blockdev '{"driver":"iscsi","portal":"example.org:3260","target":"iqn.1992-01.com.example","lun":0,"transport":"tcp","node-name":"libvirt-5-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=4,drive=libvirt-5-backend,id=hostdev2 \
+-device scsi-generic,drive=libvirt-5-backend,id=hostdev2,bus=scsi0.0,channel=0,scsi-id=2,lun=4 \
 -blockdev '{"driver":"iscsi","portal":"example.org:3260","target":"iqn.1992-01.com.example","lun":1,"transport":"tcp","node-name":"libvirt-6-backend","read-only":true}' \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=5,drive=libvirt-6-backend,id=hostdev3 \
+-device scsi-generic,drive=libvirt-6-backend,id=hostdev3,bus=scsi0.0,channel=0,scsi-id=2,lun=5 \
 -object '{"qom-type":"secret","id":"libvirt-7-backend-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \
 -blockdev '{"driver":"iscsi","portal":"example.org:3260","target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp","user":"myname","password-secret":"libvirt-7-backend-secret0","node-name":"libvirt-7-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=3,lun=4,drive=libvirt-7-backend,id=hostdev4 \
+-device scsi-generic,drive=libvirt-7-backend,id=hostdev4,bus=scsi0.0,channel=0,scsi-id=3,lun=4 \
 -object '{"qom-type":"secret","id":"libvirt-8-backend-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \
 -blockdev '{"driver":"iscsi","portal":"example.org:3260","target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp","user":"myname","password-secret":"libvirt-8-backend-secret0","initiator-name":"iqn.2020-07.com.example:test","node-name":"libvirt-8-backend","read-only":false}' \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=3,lun=5,drive=libvirt-8-backend,id=hostdev5 \
+-device scsi-generic,drive=libvirt-8-backend,id=hostdev5,bus=scsi0.0,channel=0,scsi-id=3,lun=5 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/name-escape.args b/tests/qemuxml2argvdata/name-escape.args
index eaef25b3f1..eb8d9ac10a 100644
--- a/tests/qemuxml2argvdata/name-escape.args
+++ b/tests/qemuxml2argvdata/name-escape.args
@@ -40,6 +40,6 @@ QEMU_AUDIO_DRV=spice \
 -spice unix,addr=/tmp/lib/domain--1-foo=1,,bar=2/spice.sock,gl=on,rendernode=/dev/dri/foo,,bar,seamless-migration=on \
 -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \
 -drive file.driver=iscsi,file.portal=example.foo.org:3260,file.target=iqn.1992-01.com.example:my,,storage,file.lun=1,file.transport=tcp,if=none,format=raw,id=drive-hostdev0 \
--device scsi-generic,bus=scsi0.0,channel=0,scsi-id=0,lun=4,drive=drive-hostdev0,id=hostdev0 \
+-device scsi-generic,drive=drive-hostdev0,id=hostdev0,bus=scsi0.0,channel=0,scsi-id=0,lun=4 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \
 -msg timestamp=on
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux