Bug 827346 - How to rename a vm domain.
How to rename a vm domain.
Status: CLOSED DUPLICATE of bug 558160
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Libvirt Maintainers
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-01 04:05 EDT by xuanmao
Modified: 2012-06-05 08:32 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-05 08:32:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description xuanmao 2012-06-01 04:05:09 EDT
Libvirt Version: 0.9.8

Hi,
I want to know if there is a way to rename a VM domain. The best way is API.
I know a way to do this:

virsh dumpxml myvm > foo.xml
<edit foo.xml, change the name>
virsh undefine myvm
virsh define foo.xml

but I don't want implement in this way.

can you give me some ideas for it, like "clone, migrate actions etc."
thanks.
Comment 1 Eric Blake 2012-06-01 08:56:31 EDT
Your way is the current workaround.  This is a very old feature request that no one has bothered to code up.

*** This bug has been marked as a duplicate of bug 558160 ***
Comment 2 xuanmao 2012-06-01 20:50:28 EDT
Is there a old libvirt version including it? I want this function to develop.
Comment 3 Eric Blake 2012-06-03 09:01:59 EDT
(In reply to comment #2)
> Is there a old libvirt version including it? I want this function to develop.

Bug 558160 is still open as a reminder that there is no version of libvirt that yet provides this feature.  If you'd like to help develop this funciton, patches are welcome, in the context of that older bug.

*** This bug has been marked as a duplicate of bug 558160 ***
Comment 4 xuanmao 2012-06-05 03:51:17 EDT
I am trying to use libvirt API implement. The same like virsh tools.

virsh dumpxml myvm > foo.xml

I used virDomainGetXMLDesc API to get xml description of domain, then convert to virDomainDef, and I changed def->name, the last I convert def back to xml.

virsh undefine myvm

I used virDomainUndefine.

virsh define foo.xml

I used virDomainDefineXML.

These APIs all called successed. the domain name show on virt-manager was not changed yet,but the name show on open window was changed and details changed too. the vir-manager must reconnect, then the name is correct.  

use virsh tools is ok.

Did I forget something?
Comment 5 Eric Blake 2012-06-05 08:32:07 EDT
(In reply to comment #4)
> I am trying to use libvirt API implement. The same like virsh tools.
> 

Please - rather than re-opening this bug, how about we move the conversation to the open bug 558160.  There is no point sticking the information in the duplicate bug, when it is the original bug that should be tracking this.

*** This bug has been marked as a duplicate of bug 558160 ***

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