secret
Created

Integrating Xen 4.2 with Systemd.

  • Download Gist
xen-and-systemd
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
Integrating Xen 4.2 AUR with Systemd.
=================================
 
I tested the AUR package with a fresh installation of Arch of x86_64. Only
packages 'base', 'base-devel'and the dependencies mentioned on the site
were installed.
* package build also requires dev86
* dev86 is in multilib, x86_64 users need to enable multilib in /etc/pacman.conf
 
* users need to add a new entry to their bootloader config file (mentioned)
* users need to set up a network bridge or alternative for dom0 (not mentioned)
 
The following are what was needed to make systemd work successfully with the AUR package
(and the installation from xen.org source).
 
* Need to include the following line in /etc/fstab:
none /proc/xen xenfs defaults 0 0
 
* Need to place the file 'xendomains' (created in init.d) somewhere useful.
Fedora use /usr/libexec which Arch does not have. It's a script so maybe
/etc/xen/scripts/ ?
 
* Error messages about 'failed to execute /usr/lib/.... xend/udev_event'
(lots of them) are caused by /etc/udev/rules.d/xend.rules
As xend is (a) deprecated and (b) not used, it is safe to remove xend.rules
 
I was able to remove /etc/udev/xen-backend rules without any (apparent) effect.
 
* The AUR build creates both oxenstored and censtored. oxenstored is more
efficient according to xen.org so oxenstored.service is provided.
 
* The following files integrate Xen 4.2 with systemd 195. They replace xencommons
which loads startup modules then starts oxenstored, xenconsoled and xendomains.
To start the services at startup, issue:
systemctl enable oxenstored.service
systemctl enable xenconsoled.service
systemctl enable xendomains.service
 
---------------------------------------------------------------------------------
/etc/modules-load.d/xen.conf
---------------------------------------------------------------------------------
 
xen-evtchn
xen-gntdev
xen-gntalloc
xen-blkback
xen-netback
xen-pciback
xen-acpi-processor
# The following were included in xencommons, but were not inserted by systemd
# evtchn
# gntdev
# netbk
# blkbk
# xen-scsibk
# usbbk
# pciback
# blktap2
# blktap
#### end of xen.conf
 
---------------------------------------------------------------------------------
/usr/lib/systemd/system/xenstored.service
---------------------------------------------------------------------------------
 
[Unit]
Description=Xenstored - daemon managing xenstore file system
Before=libvirtd.service libvirt-guests.service
After=dbus.service
RefuseManualStop=true
 
[Service]
Type=forking
PIDFile=/var/run/xenstored.pid
ExecStart=/usr/sbin/xenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
 
[Install]
WantedBy=multi-user.target
 
#### end of xenstored.service
 
 
---------------------------------------------------------------------------------
/usr/lib/systemd/system/xenconsoled.service
---------------------------------------------------------------------------------
 
[Unit]
Description=Xenconsoled - handles logging from guest consoles and hypervisor
After=xenstored.service
 
[Service]
Type=simple
PIDFile=/var/run/xenconsoled.pid
ExecStart=/usr/sbin/xenconsoled
 
[Install]
WantedBy=multi-user.target
 
#### end of xencommons.service
 
 
---------------------------------------------------------------------------------
/usr/lib/systemd/system/xendomains.service
---------------------------------------------------------------------------------
 
[Unit]
Description=Xendomains - start and stop guests on boot and shutdown
Requires=proc-xen.mount xenstored.service
After=proc-xen.mount xenstored.service xenconsoled.service
ConditionPathExists=/proc/xen
 
[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/usr/bin/grep -q control_d /proc/xen/capabilities
ExecStart=/etc/xen/scripts/xendomains start
ExecStop=/etc/xen/scripts/xendomains stop
 
[Install]
WantedBy=multi-user.target
 
#### end of xendomains.service
 
 
********************************************************************************
xen.conf paleo9
 
oxenstored.service xenconsoled.service xendomains.service
based on Fedora 17, modified for the Arch system by paleo9
*********************************************************************************

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.