aruhier / virt-backup

Backup your kvm guests managed by libvirt
Other
107 stars 23 forks source link

Disk configuration does not work #23

Closed corrafig closed 5 years ago

corrafig commented 5 years ago

I have vm backup with two disks; one file based (vda) and one block device (vdb). I want to backup the vda and exclude the physical disk.

In virt-backup configuration I tried to exclude vdb by listing only vda in configuration. The exclude doesn't seem to work.

Config:

groups:
  primary:
    target: /mnt/nas/virt-backup
    compression: gz
    compression_lvl: 6
    hosts:
      - host: backup
        disks:
          - vda

Disks:

 # virsh dumpxml backup | grep vd
      <target dev='vda' bus='virtio'/>
      <target dev='vdb' bus='virtio'/>

Result:

# virt-backup backup
backup: Backup started
libvirt: Domain Snapshot error : unsupported configuration: source for disk 'vdb' is not a regular file; refusing to generate external snapshot name
Error with domain backup: snapshot not started
snapshot not started
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/backups/pending.py", line 160, in start
    self._snapshot_and_save_date(definition)
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/backups/pending.py", line 193, in _snapshot_and_save_date
    snapshot_metadatas = self._ext_snapshot_helper.start()
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/backups/snapshot.py", line 91, in start
    snapshot = self.external_snapshot()
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/backups/snapshot.py", line 118, in external_snapshot
    libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA
  File "/usr/local/lib/python3.7/dist-packages/libvirt.py", line 2626, in snapshotCreateXML
    if ret is None:raise libvirtError('virDomainSnapshotCreateXML() failed', dom=self)
libvirt.libvirtError: unsupported configuration: source for disk 'vdb' is not a regular file; refusing to generate external snapshot name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/groups/pending.py", line 234, in start_multithread
    completed_backups[dom_name] = f.result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/groups/pending.py", line 268, in _start_backup
    return backup.start()
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/backups/pending.py", line 177, in start
    self.clean_aborted()
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/backups/pending.py", line 440, in clean_aborted
    self._ext_snapshot_helper.clean()
  File "/usr/local/lib/python3.7/dist-packages/virt_backup/backups/snapshot.py", line 150, in clean
    raise SnapshotNotStarted()
virt_backup.exceptions.SnapshotNotStarted: snapshot not started
backups failed for domains: backup

virt-backup 0.3.0

aruhier commented 5 years ago

Hi, Thanks a lot for the report, I will take a look at that today.

aruhier commented 5 years ago

Indeed, it seems that during a backup, the filtering for the disks to snapshot are ignored. It introduces another issue, as snapshots for unlisted disks are not cleaned.

aruhier commented 5 years ago

Please test the last release (v0.3.1), it should be fixed now. Thanks for the issue, tell me if the bug still occurs and I will reopen it!

corrafig commented 5 years ago

Thanks @aruhier for quick fix. I tested v0.3.1 and it works now.