Revert virt-xml multiple --edit support

This reverts b34ae0d0c8 and
1fef5d8661.

Playing with this some more I found some deeper problems. For example

```console
[:~/src/virt-manager] (main) $ ./virt-xml test-for-virtxml --connect test://`pwd`/tests/data/testdriver/testsuite.xml --print-diff --edit 1 --video model=FOO --edit 2 --sound model=BAR
--- Original XML
+++ Altered XML
@@ -180,14 +180,14 @@
     <graphics type="vnc" port="-1" autoport="yes">
       <listen type="address"/>
     </graphics>
-    <sound model="sb16"/>
+    <sound model="BAR"/>
     <sound model="es1370"/>
     <sound model="ich6"/>
     <video>
       <model type="vmvga" vram="16384" heads="1" primary="yes"/>
     </video>
     <video>
-      <model type="cirrus" vram="16384" heads="3"/>
+      <model type="FOO" vram="16384" heads="3"/>
     </video>
     <hostdev mode="subsystem" type="usb" managed="yes">
       <source>
```

There's other weirdness too, though it's mostly strange plays on previous weird behavior

* `--edit --video model=vga --edit --sound model=ich9 --video model=qxl` works
* `--add-device --sound model=foo --video model=bar` was previously rejected but now works
* `--remove-device --video model=vmvga --sound model=sb16` was previously rejected by now works

Fixing all this is not trivial. So I think we need to revert and go back to the drawing board.
This commit is contained in:
Cole Robinson
2024-08-28 11:43:36 -04:00
committed by Pavel Hrdina
parent 5fe6dcc6b4
commit 7e79e064ea
5 changed files with 32 additions and 104 deletions

View File

@@ -1373,9 +1373,7 @@ c.add_invalid("test --cpu host-passthrough", grep="One of --edit, ") # conflict
c.add_invalid("test --edit --add-device --disk path=foo", grep="Conflicting options --edit, --add-device")
c.add_invalid("test --edit 0 --disk path=", grep="Invalid --edit option '0'")
c.add_invalid("test --edit --hostdev driver_name=vfio", grep='No --hostdev objects found in the XML')
c.add_invalid("test --edit --cpu host-passthrough --boot hd,network", grep="Each XML-ACTION requires one --edit option.")
c.add_invalid("test --edit --cpu host-passthrough --edit", grep="Each XML-ACTION requires one --edit option.")
c.add_compare("test --print-diff --edit --cpu host-passthrough --edit --boot hd,network", "multiple-edit")
c.add_invalid("test --edit --cpu host-passthrough --boot hd,network", grep="Only one change operation may be specified")
c.add_invalid("test --edit", grep="No change specified.")
c.add_invalid("test --edit 2 --cpu host-passthrough", grep="'--edit 2' requested but there's only 1 --cpu object in the XML")
c.add_invalid("test-for-virtxml --edit 5 --tpm /dev/tpm", grep="'--edit 5' requested but there's only 1 --tpm object in the XML")
@@ -1385,7 +1383,6 @@ c.add_invalid("test-for-virtxml --edit --graphics password=foo,keymap= --update
c.add_invalid("--build-xml --memory 10,maxmemory=20", grep="--build-xml not supported for --memory")
c.add_invalid("test-state-shutoff --edit sparse=no --disk path=blah", grep="Don't know how to match device type 'disk' property 'sparse'")
c.add_invalid("test --add-device --xml ./@foo=bar", grep="--xml can only be used with --edit")
c.add_invalid("test --edit --xml ./@foo=bar --edit --video model=virtio", grep="--xml cannot be used with any other XML-ACTION")
c.add_invalid("test-for-virtxml --edit --boot refresh-machine-type=yes", grep="Don't know how to refresh")
c.add_compare("test --print-xml --edit --vcpus 7", "print-xml") # test --print-xml
c.add_compare("--edit --cpu host-passthrough", "stdin-edit", input_file=(_VIRTXMLDIR + "virtxml-stdin-edit.xml")) # stdin test
@@ -1506,7 +1503,6 @@ c.add_compare("--remove-device --hostdev mdev_b1ae8bf6_38b0_4c81_9d44_78ce3f5204
c = vixml.add_category("edit/remove spice graphics", "test-spice --print-diff --define")
c.add_compare("--edit --graphics type=vnc", "change-spice-to-vnc")
c.add_compare("--remove-device --graphics type=spice", "remove-spice-graphics")
c.add_compare("--edit --graphics type=vnc --edit --video model=virtio", "change-graphics-and-video")
c = vixml.add_category("add/rm devices and start", "test-state-shutoff --print-diff --start")
c.add_invalid("--add-device --pm suspend_to_disk=yes", grep="Cannot use --add-device with --pm") # --add-device without a device