[PATCH] virt-install: Add --video option

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

 



The attached patch adds a --video option to virt-install, for specifying the
video device model to attach to the VM (cirrus, vga, vmvga, etc.).

Pretty straightforward, the invocation is simply --video MODEL, ex:

--video vga

Questions or comments appreciated.

- Cole
# HG changeset patch
# User Cole Robinson <crobinso@xxxxxxxxxx>
# Date 1247102917 14400
# Node ID 658d02442b2f8a55de9c6e19c498e09cb00a173e
# Parent  7751290d749d678e6a97a32ea5455af6e2226e78
virt-install: Add --video option.

Takes the video model (cirrus, vga, etc) as the only argument. Can easily
be expanded in the future if needed.

diff -r 7751290d749d -r 658d02442b2f man/en/virt-install.pod.in
--- a/man/en/virt-install.pod.in	Wed Jul 08 21:28:19 2009 -0400
+++ b/man/en/virt-install.pod.in	Wed Jul 08 21:28:37 2009 -0400
@@ -573,6 +573,12 @@
 host to render the output. If the SDL window is closed the guest may
 be unconditionally terminated.
 
+=item --video=VIDEO
+
+Specify what video device model will be attached to the guest. Valid values
+for VIDEO are hypervisor specific, but some options for recent kvm are
+cirrus, vga, or vmvga (vmware).
+
 =item  --nographics
 
 No graphical console will be allocated for the guest. Fully virtualized guests
diff -r 7751290d749d -r 658d02442b2f tests/clitest.py
--- a/tests/clitest.py	Wed Jul 08 21:28:19 2009 -0400
+++ b/tests/clitest.py	Wed Jul 08 21:28:37 2009 -0400
@@ -200,6 +200,8 @@
         "--sdl",
         # VNC w/ lots of options
         "--vnc --keymap ja --vncport 5950 --vnclisten 1.2.3.4",
+        # --video option
+        "--vnc --video vga",
       ],
 
       "invalid": [
@@ -207,6 +209,8 @@
         "--vnc --keymap ZZZ",
         # Invalid port
         "--vnc --vncport -50",
+        # Invalid --video
+        "--vnc --video foobar",
       ],
 
      }, # category "graphics"
diff -r 7751290d749d -r 658d02442b2f virt-install
--- a/virt-install	Wed Jul 08 21:28:19 2009 -0400
+++ b/virt-install	Wed Jul 08 21:28:37 2009 -0400
@@ -627,6 +627,9 @@
     parser.add_option_group(netg)
 
     vncg = cli.graphics_option_group(parser)
+    vncg.add_option("", "--video", dest="video", type="string",
+                    action="callback", callback=cli.check_before_append,
+                    help=_("Specify video hardware type."))
     vncg.add_option("", "--noautoconsole", action="store_false",
                     dest="autoconsole",
                     help=_("Don't automatically try to connect to the guest "
@@ -739,6 +742,8 @@
         get_chardevs(VirtualDevice.VIRTUAL_DEV_PARALLEL, options.parallels,
                      guest)
 
+    cli.get_video(options.video, guest)
+
     # set up disks
     get_disks(options.file_path, options.diskopts, options.disksize,
               options.sparse, options.nodisks, guest, conn)
diff -r 7751290d749d -r 658d02442b2f virtinst/cli.py
--- a/virtinst/cli.py	Wed Jul 08 21:28:19 2009 -0400
+++ b/virtinst/cli.py	Wed Jul 08 21:28:37 2009 -0400
@@ -716,6 +716,15 @@
                                                           name=devname)
         guest.hostdevs.append(dev)
 
+def get_video(video_models, guest):
+    if not video_models:
+        return
+
+    for model in video_models:
+        dev = virtinst.VirtualVideoDevice(guest.conn)
+        dev.model_type = model
+        guest.add_device(dev)
+
 ### Option parsing
 def check_before_store(option, opt_str, value, parser):
     if len(value) == 0:
_______________________________________________
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