{"id":3913,"date":"2012-06-22T15:58:06","date_gmt":"2012-06-22T13:58:06","guid":{"rendered":"https:\/\/ingmarverheij.com\/?p=3913"},"modified":"2012-06-22T15:59:34","modified_gmt":"2012-06-22T13:59:34","slug":"32bpp-in-xenserver-virtual-machine","status":"publish","type":"post","link":"https:\/\/ingmarverheij.com\/en\/32bpp-in-xenserver-virtual-machine\/","title":{"rendered":"32bpp in XenServer virtual machine"},"content":{"rendered":"\n<p>Recently I had to setup a virtual machine on a Citrix XenServer host that could use 32bpp. This turned out harder than I thought because the default video adapter in a Xen virtual machine is a Cirrus with 4MB, and that video card is not capable of 32bpp.<\/p>\n<p><a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/LoadBotVM01_2012-06-21_11-31-18.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"\" border=\"0\" alt=\"\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/LoadBotVM01_2012-06-21_11-31-18_thumb.png\" width=\"154\" height=\"156\" \/><\/a><a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/LoadBotVM01_2012-06-21_11-31-34.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"\" border=\"0\" alt=\"\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/LoadBotVM01_2012-06-21_11-31-34_thumb.png\" width=\"154\" height=\"156\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<p><em><a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/vga-x6-1.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px 0px 0px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"\" border=\"0\" alt=\"\" align=\"right\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/vga-x6-1_thumb.jpg\" width=\"107\" height=\"79\" \/><\/a>To be honest when I read Cirrus I had a flash-back to the times I bought my first computer; a 386SX 33Mhz with 2MB RAM and a Cirrus VGA card (on a ISA interface if I\u2019m not mistaking).<\/em><\/p>\n<h2>&#160;<\/h2>\n<h2>Adding video memory<\/h2>\n<p>I <strike>thought<\/strike> hoped it would be easy to just add some video memory with <font face=\"Courier New\">xe vm-param-set<\/font> but couldn\u2019t find a parameter to configure. In fact, there isn\u2019t (yet). <\/p>\n<p>There is method described but this will affect all virtual machines on the same XenServer host, it is described below (qemu-dm-wrapper). Knowing it is possible to \u2018swap\u2019 the videocard in a virtual machine and adding video memory by adding parameters to the <a href=\"https:\/\/www.google.nl\/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=0CGAQFjAA&amp;url=http%3A%2F%2Fwww.qemu.org%2F&amp;ei=Y3nkT57JNILi8APd6L3ZCg&amp;usg=AFQjCNG8Ws71JcEsXl9rSxCW8Ie5taHS3g\" target=\"_blank\">QEMU<\/a> (open source machine emulator and virtualizer) process.<\/p>\n<p>A Xen virtual machine consist of two processes and can be found with <font face=\"Courier New\">ps aux | grep qemu<\/font><\/p>\n<pre lang=\"bash\">65556    13951  7.7  1.3  31380  9720 ?        SLsl 12:52   0:01 qemu-dm-21 -d 21 -m 4096 -boot dc -serial pty -vcpus 1 -vncunused -k en-us -usb -usbdevice tablet -net nic,vlan=0,macaddr=66:18:15:10:62:0a,model=rtl8139 -net tap,vlan=0,bridge=xenbr0,ifname=tap21.0 -acpi -videoram 4 -M xenfv -monitor pty -vnc 127.0.0.1:1\nroot     13956  0.0  0.4  26464  3552 ?        S    12:52   0:00 qemu-dm-21 -d 21 -m 4096 -boot dc -serial pty -vcpus 1 -vncunused -k en-us -usb -usbdevice tablet -net nic,vlan=0,macaddr=66:18:15:10:62:0a,model=rtl8139 -net tap,vlan=0,bridge=xenbr0,ifname=tap21.0 -acpi -videoram 4 -M xenfv -monitor pty -vnc 127.0.0.1:1<\/pre>\n<p>When the video adapter is \u2018swapped\u2019 the result of the <font face=\"Courier New\">ps<\/font> command is:<\/p>\n<pre lang=\"bash\">65565    18611  0.0  0.6  26456  4568 ?        SLsl 13:56   0:00 qemu-dm-30 -d 30 -m 4096 -boot dc -serial pty -vcpus 1 -vncunused -k en-us -usb -usbdevice tablet -net nic,vlan=0,macaddr=66:18:15:10:62:0a,model=rtl8139 -net tap,vlan=0,bridge=xenbr0,ifname=tap30.0 -acpi -videoram 4 -M xenfv -monitor pty -vnc 127.0.0.1:1 -std-vga -videoram 4\nroot     18616  0.0  0.4  26456  3540 ?        S    13:56   0:00 qemu-dm-30 -d 30 -m 4096 -boot dc -serial pty -vcpus 1 -vncunused -k en-us -usb -usbdevice tablet -net nic,vlan=0,macaddr=66:18:15:10:62:0a,model=rtl8139 -net tap,vlan=0,bridge=xenbr0,ifname=tap30.0 -acpi -videoram 4 -M xenfv -monitor pty -vnc 127.0.0.1:1 -std-vga -videoram 4<\/pre>\n<p>As you can see two parameters are added:<\/p>\n<ul>\n<li>-std-vga&#160; (use \u2018standard\u2019 video card, instead of the cirrus) <\/li>\n<li>-videoram 4 (set 4MB of video ram) <\/li>\n<\/ul>\n<p>Since there is no configurable parameter per VM (<font face=\"Courier New\">xe vm-param-set<\/font>) I looked for a solution to inject the parameter via another parameter. In github.com I found the <a href=\"https:\/\/github.com\/xen-org\/xenops\/blob\/master\/src\/xenops.ml\" target=\"_blank\">xenops.ml<\/a> file that launched the qemu-dm-wrapper script. Here I found three possible candidates:<a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/xenops.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px 0px 0px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"\" border=\"0\" alt=\"\" align=\"right\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/xenops_thumb.png\" width=\"154\" height=\"120\" \/><\/a><\/p>\n<ul>\n<li>static_max_kib; <\/li>\n<li>boot; <\/li>\n<li>vcpus. <\/li>\n<\/ul>\n<p>Since both static_max_kib and vcpus are integer values there was no way I could add the parameter (-std-vga \u2013videoram 4), but boot\u2026 let\u2019s give it a shot!<\/p>\n<p><em>Don\u2019t try this at home\/office\/wherever, it doesn\u2019t work (spoiler alert)<\/em><\/p>\n<p>I added the parameters to the boot priority (default=dc: 1) cd-rom [d] and then 2) hdd ([c]) parameter of the virtual machine\u2026<\/p>\n<pre lang=\"bash\">xe vm-param-set uuid=<guid> HVM-boot-params:order=&quot;dc -acpi -vga std&quot;<\/pre>\n<p>&#8230;and started the virtual machine. Nothing happened, the VM could not be started. The \/var\/log\/messsage logfile should me why. <\/p>\n<pre lang=\"bash\">Jun 21 14:00:47 xenserver-orulmhui kernel: device vif31.0 entered promiscuous mode\nJun 21 14:00:47 xenserver-orulmhui fe: qemu-dm-31[19173]: domid: 31\nJun 21 14:00:47 xenserver-orulmhui fe: qemu-dm-31[19173]: Invalid boot device ' '\nJun 21 14:00:47 xenserver-orulmhui fe: 19173 (\/opt\/xensource\/libexec\/qemu-dm-wrapper 31 -d 31 -m 4096 -boot dc -std-vga -se...) exitted with code 1\nJun 21 14:00:52 xenserver-orulmhui xapi: [error|xenserver-orulmhui|8220|Async.VM.start R:8311b4a1f5f7|xenops] watch: timeout while watching xenstore after 5.000000 seconds<\/pre>\n<p>There is a check builtin the vl.c that verifies each boot option, a space is not allowed as a boot option.<\/p>\n<p><a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/vl.c.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"\" border=\"0\" alt=\"\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/vl.c_thumb.png\" width=\"154\" height=\"129\" \/><\/a><\/p>\n<p>I\u2019ve run some more test but it all came to a death end\u2026<\/p>\n<p>\u2026until I found a pull request from David Scott (XenServer System Architect at Citrix Systems) with the name \u2018<a href=\"https:\/\/github.com\/xen-org\/xen-api\/pull\/347\" target=\"_blank\">Add platform options for HVM display adapter and videoram<\/a>\u2019.&#160; So there will be a configurable parameter per VM that enable you to specify which video adapter to use and how many video ram it has. It has even been merged in the Xen code! On my XenServer 6.0.12 the parameters didn\u2019t work so I assume they\u2019re not included the XenServer code (yet). <\/p>\n<p><strong>I\u2019ve sent David an e-mail to ask him if and when it will be included in Citrix XenServer. To be continued!?!<\/strong><\/p>\n<h2>&#160;<\/h2>\n<h2>qemu-dm-wrapper<\/h2>\n<p>You can add the parameters to the <a href=\"https:\/\/www.google.nl\/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=0CGAQFjAA&amp;url=http%3A%2F%2Fwww.qemu.org%2F&amp;ei=Y3nkT57JNILi8APd6L3ZCg&amp;usg=AFQjCNG8Ws71JcEsXl9rSxCW8Ie5taHS3g\" target=\"_blank\">QEMU<\/a> process by altering the <font face=\"Courier New\">qemu-dm-wrapper<\/font> file, which can be found in the <font face=\"Courier New\">\/opt\/xensource\/libexec<\/font> directory of the XenServer host.<\/p>\n<p><em>Keep in mind this will change the behaviour of ALL virtual machines running on this (and only on this ) XenServer host .<\/em><\/p>\n<ol>\n<li>Locate the line <font face=\"Courier New\">def main(argv):<\/font><\/li>\n<li>Below you will find a line that lookes like <font face=\"Courier New\">qemu_args = [&#8216;qemu-dm-%d&#8217;%domid] + argv[3:] <font face=\"Arial\">(this is different for XenServer 5 \/ 6 \/ etc.)<\/font><\/font><\/li>\n<li><font face=\"Courier New\"><font face=\"Arial\">Immediately after that line add the following lines:<\/font><\/font><\/li>\n<ul>\n<li><font face=\"Courier New\">qemu_args.append(&#8216;-std-vga&#8217;)<\/font><\/li>\n<li><font face=\"Courier New\">qemu_args.append(&#8216;-videoram&#8217;)<\/font><\/li>\n<li><font face=\"Courier New\">qemu_args.append(&#8216;4&#8217;)<font face=\"Arial\"> &lt;&lt; you can increase the video memory if you want<\/font>\n<p><\/font><\/li>\n<\/ul>\n<p><font face=\"Arial\">Now each virtual machine that gets started will receive a \u2018standard\u2019 VGA adapter instead of a Cirrus. Most importantly (for me), 32bpp is available.<\/font><\/p>\n<p><a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/XenCenter_2012-06-21_15-27-20.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"\" border=\"0\" alt=\"\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/XenCenter_2012-06-21_15-27-20_thumb.png\" width=\"154\" height=\"156\" \/><\/a><a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/XenCenter_2012-06-21_15-27-34.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"\" border=\"0\" alt=\"\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/06\/XenCenter_2012-06-21_15-27-34_thumb.png\" width=\"154\" height=\"156\" \/><\/a><\/p>\n<p><\/p>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Recently I had to setup a virtual machine on a Citrix XenServer host that could use 32bpp. This turned out harder than I thought because the default video adapter in a Xen virtual machine is a Cirrus with 4MB, and that video card is not capable of 32bpp.<\/p>","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[77],"tags":[463,464,466,465,669],"class_list":["post-3913","post","type-post","status-publish","format-standard","hentry","category-xenserver","tag-32bpp","tag-cirrus","tag-github","tag-xen","tag-xenserver"],"_links":{"self":[{"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/posts\/3913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/comments?post=3913"}],"version-history":[{"count":4,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/posts\/3913\/revisions"}],"predecessor-version":[{"id":3917,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/posts\/3913\/revisions\/3917"}],"wp:attachment":[{"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/media?parent=3913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/categories?post=3913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/tags?post=3913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}