[libvirt] [PATCH] virsh: Implement command to rename domain
Michal Privoznik
mprivozn at redhat.com
Tue Sep 2 10:02:14 UTC 2014
On 01.09.2014 10:31, Philipp Hahn wrote:
> Hello Tomas,
>
> On 01.09.2014 01:51, Tomas Meszaros wrote:
>> I've recently worked with rather large number of virtual machines
>> and needed to rename all domains. I couldn't find better way how
>> to rename domain other than:
>>
>> virsh dumpxml domain > domain.xml
>> (change domain name in domain.xml)
>> virsh undefine domain
>> virsh define domain.xml
1: ^^^
>>
>> This is rather pain to do every time I want to rename domain.
>> I think there should be simple way to change domain name.
>
> This has been requested in the past already (even by me ;-)
> Renaming is not that simple, as there are several more things to do:
> 1. Rename log files (this was somehow controversial last time it was
> discussed, especially combined with external programs like logrotate)
I don't find this troublesome. I mean, it's desired for a domain A to
have logs in A.log, and for domain B in B.log. Doesn't matter if A was
renamed to B. If that's the case I'd expect something like the following
to be the last line in A.log:
Domain A was renamed to B.
This is what will happen after [1] anyway (without the nice message in
A.log).
> 2. Fix domain config for suspended VMs.
> 3. Keep existing snapshots
> 3.1 Fix domain config in snapshots.
These two can be a reason to refuse renaming until the time we have
appropriate design.
>
> Especially the last thing does very bad things if you revert a renamed
> VM, as the UUID is then no longer unique.
>
Having said that, I think we need an libvirt API instead of pure virsh
implementation. It'll be usable for layered products then too.
Michal
More information about the libvir-list
mailing list