On 11/19/20 1:26 PM, Peter Krempa wrote:
> This version refactors cmdAttachDisk first so that we can use a much
> simpler logic to format the XML.
>
> With the simpler logic and tests the code now doesn't misformat the XML
> in certain situations as it was with the previous posting:
>
> virsh attach-disk --print-xml --domain ble --source "asdfsource" --target "tgt"
> >
> <source dev='asdfsource'/>
> <target dev='tgt'/>
> </disk>
>
> I've rather rewrote how we do things than trying to investigate why the
> original version [1] failed.
>
> The new version also adds tests so it's simpler to see that things
> actually work.
>
> [1] https://www.redhat.com/archives/libvir-list/2020-November/msg01071.html
>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> Peter Krempa (15):
> tests: virsh: Add simple testsuite for using --print-xml of various
> commands
> virsh: cmdAttachDisk: Declare one variable per line
> virsh: cmdAttachDisk: Use automatic memory clearing for 'xml' and
> 'dom'
> virsh: cmdAttachDisk: Refactor control flow
> virsh: cmdAttachDisk: Don't assume type='block' if file can't be
> examined
> virsh: cmdAttachDisk: Split out formatting of disk address
> virsh: Extract address formatting from cmdAttachDiskFormatAddress
> virsh: Unify code for <address type='drive'
> virsh: Refactor str2DiskAddress
> virsh: Rename 'struct DiskAddress' and friends
> virsh: virshAddress*: Move out of cmdAttachDisk block
> virsh: cmdAttachDisk: Use enum for disk source type
> virsh: cmdAttachDisk: Use virXMLFormatElement
> tests: virsh-output: Mark as expensive
> tests: virsh-checkpoint/snapshot: Mark as expensive
>
> Ryan Gahagan (1):
> virsh: Added attach-disk support for network disk
>
> docs/manpages/virsh.rst | 31 +-
> tests/meson.build | 1 +
> tests/virsh-checkpoint | 2 +
> tests/virsh-output | 29 ++
> tests/virsh-output-commands | 94 +++++
> tests/virsh-output.out | 496 ++++++++++++++++++++++++
> tests/virsh-snapshot | 2 +
> tools/virsh-domain.c | 748 ++++++++++++++++++------------------
> 8 files changed, 1017 insertions(+), 386 deletions(-)
> create mode 100755 tests/virsh-output
> create mode 100755 tests/virsh-output-commands
> create mode 100644 tests/virsh-output.out
>