[et-mgmt-tools] [PATCH 03 of 11] Make --arch optional

john.levon at sun.com john.levon at sun.com
Mon Jul 7 22:51:33 UTC 2008


# HG changeset patch
# User john.levon at sun.com
# Date 1215470376 25200
# Node ID fa3aae2098440bb154e4b699c1a352fe6a4f110b
# Parent  f0ddebbf39a3926f55045ade4fbf850706ed6c3e
Make --arch optional.

Default to the current system arch.

Signed-off-by: John Levon <john.levon at sun.com>

diff --git a/man/en/virt-convert.1 b/man/en/virt-convert.1
--- a/man/en/virt-convert.1
+++ b/man/en/virt-convert.1
@@ -129,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "VIRT-CONVERT 1"
-.TH VIRT-CONVERT 1 "2008-07-01" "perl v5.8.8" "Virtual Machine Install Tools"
+.TH VIRT-CONVERT 1 "2008-07-04" "perl v5.8.8" "Virtual Machine Install Tools"
 .SH "NAME"
 virt\-convert \- convert virtual machines between formats
 .SH "SYNOPSIS"
@@ -161,7 +161,8 @@ Show the help message and exit
 Show the help message and exit
 .IP "\-a \s-1ARCH\s0, \-\-arch=ARCH" 4
 .IX Item "-a ARCH, --arch=ARCH"
-Architecture of the virtual machine (i686, x86_64, ppc)
+Architecture of the virtual machine (i686, x86_64, ppc). Defaults to
+that of the host machine.
 .IP "\-v, \-\-hvm      Create  a fully virtualized guest image" 4
 .IX Item "-v, --hvm      Create  a fully virtualized guest image"
 Convert machine to a hvm/qemu based image (this is the default if paravirt is not specified)
diff --git a/man/en/virt-convert.pod b/man/en/virt-convert.pod
--- a/man/en/virt-convert.pod
+++ b/man/en/virt-convert.pod
@@ -39,7 +39,8 @@ Show the help message and exit
 
 =item -a ARCH, --arch=ARCH
 
-Architecture of the virtual machine (i686, x86_64, ppc)
+Architecture of the virtual machine (i686, x86_64, ppc). Defaults to
+that of the host machine.
 
 =item  -v, --hvm      Create  a fully virtualized guest image
 
diff --git a/virt-convert b/virt-convert
--- a/virt-convert
+++ b/virt-convert
@@ -27,6 +27,7 @@ from optparse import OptionParser
 from optparse import OptionParser
 
 import virtinst.cli as cli
+import virtinst.util as util
 import virtconv
 import virtconv.vmconfig as vmconfig
 
@@ -36,6 +37,7 @@ def parse_args():
     opts.set_usage("%prog [options] inputdir|input.vmx "
         "[outputdir|output.xml]")
     opts.add_option("-a", "--arch", type="string", dest="arch",
+                    default=util.get_default_arch(),
                     help=("Machine Architecture Type (i686/x86_64/ppc)"))
     opts.add_option("-t", "--type", type="string", dest="type",
                     help=("Output virtualization type (hvm, paravirt"))
@@ -58,10 +60,6 @@ def parse_args():
     if len(args) > 2:
         opts.error(("Too many arguments provided"))
     
-    if (options.arch is None):
-        opts.error(("Missing option value \n\nArchitecture: " +
-       str(options.arch)))
-
     # hard-code for now
     if options.inputformat != "vmx":
         opts.error(("Unsupported input format \"%s\"" % options.inputformat))




More information about the et-mgmt-tools mailing list