June 18, 201412 yr Converting Xen CFG to libvirt XML In previous betas of unRAID 6, users made use of the xl toolset from Xen to create and control virtual machines. In Beta 6d, while the xl toolset remains, a new and preferred method to VM management has been introduced: libvirt. Libvirt is a set of tools that are used to create and control virtual machines under both the Xen and KVM hypervisor. For those that have upgraded to beta 6d from a previous unRAID 6 beta that included Xen, you should already be comfortable defining your VMs through a .cfg file. If you wish to continue using this method for your existing VMs, you still can. However, the process of converting an domain's xl cfg file to the XML format used by libvirt isn't overly challenging. Here's an example for converting an existing xl cfg file for a domain into libvirt's XML format: Domain CFG File name="win7-v1" builder="hvm" vcpus=2 memory=2048 disk=['file:/path/to/virtual/disk.img,hda,w'] vif=['mac=00:00:00:01:34:12,bridge=xenbr0'] boot="dc" vnc=1 vnclisten='0.0.0.0' vncpasswd='' #NO USB PASSTHROUGH DEVICES, USE THIS usb=1 usbdevice='tablet' on_poweroff="destroy" on_reboot="restart" on_crash="destroy" xen_platform_pci=1 viridian=1 Domain XML File <domain type='xen' id='3'> <name>win7-v1</name> <uuid>4dea22b31d52d8f32516782e98ab3fa0</uuid> <os> <type>hvm</type> <loader>/usr/lib/xen/boot/hvmloader</loader> <boot dev='hd'/> </os> <memory>2097152</memory> <vcpu>2</vcpu> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <features> <pae/> <acpi/> <apic/> </features> <clock sync="localtime"/> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <interface type='bridge'> <source bridge='xenbr0'/> <mac address='00:16:3e:5d:c7:9e'/> <script path='vif-bridge'/> </interface> <disk type='file'> <source file='/path/to/virtual/disk.img'/> <target dev='hda'/> </disk> <graphics type='vnc' port='5900'> <listen type='address' address='0.0.0.0'/> </graphics> </devices> </domain> For more information on creating XML files for Xen using libvirt's virsh tool, check out this link: http://libvirt.org/drvxen.html
June 18, 201412 yr Thanks JonP - how does one comment out lines in the XML? IE # Disable Passthrough for Driver updates and any Windows update requiring a restart. # Use TightVNC Java Viewer with RAW encoding to Update (port: 5901). IP check in unraid terminal: ifconfig. name = 'windows' builder = 'hvm' vcpus = '2' #can set this to 1-4 safely depending on your CPU/# of VMs. memory = '2048' #DO NOT EXCEED UNLESS BRAVE IF DOING GPU PASS THROUGH #memory = '8192' #----For Disc Installation and any Updates (VNC into Windows) #disk = ['phy:/mnt/cache/VM/windows/windows.img,hda,w','file:/mnt/cache/VM/windows/Windows81_DVD.iso,hdc:cdrom,r'] #boot = 'dc' #usbdevice='tablet' #----After Installation and for GPU Passthrough disk = ['phy:/mnt/cache/VM/windows/windows.img,hda,w'] boot = 'c' usbdevice = ['tablet','host:413c:3016','host:413c:2005','host:05e3:0719'] #LOOK UP VIA lsusb COMMAND IN CONSOLE pci = [ '01:00.0','01:00.1','05:00.0','05:00.1','05:00.2' ] #LOOK UP VIA lspci COMMAND IN CONSOLE #Prior to Start VIA xl pci-assignable-list COMMAND IN CONSOLE to show list of excluded from unRaid PCI devices. #Note, after starting VM, Putty into Tower2 and issue "xl pci-attach windows 0000:05:02.0" to mount the Sata Card / Optical Disk Drive #---Other Settings xen_platform_pci='1' #UNCOMMENT POST INSTALL OF XEN PARAVIRTUALIZATION DRIVERS on_poweroff="destroy" on_reboot="restart" on_crash="destroy" vif = ['mac=00:16:3E:51:20:4C,bridge=br0,model=e1000'] #network bridge device_model_version="qemu-xen-traditional" acpi = '1' apic = '1' sdl = '0' stdvga = '0' viridian = '1' usb=1 #VNC SETTINGS vnc = '1' vnclisten = '0.0.0.0' #vncpasswd = '' vncdisplay = 1 __
June 18, 201412 yr XML comments are achieved by using this: <!-- INSERT COMMENT HERE --> Fantastic. Thanks!
June 24, 201412 yr How about passthrough? How would one state this in libvirt xml format? Sent from my LT26i using Tapatalk
July 8, 201411 yr You define it like this; #pci = [ '01:00.0','01:00.1' ] #LOOK UP VIA lspci COMMAND IN CONSOLE 1. ssh to domU/unraid server, run "lspci" should look something like this (its a bigger list) ; 01:00.0 VGA compatible controller: AMD/ATI [Advanced Micro Devices, Inc.] Caicos [Radeon HD 6450] 01:00.1 Audio device: AMD/ATI [Advanced Micro Devices, Inc.] Caicos HDMI Audio [Radeon HD 6400 Series] 2. pick the pci adresses you need and write them down. Let us use 01:00.0 as your gpu (and 01:00.1 as hdmi audio device) in this example, it will most likely not be the same on your machine. 3. then cd /boot/syslinux/ 4. then mcedit syslinux.cfg 5. insert this into bottom of file; label Xen/unRAID Passthrough # <- text in boot menu menu default kernel /syslinux/mboot.c32 append /xen dom0_mem=2097152 --- /bzimage xen-pciback.hide=(01:00.0)(01:00.1) --- /bzroot 6. its imperative that you remove any other line with "menu default" from the already existing config file, as this will then be your default os-boot options. 7. the lines above will make unraid ignore the devices 01:00.0 and 01:00.1 and will not assign them to unraid making them available for a virtual guest machine. 8. when you have booted, do the following command: xl pci-assignable-list 9. you should see 01:00.0 and 01:00.1 in this list, if you do, the devices are ready to be passed through to your VM. Remember, you have to install and update the virtual machine first via VNC. When this is done, install the AMD/ATI drivers without (extremely important) Catalyst Control Center (CCC). Just deselect it in the installer (select custom install in the installer). Your VM might crash (or not), dont worry about it. Go to your VM config file, edit the line in your config file to this; pci = [ '01:00.0','01:00.1' ] Start your VM. Expect to have a few bsod's etc. You're trying to passthrough an NVIDIA card? sorry m8, can't help you. Although, AMD/ATI cards works a lot better for passthrough.
November 21, 201411 yr Is this the config file format for KVM? (ie, can I do this config file conversion and then launch my image file in KVM?) Also, what's the KVM equivalent of xen-pciback.hide for hiding passthrough devices? Thanks
Archived
This topic is now archived and is closed to further replies.