[libvirt] [PATCH] conf: don't output managed attr for non-pci hostdevs

Nikolay Shirokovskiy posted 1 patch 5 years, 2 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1550828104-754472-1-git-send-email-nshirokovskiy@virtuozzo.com
src/conf/domain_conf.c                             |  6 ++++--
tests/qemuargv2xmldata/hostdev-usb-address.xml     |  2 +-
tests/qemuxml2argvdata/controller-order.xml        |  2 +-
.../disk-hostdev-scsi-address-conflict.xml         |  2 +-
.../disk-hostdev-scsi-virtio-iscsi-auth-AES.xml    |  2 +-
.../hostdev-scsi-autogen-address.xml               | 22 +++++++++++-----------
tests/qemuxml2argvdata/hostdev-scsi-boot.xml       |  2 +-
tests/qemuxml2argvdata/hostdev-scsi-large-unit.xml |  2 +-
.../hostdev-scsi-lsi-iscsi-auth.xml                |  4 ++--
tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi.xml  |  4 ++--
tests/qemuxml2argvdata/hostdev-scsi-lsi.xml        |  2 +-
tests/qemuxml2argvdata/hostdev-scsi-rawio.xml      |  2 +-
tests/qemuxml2argvdata/hostdev-scsi-readonly.xml   |  2 +-
tests/qemuxml2argvdata/hostdev-scsi-sgio.xml       |  2 +-
tests/qemuxml2argvdata/hostdev-scsi-shareable.xml  |  2 +-
.../hostdev-scsi-vhost-scsi-ccw.xml                |  2 +-
.../hostdev-scsi-vhost-scsi-pci.xml                |  2 +-
.../hostdev-scsi-vhost-scsi-pcie.xml               |  2 +-
.../hostdev-scsi-virtio-iscsi-auth.xml             |  4 ++--
.../qemuxml2argvdata/hostdev-scsi-virtio-iscsi.xml |  4 ++--
.../qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml  |  2 +-
.../hostdev-usb-address-device-boot.xml            |  2 +-
.../hostdev-usb-address-device.xml                 |  2 +-
tests/qemuxml2argvdata/hostdev-usb-address.xml     |  2 +-
.../hostdevs-drive-address-conflict.xml            |  4 ++--
tests/qemuxml2argvdata/name-escape.xml             |  2 +-
tests/qemuxml2argvdata/user-aliases-usb.xml        |  4 ++--
tests/qemuxml2xmloutdata/hostdev-mdev-display.xml  |  2 +-
.../qemuxml2xmloutdata/hostdev-mdev-precreated.xml |  2 +-
.../hostdev-scsi-autogen-address.xml               | 22 +++++++++++-----------
.../qemuxml2xmloutdata/hostdev-scsi-large-unit.xml |  2 +-
.../hostdev-scsi-lsi-iscsi-auth.xml                |  4 ++--
.../qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml  |  4 ++--
tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml      |  2 +-
tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml    |  2 +-
tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml |  2 +-
tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml     |  2 +-
.../qemuxml2xmloutdata/hostdev-scsi-shareable.xml  |  2 +-
.../hostdev-scsi-vhost-scsi-ccw.xml                |  2 +-
.../hostdev-scsi-vhost-scsi-pci.xml                |  2 +-
.../hostdev-scsi-vhost-scsi-pcie.xml               |  2 +-
.../hostdev-scsi-virtio-iscsi-auth.xml             |  4 ++--
.../hostdev-scsi-virtio-iscsi.xml                  |  4 ++--
.../hostdev-scsi-virtio-scsi.xml                   |  2 +-
.../hostdev-subsys-mdev-vfio-ccw.xml               |  2 +-
tests/qemuxml2xmloutdata/hostdev-usb-address.xml   |  2 +-
tests/xlconfigdata/test-usb.xml                    |  2 +-
47 files changed, 80 insertions(+), 78 deletions(-)
[libvirt] [PATCH] conf: don't output managed attr for non-pci hostdevs
Posted by Nikolay Shirokovskiy 5 years, 2 months ago
It is ignored on input for non pci hostdevs as written in docs.
I guess it would be better if the attr was disabled to be specified
in the first place instead but such behaviour is already documented.
At least let's not output it back. This will fix issue when
managed appeared on output for non pci hostdevs when it was not
specified on input.

