Add post deployment scripts
+ Install xen tools dpkg on compute nodes + Install nova/xapi plugin on compute nodes + Install xenapi sdk on compute nodes + Setup HIMN between compute nodes and xenservers + Initialize nova-compute.conf + Remove existed images from glance and create new
This commit is contained in:
parent
fa4115f921
commit
b0f773086c
|
@ -9,10 +9,10 @@ os.environ["PGPASSWORD"] = db_settings['passwd']
|
|||
|
||||
def execute_sql(sql):
|
||||
paras = dict(db_settings.items() + {'sql':sql}.items())
|
||||
print paras
|
||||
cmd = ('psql -h {host} -p {port} -U {user} -w -d {name} '
|
||||
'-c "{sql}" '
|
||||
).format(**paras)
|
||||
print cmd
|
||||
os.system(cmd)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -4,7 +4,10 @@ scp cleardb.py root@$FUELMASTER:$PLUGIN_PATH
|
|||
ssh root@$FUELMASTER dockerctl copy cleardb.py nailgun:/tmp/cleardb.py
|
||||
ssh root@$FUELMASTER dockerctl shell nailgun /tmp/cleardb.py
|
||||
|
||||
cat base_release.yaml xs_release.yaml > newrelease.yaml
|
||||
cat base_release.yaml > newrelease.yaml
|
||||
echo '- pk: 9' >> newrelease.yaml
|
||||
echo ' extend: *base_release' >> newrelease.yaml
|
||||
cat xs_release.yaml >> newrelease.yaml
|
||||
scp newrelease.yaml root@$FUELMASTER:$PLUGIN_PATH
|
||||
ssh root@$FUELMASTER dockerctl copy newrelease.yaml nailgun:/tmp/newrelease.yaml
|
||||
ssh root@$FUELMASTER dockerctl shell nailgun manage.py loaddata /tmp/newrelease.yaml
|
||||
|
@ -13,7 +16,7 @@ rm newrelease.yaml
|
|||
fpb --check xenserver-fuel-plugin
|
||||
fpb --build xenserver-fuel-plugin
|
||||
|
||||
scp xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm root@$FUELMASTER:$PLUGIN_PATH
|
||||
scp xenserver-fuel-plugin/xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm root@$FUELMASTER:$PLUGIN_PATH
|
||||
|
||||
ssh root@$FUELMASTER fuel plugins --install $PLUGIN_PATH/xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm ||
|
||||
ssh root@$FUELMASTER fuel plugins --update $PLUGIN_PATH/xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
function add_interface {
|
||||
local vm_uuid
|
||||
vm_uuid="$1"
|
||||
|
||||
local device_number
|
||||
device_number=$2
|
||||
|
||||
local himn_uuid
|
||||
himn_uuid=`xe network-list bridge=xenapi minimal=true`
|
||||
|
||||
xe vif-create network-uuid=$himn_uuid vm-uuid=$vm_uuid device=$device_number
|
||||
}
|
||||
|
||||
vm_uuids="$@"
|
||||
|
||||
for vm_uuid in $vm_uuids
|
||||
do
|
||||
eth2_uuid=$(add_interface "$vm_uuid" 2)
|
||||
xe vif-plug uuid=$eth2_uuid
|
||||
done
|
|
@ -0,0 +1,76 @@
|
|||
#!/bin/bash
|
||||
|
||||
function setup_himn {
|
||||
echo 'auto eth2
|
||||
iface eth2 inet dhcp' \
|
||||
> /etc/network/interfaces.d/ifcfg-eth2
|
||||
}
|
||||
|
||||
function install_xen_tools {
|
||||
local xen_tools_url
|
||||
xen_tools_url="$1"
|
||||
|
||||
local xen_tools_file
|
||||
xen_tools_file=$(mktemp)
|
||||
|
||||
wget -qO "$xen_tools_file" "$xen_tools_url"
|
||||
dpkg -i "$xen_tools_file"
|
||||
rm "$xen_tools_file"
|
||||
}
|
||||
|
||||
function install_xapi_plugin {
|
||||
local nova_url
|
||||
nova_url="$1"
|
||||
|
||||
local nova_zipball
|
||||
nova_zipball=$(mktemp)
|
||||
|
||||
local nova_sources
|
||||
nova_sources=$(mktemp -d)
|
||||
|
||||
wget -qO "$nova_zipball" "$nova_url"
|
||||
unzip "$nova_zipball" -d "$nova_sources"
|
||||
cp $nova_sources/plugins/xenserver/xenapi/etc/xapi.d/plugins/* /etc/xapi.d/plugins/
|
||||
rm "$nova_zipball"
|
||||
rm -rf "$nova_sources"
|
||||
}
|
||||
|
||||
function install_xenapi_sdk {
|
||||
local xenapi_url
|
||||
xenapi_url="$1"
|
||||
|
||||
local xenapi_zipball
|
||||
xenapi_zipball=$(mktemp)
|
||||
|
||||
local xenapi_sources
|
||||
xenapi_sources=$(mktemp -d)
|
||||
|
||||
wget -qO "$xenapi_zipball" "$xenapi_url"
|
||||
unzip "$xenapi_zipball" -d "$xenapi_sources"
|
||||
tar -xf $xenapi_sources/*.tar
|
||||
cp $xenapi_sources/XenAPI-*/XenAPI.py /usr/lib/python2.7/distpackages/
|
||||
rm "$xenapi_zipball"
|
||||
rm -rf "$xenapi_sources"
|
||||
}
|
||||
|
||||
function create_novacompute_conf {
|
||||
local username
|
||||
username="$1"
|
||||
|
||||
local password
|
||||
password="$2"
|
||||
|
||||
echo '[DEFAULT]
|
||||
compute_driver=xenapi.XenAPIDriver
|
||||
[xenserver]
|
||||
connection_url=http://10.219.10.22
|
||||
connection_username=$username
|
||||
connection_password=$password' \
|
||||
> /etc/nova/nova-compute.conf
|
||||
}
|
||||
|
||||
setup_himn
|
||||
install_xen_tools "http://xen-tools.org/software/xen-tools/xen-tools_4.5-1_all.deb"
|
||||
install_xapi_plugin "https://codeload.github.com/openstack/nova/zip/2014.2.2"
|
||||
install_xenapi_sdk "https://pypi.python.org/packages/source/X/XenAPI/XenAPI-1.2.tar.gz"
|
||||
create_novacompute_conf "$username_text" "$password_text"
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
function clear_images {
|
||||
for ID in $(glance image-list | awk 'NR>2{print $2}' | grep -v '^$');
|
||||
do
|
||||
glance image-delete $ID
|
||||
done
|
||||
}
|
||||
|
||||
function create_image {
|
||||
local image_name
|
||||
image_name="$1"
|
||||
|
||||
local vm_mode
|
||||
vm_mode="$2"
|
||||
|
||||
local image_url
|
||||
image_url="$3"
|
||||
|
||||
local image_file
|
||||
image_file=$(mktemp)
|
||||
|
||||
wget -qO "$image_file" "$image_URL"
|
||||
glance image-create \
|
||||
--name "$image_name" \
|
||||
--container-format ovf \
|
||||
--disk-format vhd \
|
||||
--property vm_mode="$vm_mode" \
|
||||
--is-public True \
|
||||
--file "$image_file"
|
||||
|
||||
rm "$image_file"
|
||||
}
|
||||
|
||||
source /root/openrc
|
||||
|
||||
clear_images
|
||||
create_image "TestVM" "xen" "http://ca.downloads.xensource.com/OpenStack/cirros-0.3.3-x86_64-disk.vhd"
|
||||
create_image "F17-x86_64-cfntools" "hvm" "http://ca.downloads.xensource.com/OpenStack/F21-x86_64-cfntools.tgz"
|
|
@ -1 +0,0 @@
|
|||
#!/bin/bash
|
|
@ -3,7 +3,7 @@ name: xenserver-fuel-plugin
|
|||
# Human-readable name for your plugin
|
||||
title: Xenserver Plugin
|
||||
# Plugin version
|
||||
version: '0.0.1'
|
||||
version: '0.0.2'
|
||||
# Description
|
||||
description: Enable Mirantis OpenStack to integrate with Xenserver
|
||||
# Required fuel version
|
||||
|
|
|
@ -6,7 +6,13 @@
|
|||
stage: post_deployment
|
||||
type: shell
|
||||
parameters:
|
||||
cmd: ./deploy.sh
|
||||
cmd: ./controller_post_deployment.sh
|
||||
timeout: 42
|
||||
- role: ['compute']
|
||||
stage: post_deployment
|
||||
type: shell
|
||||
parameters:
|
||||
cmd: ./compute_post_deployment.sh
|
||||
timeout: 42
|
||||
# Task is applied for all roles
|
||||
- role: '*'
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
- pk: 10
|
||||
extend: *base_release
|
||||
fields:
|
||||
name: "Juno+Citrix XenServer on Ubuntu 14.04.1"
|
||||
version: "2014.2.2-6.1"
|
||||
|
@ -233,6 +231,9 @@
|
|||
- "settings:storage.objects_ceph.value": false
|
||||
- "settings:storage.ephemeral_ceph.value": false
|
||||
- "settings:storage.images_ceph.value": false
|
||||
restrictions:
|
||||
- condition: "'XenServer' in cluster:name"
|
||||
action: disable
|
||||
- data: "enable"
|
||||
label: "dialog.create_cluster_wizard.storage.ceph_enable"
|
||||
bind:
|
||||
|
@ -241,9 +242,12 @@
|
|||
- "settings:storage.ephemeral_ceph.value": true
|
||||
- "settings:storage.images_ceph.value": true
|
||||
- "settings:storage.volumes_lvm.value": false
|
||||
restrictions:
|
||||
- condition: "settings:common.libvirt_type.value == 'xen'"
|
||||
action: disable
|
||||
restrictions:
|
||||
- condition: "'XenServer' in cluster:name"
|
||||
action: disable
|
||||
restrictions:
|
||||
- condition: "'XenServer' in cluster:name"
|
||||
action: disable
|
||||
AdditionalServices:
|
||||
sahara:
|
||||
type: "checkbox"
|
||||
|
@ -251,19 +255,28 @@
|
|||
description: "dialog.create_cluster_wizard.additional.install_sahara_description"
|
||||
bind: "settings:additional_components.sahara.value"
|
||||
weight: 10
|
||||
restrictions:
|
||||
- condition: "'XenServer' in cluster:name"
|
||||
action: disable
|
||||
murano:
|
||||
type: "checkbox"
|
||||
label: "dialog.create_cluster_wizard.additional.install_murano"
|
||||
description: "dialog.create_cluster_wizard.additional.install_murano_description"
|
||||
bind: "settings:additional_components.murano.value"
|
||||
weight: 20
|
||||
restrictions:
|
||||
- condition: "'XenServer' in cluster:name"
|
||||
action: disable
|
||||
ceilometer:
|
||||
type: "checkbox"
|
||||
label: "dialog.create_cluster_wizard.additional.install_ceilometer"
|
||||
description: "dialog.create_cluster_wizard.additional.install_ceilometer_description"
|
||||
bind: "settings:additional_components.ceilometer.value"
|
||||
weight: 30
|
||||
restrictions:
|
||||
- condition: "'XenServer' in cluster:name"
|
||||
action: disable
|
||||
restrictions:
|
||||
- condition: "settings:common.libvirt_type.value == 'xen'"
|
||||
- condition: "'XenServer' in cluster:name"
|
||||
action: disable
|
||||
Ready: {}
|
Loading…
Reference in New Issue