[libvirt-users] Updating Multiple VM Guests?

Kenneth Stailey kstailey at yahoo.com
Wed Nov 10 18:20:21 UTC 2010



--- On Wed, 11/10/10, Laine Stump <laine at laine.org> wrote:

> From: Laine Stump <laine at laine.org>
> Subject: Re: [libvirt-users] Updating Multiple VM Guests?
> To: libvirt-users at redhat.com
> Date: Wednesday, November 10, 2010, 12:41 PM
> On 11/10/2010 11:59 AM, Kenneth
> Stailey wrote:
> > Hi,
> > 
> > The libvirt.org FAQ says that "virsh edit" is the
> recommended way of updating the libvirt xml.
> > 
> > If a change has to be made to many VMs "virsh edit" is
> tedious, time-consuming and likely to be prone to careless
> errors.
> > 
> > Is there a command line approach to updating multiple
> VMs?
> 
> How about:
> 
>    for g in guest1 guest2 guest3 guest4; do
>       virsh dumpxml --inactive $g
> >/tmp/g.xml
>       # do whatever sed/etc commands you
> want here
>       virsh define /tmp/g.xml
>   done
> 
> (or something like that, anyway :-)

The "sed, etc." is a mistake since XML does not have guaranteed format.  

I suppose XMLStarlet could be used.

http://xmlstar.sourceforge.net/








More information about the libvirt-users mailing list