The tests are fixed by next commands:
grep  -lRP 'hostdev.*mode=.subsystem.*type=.(?!pci).*managed' `find tests -name '*.xml'` > files
sed -i.bak -re 's/ managed=.(yes|no).//' `cat files`

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
---
 src/conf/domain_conf.c                             |  6 ++++--
 tests/qemuargv2xmldata/hostdev-usb-address.xml     |  2 +-
 tests/qemuxml2argvdata/controller-order.xml        |  2 +-
 .../disk-hostdev-scsi-address-conflict.xml         |  2 +-
 .../disk-hostdev-scsi-virtio-iscsi-auth-AES.xml    |  2 +-
 .../hostdev-scsi-autogen-address.xml               | 22 +++++++++++-----------
 tests/qemuxml2argvdata/hostdev-scsi-boot.xml       |  2 +-
 tests/qemuxml2argvdata/hostdev-scsi-large-unit.xml |  2 +-
 .../hostdev-scsi-lsi-iscsi-auth.xml                |  4 ++--
 tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi.xml  |  4 ++--
 tests/qemuxml2argvdata/hostdev-scsi-lsi.xml        |  2 +-
 tests/qemuxml2argvdata/hostdev-scsi-rawio.xml      |  2 +-
 tests/qemuxml2argvdata/hostdev-scsi-readonly.xml   |  2 +-
 tests/qemuxml2argvdata/hostdev-scsi-sgio.xml       |  2 +-
 tests/qemuxml2argvdata/hostdev-scsi-shareable.xml  |  2 +-
 .../hostdev-scsi-vhost-scsi-ccw.xml                |  2 +-
 .../hostdev-scsi-vhost-scsi-pci.xml                |  2 +-
 .../hostdev-scsi-vhost-scsi-pcie.xml               |  2 +-
 .../hostdev-scsi-virtio-iscsi-auth.xml             |  4 ++--
 .../qemuxml2argvdata/hostdev-scsi-virtio-iscsi.xml |  4 ++--
 .../qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml  |  2 +-
 .../hostdev-usb-address-device-boot.xml            |  2 +-
 .../hostdev-usb-address-device.xml                 |  2 +-
 tests/qemuxml2argvdata/hostdev-usb-address.xml     |  2 +-
 .../hostdevs-drive-address-conflict.xml            |  4 ++--
 tests/qemuxml2argvdata/name-escape.xml             |  2 +-
 tests/qemuxml2argvdata/user-aliases-usb.xml        |  4 ++--
 tests/qemuxml2xmloutdata/hostdev-mdev-display.xml  |  2 +-
 .../qemuxml2xmloutdata/hostdev-mdev-precreated.xml |  2 +-
 .../hostdev-scsi-autogen-address.xml               | 22 +++++++++++-----------
 .../qemuxml2xmloutdata/hostdev-scsi-large-unit.xml |  2 +-
 .../hostdev-scsi-lsi-iscsi-auth.xml                |  4 ++--
 .../qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml  |  4 ++--
 tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml      |  2 +-
 tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml    |  2 +-
 tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml |  2 +-
 tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml     |  2 +-
 .../qemuxml2xmloutdata/hostdev-scsi-shareable.xml  |  2 +-
 .../hostdev-scsi-vhost-scsi-ccw.xml                |  2 +-
 .../hostdev-scsi-vhost-scsi-pci.xml                |  2 +-
 .../hostdev-scsi-vhost-scsi-pcie.xml               |  2 +-
 .../hostdev-scsi-virtio-iscsi-auth.xml             |  4 ++--
 .../hostdev-scsi-virtio-iscsi.xml                  |  4 ++--
 .../hostdev-scsi-virtio-scsi.xml                   |  2 +-
 .../hostdev-subsys-mdev-vfio-ccw.xml               |  2 +-
 tests/qemuxml2xmloutdata/hostdev-usb-address.xml   |  2 +-
 tests/xlconfigdata/test-usb.xml                    |  2 +-
 47 files changed, 80 insertions(+), 78 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ceeb247..9ff659c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27330,8 +27330,10 @@ virDomainHostdevDefFormat(virBufferPtr buf,
     virBufferAsprintf(buf, "<hostdev mode='%s' type='%s'",
                       mode, type);
     if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
-        virBufferAsprintf(buf, " managed='%s'",
-                          def->managed ? "yes" : "no");
+        if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
+            virBufferAsprintf(buf, " managed='%s'",
+                              def->managed ? "yes" : "no");
+        }
 
         if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
             scsisrc->sgio)
diff --git a/tests/qemuargv2xmldata/hostdev-usb-address.xml b/tests/qemuargv2xmldata/hostdev-usb-address.xml
index 14514c9..0bdfd08 100644
--- a/tests/qemuargv2xmldata/hostdev-usb-address.xml
+++ b/tests/qemuargv2xmldata/hostdev-usb-address.xml
@@ -29,7 +29,7 @@
     </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='usb' managed='no'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='14' device='6'/>
       </source>
diff --git a/tests/qemuxml2argvdata/controller-order.xml b/tests/qemuxml2argvdata/controller-order.xml
index 5aedadc..75bc7f5 100644
--- a/tests/qemuxml2argvdata/controller-order.xml
+++ b/tests/qemuxml2argvdata/controller-order.xml
@@ -76,7 +76,7 @@
       <model type='cirrus' vram='16384' heads='1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
-    <hostdev mode='subsystem' type='usb' managed='yes'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='14' device='6'/>
       </source>
