[PATCH 11 of 11] Add --host option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# HG changeset patch
# User john.levon@xxxxxxx
# Date 1215470469 25200
# Node ID d025b8efe3e3f578e731a452417a0dd5ef73d8ac
# Parent  bed866186030cc9549f6a020e0abda871fc008c2
Add --host option

Some formats need unpleasant knowledge of what hypervisor they're going to run
on. We default to the current machine, but add a --host option to allow people
to choose (and so we can write tests).

Signed-off-by: John Levon <john.levon@xxxxxxx>

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-04" "perl v5.8.8" "Virtual Machine Install Tools"
+.TH VIRT-CONVERT 1 "2008-07-07" "perl v5.8.8" "Virtual Machine Install Tools"
 .SH "NAME"
 virt\-convert \- convert virtual machines between formats
 .SH "SYNOPSIS"
@@ -159,6 +159,11 @@ a libvirt \*(L"image\*(R" \s-1XML\s0 def
 .IP "\-h, \-\-help" 4
 .IX Item "-h, --help"
 Show the help message and exit
+.IP "\-H \s-1HOST\s0, \-\-host=HOST" 4
+.IX Item "-H HOST, --host=HOST"
+Hypervisor target host. This is needed for some output formats such as
+\&\f(CW\*(C`virt\-instance\*(C'\fR, and it will default to the current host. Current
+accepted values are 'xvm' (for Solaris xVM), or 'xen' (for Xen).
 .IP "\-a \s-1ARCH\s0, \-\-arch=ARCH" 4
 .IX Item "-a ARCH, --arch=ARCH"
 Architecture of the virtual machine (i686, x86_64, ppc). Defaults to
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
@@ -37,6 +37,12 @@ a libvirt "image" XML definition (see L<
 
 Show the help message and exit
 
+=item -H HOST, --host=HOST
+
+Hypervisor target host. This is needed for some output formats such as
+C<virt-instance>, and it will default to the current host. Current
+accepted values are 'xvm' (for Solaris xVM), or 'xen' (for Xen).
+
 =item -a ARCH, --arch=ARCH
 
 Architecture of the virtual machine (i686, x86_64, ppc). Defaults to
diff --git a/virt-convert b/virt-convert
--- a/virt-convert
+++ b/virt-convert
@@ -83,6 +83,8 @@ def parse_args():
         help=("Disables APIC for fully virtualized guest (overrides value in os-type/os-variant db)"), default=False)
     opts.add_option("", "--noacpi", action="store_true", dest="noacpi",
         help=("Disables ACPI for fully virtualized guest (overrides value in os-type/os-variant db)"), default=False)
+    opts.add_option("-H", "--host", type="string", dest="host", action="store",
+        default=vmconfig.default_host(), help=("Host hypervisor type, e.g.  'xen'"))
 
     (options, args) = opts.parse_args()
     if len(args) < 1:
@@ -196,6 +198,7 @@ def main():
     else:
         vmdef.type = vmconfig.VM_TYPE_HVM
 
+    vmdef.host = options.host
     vmdef.arch = options.arch
     vmdef.os_type = options.os_type
     vmdef.os_variant = options.os_variant
diff --git a/virtconv/vmconfig.py b/virtconv/vmconfig.py
--- a/virtconv/vmconfig.py
+++ b/virtconv/vmconfig.py
@@ -19,6 +19,8 @@
 #
 
 import os
+
+from virtinst import util
 
 _parsers = [ ]
 
@@ -286,3 +288,13 @@ def find_input(path, format = None):
                     return (os.path.join(path, cfgfile), p.name)
  
     raise StandardError("unknown format")
+
+def default_host():
+    """
+    Return the default host hypervisor, or 'None' if none seems present.
+    """
+    if platform.system() == "SunOS":
+        return "xvm"
+
+    # FIXME: should we massage this value?
+    return util.default_connection()

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux