[et-mgmt-tools] [PATCH] convert vmware machines to virt-image xml format

John Levon levon at movementarian.org
Tue Jul 1 03:48:47 UTC 2008


On Mon, Jun 30, 2008 at 08:14:55PM -0700, David Lutterkort wrote:

> > > --- virtinst--devel.orig/virt-unpack	1969-12-31 19:00:00.000000000 -0500
> > > +++ virtinst--devel/virt-unpack	2008-06-26 10:30:45.000000000 -0400
> > 
> > Why isn't this called virt-convert? I don't see any actually "unpacking"
> > going on here.
>  
> Calling it virt-pack is more a historical accident. I think renaming it
> to virt-convert makes sense. It'll require some small changes in the
> command line switches though, so you cna say from what format and to
> what format you want to convert.

Indeed. I have some comments on that too. What I'd like to see is
something like the logic below. I may even be sending patches to do
this, if I can get some consensus.

virt-convert [-i ifmt] -o ofmt input [output]

if input is a file:
    if ifmt is not specified, sniff ifmt
    input_dir = dirname(input)
    input_file = input
else if input is a dir
    sniff dir for ifmt # ls *.vmx
    input_dir = input
    input_file = sniffed_input_file

if ifmt is not specified
    error
of ofmt is not specified
    error

if output is not specified:
    output_file = prefix(input_file).libvirt-image.xml
    output_dir = input_dir
else if output is a file:
    output_dir = dirname(input)
    output_file = output
else if output is a dir:
    output_dir = output
    output_file = output_dir/prefix(input_file).libvirt-image.xml

if (input_dir == output_dir)
    disks_need_copying = can-handle-input-disk-format?
else
    disks_need_copying = True

This covers some pretty common use cases:

   virt-convert -o libvirt-domain foo.vmx foo.xml
   virt-convert -o libvirt-image vmware_appliance/
   virt-convert -o libvirt-image vmware_appliance/app.vmc vmware_appliance/app.xml

Comments?

thanks,
john




More information about the et-mgmt-tools mailing list