diff --git a/tests/qemuxml2argvdata/disk-hostdev-scsi-address-conflict.xml b/tests/qemuxml2argvdata/disk-hostdev-scsi-address-conflict.xml
index 777d857..5482d43 100644
--- a/tests/qemuxml2argvdata/disk-hostdev-scsi-address-conflict.xml
+++ b/tests/qemuxml2argvdata/disk-hostdev-scsi-address-conflict.xml
@@ -18,7 +18,7 @@
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='sda' bus='scsi'/>
     </disk>
-    <hostdev mode='subsystem' type='scsi' managed='no'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host2'/>
         <address bus='0' target='0' unit='1'/>
diff --git a/tests/qemuxml2argvdata/disk-hostdev-scsi-virtio-iscsi-auth-AES.xml b/tests/qemuxml2argvdata/disk-hostdev-scsi-virtio-iscsi-auth-AES.xml
index 21a0b11..363155d 100644
--- a/tests/qemuxml2argvdata/disk-hostdev-scsi-virtio-iscsi-auth-AES.xml
+++ b/tests/qemuxml2argvdata/disk-hostdev-scsi-virtio-iscsi-auth-AES.xml
@@ -30,7 +30,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
         <host name='example.org' port='6000'/>
         <auth username='myname'>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-autogen-address.xml b/tests/qemuxml2argvdata/hostdev-scsi-autogen-address.xml
index 6f8cf56..bf00bb8 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-autogen-address.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-autogen-address.xml
@@ -23,68 +23,68 @@
     <controller type='usb' index='0'/>
     <controller type='ide' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host1'/>
         <address bus='0' target='0' unit='1'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host2'/>
         <address bus='0' target='0' unit='2'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host3'/>
         <address bus='0' target='0' unit='3'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host4'/>
         <address bus='0' target='0' unit='4'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host5'/>
         <address bus='0' target='0' unit='5'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host6'/>
         <address bus='0' target='0' unit='6'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host7'/>
         <address bus='0' target='0' unit='7'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host8'/>
         <address bus='0' target='0' unit='8'/>
       </source>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host9'/>
         <address bus='0' target='0' unit='9'/>
       </source>
       <address type='drive' controller='1' bus='0' target='0' unit='5'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host10'/>
         <address bus='0' target='0' unit='10'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-boot.xml b/tests/qemuxml2argvdata/hostdev-scsi-boot.xml
index 13e159b..f9254fd 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-boot.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-boot.xml
@@ -21,7 +21,7 @@
     <controller type='scsi' index='0' model='virtio-scsi'/>
     <controller type='usb' index='0'/>
     <controller type='ide' index='0'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-large-unit.xml b/tests/qemuxml2argvdata/hostdev-scsi-large-unit.xml
index 8c654c4..5c36057 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-large-unit.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-large-unit.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='1074872354'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi-auth.xml b/tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi-auth.xml
index d39885b..79fb7a2 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi-auth.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi-auth.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
         <host name='example.org' port='3260'/>
         <auth username='myname'>
@@ -34,7 +34,7 @@
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
         <host name='example.org' port='3260'/>
         <auth username='myname'>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi.xml b/tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi.xml
index d84d0b3..911563d 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi.xml
@@ -25,13 +25,13 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example'>
         <host name='example.org' port='3260'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
         <host name='example.org' port='3260'/>
       </source>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi.xml b/tests/qemuxml2argvdata/hostdev-scsi-lsi.xml
index df4777c..ecdfd55 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-lsi.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-rawio.xml b/tests/qemuxml2argvdata/hostdev-scsi-rawio.xml
index 2ece594..7fa470d 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-rawio.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-rawio.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered' rawio='yes'>
+    <hostdev mode='subsystem' type='scsi' sgio='unfiltered' rawio='yes'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-readonly.xml b/tests/qemuxml2argvdata/hostdev-scsi-readonly.xml
index 1cdf562..1593160 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-readonly.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-readonly.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-sgio.xml b/tests/qemuxml2argvdata/hostdev-scsi-sgio.xml
index bad2ceb..e0d786a 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-sgio.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-sgio.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered'>
+    <hostdev mode='subsystem' type='scsi' sgio='unfiltered'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-shareable.xml b/tests/qemuxml2argvdata/hostdev-scsi-shareable.xml
index 3b176a2..e4765ca 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-shareable.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-shareable.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-ccw.xml b/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-ccw.xml
index 33234bc..21029d5 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-ccw.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-ccw.xml
@@ -22,7 +22,7 @@
     <controller type='scsi' index='0' model='virtio-scsi'>
       <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
     </controller>
-    <hostdev mode='subsystem' type='scsi_host' managed='no'>
+    <hostdev mode='subsystem' type='scsi_host'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
     </hostdev>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pci.xml b/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pci.xml
index 13455f6..6f63453 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pci.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pci.xml
@@ -31,7 +31,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi_host' managed='no'>
+    <hostdev mode='subsystem' type='scsi_host'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
     </hostdev>
     <memballoon model='virtio'>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pcie.xml b/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pcie.xml
