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

Cole Robinson crobinso at redhat.com
Thu Jun 26 21:29:35 UTC 2008


Joey Boggs wrote:
> I integrated the common cli options and all the other modifications, but 
> wasn't sure the best way to approach the para/full virt check removal 
> from the comments
> 
> "If you use the above --paravirt/--hvm option change, you won't need
> this check." Both before and after code snips below.
> 
> I changed the if/else to evaluate the options for True on either 
> para/full, if there's something else you'd want to see please let me know
> 
> 
> -------------------------------------------------------------------------------
>     parser.add_option("-v", "--hvm", action="store_true", dest="fullvirt",
>                       help=("This guest should be a fully virtualized 
> guest"))
>     parser.add_option("-p", "--paravirt", action="store_true", 
> dest="paravirt",
>                       help=("This guest should be a paravirtualized guest"))
> 
> 
> 
> 
>     if options.paravirt is True:
>         virt_boot_template = """<boot type="xen">
>           <guest>
>             <arch>%(vm_arch)s</arch>
>             <features>
>               <pae/>
>             </features>
>           </guest>
>           <os>
>             <loader>pygrub</loader>
>           </os>
>          %(vm_pv_disks)s
>          </boot>"""
>     elif options.fullvirt is True:
> 
>         virt_boot_template = """<boot type="hvm">
>           <guest>
>             <arch>%(vm_arch)s</arch>
>           </guest>
>           <os>
>             <loader dev="hd"/>
>           </os>
>           %(vm_fv_disks)s
>         </boot>"""
>     else:
>         print "Invalid virtualization type specified"
>         sys.exit(1)

Sorry, I wasn't very clear. The unnecessary check I was talking about
was the last sanity check, the "Invalid virtualization type". Since this
is basically a boolean option (hvm or not), i'd do something like

if options.paravirt:
  hvm = False
else:
  hvm = True

In main() and pass hvm explictly to the above function.

- Cole




More information about the et-mgmt-tools mailing list