Bug 1183495

Summary: Failed to clone guest with custom path via virt-manager
Product: Red Hat Enterprise Linux 7 Reporter: zhoujunqin <juzhou>
Component: virt-managerAssignee: virt-mgr-maint
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: gscrivan, mzhan, tzheng
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-1.2.0-1-el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:23:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
virt-manager-gui.debug
none
virt-clone-cmd-debug none

Description zhoujunqin 2015-01-19 08:37:06 UTC
Created attachment 981417 [details]
virt-manager-gui.debug

Description of problem:
Failed to clone guest with custom path via virt-manager

Version-Release number of selected component (if applicable):
virt-manager-1.1.0-12.el7.noarch
libvirt-1.2.8-13.el7.x86_64
qemu-kvm-1.5.3-85.el7.x86_64
kernel-3.10.0-223.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Launch virt-manager,prepare a guest with shutdown status.
   Guest called: rhel6.6-test
2. Right click the guest,click "clone","Clone virtual machine" dialog pop out.
3. On the dialog,from "Storage", choose "Details", a new dialog "Change storage path" pop out.
4. Input a New Path: "/opt/kvm-rhel6.6-i386-qcow2-clone.img", then click "OK".
5. Click "clone".


Actual results:
1. After step4, error showing:
Error changing storage path: Could not use path '/opt/kvm-6.6-i386-qcow2-clone.img' for cloning: Could not define storage pool: operation failed: Storage source conflict with pool: 'opt'
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/clone.py", line 713, in change_storage_finish
    self.clone_design.clone_paths = new_path
  File "/usr/share/virt-manager/virtinst/cloner.py", line 150, in set_clone_paths
    (path, str(e)))
ValueError: Could not use path '/opt/kvm-6.6-i386-qcow2-clone.img' for cloning: Could not define storage pool: operation failed: Storage source conflict with pool: 'opt'

1.2 In virt-manager detail debug information, showing two pools creating:
Mon, 19 Jan 2015 15:34:03 virt-manager 22229] DEBUG (diskbackend:144) Attempting to build pool=opt target=/opt
[Mon, 19 Jan 2015 15:34:03 virt-manager 22229] DEBUG (storage:464) Creating storage pool 'opt' with xml:
<pool type="dir">
  <name>opt</name>
  <uuid>ed131ba7-2708-4f2d-9618-6ac4f314eb7d</uuid>
  <target>
    <path>/opt</path>
  </target>
</pool>

[Mon, 19 Jan 2015 15:34:03 virt-manager 22229] DEBUG (diskbackend:144) Attempting to build pool=opt-1 target=/opt
[Mon, 19 Jan 2015 15:34:03 virt-manager 22229] DEBUG (storage:464) Creating storage pool 'opt-1' with xml:
<pool type="dir">
  <name>opt-1</name>
  <uuid>c637b481-cfae-4938-86eb-88f6e025cc84</uuid>
  <target>
    <path>/opt</path>
  </target>
</pool>

1.3 A new pool "opt" added.

# virsh pool-list --all
 Name                 State      Autostart
-------------------------------------------
 default              active     yes      
 libvirt              active     yes      
 opt                  active     yes    


2. Close Error box and click "OK" again, there is no error pop up and after click "Clone", guest can be cloned with no error.

I will attach virt-manager debug info: virt-manager-gui.debug

Expected results:
Guest can be cloned successfully with custom path first time.

Additional info:
via virt-clone command can clone guest with custom path successfully:

1. Check existing pools:
# virsh pool-list --all
 Name                 State      Autostart
-------------------------------------------
 default              active     yes      
 libvirt              active     yes  
  
2.
# virt-clone  -o rhel6.6-test -n rhel6.6-test-clone -f /opt/kvm-6.6-i386-qcow2-clone.img
Allocating 'kvm-6.6-i386-qcow2-clone.img'                                                                            | 1.0 kB  00:00:10    

Clone 'rhel6.6-test-clone' created successfully.
3.
# virsh pool-list --all
 Name                 State      Autostart
-------------------------------------------
 default              active     yes      
 libvirt              active     yes      
 opt                  active     yes  

I will attach virt-clone command debug info: virt-clone-cmd-debug

Comment 1 zhoujunqin 2015-01-19 08:37:41 UTC
Created attachment 981418 [details]
virt-clone-cmd-debug

Comment 2 Giuseppe Scrivano 2015-02-11 16:46:23 UTC
I cannot reproduce this issue upstream.

I believe that it is fixed by this commit:

commit c5ccd68e4dbb653b2938efef0e33c64b83b45eba
Author: Cole Robinson <crobinso>
Date:   Mon Dec 8 17:28:29 2014 -0500

    devicedisk: Handle an empty storage backend
    
    Rather than have every little bit depend on a present storage backend,
    only create one when it really matters.

Comment 4 fwu 2015-05-18 06:11:01 UTC
I can reproduce this issue with package:
virt-manager-1.1.0-12.el7.noarch

Steps are the same as bug described.

Then try to verify with new build:
virt-manager-1.2.0-3.el7.noarch

Steps:
1.Check the existing pools: 
 # virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     yes       

2. Launch virt-manager,prepare a guest with shutdown status.
   Guest called: rhel6.6-test
3. Right click the guest,click "clone","Clone virtual machine" dialog pop out.
4. On the dialog,from "Storage", choose "Details", a new dialog "Change storage path" pop out.
5. Input a New Path: "/opt/wf6.6-clone.img", then click "OK".
6. Click "clone".
7. Check again to make sure if any new pools are added after clone finished: # virsh pool-list --all

Result:
After step 6, The guest can be cloned with custom path automatically with no error occurs.
After step 7, there was only one storage pool was created.
# virsh  pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     yes       
 opt                  active     yes       

According to the result above in the latest version of virt-manager, move this bug from ON_QA to VERIFIED.

Comment 6 errata-xmlrpc 2015-11-19 05:23:48 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