index c4e8c33..7ca9cc9 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pcie.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-vhost-scsi-pcie.xml
@@ -15,7 +15,7 @@
   <devices>
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <controller type='usb' index='0' model='none'/>
-    <hostdev mode='subsystem' type='scsi_host' managed='no'>
+    <hostdev mode='subsystem' type='scsi_host'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
     </hostdev>
     <memballoon model='none'/>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-iscsi-auth.xml b/tests/qemuxml2argvdata/hostdev-scsi-virtio-iscsi-auth.xml
index 0f63f98..c286cb5 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-iscsi-auth.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-iscsi-auth.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
         <host name='example.org' port='3260'/>
         <auth username='myname'>
@@ -34,7 +34,7 @@
       </source>
       <address type='drive' controller='0' bus='0' target='2' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
         <host name='example.org' port='3260'/>
         <auth username='myname'>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-iscsi.xml b/tests/qemuxml2argvdata/hostdev-scsi-virtio-iscsi.xml
index 9a457db..5162ddd 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-iscsi.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-iscsi.xml
@@ -25,13 +25,13 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example'>
         <host name='example.org' port='3260'/>
       </source>
       <address type='drive' controller='0' bus='0' target='2' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
         <host name='example.org' port='3260'/>
       </source>
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml
index aa56cac..3bc79bb 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml
+++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2argvdata/hostdev-usb-address-device-boot.xml b/tests/qemuxml2argvdata/hostdev-usb-address-device-boot.xml
index 8fd6720..f32a6f1 100644
--- a/tests/qemuxml2argvdata/hostdev-usb-address-device-boot.xml
+++ b/tests/qemuxml2argvdata/hostdev-usb-address-device-boot.xml
@@ -17,7 +17,7 @@
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <hostdev mode='subsystem' type='usb' managed='no'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='14' device='6'/>
       </source>
diff --git a/tests/qemuxml2argvdata/hostdev-usb-address-device.xml b/tests/qemuxml2argvdata/hostdev-usb-address-device.xml
index 0fe6d63..9ba0cbb 100644
--- a/tests/qemuxml2argvdata/hostdev-usb-address-device.xml
+++ b/tests/qemuxml2argvdata/hostdev-usb-address-device.xml
@@ -18,7 +18,7 @@
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <hostdev mode='subsystem' type='usb' managed='no'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='14' device='6'/>
       </source>
diff --git a/tests/qemuxml2argvdata/hostdev-usb-address.xml b/tests/qemuxml2argvdata/hostdev-usb-address.xml
index 9deb2a6..04704bd 100644
--- a/tests/qemuxml2argvdata/hostdev-usb-address.xml
+++ b/tests/qemuxml2argvdata/hostdev-usb-address.xml
@@ -25,7 +25,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='usb' managed='no'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='14' device='6'/>
       </source>
diff --git a/tests/qemuxml2argvdata/hostdevs-drive-address-conflict.xml b/tests/qemuxml2argvdata/hostdevs-drive-address-conflict.xml
index c78c1be..d35a31b 100644
--- a/tests/qemuxml2argvdata/hostdevs-drive-address-conflict.xml
+++ b/tests/qemuxml2argvdata/hostdevs-drive-address-conflict.xml
@@ -14,14 +14,14 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-i686</emulator>
-    <hostdev mode='subsystem' type='scsi' managed='no'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host2'/>
         <address bus='0' target='0' unit='1'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='no'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host2'/>
         <address bus='0' target='0' unit='2'/>
diff --git a/tests/qemuxml2argvdata/name-escape.xml b/tests/qemuxml2argvdata/name-escape.xml
index fab2a77..d533587 100644
--- a/tests/qemuxml2argvdata/name-escape.xml
+++ b/tests/qemuxml2argvdata/name-escape.xml
@@ -28,7 +28,7 @@
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
     <controller type='scsi' index='0' model='virtio-scsi'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
         <source protocol='iscsi' name='iqn.1992-01.com.example:my,storage/1'>
         <host name='example.foo.org' port='3260'/>
       </source>
diff --git a/tests/qemuxml2argvdata/user-aliases-usb.xml b/tests/qemuxml2argvdata/user-aliases-usb.xml
index 668a9c3..5647a0b 100644
--- a/tests/qemuxml2argvdata/user-aliases-usb.xml
+++ b/tests/qemuxml2argvdata/user-aliases-usb.xml
@@ -62,13 +62,13 @@
       <master startport='4'/>
       <address type='pci' domain='0' bus='0' slot='5' function='2'/>
     </controller>
-    <hostdev mode='subsystem' type='usb' managed='yes'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='14' device='6'/>
       </source>
       <address type='usb' bus='0' port='3'/>
     </hostdev>
-    <hostdev mode='subsystem' type='usb' managed='yes'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='15' device='6'/>
       </source>
diff --git a/tests/qemuxml2xmloutdata/hostdev-mdev-display.xml b/tests/qemuxml2xmloutdata/hostdev-mdev-display.xml
index d0a8591..9fc998b 100644
--- a/tests/qemuxml2xmloutdata/hostdev-mdev-display.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-mdev-display.xml
@@ -30,7 +30,7 @@
       <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </video>
