Amaresh Pathak
Amaresh Pathak

Reputation: 31

SLES12-Libvirt: virsh vol-delete fails when deleting disk image: cannot unlink file 'XXX': Permission denied

Description of problem: On SLES-12 machine, if we try to delete the disk image through virsh vol-delete command immediately for vm which is provisioned through virt-manager, getting

cannot unlink file 'XXX': Permission denied" error.

This error occurs only for disk which gets created while provisioning the vm. If we delete the same disk through virt-manager then it gets deleted properly.

If we create another disk through virt-manager and delete by using above virsh command,it gets deleted properly.

To summarize, problem is only for deleting disk which is created as part of provisioning VM.

Version-Release number of selected component (if applicable):

OS:SUSE Linux Enterprise Server 12 SP1 (x86_64)

Libvirt Version: cv-hj-kvmlib01-am02:/var/lib/libvirt/images # virsh version Compiled against library: libvirt 1.3.1 Using library: libvirt 1.3.1 Using API: QEMU 1.3.1 Running hypervisor: QEMU 2.3.1

Steps to Reproduce:

  1. Provision the vm through virt-manager on SLES_12
  2. Delete the disk image which is created while provisioning the vm using virsh command line:

virsh # vol-delete /var/lib/libvirt/images/.qcow2

error: Failed to delete vol /var/lib/libvirt/images/.qcow2

error: cannot unlink file '/var/lib/libvirt/images/.qcow2': Permission denied

Upvotes: 2

Views: 1693

Answers (1)

foobrew
foobrew

Reputation: 1765

I think this might be similar to the question you asked here.

Assuming this is a volume you've properly detached from the VM, you probably just need a pool-refresh to let virsh know the volume is no longer in use:

# virsh pool-refresh default

(assuming your using the 'default' pool)

Then try deleting again. If you still get permission errors, I'd suggest looking at the perms of the image files and the contents of the following two configs:

/etc/libvirt/qemu.conf

/etc/libvirt/libvirtd.conf

Upvotes: 2

Related Questions