[libvirt] [PATCH] virsh edit command

Daniel P. Berrange berrange at redhat.com
Tue Jul 29 16:22:29 UTC 2008


On Tue, Jul 29, 2008 at 05:09:37PM +0100, John Levon wrote:
> On Tue, Jul 29, 2008 at 05:00:27PM +0100, Richard W.M. Jones wrote:
> 
> > > Isn't the *right* solution to this problem to finally add property
> > > set/get interface for the things people actually want to modify, like
> > > boot flags?
> > 
> > Do you mean things like the current 'virsh attach-device' / 'virsh
> > detach-device' interface?
> 
> I hope not... that's just as bad as editing the domain XML.
> 
> > I'm responding here to a need that sysadmins feel they have -- to edit
> > the configuration file (even if it's XML).  Witness an endless series
> > of questions on this subject on the #virt channel yesterday.
> 
> Right. But to my mind you're fixing the symptom not the problem. *Why*
> do they need to edit the XML? I ask this of everybody who complains at
> me about having to edit XML: 99% of the time it's wanting to change boot
> flags, but it's also stuff like turning off ACPI, setting on_crash, etc.
> 
> Editing XML is absolutely not user friendly, and adding 'edit' just
> papers over the real problems IMHO.

When I did the storage APIs, I had the traditional commands 'create'
and 'define' which took XML documents. I then also add a 'create-as'
and 'define-as' command which took a list of named arguments. virsh
then turned these into XML docs.

eg, to create an LVM backed storage pool from /dev/hda2, 
you could do something like


     virsh pool-define-as --source-path /dev/hda2 MyVolGroup lvm


And it'd create

    <pool type='lvm'>
      <name>MyVolGroup</name>
      <source>
        <device path='/dev/hda2'/>
      </source>
    </pool>

This only deals with creation, or defining a new config, not updating
an existing config - in the latter you'd only want to specify the bits
which are actually changing - for that we'd want an 'edit-as' command
which reads the XML, updates the bits that are changing, and saves the
XML back into libvirt

We could try todo a similar thing for domains too, though obviously
we're going to have a huge number of options to handle to get decent
coverage. We'd also need to have an 'edit-as'

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list