-    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on'>
+    <hostdev mode='subsystem' type='mdev' model='vfio-pci' display='on'>
       <source>
         <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
       </source>
diff --git a/tests/qemuxml2xmloutdata/hostdev-mdev-precreated.xml b/tests/qemuxml2xmloutdata/hostdev-mdev-precreated.xml
index 9d35fac..9f350ce 100644
--- a/tests/qemuxml2xmloutdata/hostdev-mdev-precreated.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-mdev-precreated.xml
@@ -23,7 +23,7 @@
     </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci'>
+    <hostdev mode='subsystem' type='mdev' model='vfio-pci'>
       <source>
         <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
       </source>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-autogen-address.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-autogen-address.xml
index 3b4242e..0b0cb12 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-autogen-address.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-autogen-address.xml
@@ -35,77 +35,77 @@
     </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host1'/>
         <address bus='0' target='0' unit='1'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host2'/>
         <address bus='0' target='0' unit='2'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='2'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host3'/>
         <address bus='0' target='0' unit='3'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='3'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host4'/>
         <address bus='0' target='0' unit='4'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host5'/>
         <address bus='0' target='0' unit='5'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='5'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host6'/>
         <address bus='0' target='0' unit='6'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='6'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host7'/>
         <address bus='0' target='0' unit='7'/>
       </source>
       <address type='drive' controller='1' bus='0' target='0' unit='0'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host8'/>
         <address bus='0' target='0' unit='8'/>
       </source>
       <address type='drive' controller='1' bus='0' target='0' unit='1'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host9'/>
         <address bus='0' target='0' unit='9'/>
       </source>
       <address type='drive' controller='1' bus='0' target='0' unit='5'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host10'/>
         <address bus='0' target='0' unit='10'/>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-large-unit.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-large-unit.xml
index 1b0da12..26b3c83 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-large-unit.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-large-unit.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='1074872354'/>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi-auth.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi-auth.xml
index beeb3cb..5f5b3c5 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi-auth.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi-auth.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
         <host name='example.org' port='3260'/>
         <auth username='myname'>
@@ -41,7 +41,7 @@
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
         <host name='example.org' port='3260'/>
         <auth username='myname'>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml
index cff162b..da2667c 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml
@@ -32,13 +32,13 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example/0'>
         <host name='example.org' port='3260'/>
       </source>
       <address type='drive' controller='0' bus='0' target='0' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
         <host name='example.org' port='3260'/>
       </source>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml
index d8931da..36fd21f 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml
index df1375d..34cbc9a 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered' rawio='yes'>
+    <hostdev mode='subsystem' type='scsi' sgio='unfiltered' rawio='yes'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml
index dd252f8..79e7c7e 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml
index 05cefc0..eae879a 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes' sgio='unfiltered'>
+    <hostdev mode='subsystem' type='scsi' sgio='unfiltered'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-shareable.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-shareable.xml
index 31aa2dd..57b9936 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-shareable.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-shareable.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-ccw.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-ccw.xml
index 3723bd0..d41cdfe 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-ccw.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-ccw.xml
@@ -23,7 +23,7 @@
     <controller type='scsi' index='0' model='virtio-scsi'>
       <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
     </controller>
-    <hostdev mode='subsystem' type='scsi_host' managed='no'>
+    <hostdev mode='subsystem' type='scsi_host'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
       <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
     </hostdev>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pci.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pci.xml
index 174096b..1dbacfc 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pci.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pci.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi_host' managed='no'>
+    <hostdev mode='subsystem' type='scsi_host'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </hostdev>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pcie.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pcie.xml
index ef48d81..917e9cd 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pcie.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-vhost-scsi-pcie.xml
@@ -31,7 +31,7 @@
     </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi_host' managed='no'>
+    <hostdev mode='subsystem' type='scsi_host'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
       <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
     </hostdev>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi-auth.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi-auth.xml
index a3886ec..013d8f3 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi-auth.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi-auth.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
         <host name='example.org' port='3260'/>
         <auth username='myname'>
@@ -41,7 +41,7 @@
       </source>
       <address type='drive' controller='0' bus='0' target='2' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
         <host name='example.org' port='3260'/>
         <auth username='myname'>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi.xml
index d31af32..847b785 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-iscsi.xml
@@ -32,13 +32,13 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example/0'>
         <host name='example.org' port='3260'/>
       </source>
       <address type='drive' controller='0' bus='0' target='2' unit='4'/>
     </hostdev>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source protocol='iscsi' name='iqn.1992-01.com.example/1'>
         <host name='example.org' port='3260'/>
       </source>
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml
index df87897..cb79018 100644
--- a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml
@@ -32,7 +32,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='scsi' managed='yes'>
+    <hostdev mode='subsystem' type='scsi'>
       <source>
         <adapter name='scsi_host0'/>
         <address bus='0' target='0' unit='0'/>
