Set up Oneiric PV DomU at Xen 4.1.2 Oneiric Dom0 (3.1.0-030100-generic)

Procedure is standard Debian’s network PV install. Download configuration file from following location. Debian and consequently Ubuntu still consider Libvirt and virtinst tools like virt-manager and command line utility virt-install as way to manage RH’s Xen domains like F15,F16,CentOS 6 either to be utilized with remote system mirrors

# wget http://ca.archive.ubuntu.com/ubuntu/dists/oneiric/main/installer-amd64/current/images/netboot/xen/xm-debian.cfg

# cp xm-debian.cfg xm-debian1.cfg

I had to patch xm-debian1.cfg via xm-debian1.patch to make it working

--- xm-debian1.cfg.orig	2011-10-27 17:17:17.333111002 +0400
+++ xm-debian1.cfg	2011-10-27 16:33:24.985110998 +0400
@@ -38,10 +38,10 @@
 # Standard variables
 
 # Initial memory allocation (in megabytes) for the new domain.
-memory = 128
+memory = 2048
 
 # A name for your domain. All domains must have different names.
-name = "ExampleDomain"
+name = "OneiricPVD"
 
 # 128-bit UUID for the domain.  The default behavior is to generate a new UUID
 # on each call to 'xm create'.
@@ -53,7 +53,7 @@
 #cpus = "0-3,5,^1" # run on cpus 0,2,3,5
 
 # Number of Virtual CPUS to use, default is 1
-#vcpus = 1
+vcpus = 2
 
 #----------------------------------------------------------------------------
 # Define network interfaces.
@@ -69,9 +69,9 @@
 #
 # or more than one interface may be configured:
 #
-# vif = ['', 'bridge=xenbr1']
+vif = ['', 'bridge=br0']
 
-vif = ['']
+# vif = ['']
 
 #----------------------------------------------------------------------------
 # Define the disk devices you want the domain to have access to, and
@@ -82,7 +82,7 @@
 #
 # NB: Only xvd devices are supported by the kernel in Debian Lenny and later.
 
-disk = ['file:/path/to/disk.img,xvda,w']
+disk = ['phy:/dev/sda7,xvda,w']
 
 #----------------------------------------------------------------------------
 # Define frame buffer device.
@@ -175,7 +175,7 @@
 xm_vars.check()
 
 if not xm_vars.env.get('install'):
-    bootloader="pygrub"
+    bootloader="/usr/lib64/xen/bin/pygrub"
 elif xm_vars.env['install-method'] == "network":
     import os.path
     print "Install Mirror: %s" % xm_vars.env['install-mirror']
@@ -192,12 +192,16 @@
     print
 
     if xm_vars.env.get('install-kernel'):
-        kernelurl = xm_vars.env['install-kernel']
+#       kernelurl = xm_vars.env['install-kernel']
+        kernelurl = installer + "/netboot/xen/vmlinuz"
+        print "Kernel to load: %s" % kernelurl
     else:
         kernelurl = installer + "/netboot/xen/vmlinuz"
-
+        
     if xm_vars.env.get('install-ramdisk'):
-        ramdiskurl = xm_vars.env['install-ramdisk']
+#       ramdiskurl = xm_vars.env['install-ramdisk']
+        ramdiskurl = installer + "/netboot/xen/initrd.gz"
+        print "Ramdisk to load: %s" %  ramdiskurl
     else:
         ramdiskurl = installer + "/netboot/xen/initrd.gz"
 
@@ -244,7 +248,7 @@
     disk.insert(0, 'file:%s,%s:cdrom,r' % (xm_vars.env['install-media'],
                                            xm_vars.env['install-cdrom-device']))
 
-    bootloader="pygrub"
+    bootloader="/usr/lib64/xen/bin/pygrub"
     bootargs="--kernel=%s --ramdisk=%s" % (kernelpath, ramdiskpath)
     print "From CD"
 else:


# xm create -f xm-debian1.cfg -c install=true \
install-kernel="vmlinuz" install-ramdisk="initrd.gz" \
install-mirror="http://ca.archive.ubuntu.com/ubuntu" \
install-arch=amd64 install-method=network

Network installation starts :-









Create file for XML PV Guest definition

