Jump to: navigation, search

Difference between revisions of "XenServer/Development"

(making it sit under the new set of XenServer docs)
(Install Glance)
 
(22 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__
+
 
 
<!-- ## page was renamed from [[XenServerDevelopment]] -->
 
<!-- ## page was renamed from [[XenServerDevelopment]] -->
 
= [[XenServer]] Development =
 
= [[XenServer]] Development =
  
 +
__TOC__
  
<pre><nowiki>#!wiki red/solid
+
== Getting Started Notes ==
Note: you can now use DevStack to get started with XenServer.
 
For more details see: [[XenXCPAndXenServer]]
 
</nowiki></pre>
 
  
  
<<[[TableOfContents]]()>>
+
<pre><nowiki>#!wiki green/solid
 +
To get started using XenServer, take a look at the [[XenServer/GettingStarted|XenServer Getting Started Guide]].
 +
</nowiki></pre>
  
== Getting Started Notes ==
 
  
[[XenServer]] requires a nova-compute domU to run on the hypervisor in order to inject images into the VHDs.  Nova-compute is the worker for the Hypervisor.  It pulls jobs and applies them to the hypervisor it resides on.  It's required to run on the hypervisor because it utilizes /sys/hypervisor.  
+
[[XenServer]] requires nova-compute runs in a para-virtualized (PV) Linux VM (domU not dom0) on the hypervisor you want to manage. This is required to inject images into the VHDs.  It pulls jobs and applies them to the hypervisor it resides on.  It's required to run on the hypervisor because it utilizes /sys/hypervisor, and needs to attach virtual disks, so nova can populate them with the required data.
  
== Prepare Nova ==
+
== Instance Management ==
 
+
=== Prepare Images ===
=== Install dependencies ===
 
  
  
 
<pre><nowiki>
 
<pre><nowiki>
sudo apt-get install python-software-properties
+
mkdir -p ~/openstack/images && cd ~/openstack/images
sudo add-apt-repository ppa:nova-core/trunk
+
mkdir glance
sudo apt-get update
+
</nowiki></pre>
  
sudo apt-get install git-core mysql-server build-essential rabbitmq-server unzip swig screen parted curl euca2ools python-pip python-dev python-mysqldb libxml2 libxslt-dev
 
  
sudo pip install xenapi
+
==== AMI Images ====
</nowiki></pre>
 
 
 
=== Setup development branch ===
 
  
  
 
<pre><nowiki>
 
<pre><nowiki>
mkdir ~/openstack && cd ~/openstack
+
mkdir lucid_ami && cd lucid_ami
 +
 
 +
wget -q -O - http://173.203.107.207/ubuntu-lucid.tar | tar xSv
  
git clone https://github.com/openstack/nova.git
+
glance add name=ramdisk disk_format=ari container_format=ari is_public=True < initrd.img-2.6.32-23-server
sudo pip install -r nova/tools/pip-requires
+
glance add name=kernel disk_format=aki container_format=aki is_public=True < vmlinuz-2.6.32-23-server
 +
glance add name=lucid_ami disk_format=ami container_format=ami is_public=True ramdisk_id=<ramdisk ID> kernel_id=<kernel ID> < ubuntu-lucid.img
 
</nowiki></pre>
 
</nowiki></pre>
  
  
You may run into issues when when running the <code><nowiki>sudo pip install -r nova/tools/pip-requires</nowiki></code> command with an error similar to this on Ubuntu 10.04.2 LTS:
+
==== OVF Images ====
 +
 
 +
===== Linux =====
  
  
 
<pre><nowiki>
 
<pre><nowiki>
<backtrace>
+
mkdir linux_ovf && cd linux_ovf
VersionConflict: (M2Crypto 0.20.1 (/usr/lib/pymodules/python2.6), Requirement.parse('M2Crypto==0.20.2'))
 
  
Storing complete log in ./pip-log.txt
+
glance add name=lucid_ovf disk_format=vhd container_format=ovf is_public=True < lucid.ova
 
</nowiki></pre>
 
</nowiki></pre>
  
  
This is because euca2ools and cloud-utils install an older version of [[M2Crypto]].  You can solve this by installing the required version:
+
===== Windows =====
  
  
 
<pre><nowiki>
 
<pre><nowiki>
wget http://repo.vexxhost.com/openstack/m2crypto/python-m2crypto_0.20.2-1_amd64.deb
+
mkdir windows && cd windows
sudo dpkg -i python-m2crypto_0.20.2-1_amd64.deb
+
 
 +
glance add name=windows disk_format=vhd container_format=ovf type=raw os_type=windows is_public=True < windows.ova
 
</nowiki></pre>
 
</nowiki></pre>
  
  
You can rerun the <code><nowiki>sudo pip install -r nova/tools/pip-requires</nowiki></code> command and it will install with no problems afterwards
+
=== Run Instance ===
  
=== Install Glance ===
+
<pre><nowiki>
'''Note''': The glance-scrubber.conf file may be missing from some packages, refer to https://bugs.launchpad.net/ubuntu/+source/glance/+bug/816972.  
+
ssh-keygen -f nova_key && chmod 600 nova_key
 +
euca-add-keypair nova_key > nova_key.priv
  
 
+
nova flavor-list
<pre><nowiki>
+
nova image-list
https://github.com/openstack/glance.git
+
nova boot test --flavor <flavor ID> --image <image ID>
cd glance
+
nova list
sudo cp etc/glance-*.conf ~
 
# set filesystem_store_datadir to somewhere writable (/home/name/openstack/images/glance perhaps) in glance-api.conf
 
# set sql_connection to MySQL (mysql://root:password@127.0.0.1/glance) in glance-registry.conf and glance-scrubber.conf
 
sudo python setup.py install
 
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
=== Connect to instance console ===
 +
==== VNC ====
  
=== Setup MySQL ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
mysql -u root -p -e "create database nova; create database glance;"
+
ssh root@<XenServer IP> netstat -tuanp | grep vncterm
 +
ssh -L 590N:localhost:590N root@<XenServer IP>
 +
vnc://localhost:590N
 
</nowiki></pre>
 
</nowiki></pre>
  
=== Configure Nova flags ===
 
  
<pre><nowiki>
+
==== [[XenConsole]] ====
cd nova
 
  
# xenapi_inject_image == false if using an ovf type glance file.  otherwise set to true to inject the bits into the image
 
  
cat > ../nova.conf << EOF
+
<pre><nowiki>
--verbose
+
ssh root@<XenServer IP>
--nodaemon
+
list_domains
--sql_connection=mysql://root:<password>@127.0.0.1/nova
+
ps ax | grep vnc | grep <domain ID>
--network_manager=nova.network.manager.FlatManager
+
kill -9 <VNC PIDs>
--image_service=nova.image.glance.GlanceImageService
+
/usr/lib/xen/bin/xenconsole <domain ID>
--flat_network_bridge=xenbr0
 
--connection_type=xenapi
 
--xenapi_connection_url=https://<XenServer IP>
 
--xenapi_connection_username=root
 
--xenapi_connection_password=password
 
--reboot_timeout=600
 
--rescue_timeout=86400
 
--resize_confirm_window=86400
 
--allow_admin_api
 
--enabled_apis=osapi_compute
 
--allow_resize_to_same_host
 
--xenapi_generate_swap
 
--firewall_driver=nova.virt.xenapi.firewall.Dom0IptablesFirewallDriver
 
EOF
 
 
 
# Add the following to your flagfile if you're using Ubuntu Maverick
 
cat >> ../nova.conf << EOF
 
--xenapi_remap_vbd_dev
 
EOF
 
 
 
sudo mkdir /etc/nova
 
sudo ln -s ~/openstack/nova.conf /etc/nova/
 
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
=== Install [[XenTools]] ===
 +
Make ''xs-tools.iso'' available to the instance in [[XenCenter]], [[OpenXenManager]] or the CLI (not documented here) before proceeding.
  
=== Ensure tests pass ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
./run_tests.sh -x -N
+
ssh root@<instance IP>
 +
mount /dev/xvdb /mnt
 +
cd /mnt/Linux
 +
dpkg -i ./xe-guest-utilities_5.5.0-464_amd64.deb
 +
update-rc.d -f xe-linux-distribution remove
 +
update-rc.d xe-linux-distribution defaults
 +
reboot
 
</nowiki></pre>
 
</nowiki></pre>
  
=== Test XenAPI ===
 
  
<pre><nowiki>
+
=== Install [[OpenXenManager]] on OS X ===
./bin/nova-manage shell python
 
import XenAPI
 
import nova.virt.xenapi_conn
 
nova.virt.xenapi_conn.XenAPI = XenAPI
 
x = nova.virt.xenapi_conn.XenAPIConnection("https://<XenServer IP>", "root", "password")
 
x.list_instances()
 
</nowiki></pre>
 
  
=== Setup Nova ===
 
  
<pre><nowiki>
+
<pre><nowiki>#!wiki note
cd nova/nova/CA && ./genrootca.sh && cd ../..
+
The rev48 "packaged" tarball [[http://sourceforge.net/projects/openxenmanager/forums/forum/1159068/topic/4529278|may be broken]] -- SVN trunk worked for me, with the Homebrew dependency installation method I've documented below. ''--ChesMartin''
 +
</nowiki></pre>
  
NAME=<name>
 
  
./bin/nova-manage db sync
+
# Download: http://xensemaking.com/openxenmanager/
./bin/nova-manage user admin $NAME
+
# Compile pygtk:
./bin/nova-manage project create openstack $NAME
 
./bin/nova-manage network create private 10.0.0.0/8 1 64 [0 0 <IPv6 Prefix>::/<Mask> <IPv6 Gateway>]
 
./bin/nova-manage project zip openstack $NAME
 
  
unzip nova.zip
 
. novarc
 
</nowiki></pre>
 
 
=== Enable Legacy Auth ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
vim etc/nova/api-paste.ini
+
sudo port install py26-gtk
# set [pipeline:openstack_compute_api_v2]
 
# pipeline = faultwrap noauth ratelimit osapi_compute_app_v2
 
# to
 
# [pipeline:openstack_compute_api_v2]
 
# pipeline = faultwrap auth ratelimit osapi_compute_app_v2
 
 
</nowiki></pre>
 
</nowiki></pre>
  
=== Run Nova ===
 
  
<pre><nowiki>
+
If you're a Homebrew user, you're unfortunately in for a more work due in part to [https://github.com/mxcl/homebrew/pull/4353 some dependencies not being available as formula yet]. You can try this [https://gist.github.com/1094799 procedure for building PyGTK and dependencies].
screen  # each process gets its own window
 
  
./bin/nova-api
+
1.#3 Open a X11 shell and go to the openxenmanager directory
./bin/nova-compute
+
# Run [[OpenXenManager]]:
./bin/nova-network
 
./bin/nova-scheduler
 
</nowiki></pre>
 
  
=== Setup Glance ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
sudo mkdir /var/log/glance
+
python window.py
sudo glance-manage db_sync
 
 
</nowiki></pre>
 
</nowiki></pre>
  
=== Run Glance ===
 
  
<pre><nowiki>
+
The project <code><nowiki>README</nowiki></code> also mentions <code><nowiki>python-gtk-vnc</nowiki></code> and <code><nowiki>rrdtool</nowiki></code> for graphs -- neither path here takes those into account so you'll need to look into them if you wish to have those features working.
sudo glance-control all start
 
</nowiki></pre>
 
  
== Prepare [[XenServer]] ==
+
== Legacy way to Prepare [[XenServer]] ==
 
=== Install Nova plugins ===
 
=== Install Nova plugins ===
  
Line 217: Line 166:
 
<Provisional message: placeholder update when Nova E4 releases> From Nova Essex 4, a new flag called 'sr_matching_filter' has been introduced (which defaults to 'other-config:i18n-key=local-storage'). This filter is used for finding the SR on which to install guest instances. The default value is the Local Storage in default [[XenServer]]/XCP installations as detailed above. However, if you want to select an SR with different matching criteria, this flag can be set to 'other-config:my_favorite_sr=true'. This means that XenAPI will look for an SR whose other-config contains the key-value pair (my_favorite_sr, true). On the other hand, to fall back on the Default SR, as displayed by [[XenCenter]] and as returned by xenapi.pool.get_default_SR, this flag can be set to to 'default-sr:true'.
 
<Provisional message: placeholder update when Nova E4 releases> From Nova Essex 4, a new flag called 'sr_matching_filter' has been introduced (which defaults to 'other-config:i18n-key=local-storage'). This filter is used for finding the SR on which to install guest instances. The default value is the Local Storage in default [[XenServer]]/XCP installations as detailed above. However, if you want to select an SR with different matching criteria, this flag can be set to 'other-config:my_favorite_sr=true'. This means that XenAPI will look for an SR whose other-config contains the key-value pair (my_favorite_sr, true). On the other hand, to fall back on the Default SR, as displayed by [[XenCenter]] and as returned by xenapi.pool.get_default_SR, this flag can be set to to 'default-sr:true'.
  
== Instance Management ==
+
== Legacy way to Prepare Nova ==
=== Prepare Images ===
+
 
 +
This is how you can manually install nova. It is probably better to try [[XenServer/DevStack|DevStack]].
 +
 
 +
=== Install dependencies ===
  
  
 
<pre><nowiki>
 
<pre><nowiki>
mkdir -p ~/openstack/images && cd ~/openstack/images
+
sudo apt-get update
mkdir glance
+
 
 +
sudo apt-get install git-core mysql-server build-essential rabbitmq-server unzip swig screen parted curl euca2ools python-pip python-dev python-mysqldb libxml2 libxslt-dev libmysqlclient-dev libpq-dev bash-completion
 +
 
 +
sudo pip install xenapi
 
</nowiki></pre>
 
</nowiki></pre>
  
 
+
=== Setup development branch ===
==== AMI Images ====
 
  
  
 
<pre><nowiki>
 
<pre><nowiki>
mkdir lucid_ami && cd lucid_ami
+
mkdir ~/openstack && cd ~/openstack
 
 
wget -q -O - http://173.203.107.207/ubuntu-lucid.tar | tar xSv
 
  
glance add name=ramdisk disk_format=ari container_format=ari is_public=True < initrd.img-2.6.32-23-server
+
git clone https://git.openstack.org/openstack/nova.git
glance add name=kernel disk_format=aki container_format=aki is_public=True < vmlinuz-2.6.32-23-server
+
sudo pip install -r nova/requirements.txt
glance add name=lucid_ami disk_format=ami container_format=ami is_public=True ramdisk_id=<ramdisk ID> kernel_id=<kernel ID> < ubuntu-lucid.img
 
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
=== Install Glance ===
 +
'''Note''': The glance-scrubber.conf file may be missing from some packages, refer to https://bugs.launchpad.net/ubuntu/+source/glance/+bug/816972.
  
==== OVF Images ====
 
  
===== Linux =====
+
<pre><nowiki>
 +
https://github.com/git.openstack.org/glance.git
 +
cd glance
 +
sudo cp etc/glance-*.conf ~
 +
# set filesystem_store_datadir to somewhere writable (/home/name/openstack/images/glance perhaps) in glance-api.conf
 +
# set sql_connection to MySQL (mysql://root:password@127.0.0.1/glance) in glance-registry.conf and glance-scrubber.conf
 +
sudo python setup.py install
 +
</nowiki></pre>
  
 +
=== Setup MySQL ===
  
 
<pre><nowiki>
 
<pre><nowiki>
mkdir linux_ovf && cd linux_ovf
+
mysql -u root -p -e "create database nova; create database glance;"
 +
</nowiki></pre>
  
glance add name=lucid_ovf disk_format=vhd container_format=ovf is_public=True < lucid.ova
+
=== Configure Nova flags ===
</nowiki></pre>
 
  
 +
<pre><nowiki>
 +
cd nova
  
===== Windows =====
+
# xenapi_inject_image == false if using an ovf type glance file.  otherwise set to true to inject the bits into the image
  
 +
cat > ../nova.conf << EOF
 +
[DEFAULT]
 +
api_paste_config=/etc/nova/api-paste.ini
 +
debug=True
 +
verbose=True
 +
sql_connection=mysql://root:<password>@127.0.0.1/nova
 +
network_manager=nova.network.manager.FlatManager
 +
flat_network_bridge=xenbr0
 +
xenapi_connection_url=https://<XenServer IP>
 +
xenapi_connection_username=root
 +
xenapi_connection_password=password
 +
reboot_timeout=600
 +
rescue_timeout=86400
 +
resize_confirm_window=86400
 +
enabled_apis=osapi_compute
 +
allow_resize_to_same_host=True
 +
firewall_driver=nova.virt.xenapi.firewall.Dom0IptablesFirewallDriver
 +
glance_api_servers=http://<glance_ip>:9292
 +
EOF
  
<pre><nowiki>
+
# Add the following to your flagfile if you're using Ubuntu Maverick
mkdir windows && cd windows
+
cat >> ../nova.conf << EOF
 +
xenapi_remap_vbd_dev=True
 +
EOF
  
glance add name=windows disk_format=vhd container_format=ovf type=raw os_type=windows is_public=True < windows.ova
+
sudo mkdir /etc/nova
 +
sudo ln -s <PATH>/nova.conf /etc/nova/
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
Symlink api-paste.ini into /etc/nova
 +
Symlink policy.json into /etc/nova
  
=== Run Instance ===
+
=== Ensure tests pass ===
  
 
<pre><nowiki>
 
<pre><nowiki>
ssh-keygen -f nova_key && chmod 600 nova_key
+
./run_tests.sh -x -N
euca-add-keypair nova_key > nova_key.priv
 
 
 
nova flavor-list
 
nova image-list
 
nova boot test --flavor <flavor ID> --image <image ID>
 
nova list
 
 
</nowiki></pre>
 
</nowiki></pre>
  
=== Connect to instance console ===
+
=== Setup Nova ===
==== VNC ====
 
 
 
  
 
<pre><nowiki>
 
<pre><nowiki>
ssh root@<XenServer IP> netstat -tuanp | grep vncterm
+
cd nova/nova/CA && ./genrootca.sh && cd ../..
ssh -L 590N:localhost:590N root@<XenServer IP>
 
vnc://localhost:590N
 
</nowiki></pre>
 
  
 +
NAME=<name>
  
==== [[XenConsole]] ====
+
./bin/nova-manage db sync
 +
./bin/nova-manage user admin $NAME
 +
./bin/nova-manage project create openstack $NAME
 +
./bin/nova-manage network create private 10.0.0.0/8 1 64 [0 0 <IPv6 Prefix>::/<Mask> <IPv6 Gateway>]
 +
./bin/nova-manage project zip openstack $NAME
  
 
+
unzip nova.zip
<pre><nowiki>
+
. novarc
ssh root@<XenServer IP>
 
list_domains
 
ps ax | grep vnc | grep <domain ID>
 
kill -9 <VNC PIDs>
 
/usr/lib/xen/bin/xenconsole <domain ID>
 
 
</nowiki></pre>
 
</nowiki></pre>
  
=== Install [[XenTools]] ===
+
=== Enable Legacy Auth ===
Make ''xs-tools.iso'' available to the instance in [[XenCenter]], [[OpenXenManager]] or the CLI (not documented here) before proceeding.
 
 
 
  
 
<pre><nowiki>
 
<pre><nowiki>
ssh root@<instance IP>
+
vim etc/nova/api-paste.ini
mount /dev/xvdb /mnt
+
# set [pipeline:openstack_compute_api_v2]
cd /mnt/Linux
+
# pipeline = faultwrap noauth ratelimit osapi_compute_app_v2
dpkg -i ./xe-guest-utilities_5.5.0-464_amd64.deb
+
# to
update-rc.d -f xe-linux-distribution remove
+
# [pipeline:openstack_compute_api_v2]
update-rc.d xe-linux-distribution defaults
+
# pipeline = faultwrap auth ratelimit osapi_compute_app_v2
reboot
 
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
=== Run Nova ===
  
=== Install [[OpenXenManager]] on OS X ===
+
<pre><nowiki>
 +
screen  # each process gets its own window
  
 
+
./bin/nova-api
<pre><nowiki>#!wiki note
+
./bin/nova-compute
The rev48 "packaged" tarball [[http://sourceforge.net/projects/openxenmanager/forums/forum/1159068/topic/4529278|may be broken]] -- SVN trunk worked for me, with the Homebrew dependency installation method I've documented below. ''--ChesMartin''
+
./bin/nova-conductor
 +
./bin/nova-network
 +
./bin/nova-scheduler
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
=== Configure Glance ===
  
# Download: http://xensemaking.com/openxenmanager/
+
Make sure glance-registry.conf has
# Compile pygtk:
+
<pre><nowiki>
 +
sql_connection=mysql://root@127.0.0.1/glance
 +
</nowiki></pre>
  
 +
=== Setup Glance ===
  
 
<pre><nowiki>
 
<pre><nowiki>
sudo port install py26-gtk
+
sudo mkdir /var/log/glance
 +
sudo glance-manage db_sync
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
=== Run Glance ===
  
If you're a Homebrew user, you're unfortunately in for a more work due in part to [https://github.com/mxcl/homebrew/pull/4353 some dependencies not being available as formula yet]. You can try this [https://gist.github.com/1094799 procedure for building PyGTK and dependencies].
+
<pre><nowiki>
 +
sudo glance-control all start
 +
</nowiki></pre>
  
1.#3 Open a X11 shell and go to the openxenmanager directory
+
=== Configure Novaclient ===
# Run [[OpenXenManager]]:
 
  
 +
Create a novarc file and source it with follows
  
 
<pre><nowiki>
 
<pre><nowiki>
python window.py
+
export OS_USERNAME=admin
 +
export OS_PASSWORD=admin
 +
export OS_TENANT_NAME=openstack
 +
export OS_AUTH_URL=http://127.0.0.1:8774/v2
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
=== Test with Novaclient ===
 +
<pre><nowiki>
 +
$ nova list
 +
+----+------+--------+------------+-------------+----------+
 +
| ID | Name | Status | Task State | Power State | Networks |
 +
+----+------+--------+------------+-------------+----------+
 +
+----+------+--------+------------+-------------+----------+
  
The project <code><nowiki>README</nowiki></code> also mentions <code><nowiki>python-gtk-vnc</nowiki></code> and <code><nowiki>rrdtool</nowiki></code> for graphs -- neither path here takes those into account so you'll need to look into them if you wish to have those features working.
+
</nowiki></pre>

Latest revision as of 13:26, 30 September 2013

XenServer Development

Getting Started Notes

#!wiki green/solid
To get started using XenServer, take a look at the [[XenServer/GettingStarted|XenServer Getting Started Guide]].


XenServer requires nova-compute runs in a para-virtualized (PV) Linux VM (domU not dom0) on the hypervisor you want to manage. This is required to inject images into the VHDs. It pulls jobs and applies them to the hypervisor it resides on. It's required to run on the hypervisor because it utilizes /sys/hypervisor, and needs to attach virtual disks, so nova can populate them with the required data.

Instance Management

Prepare Images

mkdir -p ~/openstack/images && cd ~/openstack/images
mkdir glance


AMI Images

mkdir lucid_ami && cd lucid_ami

wget -q -O - http://173.203.107.207/ubuntu-lucid.tar | tar xSv

glance add name=ramdisk disk_format=ari container_format=ari is_public=True < initrd.img-2.6.32-23-server
glance add name=kernel disk_format=aki container_format=aki is_public=True < vmlinuz-2.6.32-23-server
glance add name=lucid_ami disk_format=ami container_format=ami is_public=True ramdisk_id=<ramdisk ID> kernel_id=<kernel ID> < ubuntu-lucid.img


OVF Images

Linux
mkdir linux_ovf && cd linux_ovf

glance add name=lucid_ovf disk_format=vhd container_format=ovf is_public=True < lucid.ova


Windows
mkdir windows && cd windows

glance add name=windows disk_format=vhd container_format=ovf type=raw os_type=windows is_public=True < windows.ova


Run Instance

ssh-keygen -f nova_key && chmod 600 nova_key
euca-add-keypair nova_key > nova_key.priv

nova flavor-list
nova image-list
nova boot test --flavor <flavor ID> --image <image ID>
nova list

Connect to instance console

VNC

ssh root@<XenServer IP> netstat -tuanp | grep vncterm
ssh -L 590N:localhost:590N root@<XenServer IP>
vnc://localhost:590N


XenConsole

ssh root@<XenServer IP>
list_domains
ps ax | grep vnc | grep <domain ID>
kill -9 <VNC PIDs>
/usr/lib/xen/bin/xenconsole <domain ID>

Install XenTools

Make xs-tools.iso available to the instance in XenCenter, OpenXenManager or the CLI (not documented here) before proceeding.


ssh root@<instance IP>
mount /dev/xvdb /mnt
cd /mnt/Linux
dpkg -i ./xe-guest-utilities_5.5.0-464_amd64.deb
update-rc.d -f xe-linux-distribution remove
update-rc.d xe-linux-distribution defaults
reboot


Install OpenXenManager on OS X

#!wiki note
The rev48 "packaged" tarball [[http://sourceforge.net/projects/openxenmanager/forums/forum/1159068/topic/4529278|may be broken]] -- SVN trunk worked for me, with the Homebrew dependency installation method I've documented below. ''--ChesMartin''


  1. Download: http://xensemaking.com/openxenmanager/
  2. Compile pygtk:


sudo port install py26-gtk


If you're a Homebrew user, you're unfortunately in for a more work due in part to some dependencies not being available as formula yet. You can try this procedure for building PyGTK and dependencies.

1.#3 Open a X11 shell and go to the openxenmanager directory
  1. Run OpenXenManager:


python window.py


The project README also mentions python-gtk-vnc and rrdtool for graphs -- neither path here takes those into account so you'll need to look into them if you wish to have those features working.

Legacy way to Prepare XenServer

Install Nova plugins

cd ~/openstack/nova/plugins/xenserver/xenapi 
scp -r etc/ root@<XenServer IP>:/

ssh root@<XenServer IP>

chmod a+x /etc/xapi.d/plugins/*
sed -i -e "s/enabled=0/enabled=1/" /etc/yum.repos.d/CentOS-Base.repo
yum install parted
mkdir /boot/guest
sed -i -e "s/enabled=1/enabled=0/" /etc/yum.repos.d/CentOS-Base.repo


Configure SR storage

ssh root@<XenServer IP> xe sr-list  # look for the 'Local storage' SR
ssh root@<XenServer IP> xe sr-param-set uuid=<SR uuid> other-config:i18n-key=local-storage

<Provisional message: placeholder update when Nova E4 releases> From Nova Essex 4, a new flag called 'sr_matching_filter' has been introduced (which defaults to 'other-config:i18n-key=local-storage'). This filter is used for finding the SR on which to install guest instances. The default value is the Local Storage in default XenServer/XCP installations as detailed above. However, if you want to select an SR with different matching criteria, this flag can be set to 'other-config:my_favorite_sr=true'. This means that XenAPI will look for an SR whose other-config contains the key-value pair (my_favorite_sr, true). On the other hand, to fall back on the Default SR, as displayed by XenCenter and as returned by xenapi.pool.get_default_SR, this flag can be set to to 'default-sr:true'.

Legacy way to Prepare Nova

This is how you can manually install nova. It is probably better to try DevStack.

Install dependencies

sudo apt-get update

sudo apt-get install git-core mysql-server build-essential rabbitmq-server unzip swig screen parted curl euca2ools python-pip python-dev python-mysqldb libxml2 libxslt-dev libmysqlclient-dev libpq-dev bash-completion

sudo pip install xenapi

Setup development branch

mkdir ~/openstack && cd ~/openstack

git clone https://git.openstack.org/openstack/nova.git
sudo pip install -r nova/requirements.txt

Install Glance

Note: The glance-scrubber.conf file may be missing from some packages, refer to https://bugs.launchpad.net/ubuntu/+source/glance/+bug/816972.


https://github.com/git.openstack.org/glance.git
cd glance
sudo cp etc/glance-*.conf ~
# set filesystem_store_datadir to somewhere writable (/home/name/openstack/images/glance perhaps) in glance-api.conf
# set sql_connection to MySQL (mysql://root:password@127.0.0.1/glance) in glance-registry.conf and glance-scrubber.conf
sudo python setup.py install

Setup MySQL

mysql -u root -p -e "create database nova; create database glance;"

Configure Nova flags

cd nova

# xenapi_inject_image == false if using an ovf type glance file.  otherwise set to true to inject the bits into the image

cat > ../nova.conf << EOF
[DEFAULT]
api_paste_config=/etc/nova/api-paste.ini
debug=True
verbose=True
sql_connection=mysql://root:<password>@127.0.0.1/nova
network_manager=nova.network.manager.FlatManager
flat_network_bridge=xenbr0
xenapi_connection_url=https://<XenServer IP>
xenapi_connection_username=root
xenapi_connection_password=password
reboot_timeout=600
rescue_timeout=86400
resize_confirm_window=86400
enabled_apis=osapi_compute
allow_resize_to_same_host=True
firewall_driver=nova.virt.xenapi.firewall.Dom0IptablesFirewallDriver
glance_api_servers=http://<glance_ip>:9292
EOF

# Add the following to your flagfile if you're using Ubuntu Maverick
cat >> ../nova.conf << EOF
xenapi_remap_vbd_dev=True
EOF

sudo mkdir /etc/nova
sudo ln -s <PATH>/nova.conf /etc/nova/

Symlink api-paste.ini into /etc/nova Symlink policy.json into /etc/nova

Ensure tests pass

./run_tests.sh -x -N

Setup Nova

cd nova/nova/CA && ./genrootca.sh && cd ../..

NAME=<name>

./bin/nova-manage db sync
./bin/nova-manage user admin $NAME
./bin/nova-manage project create openstack $NAME
./bin/nova-manage network create private 10.0.0.0/8 1 64 [0 0 <IPv6 Prefix>::/<Mask> <IPv6 Gateway>]
./bin/nova-manage project zip openstack $NAME

unzip nova.zip
. novarc

Enable Legacy Auth

vim etc/nova/api-paste.ini
# set [pipeline:openstack_compute_api_v2]
# pipeline = faultwrap noauth ratelimit osapi_compute_app_v2
# to
# [pipeline:openstack_compute_api_v2]
# pipeline = faultwrap auth ratelimit osapi_compute_app_v2

Run Nova

screen  # each process gets its own window

./bin/nova-api
./bin/nova-compute
./bin/nova-conductor
./bin/nova-network
./bin/nova-scheduler

Configure Glance

Make sure glance-registry.conf has

sql_connection=mysql://root@127.0.0.1/glance

Setup Glance

sudo mkdir /var/log/glance
sudo glance-manage db_sync

Run Glance

sudo glance-control all start

Configure Novaclient

Create a novarc file and source it with follows

export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_TENANT_NAME=openstack
export OS_AUTH_URL=http://127.0.0.1:8774/v2

Test with Novaclient

$ nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+