diff --git a/tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw.xml b/tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw.xml
index a14ab05..5c4d2b5 100644
--- a/tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw.xml
@@ -14,7 +14,7 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-s390x</emulator>
-    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-ccw'>
+    <hostdev mode='subsystem' type='mdev' model='vfio-ccw'>
       <source>
         <address uuid='90c6c135-ad44-41d0-b1b7-bae47de48627'/>
       </source>
diff --git a/tests/qemuxml2xmloutdata/hostdev-usb-address.xml b/tests/qemuxml2xmloutdata/hostdev-usb-address.xml
index 9e33773..c89780d 100644
--- a/tests/qemuxml2xmloutdata/hostdev-usb-address.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-usb-address.xml
@@ -29,7 +29,7 @@
     <controller type='pci' index='0' model='pci-root'/>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <hostdev mode='subsystem' type='usb' managed='no'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='14' device='6'/>
       </source>
diff --git a/tests/xlconfigdata/test-usb.xml b/tests/xlconfigdata/test-usb.xml
index 5bac73b..017d9f6 100644
--- a/tests/xlconfigdata/test-usb.xml
+++ b/tests/xlconfigdata/test-usb.xml
@@ -26,7 +26,7 @@
     </console>
     <input type='mouse' bus='xen'/>
     <input type='keyboard' bus='xen'/>
-    <hostdev mode='subsystem' type='usb' managed='no'>
+    <hostdev mode='subsystem' type='usb'>
       <source>
         <address bus='1' device='3'/>
       </source>
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: don't output managed attr for non-pci hostdevs
Posted by John Ferlan 5 years, 1 month ago

On 2/22/19 4:35 AM, Nikolay Shirokovskiy wrote:
> It is ignored on input for non pci hostdevs as written in docs.
> I guess it would be better if the attr was disabled to be specified
> in the first place instead but such behaviour is already documented.
> At least let's not output it back. This will fix issue when
> managed appeared on output for non pci hostdevs when it was not
> specified on input.
> 
> The tests are fixed by next commands:
> grep  -lRP 'hostdev.*mode=.subsystem.*type=.(?!pci).*managed' `find tests -name '*.xml'` > files
> sed -i.bak -re 's/ managed=.(yes|no).//' `cat files`
> 

To save yourself some effort in the future...

VIR_TEST_REGENERATE_OUTPUT=1 tests/qemuxml2xmltest
VIR_TEST_REGENERATE_OUTPUT=1 tests/xlconfigtest
VIR_TEST_REGENERATE_OUTPUT=1 tests/qemuargv2xmltest

Would have got a lot of them...

> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
> ---
>  src/conf/domain_conf.c                             |  6 ++++--
>  tests/qemuargv2xmldata/hostdev-usb-address.xml     |  2 +-
>  tests/qemuxml2argvdata/controller-order.xml        |  2 +-
>  .../disk-hostdev-scsi-address-conflict.xml         |  2 +-
>  .../disk-hostdev-scsi-virtio-iscsi-auth-AES.xml    |  2 +-
>  .../hostdev-scsi-autogen-address.xml               | 22 +++++++++++-----------
>  tests/qemuxml2argvdata/hostdev-scsi-boot.xml       |  2 +-
>  tests/qemuxml2argvdata/hostdev-scsi-large-unit.xml |  2 +-
>  .../hostdev-scsi-lsi-iscsi-auth.xml                |  4 ++--
>  tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi.xml  |  4 ++--
>  tests/qemuxml2argvdata/hostdev-scsi-lsi.xml        |  2 +-
>  tests/qemuxml2argvdata/hostdev-scsi-rawio.xml      |  2 +-
>  tests/qemuxml2argvdata/hostdev-scsi-readonly.xml   |  2 +-
>  tests/qemuxml2argvdata/hostdev-scsi-sgio.xml       |  2 +-
>  tests/qemuxml2argvdata/hostdev-scsi-shareable.xml  |  2 +-
>  .../hostdev-scsi-vhost-scsi-ccw.xml                |  2 +-
>  .../hostdev-scsi-vhost-scsi-pci.xml                |  2 +-
>  .../hostdev-scsi-vhost-scsi-pcie.xml               |  2 +-
>  .../hostdev-scsi-virtio-iscsi-auth.xml             |  4 ++--
>  .../qemuxml2argvdata/hostdev-scsi-virtio-iscsi.xml |  4 ++--
>  .../qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml  |  2 +-
>  .../hostdev-usb-address-device-boot.xml            |  2 +-
>  .../hostdev-usb-address-device.xml                 |  2 +-
>  tests/qemuxml2argvdata/hostdev-usb-address.xml     |  2 +-
>  .../hostdevs-drive-address-conflict.xml            |  4 ++--
>  tests/qemuxml2argvdata/name-escape.xml             |  2 +-
>  tests/qemuxml2argvdata/user-aliases-usb.xml        |  4 ++--
>  tests/qemuxml2xmloutdata/hostdev-mdev-display.xml  |  2 +-
>  .../qemuxml2xmloutdata/hostdev-mdev-precreated.xml |  2 +-
>  .../hostdev-scsi-autogen-address.xml               | 22 +++++++++++-----------
>  .../qemuxml2xmloutdata/hostdev-scsi-large-unit.xml |  2 +-
>  .../hostdev-scsi-lsi-iscsi-auth.xml                |  4 ++--
>  .../qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml  |  4 ++--
>  tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml      |  2 +-
>  tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml    |  2 +-
>  tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml |  2 +-
>  tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml     |  2 +-
>  .../qemuxml2xmloutdata/hostdev-scsi-shareable.xml  |  2 +-
>  .../hostdev-scsi-vhost-scsi-ccw.xml                |  2 +-
>  .../hostdev-scsi-vhost-scsi-pci.xml                |  2 +-
>  .../hostdev-scsi-vhost-scsi-pcie.xml               |  2 +-
>  .../hostdev-scsi-virtio-iscsi-auth.xml             |  4 ++--
>  .../hostdev-scsi-virtio-iscsi.xml                  |  4 ++--
>  .../hostdev-scsi-virtio-scsi.xml                   |  2 +-
>  .../hostdev-subsys-mdev-vfio-ccw.xml               |  2 +-
>  tests/qemuxml2xmloutdata/hostdev-usb-address.xml   |  2 +-
>  tests/xlconfigdata/test-usb.xml                    |  2 +-
>  47 files changed, 80 insertions(+), 78 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index ceeb247..9ff659c 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -27330,8 +27330,10 @@ virDomainHostdevDefFormat(virBufferPtr buf,
>      virBufferAsprintf(buf, "<hostdev mode='%s' type='%s'",
>                        mode, type);
>      if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
> -        virBufferAsprintf(buf, " managed='%s'",
> -                          def->managed ? "yes" : "no");
> +        if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
> +            virBufferAsprintf(buf, " managed='%s'",
> +                              def->managed ? "yes" : "no");
> +        }