# cat OneiricPVD.xml
<domain type='xen' id='7'>
<name>OneiricPVD</name>
<description></description>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<bootloader>/usr/lib64/xen/bin/pygrub</bootloader>
<bootloader_args>-q</bootloader_args>
<os>
<type>linux</type>
<kernel></kernel>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sda7'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<mac address='00:16:3e:63:7d:40'/>
<source bridge='br0'/>
<script path='/etc/xen/scripts/vif-bridge'/>
<target dev='vif7.0'/>
</interface>
<console type='pty' tty='/dev/pts/3'>
<source path='/dev/pts/3'/>
<target type='xen' port='0'/>
</console>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='5900' autoport='yes'/>
</devices>
</domain>

# virsh define OneiricPVD.xml




About these ads

15 Responses to Set up Oneiric PV DomU at Xen 4.1.2 Oneiric Dom0 (3.1.0-030100-generic)

  1. adam says:

    Thanks very much, this is fantastically helpful.

    I have a very newbie question: I’ve been creating PV domU guests via:
    - xen-create-image –hostname vm1 –role=udev,pygrub [+deboostrap]
    - xm new /etc/xen/vm1.cfg
    - xm start vm1

    I don’t use “virsh define” in this procedure. Is “virsh define” an alternative method? I’d like to understand more about when it can/should be used.

  2. adam says:

    P.S. I should add, I use /etc/xen-tools/xen-tools.conf to feed the xen-create-image command (feel free to consolidate this comment into my previous one)

  3. dbaxps says:

    I’ve never used xen-create-image command.
    I’ve created PV and HVM domains via standard python profiles, which
    I just remember very well either via virt-install , e.g. utilizing xen driver
    in libvirt.

  4. adam says:

    I just created a guest using virt-install – it’s so much more intuitive.

    Question: is it possible to back out an .xml guest definition from a guest that’s been create using the virt-install command line. So I ran the following:
    virt-install –paravirt –name vm2 –ram 256 –disk /dev/mapper/vgxen1-vm2 –location http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/

    I now have a transient debian guest. I’d like to turn it into a permanent one – how to I get the .xml or do I have to create it manually?

  5. dbaxps says:

    I believe virt-install should create XML profile somewhere like
    /etc/libvirt/xen .
    Other option :-
    If you committed virt-install OK
    $ sudo virsh list –all
    $ sudo virsh dumpxml VMNAME > VM.xml

    Virt-install will display XML profile, running with –debug option as
    well.

  6. adam says:

    So I followed your instructions which were absolutely the right way to get the xml. However, when I ran ‘virsh define [guest].xml’ I received an error: ‘error: Failed to define domain from vm1.xml
    error: unknown OS type xen’ (I also got the same error if I tried ‘virsh create’).

    I’m wondering if you’ve seen this before (no worries if not, you’ve been very helpful already)?

  7. dbaxps says:

    Make sure you properly tuned virsh environment.

    http://bderzhavets.wordpress.com/2011/07/23/build-xen-4-1-1-on-ubuntu-11-10/

    Run
    $ virsh version
    what it reports ?

  8. adam says:

    Ok, so if I run ‘virsh version’ at the normal command prompt I get:
    Compiled against library: libvir 0.9.2
    Using library: libvir 0.9.2
    Using API: QEMU 0.9.2
    Running hypervisor: QEMU 0.14.1

    However if I run ‘virsh –connect xen:///’ I am then connected to the xen hyerpvisor. I run ‘version’ and get:
    Compiled against library: libvir 0.9.2
    Using library: libvir 0.9.2
    Using API: Xen 3.0.1
    Running hypervisor: Xen 4.1.0

    Also, I can define the domain with ‘define [guest].xml’.

    Is there any way I can make sure I am connected to the xen hypervisor by default so I don’t have to initiate with ‘virsh –connect xen:///’?

    Thanks for the link. I will now get 4.1.1 running.

  9. dbaxps says:

    Comlete log of your install :-
    root@boris-System-P5Q3:~# virt-install –connect xen:/// –debug -n SQUEEZE –vnc \
    > -p -r 2048 –vcpus=2 -f /dev/sdb7 \
    > -l http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/
    Sat, 19 Nov 2011 19:23:20 DEBUG Launched with command line:
    /usr/bin/virt-install –connect xen:/// –debug -n SQUEEZE –vnc -p -r 2048 –vcpus=2 -f /dev/sdb7 -l http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/
    Sat, 19 Nov 2011 19:23:20 DEBUG Requesting libvirt URI xen:///
    Sat, 19 Nov 2011 19:23:20 DEBUG Received libvirt URI xen:///
    Sat, 19 Nov 2011 19:23:20 DEBUG Requesting virt method ‘xen’, hv type ‘default’.
    Sat, 19 Nov 2011 19:23:20 DEBUG Received virt method ‘xen’
    Sat, 19 Nov 2011 19:23:20 DEBUG Hypervisor name is ‘xen’
    Sat, 19 Nov 2011 19:23:20 DEBUG –graphics compat generated: vnc
    Sat, 19 Nov 2011 19:23:20 DEBUG DistroInstaller location is a network source.
    Sat, 19 Nov 2011 19:23:20 DEBUG Attempting to detect distro:
    Sat, 19 Nov 2011 19:23:22 DEBUG Fetching URI: http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/MANIFEST
    Sat, 19 Nov 2011 19:23:22 DEBUG Saved file to /var/tmp/virtinst-MANIFEST.1GW1wt
    Sat, 19 Nov 2011 19:23:22 DEBUG Detected a Debian distro
    Sat, 19 Nov 2011 19:23:22 DEBUG Guest.has_install_phase: True

    Starting install…
    Sat, 19 Nov 2011 19:23:22 DEBUG scratchdir=/var/lib/xen
    Sat, 19 Nov 2011 19:23:23 DEBUG Attempting to detect distro:
    Sat, 19 Nov 2011 19:23:25 DEBUG Fetching URI: http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/MANIFEST
    Sat, 19 Nov 2011 19:23:25 DEBUG Saved file to /var/lib/xen/virtinst-MANIFEST.rh1eGO
    Retrieving file MANIFEST… | 3.3 kB 00:00 …
    Sat, 19 Nov 2011 19:23:25 DEBUG Detected a Debian distro
    Sat, 19 Nov 2011 19:23:25 DEBUG Fetching URI: http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/xen/vmlinuz
    Sat, 19 Nov 2011 19:23:36 DEBUG Saved file to /var/lib/xen/virtinst-vmlinuz.5Or9oh 00:00 ETA
    Retrieving file vmlinuz… | 4.6 MB 00:10 …
    Sat, 19 Nov 2011 19:23:36 DEBUG Fetching URI: http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/xen/initrd.gz
    Sat, 19 Nov 2011 19:24:51 DEBUG Saved file to /var/lib/xen/virtinst-initrd.gz.T9hVje 00:00 ETA
    Retrieving file initrd.gz… | 37 MB 01:15 …
    Sat, 19 Nov 2011 19:24:51 DEBUG Auto detected OS type as: linux
    Sat, 19 Nov 2011 19:24:51 DEBUG Have access to local system scratchdir so nothing to upload
    Sat, 19 Nov 2011 19:24:51 DEBUG Could not open “/etc/sysconfig/keyboard” [Errno 2] No such file or directory: ‘/etc/sysconfig/keyboard’
    Sat, 19 Nov 2011 19:24:51 DEBUG Could not open “/etc/X11/xorg.conf”: [Errno 2] No such file or directory: ‘/etc/X11/xorg.conf’
    Sat, 19 Nov 2011 19:24:51 DEBUG Could not open “/etc/sysconfig/keyboard” [Errno 2] No such file or directory: ‘/etc/sysconfig/keyboard’
    Sat, 19 Nov 2011 19:24:51 DEBUG Could not open “/etc/X11/xorg.conf”: [Errno 2] No such file or directory: ‘/etc/X11/xorg.conf’
    Sat, 19 Nov 2011 19:24:51 DEBUG Generated install XML:

    SQUEEZE
    3978d7ce-454b-103e-d9df-a486052bf6ce
    2097152
    2097152
    2

    linux
    /var/lib/xen/virtinst-vmlinuz.5Or9oh
    /var/lib/xen/virtinst-initrd.gz.T9hVje
    method=http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/

    destroy
    destroy
    destroy

    Sat, 19 Nov 2011 19:24:51 DEBUG Generated boot XML:

    SQUEEZE
    3978d7ce-454b-103e-d9df-a486052bf6ce
    2097152
    2097152
    2
    /usr/lib/xen-default/bin/pygrub

    destroy
    restart
    restart

    Creating domain… | 0 B 00:01
    Sat, 19 Nov 2011 19:24:53 DEBUG Started guest, connecting to console if requested
    Sat, 19 Nov 2011 19:24:53 DEBUG Launching virt-viewer for graphics type ‘vnc’
    Sat, 19 Nov 2011 19:24:53 DEBUG Running: /usr/bin/virt-viewer –connect xen:/// –wait 1

    (virt-viewer:2892): Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”,
    Sat, 19 Nov 2011 19:24:53 DEBUG XML fetched from libvirt object:

    SQUEEZE
    3978d7ce-454b-103e-d9df-a486052bf6ce

    2097152
    2097152
    2

    linux
    /var/lib/xen/virtinst-vmlinuz.5Or9oh
    /var/lib/xen/virtinst-initrd.gz.T9hVje
    method=http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/

    destroy
    destroy
    destroy

    /usr/lib/xen-4.1/bin/qemu-dm

    Sat, 19 Nov 2011 20:04:50 DEBUG Removing /var/lib/xen/virtinst-vmlinuz.5Or9oh
    Sat, 19 Nov 2011 20:04:50 DEBUG Removing /var/lib/xen/virtinst-initrd.gz.T9hVje
    Guest installation complete… restarting guest.
    Sat, 19 Nov 2011 20:04:56 DEBUG Launching virt-viewer for graphics type ‘vnc’
    Sat, 19 Nov 2011 20:04:56 DEBUG Running: /usr/bin/virt-viewer –connect xen:/// –wait 2

    (virt-viewer:3705): Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”,

  10. dbaxps says:

    root@boris-System-P5Q3:~# virsh list –all
    Id Name State
    ———————————-
    0 Domain-0 running
    – OneiricPV shut off
    – SQUEEZE shut off
    – VF16PV shut off
    – VF16RC5 shut off

    root@boris-System-P5Q3:~# virsh start SQUEEZE
    Domain SQUEEZE started

    root@boris-System-P5Q3:~# vncviewer localhost:0

    VNC Viewer Free Edition 4.1.1 for X – built Sep 7 2011 11:16:25
    Copyright (C) 2002-2005 RealVNC Ltd.
    See http://www.realvnc.com for information on VNC.

    Sat Nov 19 20:11:30 2011
    CConn: connected to host localhost port 5900
    CConnection: Server supports RFB protocol version 3.8
    CConnection: Using RFB protocol version 3.8
    TXImage: Using default colormap and visual, TrueColor, depth 24.
    CConn: Using pixel format depth 6 (8bpp) rgb222
    CConn: Using ZRLE encoding
    CConn: Throughput 20006 kbit/s – changing to hextile encoding
    CConn: Throughput 20006 kbit/s – changing to full colour
    CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
    CConn: Using hextile encoding

    VNC window pops up nicely.

  11. dbaxps says:

    View this :-

    http://bderzhavets.wordpress.com/2011/11/19/set-up-debian-squeeze-pv-domu-at-xen-4-1-2-oneiric-dom0/

    I don’t need redefine domain. In case if I would.
    virsh dumpxml VMNAME > 1.xml
    virsh undefine VMNAME
    virsh define 1.xml

  12. adam says:

    Thanks for the other link.

    Any views on LVM vs qcow2 for guest storage. I’ve been using LVMs but I like the flexibility of non-device based storage. I don’t know what the performance is like though.

  13. dbaxps says:

    > Is there any way I can make sure I am connected to the xen hypervisor
    > by default so I don’t have to initiate with ‘virsh –connect xen:///’?

    Answer was here :-
    http://bderzhavets.wordpress.com/2011/07/23/build-xen-4-1-1-on-ubuntu-11-10/

    already submitted to you.

    Never tried qcow2 with xen.

  14. adam says:

    Got it. Thanks a lot Boris, this has been a very educational day, it’s much appreciated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: