Archive for the ‘Virtualization’ Category

General:

  • install file server role: file management from other machine using \\servername\c$
    Import-Module Servermanager
    get-windowsfeature *
    add-windowsfeature fs-fileserver
  • blue console sconfig.cmd offers only Log Off or Shut Down / Restart.
    But pressing ctrl+alt+del offers Lock to lock the screen
  • install corefig to get some graphical management tools (docs here)
    set powershell to remote signed and unblock corefig ps* files:
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
    Unblock-File -Path path_to_corefig\*.ps*
  • to open ports run powershell command
    New-NetFirewallRule -protocol tcp -localport 3551 -direction inbound -action allow -displayname apcupsd
    (rule is gets removed by Remove-NetFirewallRulle -displayname apcupsd)
  • to forward ports to another host run netsh command
    netsh interface portproxy add v4tov4 listenport=1234 listenaddress=10.0.1.234 connectport=5678 connectaddress=10.0.5.678
    (netsh interface portproxy delete v4tov4 listenport=1234 listenaddress=10.0.1.234)
  • to display id of a vm use powershell (reference):
    get-vm
    $vm=get-vm -name your_vm_name
    $vm.vmid
  • hyperv vm’s can be managed by 5nine Manager (free edition for up to 6(? only seen 2) local vm’s)
    or use ProHVM by probus-it.com (Standard edition is free; key file by email after registration; for multiple servers multiple key files can be obtained; works with local and remote hosts!)
  • this tool runs on hyper v server and includes a vm console
    (which may be put into HKLU/…/Run; fetch cmd args using process explorer)
  • to install drivers from inf files use
    pnputil -i -a path_to_inf_file.inf
  • some server 2012 core specific help for powershell is here

Server 2008r2 sp1 as guest vm:

  • easily moved from hard disk to vhdx by running disk2vhd tool inside physical 2008r2 server
    with a network share as target
  • important, if server 2008r2 includes hyper v role: bluescreen when hyper v 2012 guest tools are installed:
    Boot 2008r2 inside vm; use server manager to uninstall hyper-v role (needs 2 or more reboots); if server manager confirms successful removal of hyper v role, then install 2012 hyper v guest tools; insert hyperv guest iso using hyper v manager (5nine).

Special note for mainboard with adaptec softraid for onboard ata disks

  • server 2012r2 can be installed on such a raid drive, if sata raid driver is installed from usb during installation (e.g for amd boards with sp5100 chip)
  • adaptec storage manager runs inside hyper v 2012r2; email notifications can be configured; manual.
    (smtp access by ssl/tls via stunnel; stunnel -install configures stunnel as auto starting service; config: client=yes accept=127.0.0.1:25 connect=yourmailserver.tld:465)
  • smartctl of smartmontools seems to be unable to look into physical drives of this adaptec softraid devices (but possible with intel softraid)

 

Time to put things together. Xen orchestra has now got a ‘vnc‘ link (like http://localhost/xo/htdocs/vnc.php?url=127.0.0.1:5901&name=w7b) which opens gtk vnc plugin (amd64 binary here). – This link is placed in section Misc of xen orchestra’s virtual machine detail window.

The configuration file of xen orchestra, xen-orchestra.conf, has got a section to control gtk vnc plugin. If a windows vm needs mouse grabbing, it can be set in this file. The handling of these settings is done in htdocs/vnc.php. If virtual machine w7b needs even more specific settings an additional file vnc_w7b.php can be used.

Compared to the description in this post vnc gtk plugin does now automatically grab the focus (keyboard immediately active after loading of html page; no need to click into vnc viewer window first) and a send keys menu has been added (0103-add_autofocus_and_sendkeys.diff).

(Build instructions remain the same except that after (updated) colortoolbar.patch.gz a second patch colortoolbar2.patch.gz has to be applied; updated amd64 debian archive: mozilla-gtk-vnc_0.3.10-6_amd64.deb).

There is one little additional patch to xen orchestra (03-add_vm_name_to_vnc_link.diff). The main changes are in vnc.php (compare previous post about xen orchestra). An updated zip archive with patched xen orchestra is here.

Xen virtual machines transmit their screen contents by vnc. A browser based viewer is the java vnc viewer plugin (see previous post). Advantage of java is that it runs on many platforms. However java tends to use a lot of RAM. On ubuntu 10.04 there is an alternative browser plugin which is gtk based: gtk viewer plugin.

The gtk vnc plugin offers only very basic functions: just an authentication dialog and the vnc viewer window. – This post adds a minimalistic toolbar to the plugin (test.html, gtk-vnc-plugin.so, libgtk-vnc-1.0.so.0.0.1).

Steps to build the plugin described above:

Looking for a graphical, browser based tool to manage xen 4.0 virtual machines I tried xen orchestra):

  • pro: needs only a web server with php (mysql optional); user interface not overloaded;  open source, well structured code.
  • con: only one detail window can be opened at the same time – needs patch; needs on ubuntu 10.04 a workaround for command xm new (see previous post).

The patch for multiple detail windows just had to replace some html tag id fields in htdocs/scripts/xo.js (01-xo.js.wId.diff).

Because I found it convenient to inspect my virtual machines with a browser based vnc viewer, I added a line to the detail window which displays the id and a link to vnc:
Domain id: 1 (vnc)
This patch uses the xen api to query the consoles of the virtual machine and looks up the ip address and the port of the vnc server connected to the console (02-add_vnc_link.diff, to be applied after 01-xo.js.wId.diff).

