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

View: New views
4 Messages — Rating Filter:   Alert me  

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

by Cole Robinson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
# 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@...
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

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

by Daniel P. Berrange-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 09, 2009 at 03:26:49PM -0400, Cole Robinson wrote:
> 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.

Worth at least stating that in the future you may have extra args

  eg  -video xen,vram=8000

The XML allows for vram to be specified, but I've not got it wired
up to any driver yet. Xen is the only one currently able to customize
it, so could wire it up there

Daniel
--
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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

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

by Cole Robinson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Daniel P. Berrange wrote:

> On Thu, Jul 09, 2009 at 03:26:49PM -0400, Cole Robinson wrote:
>> 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.
>
> Worth at least stating that in the future you may have extra args
>
>   eg  -video xen,vram=8000
>


Whoops, yeah, it's mentioned in the commit message with the patch, just forgot
it in the mail. It will be trivial to expand in the future.

- Cole

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

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

by Cole Robinson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cole Robinson wrote:
> 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.
>

Pushed now.

Thanks,
Cole

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