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 1210564 - virt-clone deals abnormal when set --file path under /
Summary: virt-clone deals abnormal when set --file path under /
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: virt-manager
Version: 7.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Giuseppe Scrivano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-10 05:39 UTC by tingting zheng
Modified: 2015-11-19 05:25 UTC (History)
4 users (show)

Fixed In Version: virt-manager-1.2.1-1-el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:25:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Attach the debug file (9.33 KB, text/plain)
2015-04-10 10:08 UTC, tingting zheng
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2206 0 normal SHIPPED_LIVE virt-manager bug fix and enhancement update 2015-11-19 08:17:29 UTC

Description tingting zheng 2015-04-10 05:39:18 UTC
Description
virt-clone deals abnormal when set --file path under /

Version:
virt-manager-1.1.0-12.el7.noarch
virt-install-1.1.0-12.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1.Prepare a guest,eg:vm1.

2.Use virt-clone to clone the guest,set output disk under /,eg:/test,then virt-clone will deal it as //test.
2.1 Try --file /test:
# virt-clone -o vm1 -n vm1-test --file /test
Allocating 'test'                                                                          | 1.0 kB  00:00:09

Clone 'vm1-test' created successfully.

2.2Try --file /root:
# virt-clone -o vm1 -n vm1-test --file /root
ERROR    This will overwrite the existing path '//root' (Use --force to override)


3.After clone,check the xml file of the new cloned guest,it shows as //test.
# virsh dumpxml vm1-test
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='//test'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

4.Check the pool,there are 2 additional pools with path / and // created.
# virsh pool-dumpxml dirpool
<pool type='dir'>
  <name>dirpool</name>
  <uuid>cff91592-bb7d-4d76-ab78-46b0f0ec1aa8</uuid>
 <capacity unit='bytes'>189456433152</capacity>
  <allocation unit='bytes'>70228844544</allocation>
  <available unit='bytes'>119227588608</available>
  <source>
  </source>
  <target>
    <path>/</path>
    <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

# virsh pool-dumpxml dirpool-1
<pool type='dir'>
  <name>dirpool-1</name>
  <uuid>9ce6e1ea-6490-45ef-b6bb-582e13651f86</uuid>
  <capacity unit='bytes'>189456433152</capacity>
  <allocation unit='bytes'>61638909952</allocation>
  <available unit='bytes'>127817523200</available>
  <source>
  </source>
  <target>
    <path>//</path>

 <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

Actual results:
As description.

Expected results:
2.1 A image named test under / will be created for the newly cloned guest.
2.2 Some error like below will be showed:
Error with storage parameters: The path '/root' must be a file or a device, not a directory

Additional info:
I can not reproduce this issue on rhel6:
2.1 Try --file /test:
it will if I use --file /test,then a image named test under / will be created.
2.2 Try --file /root:
# virt-clone -o test -n test-test -f /root
ERROR    Error with storage parameters: The path '/root' must be a file or a device, not a directory

Comment 2 tingting zheng 2015-04-10 10:08:41 UTC
Created attachment 1013071 [details]
Attach the debug file

Comment 3 Giuseppe Scrivano 2015-04-10 10:20:55 UTC
it seems to be fixed upstream by:

commit cf0206a58cf042e257923316e018d6c20739095d
Author: Cole Robinson <crobinso>
Date:   Fri Dec 5 21:09:26 2014 -0500

    devicedisk: Break apart set_create_storage
    
    And break about the vol_install vs local clone storage creators. And
    just generally delete a lot of code. The commit aint pretty but it works
    and deletes a ton of hacks

Comment 5 fwu 2015-06-05 04:41:24 UTC
I can reproduce this bug on the following version:
virt-manager-1.1.0-12.el7.noarch
virt-install-1.1.0-12.el7.noarch

Steps are the same as the backport in Comment 1 shows.

Then verify with the latest package:
virt-manager-1.2.0-4.el7.noarch
virt-install-1.2.0-4.el7.noarch

