virsh edit does not work when <initiator> and <auth> is used in config

Peter Krempa pkrempa at redhat.com
Thu Jun 25 06:52:43 UTC 2020


On Thu, Jun 25, 2020 at 05:53:03 +0200, Fourhundred Thecat wrote:
> Hello,
> 
> I am having problem when using: "virsh edit <vm_name>"
> 
> my VM has network iscsi disk defined:
> 
> 
>     <disk type='network' device='disk'>
>       <driver name='qemu' type='raw'/>
>       <source protocol='iscsi'
> name='iqn.1992-08.com.netapp:5481.60080e50001ff2000000000051aee24d/0'>
>         <host name='10.1.212.52' port='3260'/>
> 
>         <initiator>
>           <iqn name='iqn.2013-01.bla.bla:01:test'/>
>         </initiator>
> 
>         <auth username='myname'>
>           <secret type='iscsi' usage='libvirtiscsi'/>
>         </auth>
> 
>       </source>
>     ...
>     </disk>
> 
> when I defined thje VM the first time, as always, libvirt reorders the
> lines in the XML config file as it likes.
> 
> One of the reordering it did, was to put the "<initiator>" block above
> the "<auth>" block.
> 
> But once I want to edit, "virsh edit <vm_name>", whatever change I make,
> even unrelated to iscsi disk, it reports error:
> 
> error: XML document failed to validate against schema: Unable to
> validate doc against /usr/share/libvirt/schemas/domain.rng
> Extra element devices in interleave
> Element domain failed to validate content

You are not mentioning the libvirt version you use.

Anyways this was a problem with the XML schema which was fixed by:

commit 8b58b5ee03c6d4b7916d9ee6cdf40571e1e12919
Author: Michal Prívozník <mprivozn at redhat.com>
Date:   Wed Jan 8 17:03:42 2020 +0100

    schema: Allow iSCSI source to have interleaved children

    There is no need to require users to produce iSCSI disk source
    following our ordering of children elements. In fact, we don't
    even accept our own order in the schema :(.

which was released in libvirt v6.0

> 
> 
> after long trial and error, I found I can finally save it when I reorder
> the
> 
> "<initiator>" and "<auth>" blocks, so that  "<auth>" is above
> "<initiator>". Once i save it, libvirt then reorders it back to the
> order, which will generate erro next time I attemt to edit.
> 
> Anyway, this seems like a bug, and especially evil one.
> 
> How could I get rid of this behaviour?

Please upgrade to the fixed version or use the 'i' option when saving
XML in virsh to ignore XML schema errors.

> 
> thanks,
> 
> 




More information about the libvirt-users mailing list