Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to exclude disks #2

Closed
rickyketch opened this issue Mar 19, 2021 · 11 comments
Closed

No way to exclude disks #2

rickyketch opened this issue Mar 19, 2021 · 11 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rickyketch
Copy link

rickyketch commented Mar 19, 2021

An interesting project. I tried virtnbdbackup on a CentOS 7 VM on a Fedora 33 host. The VM has a small, QCOW2 system disk and a large, raw storage disk, and a CDROM drive that is unused, but it got created by default. I only wanted to back up the system disk, vda.

At first it couldn't get past the CDROM drive, sda:
ERROR:root:unsupported configuration: disk 'sda' has no media
I attached an iso file to the CDROM drive and then got:
ERROR:root:unsupported configuration: disk 'sda' is empty or readonly
So I deleted the CDROM drive and then it couldn't get past the raw storage drive, vdb
ERROR:root:unsupported configuration: checkpoint for disk vdb unsupported for storage type raw
So I deleted the vdb disk device, and only then it succeeded in creating a backup of the system disk, vda.

I found in the code the "--include" commandline switch:
parser.add_argument("-i", "--include", default=None, type=str, help="Backup only disk with target dev name specified")
That seems like just what I needed.
[root@oplx7010 2TBpart]# virtnbdbackup -d centos7.0 -i vda -l full -o centos7.0.virtnbdbackup

But I still failed the same way with the same messages. The "include" switch had no apparent effect. It did not result in the other disks being ignored as I would have expected.

Thank you.
Richard Ketcham

@abbbi
Copy link
Owner

abbbi commented Mar 20, 2021

its some time since ive used it as i currently have no test setup. The include swich should work as expeced, does "vda" match the virtual disks target name in the xml configuration? According to the source, im checking for the target name:

      for disk in disks:                                                                                                                                                     
      ┆   if args.include != None and disk.diskTarget != args.include:                                              
      ┆   ┆   logging.info("Skipping disk: %s" % disk.diskTarget)                              
      ┆   ┆   continue  

one would need the vm XML configuration to check why it doesnt skip the disks.

@abbbi abbbi added enhancement New feature or request good first issue Good for newcomers labels Mar 20, 2021
@rickyketch
Copy link
Author

rickyketch commented Mar 21, 2021

abbbi, I believe "vda" does match

<devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/virt/DRBL-C7.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='disk' snapshot='no'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/2TBpart/IMGSTOR-B.img'/>
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='sda' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

DRBL-C7.xml.TXT

@abbbi
Copy link
Owner

abbbi commented Mar 22, 2021

can you post complete output of your command? Does the "Skipping disk:" logline appear at all?
disk.diskTarget should be "vda" in you case and it should match.

@rickyketch
Copy link
Author

rickyketch commented Mar 23, 2021

[root@oplx7010 virt]# virtnbdbackup -d DRBL-C7 -l full -o backup -i vda ERROR:root:Domain is missing required incremental-backup capability.

the domain configuration iss missing the required incremental flag like described in the README:

https://github.com/abbbi/virtnbdbackup#prerequisites

@abbbi
Copy link
Owner

abbbi commented Mar 23, 2021

Can you try the version in branch issue2,it should now automatically exclude cdrom and raw devices.
efc0cc3

@abbbi
Copy link
Owner

abbbi commented Mar 23, 2021

[root@oplx7010 virt]# virtnbdbackup -d DRBL-C7 -l full -o backup -i vda ERROR:root:Domain is missing required incremental-backup capability.

the domain configuration iss missing the required incremental flag like described in the README:

https://github.com/abbbi/virtnbdbackup#prerequisites

@rickyketch
Copy link
Author

rickyketch commented Mar 23, 2021

Ok, I just created a new, plain vanilla, centos7.0 VM to try to replicate the problem and I still got that last error message.

[root@oplx7010 virt]# virtnbdbackup -d centos7.0 -l full -o backup -i vda ERROR:root:Domain is missing required incremental-backup capability.

Then I remembered, I forgot to add "<qemu:add capability='incremental-backup'/>" like I did before.
Well, now I can't:

[root@oplx7010 virt]# virsh edit centos7.0 error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng Element domain has extra content: qemu:capabilities

and I'm trying to figure out why I could before and now I can't. Something new I've noticed with Fedora 33 is that it automatically installs updates every time I reboot. And I see that schema file got updated just a few days ago:

[root@oplx7010 qemu]# rpm -q --last libvirt-libs-6.6.0-5.fc33.x86_64 libvirt-libs-6.6.0-5.fc33.x86_64 Thu 18 Mar 2021 04:38:08 PM PDT

@abbbi
Copy link
Owner

abbbi commented Mar 23, 2021

[root@oplx7010 virt]# virtnbdbackup -d centos7.0 -l full -o backup -i vda ERROR:root:Domain is missing required incremental-backup capability.

Then I remembered, I forgot to add "<qemu:add capability='incremental-backup'/>" like I did before.
Well, now I can't:
[root@oplx7010 qemu]# rpm -q --last libvirt-libs-6.6.0-5.fc33.x86_64 libvirt-libs-6.6.0-5.fc33.x86_64 Thu 18 Mar 2021 04:38:08 PM PDT

hm.. not sure, but maybe things have changed now with more recent libvirt versions, it seems to be enabled by
default now:

https://bugzilla.redhat.com/show_bug.cgi?id=1799015

@abbbi
Copy link
Owner

abbbi commented Mar 23, 2021

hi,

i tried on centos8 with the latest advanced virtualization stream and i still need to add the XML definition,
system comes with libvirt 6.6.0 aswell. (6.6.0-13). you need to be sure that the FIRST line of the virtual machine is:

<domain type='kvm' id='4' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

so the schema applies!

@abbbi
Copy link
Owner

abbbi commented Mar 23, 2021

hi again,

i have a new test setup and was able to fix a few things in the current master branch:

  1. cdrom and unsupported devices are now ignored during checkpoint creation,
    in case virtual disk does not support checkpointing, an warning is issued, see issue Ignore CDROM / Direct attached block devices #3

  2. the include option works just right for me, using the following command:

./virtnbdbackup -d debian10 -l full -i vdb -o blax

i see only vdb is backed up:

INFO:root:Skipping disk: vda

Anyway, try the latest master version, it should fix your issues.

@rickyketch
Copy link
Author

Yes indeed. All is working now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants