Fwd: virsh backup-begin problem

Peter Krempa pkrempa at redhat.com
Thu Jan 21 13:33:12 UTC 2021


On Thu, Jan 21, 2021 at 15:42:21 +0300, Andrey Fokin wrote:
> Ok. Sorry.
> 
> On Thu, Jan 21, 2021 at 3:38 PM Peter Krempa <pkrempa at redhat.com> wrote:
> 
> > On Thu, Jan 21, 2021 at 15:16:44 +0300, Andrey Fokin wrote:
> > > Yes, there is an error message.
> > > sudo virsh backup-begin lubuntu2 ./backup.xml
> > > error: XML document failed to validate against schema: Unable to validate
> > > doc against /usr/share/libvirt/schemas/domainbackup.rng
> > > Element domainbackup has extra content: disk
> >
> > As I've noted in the exact mail you are replying to, I will not offer
> > any further assistance unless you post the question also on
> > libvirt-users at redhat.com list as you did with your original question.
> > This is to archive any discussions for future reference.
> >
> > > On Thu, Jan 21, 2021 at 2:40 PM Peter Krempa <pkrempa at redhat.com> wrote:
> > >
> > > > On Thu, Jan 21, 2021 at 12:34:43 +0100, Peter Krempa wrote:
> > > > > On Thu, Jan 21, 2021 at 14:31:18 +0300, Andrey Fokin wrote:
> > > > > > Peter, thanks. I understood you message about additional
> > configuration
> > > > in
> > > > > > domen settings. It's really interesting, and I'll going to test it
> > as
> > > > well.
> > > > > > But could you please advise how change backup-begin command XML
> > > > parameters
> > > > > > file to start full backup process? What is wrong in my case and
> > how to
> > > > fix
> > > > > > it? My config below.
> > > > > > Thanks a lot!

Let me rescue the XML as you've posted it.

<domainbackup>
    <disk name='/var/lib/libvirt/images/lubuntu2.qcow2' type='file'>
    <target file='$PWD/scratch1.img'/>
    <driver type='raw'/>
    </disk>
    <disk name='/var/lib/libvirt/images/lubuntu2-1.qcow2' type='file'>
      <target file='$PWD/scratch2.img'/>
      <driver type='raw'/>
    </disk>
</domainbackup>


So there are multiple issues here.

Firstly please refer to the XML documentation, because the mistakes you
have in your are actually documented properly:

https://libvirt.org/formatbackup.html

Problems:

1) Missing <disks> container around the individual <disk> elements
2) <disk name=' attribute must contain the disk target (such as 'vda',
   'vdb' refering to the disk in the domain definition, paths are not
   allowed. This fact is mentioned in the docs.
3) If the <target file=' paths are not examples, but you really have
   $PWD in there, note that neither virsh nor libvirt will replace it
   with the working directory. The XML is used as-is. This then violates
   the rule that paths must start with a /.

So the proper XML then is. Obviously you need to make sure that it's
what you actually meant ...

<domainbackup>
  <disks>
    <disk name='hda' type='file'>
      <target file='/path/scratch1.img'/>
      <driver type='raw'/>
    </disk>
    <disk name='hdc' type='file'>
      <target file='/path/scratch2.img'/>
      <driver type='raw'/>
    </disk>
  </disks>
</domainbackup>


e.g. the output files will be raw and not qcow2.




More information about the libvirt-users mailing list