Bug 507405

Summary: virsh: renaming of guests creates a copy
Product: [Fedora] Fedora Reporter: Julian G <j.golderer>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 11CC: berrange, clalance, claudemir.franco, crobinso, gczarcinski, itamar, markmc, maurizio.antillon, veillard, virt-maint, xen-maint
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 0.6.2-14.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-15 04:30:22 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 480594    

Description Julian G 2009-06-22 12:42:28 EDT
Description of problem:
Changing a guests name using virsh edit creates a copy of it.

Version-Release number of selected component (if applicable):
Fedora 11 x86_64 libvirt-0.6.2

Steps to Reproduce:
1. virsh edit somehost
2. Edit name inside of <name>somehost</name>
3. virsh list --all
4. Now you should have 2 guests with the same UUID - one with the old name, one with the new one
Comment 1 Daniel Berrange 2009-07-30 12:50:42 EDT
The latest libvirt now has proper UUID/name uniqueness checking and complains suitably if you edit the 'name', but leave the UUID alone.


# virsh edit openfiler23
error: operation failed: domain 'openfiler23' is already defined with uuid 7699653a-0b6c-d8b1-6c37-8e39d219cd3f
Comment 2 Daniel Berrange 2009-07-30 12:52:52 EDT
Opps, shouldn't have closed this one, since its against F11, not rawhide.
Comment 3 Daniel Berrange 2009-08-04 11:19:07 EDT
Upstream fix was

commit 54ebbde1e18ec831ff2fddb44ec27ed5dde7874a
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Fri May 8 10:11:14 2009 +0000

    Improve name & UUID uniqueness checking in QEMU driver
Comment 4 Daniel Berrange 2009-08-05 12:08:12 EDT
Built fix into libvirt-0.6.2-14.fc11
Comment 5 Fedora Update System 2009-08-05 12:12:49 EDT
libvirt-0.6.2-14.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/libvirt-0.6.2-14.fc11
Comment 6 Fedora Update System 2009-08-07 01:00:31 EDT
libvirt-0.6.2-14.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update libvirt'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-8333
Comment 7 Julian G 2009-08-08 13:30:12 EDT
after the upgrade i'm completely unable to rename a guest.

virsh edit Drupal-Testing      // changed name; save and quit editor
Fehler: operation failed: domain 'Drupal-Testing' is already defined with uuid 352617c1-d0f3-a1c1-add5-7d4a429be183
Comment 8 Daniel Berrange 2009-08-10 04:42:52 EDT
Yes, that is the intended fix, renaming is not supported in libvirt.
Comment 9 Fedora Update System 2009-08-15 04:29:51 EDT
libvirt-0.6.2-14.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Claudemir F.Franco 2010-10-25 09:35:50 EDT
Hi, people!

I'm using FC13 with libvirt-0.8.2, but the problem still persist! I tried rename my VM using the following steps:

1) virsh edit win-xp
2) change the attribute : "name" in xml the my VM.

After save the XML VM windows I recevied the following message:

error: operation failed: domain 'win-xp' is already defined with uuid 0f318195-9fbd-cedc-6683-6c8f876e957e

Sorry, maybe I'm making a mistake in the procedure.

Version my packages libvirt...

[root@dellbook2 qemu]# rpm -qa |grep -i libvirt
libvirt-client-0.8.2-1.fc13.x86_64
libvirt-python-0.8.2-1.fc13.x86_64
libvirt-0.8.2-1.fc13.x86_64
[root@dellbook2 qemu]# 

[]'s

Claudemir.
Comment 11 Chris Lalancette 2010-10-25 14:17:43 EDT
(In reply to comment #10)
> Hi, people!
> 
> I'm using FC13 with libvirt-0.8.2, but the problem still persist! I tried
> rename my VM using the following steps:
> 
> 1) virsh edit win-xp
> 2) change the attribute : "name" in xml the my VM.
> 
> After save the XML VM windows I recevied the following message:
> 
> error: operation failed: domain 'win-xp' is already defined with uuid
> 0f318195-9fbd-cedc-6683-6c8f876e957e

No, that is exactly the expected behavior.  virsh edit does not support changing the name or UUID.  If you want to change either of those, you'll need to:

virsh dumpxml $DOMAIN > domain.xml
virsh undefine $DOMAIN
<edit domain.xml>
virsh define domain.xml

Chris Lalancette
Comment 12 Claudemir F.Franco 2010-10-26 16:02:34 EDT
Hi Chris,

This worked.  Pardon my ignorance!!!  ;o)

Thanks for the tips..

Claudemir.