Steps:
1.Prepare a guest, eg:rhel6.7.

2.Use virt-clone to clone the guest, set output disk under /, eg:/test, or /root.
2.1 Try --file /test:
# virt-clone -o rhel6.7 -n rhel6.7-test --file /test

2.2 Try --file /root:
# virt-clone -o rhel6.7 -n rhel6.7-test2 --file /root

3.After clone,check the xml file of the new cloned guest.
# virsh dumpxml rhel6.7-test

4.Check the pool,there are 2 additional pools with path / and // created.
# virsh pool-dumpxml dirpool
# virsh pool-dumpxml dirpool-1

Results:
1. After Step 2.1, the cloned VM was created successfully.
Allocating 'test'                                                       | 6.0 GB  00:00:07     

Clone 'rhel6.7-clone2' created successfully.

2. After Step 2.2, there is an error message:
ERROR    Could not use path '/root' for cloning: The path '//root' must be a file or a device, not a directory

3. After Step 3, the storage shows this:
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='//test'/>
      <target dev='hda' bus='ide'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

4. After Step 4, there are two pools created, path '/' and '//', respectively.
<pool type='dir'>
  <name>dirpool</name>
  <uuid>b53d0b60-34fa-4600-9050-7b4b1eedeb8a</uuid>
  <capacity unit='bytes'>199901442048</capacity>
  <allocation unit='bytes'>36832423936</allocation>
  <available unit='bytes'>163069018112</available>
  <source>
  </source>
  <target>
    <path>/</path>
    <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

  <name>dirpool-1</name>
  <uuid>5fad1a63-28f3-4004-8a42-ff3456b6bf55</uuid>
  <capacity unit='bytes'>199901442048</capacity>
  <allocation unit='bytes'>32537817088</allocation>
  <available unit='bytes'>167363624960</available>
  <source>
  </source>
  <target>
    <path>//</path>
    <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

According to the result shown above, the error message for path '/root' has fixed correctly. However, there are duplicate storage pool created and a wrong storage path was indicated when set --file path under /. Therefore, move this bug from ON_QA to ASSIGNED.

Comment 8 fwu 2015-06-24 07:26:46 UTC
Verify this bug with the latest package:
virt-manager-1.2.1-2.el7.noarch
virt-install-1.2.1-2.el7.noarch

Steps:
1.Prepare a guest, eg:rhel6.7.

2.Use virt-clone to clone the guest, set output disk under /, eg:/test, or /root.
2.1 Try --file /test:
# virt-clone -o rhel6.7 -n rhel6.7-test --file /test

2.2 Try --file /root:
# virt-clone -o rhel6.7 -n rhel6.7-test2 --file /root

3.After clone,check the xml file of the new cloned guest.
# virsh dumpxml rhel6.7-test

4.Check the pool by executing:
# virsh pool-dumpxml dirpool

Results:
1. After Step 2.1, the cloned VM was created successfully.
Allocating 'test'                                                       | 6.0 GB  00:00:07     

Clone 'rhel6.7-clone' created successfully.

2. After Step 2.2, there is an error message:
ERROR    Could not use path '/root' for cloning: The path '//root' must be a file or a device, not a directory

3. After Step 3, the storage shows this:

   <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/test'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>


4. After Step 4, there are a pool created. The pool path is '/'.

<pool type='dir'>
  <name>dirpool</name>
  <uuid>5e5bd99e-4fbb-489f-bd6b-8d96170818a7</uuid>
  <capacity unit='bytes'>199901442048</capacity>
  <allocation unit='bytes'>48903094272</allocation>
  <available unit='bytes'>150998347776</available>
  <source>
  </source>
  <target>
    <path>/</path>
    <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

According to the result shown above, move this bug from ON_QA to VERIFIED.

Comment 10 errata-xmlrpc 2015-11-19 05:25:17 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.

https://rhn.redhat.com/errata/RHBA-2015-2206.html


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