[CentOS] How to prevent virtual machines running twice on the disk images?

Theo Band theo.band at greenpeak.com
Fri May 11 19:29:36 UTC 2012


On 05/11/2012 06:06 PM, Paul Heinlein wrote:
> On Fri, 11 May 2012, Theo Band wrote:
>
>> I use KVM on two identical centos5 hosts. [....]
>>
>> My question is, how can I prevent host A from starting a "shut off"
>> VM that actually has been migrated to host B? The VM could actually
>> be running on any another host. It could also have been crashed. The
>> most simple solution would be some sort of lock file placed next to
>> the disk image location, so seen by all hosts. But perhaps there is
>> another way of working with virt-manager that I am not aware of?
>
> My way of dealing with that is to undefine the domain on host A after
> it's been moved to host B, e.g.,
>
>   virsh migrate --live myvm remote://host-b
>   virsh undefine myvm
>
> The CentOS 6 version of virsh allows those operations to be combined:
>
>   virsh migrate --live --persistent --undefinesource myvm ...

Thanks,  that's the tip I needed. "undefine".





More information about the CentOS mailing list