Do you think perhaps @managed should be changed to a virTristateBool?
After all the RNG attribute is a virYesNo like other Tristate's.

That way the printing would only be done *if* found specifically on input.

The problem with blindly removing the "no" even though it's listed as
not being parsed on input is the differences it creates in output when
someone for some reason does add "managed='{yes|no}'" and now we
"remove" that...

So, I'm conflicted on the best resolution for this.  It is just a test
and PCI is listed as the only one that would manage it, but it is also
said the others would ignore it other than of course generating the
output blindly which you're trying to change/fix.

Perhaps there's some other opinions on this.

John

>  
>          if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
>              scsisrc->sgio)

[...]

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: don't output managed attr for non-pci hostdevs
Posted by Nikolay Shirokovskiy 5 years, 1 month ago

On 27.02.2019 20:43, John Ferlan wrote:
> 
> 
> On 2/22/19 4:35 AM, Nikolay Shirokovskiy wrote:
>> It is ignored on input for non pci hostdevs as written in docs.
>> I guess it would be better if the attr was disabled to be specified
>> in the first place instead but such behaviour is already documented.
>> At least let's not output it back. This will fix issue when
>> managed appeared on output for non pci hostdevs when it was not
>> specified on input.
>>
>> The tests are fixed by next commands:
>> grep  -lRP 'hostdev.*mode=.subsystem.*type=.(?!pci).*managed' `find tests -name '*.xml'` > files
>> sed -i.bak -re 's/ managed=.(yes|no).//' `cat files`
>>
> 
> To save yourself some effort in the future...
> 
> VIR_TEST_REGENERATE_OUTPUT=1 tests/qemuxml2xmltest
> VIR_TEST_REGENERATE_OUTPUT=1 tests/xlconfigtest
> VIR_TEST_REGENERATE_OUTPUT=1 tests/qemuargv2xmltest
> 
> Would have got a lot of them...

Thanx, great hint!

