RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 832302 - libvirt shouldn't delete an existing unregistered volume in vol-create
Summary: libvirt shouldn't delete an existing unregistered volume in vol-create
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: rc
: ---
Assignee: Osier Yang
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 888457
TreeView+ depends on / blocked
 
Reported: 2012-06-15 05:49 UTC by yuping zhang
Modified: 2013-03-04 05:18 UTC (History)
11 users (show)

Fixed In Version: libvirt-0.10.2-12.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 07:17:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0276 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2013-02-20 21:18:26 UTC

Description yuping zhang 2012-06-15 05:49:23 UTC
Description of problem:
In default pool,there is a image which name is as same as remote guest 
image,and then run virt-v2v command,v2v will exit,but it will delete the 
local image.

Version-Release number of selected component (if applicable):
virt-v2v-0.8.7-6.el6.x86_64
libvirt-0.9.10-21.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64


How reproducible:
always

Steps to Reproduce:
1.Create a image in local host default pool.
# qemu-img create /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img 1G
Formatting '/var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img', fmt=raw 
size=1073741824
# ll /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img
-rw-r--r--. 1 root root 1073741824 Jun 15 12:57 
/var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img

2.Convert a guest which image name is xen-pv-rhel5.8-x86_64.img
# virt-v2v -ic xen+ssh://10.66.72.123/ -os default xen-pv-rhel5.8-x86_64
root.72.123's password:
virt-v2v: Failed to create storage volume: libvirt error code: 38, 
message: cannot create path 
'/var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img': File exists

# echo $?
2

3.# ll /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img


Actual results:
The image was removed.
#ll /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img
ls: cannot access /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img: No 
such file or directory

Expected results:
The image should should not be removed.

Additional info:

Comment 1 Matthew Booth 2012-12-04 11:43:02 UTC
This is a libvirt bug. I've updated the title and reassigned it accordingly. Here's a simple reproducer:

# cat /tmp/disk.xml 
<volume>
  <name>unregistered.img</name>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <target>
    <format type='raw'/>
  </target>
</volume>

# touch /var/lib/libvirt/images/unregistered.img

# virsh vol-create default /tmp/disk.xml 
error: Failed to create vol from /tmp/disk.xml
error: cannot create path '/var/lib/libvirt/images/unregistered.img': File exists

# ls /var/lib/libvirt/images/unregistered.img
ls: cannot access /var/lib/libvirt/images/unregistered.img: No such file or directory

Note that libvirt has deleted the existing disk image. It should instead have not deleted it and indicated that the volume already exists, as it would have done if the volume was already registered in the pool.

Comment 2 Osier Yang 2012-12-05 17:12:11 UTC
patch committed into upstream.

https://www.redhat.com/archives/libvir-list/2012-December/msg00159.html

Comment 5 zhe peng 2012-12-13 07:28:13 UTC
I can reproduce this with pkg:
libvirt-0.10.2-7.el6.x86_64
virt-v2v-0.8.9-2.el6.x86_64

verify with:
libvirt-0.10.2-12.el6.x86_64
virt-v2v-0.8.9-2.el6.x86_64

step:
1.Create a image in local host default pool.
# qemu-img create /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img 1G
Formatting '/var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img', fmt=raw 
size=1073741824
# ll /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img
-rw-r--r--. 1 root root 1073741824 Dec 13 02:16 /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img

2.Convert a guest which image name is xen-pv-rhel5.8-x86_64.img
# virt-v2v -ic xen+ssh://10.66.72.23/ -os default xen-pv-rhel5.9-x86_64
root.72.123's password:
virt-v2v: Failed to create storage volume: libvirt error code: 55, 
message: Requested operation is not valid: volume target path '/var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img' already exists

# echo $?
2

3.# ll /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img 
-rw-r--r--. 1 root root 1073741824 Dec 13 02:16 /var/lib/libvirt/images/xen-pv-rhel5.8-x86_64.img

the image not be removed. verification passed.

Comment 6 errata-xmlrpc 2013-02-21 07:17:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0276.html


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