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

[et-mgmt-tools] [PATCH] Add --os-* options to virt-image



The attached patched allows specifying --os-type and --os-variant for
virt-image (as well as the --list-os-options command just posted).

At some point we should support this in the virt-image format, but until
then this will suffice.

Thanks,
Cole
# HG changeset patch
# User Cole Robinson <crobinso redhat com>
# Node ID 7e53bbe1c59c7048460436ec9b0f182a0f6bea66
# Parent  0d2ed2298a3028ef89b126697e6adf9fd64a95f3
virt-image: Add --os-type, --os-variant, --list-os-options

diff -r 0d2ed2298a30 -r 7e53bbe1c59c man/en/virt-image.pod
--- a/man/en/virt-image.pod	Mon Mar 02 17:07:21 2009 -0500
+++ b/man/en/virt-image.pod	Mon Mar 02 17:30:51 2009 -0500
@@ -58,6 +58,20 @@
 
 Check that vcpus do not exceed physical CPUs and warn if they do.
 
+=item  --os-type=OS_TYPE
+
+Optimize the guest configuration for a type of operating system (ex. 'linux',
+'windows'). This will attempt to pick the most suitable ACPI & APIC settings,
+optimally supported mouse drivers, virtio, and generally accommodate other
+operating system quirks. See C<--list-os-options> for valid values.
+
+=item --os-variant=OS_VARIANT
+
+Further optimize the guest configuration for a specific operating system
+variant (ex. 'fedora8', 'winxp'). This does not require an C<--os-type>
+to be specified. This parameter is optional. See C<--list-os-options> for
+valid values.
+
 =item -m MAC, --mac=MAC
 
 Fixed MAC address for the guest. See L<virt-install(1)> for details
@@ -107,6 +121,10 @@
 
 Disables ACPI for fully virtualized guest (overrides value in XML descriptor)
 
+=item --list-os-options
+
+Show a list of valid values for C<--os-type> and C<--os-variant>, then exit.
+
 =item -d, --debug
 
 Print debugging information
diff -r 0d2ed2298a30 -r 7e53bbe1c59c virt-image
--- a/virt-image	Mon Mar 02 17:07:21 2009 -0500
+++ b/virt-image	Mon Mar 02 17:30:51 2009 -0500
@@ -106,6 +106,14 @@
     geng.add_option("", "--cpuset", type="string", dest="cpuset",
                     action="callback", callback=cli.check_before_store,
                     help=_("Set which physical CPUs Domain can use."))
+    geng.add_option("", "--os-type", type="string", dest="distro_type",
+                    action="callback", callback=cli.check_before_store,
+                    help=_("The OS type being installed, e.g. "
+                           "'linux', 'unix', 'windows'"))
+    geng.add_option("", "--os-variant", type="string", dest="distro_variant",
+                      action="callback", callback=cli.check_before_store,
+                      help=_("The OS variant being installed, "
+                             "e.g. 'fedora6', 'rhel5', 'solaris10', 'win2k'"))
     parser.add_option_group(geng)
 
     fulg = OptionGroup(parser, _("Full Virtualization specific options."))
@@ -151,6 +159,9 @@
     misc.add_option("-p", "--print", action="store_true", dest="print_only",
                     help=_("Print the libvirt XML, but do not start the "
                            "domain"))
+    misc.add_option("", "--list-os-options", action="store_true",
+                    dest="list_os", default=False,
+                    help=_("List OS type and OS variant options."))
     misc.add_option("", "--boot", type="int", dest="boot",
                     help=_("The zero-based index of the boot record to use"))
     misc.add_option("", "--replace",action="store_true", dest="replace",
@@ -169,6 +180,8 @@
     parser.add_option_group(misc)
 
     (options,args) = parser.parse_args()
+    cli.do_list_os(options.list_os)
+
     if len(args) < 1:
         parser.error(_("You need to provide an image XML descriptor"))
     options.image = args[0]
@@ -220,6 +233,11 @@
     get_graphics(image.domain, options.vnc, options.vncport,
                  options.nographics, options.sdl, options.keymap, guest)
 
+    if options.distro_type:
+        guest.set_os_type(options.distro_type)
+    if options.distro_variant:
+        guest.set_os_variant(options.distro_variant)
+
     if installer.is_hvm():
         if options.noacpi:
             guest.features["acpi"] = False

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