Patched version of xen orchestra: xen-orchestra-2010-03-22-patched.zip (local version of original file: xen-orchestra-2010-03-22.zip; local version of tightvnc java viewer: VncViewer.jar)

Minor, negligible bugs:

  • Network and Storage section of detail windows are empty.
  • If the machine running xen orchestra is too busy, xen orchestra displays an empty window; just press the refresh button of the browser to get the main window back.
  • ‘Login again’ button of java vnc viewer window does not reconnect (but refresh button of browser does).
  • Error messages are not displayed if a virtual machine fails to start (open a terminal and use the command xm start yourvm).
  • the vnc viewer window has a fixed hardcoded size (800×600 in htdocs/vnv.php); as workaround add &w=1024&h=798 to the browser address line to display a 1024×768 virtual machine.
  • non captured mouse does not work well in windows, unless graphics tablet mouse driver is installed (see next post about gtk-viewer plugin on linux).

Conclusion: I really appreciate the work of Olivier Lambert, the author of xen orchestra!

Virtual machines of xen can be created with xen-builtin command xm create which uses a config file in /etc/xen. There is a second command to create xen virtual machines: xm new

Virtual machines created with xm new are permanently added to xen (virtual machines created with xm create get removed from xen when the virtual machine is shut down). – Some xen monitoring tools, like xen orchestra, rely on permanently added virtual machines.

But xm new is broken in debian (and ubuntu) because xm uses an outdated xml python library. And the corresponding debian  bug report is closed with status ‘won’t fix’. Debian maintainers support  only xen create.

Using virsh as workaround for xen new:

  • xm create myvm (from file /etc/xen/myvm)
  • virsh dumpxml myvm > /etc/xen/myvm.xml
  • xm shutdown myvm
  • virsh define /etc/xen/myvm.xml

Debian sid has the source package of libvirt (currently 0.8.1-1), but package 0.8.1-1 does not work with xen 4.0.  However the build service of opensuse factory includes as well libvirt-0.8.1 and they have xen 4.0 patches included.

To get a libvirt package for ubuntu 10.04 which is compatible with xen 4.0 the patches of opensuse had to be combined with the debian sid package (patch: debian.diff; local copy of debian sources: libvirt_0.8.1.orig.tar.gz, libvirt_0.8.1-1.debian.tar.gz, libvirt_0.8.1-1.dsc).

Build process:

  • download sources and patch into new directory and open terminal in this directory
  • tar -xzf libvirt_0.8.1.orig.tar.gz
  • cd libvirt-0.8.1
  • tar -xzf ../libvirt_0.8.1-1.debian.tar.gz
  • patch -p0 < ../debian.diff
  • ./debian/rules binary

And to install the new packages (ubuntu amd64 packages: libvirt-bin_0.8.1-1_amd64.deb, libvirt0_0.8.1-1_amd64.deb, libvirt-dev_0.8.1-1_amd64.deb, libvirt-doc_0.8.1-1_amd64.deb, python-libvirt_0.8.1-1_amd64.deb, libvirt0-dbg_0.8.1-1_amd64.deb):

  • cd ..
  • dpkg -i libvirt0_0.8.1-1_amd64.deb libvirt-bin_0.8.1-1_amd64.deb python-libvirt_0.8.1-1_amd64.deb

The resulting virsh command seems to work with xen 4.0 (tested with subcommands dumpxml and define). – You should use Package/Force version in synaptic package manager to protect these manually installed packages.

  • Adding and removing of hard disks  and cdrom devices works fine
    (guest not running)
  • Acronis Trueimage works well inside hvm virtual machines
    (if empty block devices are not recognized as hard disks, e.g. /dev/sdb7:
    dd if=/dev/zero of=/dev/sdb7 bs=1M count=100
    echo ‘w’ |fdisk /dev/sdb7
    This zeros out the beginning of block device /dev/sdb7 and writes a new partition table into /dev/sdb7; all existing data in /dev/sdb7 is overwritten – you have been warned.)
  • Sometimes the window opened by virt-manager fails to display a running virtual machine (does not connect by vnc to the running vm).
    Closing both windows (that of the vm and virt-manager itself) and reopening them usually helps (the vm continues to run).

Found in xen wiki a remark of Jeremy Fitzhardinge about the performance of Xen 4.0 (Xen Summit at Intel Shanghai Nov 19-20, 2009, Slide 7):

Performance still needs attention

  • Seems to be ~10-20% hit vs 2.6.18-xen

… but you get a current 2.6.31/32/… Linux kernel.

Preparations to boot a Xen 4.0 dom0  kernel: 2.6.18-to-2.6.31-and-higher

Status of Xen features in Linux kernel: XenParavirtOps

Thanks to the detailed posts on http://bderzhavets.wordpress.com/ [A, B, C ] virt-manager is running xen 4.0 on ubuntu 10.04
(installation of ubuntu server plus apt-get install xubuntu-desktop).

Program virt-manager has to be started as root and switching with su to root shell does not work, the login version su – has to be used (to avoid error: Failed to contact configuration server).

To create a hvm virtual machine virt-install is used:

  • virt-install -connect xen:/// -n ti2010 –r 512 –hvm –vnc -f /dev/sdb -c /root/mnt/ti2010.iso –debug –force

Parameter –force is only neccessary if the block device used as hard disk is already part of another vm.

Once the new vm gets displayed in virt-manager all properties of this vm can be edited (click ‘Open’; ‘Add Hardware’, ‘Remove’, …).