> 
>> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
>> ---
>>  src/conf/domain_conf.c                             |  6 ++++--
>>  tests/qemuargv2xmldata/hostdev-usb-address.xml     |  2 +-
>>  tests/qemuxml2argvdata/controller-order.xml        |  2 +-
>>  .../disk-hostdev-scsi-address-conflict.xml         |  2 +-
>>  .../disk-hostdev-scsi-virtio-iscsi-auth-AES.xml    |  2 +-
>>  .../hostdev-scsi-autogen-address.xml               | 22 +++++++++++-----------
>>  tests/qemuxml2argvdata/hostdev-scsi-boot.xml       |  2 +-
>>  tests/qemuxml2argvdata/hostdev-scsi-large-unit.xml |  2 +-
>>  .../hostdev-scsi-lsi-iscsi-auth.xml                |  4 ++--
>>  tests/qemuxml2argvdata/hostdev-scsi-lsi-iscsi.xml  |  4 ++--
>>  tests/qemuxml2argvdata/hostdev-scsi-lsi.xml        |  2 +-
>>  tests/qemuxml2argvdata/hostdev-scsi-rawio.xml      |  2 +-
>>  tests/qemuxml2argvdata/hostdev-scsi-readonly.xml   |  2 +-
>>  tests/qemuxml2argvdata/hostdev-scsi-sgio.xml       |  2 +-
>>  tests/qemuxml2argvdata/hostdev-scsi-shareable.xml  |  2 +-
>>  .../hostdev-scsi-vhost-scsi-ccw.xml                |  2 +-
>>  .../hostdev-scsi-vhost-scsi-pci.xml                |  2 +-
>>  .../hostdev-scsi-vhost-scsi-pcie.xml               |  2 +-
>>  .../hostdev-scsi-virtio-iscsi-auth.xml             |  4 ++--
>>  .../qemuxml2argvdata/hostdev-scsi-virtio-iscsi.xml |  4 ++--
>>  .../qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml  |  2 +-
>>  .../hostdev-usb-address-device-boot.xml            |  2 +-
>>  .../hostdev-usb-address-device.xml                 |  2 +-
>>  tests/qemuxml2argvdata/hostdev-usb-address.xml     |  2 +-
>>  .../hostdevs-drive-address-conflict.xml            |  4 ++--
>>  tests/qemuxml2argvdata/name-escape.xml             |  2 +-
>>  tests/qemuxml2argvdata/user-aliases-usb.xml        |  4 ++--
>>  tests/qemuxml2xmloutdata/hostdev-mdev-display.xml  |  2 +-
>>  .../qemuxml2xmloutdata/hostdev-mdev-precreated.xml |  2 +-
>>  .../hostdev-scsi-autogen-address.xml               | 22 +++++++++++-----------
>>  .../qemuxml2xmloutdata/hostdev-scsi-large-unit.xml |  2 +-
>>  .../hostdev-scsi-lsi-iscsi-auth.xml                |  4 ++--
>>  .../qemuxml2xmloutdata/hostdev-scsi-lsi-iscsi.xml  |  4 ++--
>>  tests/qemuxml2xmloutdata/hostdev-scsi-lsi.xml      |  2 +-
>>  tests/qemuxml2xmloutdata/hostdev-scsi-rawio.xml    |  2 +-
>>  tests/qemuxml2xmloutdata/hostdev-scsi-readonly.xml |  2 +-
>>  tests/qemuxml2xmloutdata/hostdev-scsi-sgio.xml     |  2 +-
>>  .../qemuxml2xmloutdata/hostdev-scsi-shareable.xml  |  2 +-
>>  .../hostdev-scsi-vhost-scsi-ccw.xml                |  2 +-
>>  .../hostdev-scsi-vhost-scsi-pci.xml                |  2 +-
>>  .../hostdev-scsi-vhost-scsi-pcie.xml               |  2 +-
>>  .../hostdev-scsi-virtio-iscsi-auth.xml             |  4 ++--
>>  .../hostdev-scsi-virtio-iscsi.xml                  |  4 ++--
>>  .../hostdev-scsi-virtio-scsi.xml                   |  2 +-
>>  .../hostdev-subsys-mdev-vfio-ccw.xml               |  2 +-
>>  tests/qemuxml2xmloutdata/hostdev-usb-address.xml   |  2 +-
>>  tests/xlconfigdata/test-usb.xml                    |  2 +-
>>  47 files changed, 80 insertions(+), 78 deletions(-)
>>
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index ceeb247..9ff659c 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -27330,8 +27330,10 @@ virDomainHostdevDefFormat(virBufferPtr buf,
>>      virBufferAsprintf(buf, "<hostdev mode='%s' type='%s'",
>>                        mode, type);
>>      if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
>> -        virBufferAsprintf(buf, " managed='%s'",
>> -                          def->managed ? "yes" : "no");
>> +        if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
>> +            virBufferAsprintf(buf, " managed='%s'",
>> +                              def->managed ? "yes" : "no");
>> +        }
> 
> Do you think perhaps @managed should be changed to a virTristateBool?
> After all the RNG attribute is a virYesNo like other Tristate's.

AFAIU tristate is nice when we have hypervisor-specific default values.
In this case we not. So tristate won't be that useful. So tristate
is implementation matter decoupled from RNG.

> 
> That way the printing would only be done *if* found specifically on input.

I think we should print "no" for PCI devices if @managed is omitted on input
as we do usually after expanding default values.


Nikolay

> 
> The problem with blindly removing the "no" even though it's listed as
> not being parsed on input is the differences it creates in output when
> someone for some reason does add "managed='{yes|no}'" and now we
> "remove" that...
> 
> So, I'm conflicted on the best resolution for this.  It is just a test
> and PCI is listed as the only one that would manage it, but it is also
> said the others would ignore it other than of course generating the
> output blindly which you're trying to change/fix.
> 
> Perhaps there's some other opinions on this.
> 
> John
> 
>>  
>>          if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
>>              scsisrc->sgio)
> 
> [...]
> 

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