[Libvir] RFC: A more convenient 'virsh create' command

Daniel P. Berrange berrange at redhat.com
Fri Aug 25 16:46:28 UTC 2006


The current implementation of 'virsh create' takes an XML file as its only
parameter & creates a domain from this. This is great if you have a suitable
XML file already, but if you are just trying to automate some simple tasks
from the shell then the need to use XML is a little cumbersome. Thus I was
thinking perhaps we could have an alternate way to define a new VM (keep
the current XML based way too of course)

QEMU for example makes it very easy to launch a new VM:

   qemu -m 256 -hda /path/to/image.dsk -hdc /path/to/boot.iso 

Taking inspiration from this syntax we could allow:

   virsh start -m 256 -hda /path/to/image.dsk -hdc /path/to/boot.iso -name Foo

Internally, the 'start' command would simply transform these command
line args into the neccessary libvirt XML and then call the normal
create functions.

Another way would be have a 'genxml' command, which accepted these list
of devices / config properties & then printed out appropriate XMl. This
could be piped to the regular 'virsh create' command

  virsh genxml -m 256 -hda /path/to/image.dsk -hdc /path/to/boot.iso \
   -name Foo  | virsh create -

This isn't so critical for Xen, because people are already used to writing
config files before creating the domain, but when we get a QEMU backend
i think such a convenient method for defining new VMs will be neccessary
to encourage users to use virsh instead of manually calling 'qemu'. Even
for Xen users it would make shell script easier though :-)

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list