Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1363634 - Can't create snapshot when dynamic_ownership=0
Summary: Can't create snapshot when dynamic_ownership=0
Status: NEW
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2016-08-03 09:07 UTC by Mateusz Kwiatkowski
Modified: 2018-07-18 14:58 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:

Attachments (Terms of Use)

Description Mateusz Kwiatkowski 2016-08-03 09:07:46 UTC
Description of problem:
It's not possible to create snapshot with virsh when dynamic_ownership set to 0 . I tested this on CentOS 7 with SELinux set to permissive mode and on Arch Linux without SELinux.

root@shiva /home/virtkick/hdd # virsh snapshot-create-as --domain 1_kwiat-test_cc789778-ea62-44a9-ac04-fc4a136131d4 snapshot-kwiat --diskspec vda,file=/home/virtkick/hdd/snapshot-1_kwiat-test_cc789778-ea62-44a9-ac04-fc4a136131d4.qcow2 --disk-only --atomic
error: internal error: unable to execute QEMU command 'transaction': Could not create file: Permission denied

Logs indicate that file is actually being created.


Formatting '/home/virtkick/hdd/snapshot-1_kwiat-test_cc789778-ea62-44a9-ac04-fc4a136131d4.qcow2', fmt=qcow2 size=26843545600 backing_file='/home/virtkick/hdd/1_kwiat-test_cc789778-ea62-44a9-ac04-fc4a136131d4.qcow2' backing_fmt='qcow2' encryption=off cluster_size=65536 lazy_refcounts=off

However qemu process can't open it:

open("/home/virtkick/hdd/snapshot-1_kwiat-test_cc789778-ea62-44a9-ac04-fc4a136131d4.qcow2", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
open("/home/virtkick/hdd/snapshot-1_kwiat-test_cc789778-ea62-44a9-ac04-fc4a136131d4.qcow2", O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, 0644) = -1 EACCES (Permission denied)

Version-Release number of selected component (if applicable):
Tested on:
 - CentOS7 with libvirt-1.2.17-13.el7_2.5.x86_64, qemu-2.0.0-1.el7.6.x86_64
 - Arch Linux with libvirt 2.0.0-1, qemu 2.6.0-1

How reproducible:

Steps to Reproduce:
1. In /etc/libvirt/qemu.conf set dynamic_ownership=0.
2. Create new virtual machine
3. Try to create snapshot of that virtual machine using virsh snapshot-create-as command

Known workaround is to touch the snapshot file before creating the snapshot, and chown it to user and group defined in qemu.conf.

Actual results:
Snapshot is not created due to EACCESS error.

Expected results:
Snapshot is created.

Note You need to log in before you can comment on or make changes to this bug.