Commit f4a371c6 authored by Alain Takoudjou's avatar Alain Takoudjou

First Openstack-Compute Autoconfigure Node

parent f71776d4
......@@ -7,11 +7,7 @@
parts =
certificate-authority
kvm-instance
kvm-controller-instance
kvm-promise
tunnel-ipv6-ssh
tunnel-ipv6-http
tunnel-ipv6-https
tunnel-ipv6-keystone
tunnel-ipv6-keystone-admin
tunnel-ipv6-keystone-compute
......@@ -22,6 +18,7 @@ parts =
tunnel-ipv6-novadb
tunnel-ipv6-rabbit
tunnel-ipv6-ec2
nova-configure
websockify-sighandler
novnc-promise
publish-kvm-connection-information
......@@ -42,6 +39,8 @@ promises = $${:etc}/promise
novnc-conf = $${:etc}/novnc
run = $${:var}/run
ca-dir = $${:srv}/ssl
nova = $${:bin}/nova
log = $${:var}/log
[create-mac]
recipe = slapos.cookbook:generate.mac
......@@ -52,56 +51,99 @@ recipe = slapos.cookbook:generate.password
storage-path = $${directory:srv}/passwd
bytes = 8
[gen-kvm-run]
[kvm-instance]
recipe = slapos.cookbook:kvm
vnc-passwd = $${gen-passwd:passwd}
ipv4 = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6}
vnc-ip = $${:ipv4}
vnc-port = 5901
# XXX-Cedric: should be named "default-cdrom-iso"
default-disk-image = ${debian-amd64-netinst.iso:location}/${debian-amd64-netinst.iso:filename}
nbd-host = $${slap-parameter:nbd-host}
nbd-port = $${slap-parameter:nbd-port}
nbd2-host = $${slap-parameter:nbd2-host}
nbd2-port = $${slap-parameter:nbd2-port}
tap-interface = $${slap-network-information:network-interface}
disk-path = $${directory:srv}/virtual.qcow2
disk-size = $${slap-parameter:disk-size}
disk-type = $${slap-parameter:disk-type}
socket-path = $${directory:var}/qmp_socket
pid-file-path = $${directory:run}/kvm_run.pid
smp-count = $${slap-parameter:cpu-count}
ram-size = $${slap-parameter:ram-size}
mac-address = $${create-mac:mac-address}
# XXX-Cedric: should be named runner-wrapper-path and controller-wrapper-path
runner-path = $${directory:services}/kvm
controller-path = $${directory:scripts}/kvm_controller
use-tap = False
nat-rules = 22 80 443
6tunnel-wrapper-path = $${directory:services}/6tunnel
virtual-hard-drive-url = $${slap-parameter:virtual-hard-drive-url}
virtual-hard-drive-md5sum = $${slap-parameter:virtual-hard-drive-md5sum}
shell-path = ${dash:location}/bin/dash
qemu-path = ${kvm:location}/bin/qemu-system-x86_64
qemu-img-path = ${kvm:location}/bin/qemu-img
6tunnel-path = ${6tunnel:location}/bin/6tunnel
[kvm-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/vnc_promise
hostname = $${kvm-instance:vnc-ip}
port = $${kvm-instance:vnc-port}
[ssh-port-check]
recipe = slapos.cookbook:check_port_listening
path = $${directory:nova}/ssh_port_check
hostname = $${tunnel-ipv6-ssh:ipv4}
port = $${tunnel-ipv6-ssh:ipv4-port}
[nova-conf]
recipe = slapos.recipe.template
url = ${kvm-run:location}/${kvm-run:filename}
output = $${directory:bin}/kvm_run_raw
url = ${compute-script:location}/${compute-script:filename}
output = $${directory:nova}/nova_configure.sh
mode = 0700
software_type = compute
python_path = ${buildout:executable}
disk_path = $${directory:srv}/virtual.qcow2
qemu_img_path = ${kvm:location}/bin/qemu-img
disk_size = $${slap-parameter:disk-size}
vnc_ip = $${slap-network-information:local-ipv4}
qemu_path = ${kvm:location}/bin/qemu-system-x86_64
mac_address = $${create-mac:mac-address}
smp_count = $${slap-parameter:cpu-count}
ram_size = $${slap-parameter:ram-size}
disk_type = $${slap-parameter:disk-type}
boot_disk_path = $${directory:srv}/boot.qcow2
socket_path = $${directory:var}/qmp_socket
pid_file_path = $${directory:run}/kvm_run.pid
nbd_ip = $${slap-parameter:nbd-ip}
nbd_port = 1024
vnc_port = 5901
[gen-kvm-controller]
nova-url = https://github.com/openstack/nova.git
slap-ipv4 = $${slap-network-information:local-ipv4}
nova-passwd = $${slap-parameter:master-passwd}
vnc-url = $${request-openstack-vnc-frontend:connection-url}
nova-host = $${slap-parameter:host}
[nova-conf-run]
recipe = slapos.recipe.template
url = ${kvm-controller:location}/${kvm-controller:filename}
output = $${directory:bin}/kvm_controller_raw
url = ${compute-script-run:location}/${compute-script-run:filename}
output = $${directory:nova}/nova_configure.py
mode = 0700
host-ip = $${tunnel-ipv6-ssh:ipv6}
ssh-port = $${tunnel-ipv6-ssh:ipv6-port}
system-user = $${slap-parameter:system-user}
system-passwd = $${slap-parameter:system-passwd}
nova-configure = $${nova-conf:output}
nova-result = $${directory:log}
ssh-check-script = $${ssh-port-check:path}
python_path = ${buildout:executable}
socket_path = $${directory:var}/qmp_socket
vnc_passwd = $${gen-passwd:passwd}
[kvm-controller-instance]
recipe = slapos.cookbook:wrapper
command-line = $${gen-kvm-controller:output}
wrapper-path = $${directory:scripts}/kvm_controller
eggs-dir = ${buildout:eggs-directory}
[kvm-instance]
[nova-configure]
recipe = slapos.cookbook:wrapper
command-line = $${gen-kvm-run:output}
wrapper-path = $${directory:services}/kvm
command-line = $${nova-conf-run:output}
wrapper-path = $${directory:scripts}/nova-configure
[kvm-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/vnc_promise
hostname = $${gen-kvm-run:vnc_ip}
port = $${gen-kvm-run:vnc_port}
##########CONFIGURE TUNNELS##########################
[tunnel-ipv6-base]
recipe = slapos.cookbook:ipv6toipv4
ipv6 = $${slap-network-information:global-ipv6}
......@@ -117,22 +159,28 @@ shell-path = ${dash:location}/bin/dash
6tunnel-path = ${6tunnel:location}/bin/6tunnel
[tunnel-ipv6-ssh]
<= tunnel-ipv6-base
ipv6-port = 22222
ipv4-port = 22222
runner-path = $${directory:services}/6tunnel-ssh
ipv6-port = 10022
ipv4-port = 10022
ipv6 = $${slap-network-information:global-ipv6}
ipv4 = $${slap-network-information:local-ipv4}
[tunnel-ipv6-http]
<= tunnel-ipv6-base
ipv6-port = 80
ipv4-port = 80
runner-path = $${directory:services}/6tunnel-http
#[tunnel-ipv6-ssh]
#<= tunnel-ipv6-base
#ipv6-port = 22222
#ipv4-port = 10022
#runner-path = $${directory:services}/6tunnel-ssh
[tunnel-ipv6-https]
<= tunnel-ipv6-base
ipv6-port = 443
ipv4-port = 443
runner-path = $${directory:services}/6tunnel-https
#[tunnel-ipv6-http]
#<= tunnel-ipv6-base
#ipv6-port = 80
#ipv4-port = 10080
#runner-path = $${directory:services}/6tunnel-http
#[tunnel-ipv6-https]
#<= tunnel-ipv6-base
#ipv6-port = 443
#ipv4-port = 10443
#runner-path = $${directory:services}/6tunnel-https
[tunnel-ipv6-keystone]
<= tunnel-ipv4-to6
......@@ -153,7 +201,7 @@ ipv4-port = 8774
runner-path = $${directory:services}/6tunnel-keystone-compute
[tunnel-ipv6-novnc]
<= tunnel-ipv4-to6
<= tunnel-ipv6-base
ipv6-port = 6080
ipv4-port = 6080
runner-path = $${directory:services}/6tunnel-novnc
......@@ -165,7 +213,7 @@ ipv4-port = 9292
runner-path = $${directory:services}/6tunnel-glance
[tunnel-ipv6-spice]
<= tunnel-ipv4-to6
<= tunnel-ipv6-base
ipv6-port = 6082
ipv4-port = 6082
runner-path = $${directory:services}/6tunnel-spice
......@@ -195,13 +243,15 @@ ipv6-port = 3306
ipv4-port = 3306
runner-path = $${directory:services}/6tunnel-novadb
#########INSTALL NOVNC FOR KVM IMAGE################
[novnc-instance]
recipe = slapos.cookbook:novnc
path = $${ca-novnc:executable}
ip = $${slap-network-information:global-ipv6}
port = 6081
vnc-ip = $${gen-kvm-run:vnc_ip}
vnc-port = $${gen-kvm-run:vnc_port}
port = 6090
vnc-ip = $${kvm-instance:vnc-ip}
vnc-port = $${kvm-instance:vnc-port}
novnc-location = ${noVNC:location}
websockify-path = ${buildout:directory}/bin/websockify
ssl-key-path = $${ca-novnc:key-file}
......@@ -251,9 +301,10 @@ recipe = slapos.cookbook:generic.slapmonitor
db-path = $${directory:srv}/slapmonitor_database
##############REQUEST FRONTEND AND PUBLISH CONNEXION PARAMETERS############
[request-slave-frontend]
recipe = slapos.cookbook:requestoptional
software-url = $${slap-parameter:frontend-software-url}
software-url = $${slap-parameter:kvm-frontend-url}
server-url = $${slap-connection:server-url}
key-file = $${slap-connection:key-file}
cert-file = $${slap-connection:cert-file}
......@@ -269,27 +320,57 @@ return = url resource port domainname
#sla = instance_guid
#sla-instance_guid = $${slap-parameter:frontend-instance-guid}
[request-openstack-vnc-frontend]
recipe = slapos.cookbook:requestoptional
software-url = $${slap-parameter:kvm-frontend-url}
server-url = $${slap-connection:server-url}
key-file = $${slap-connection:key-file}
cert-file = $${slap-connection:cert-file}
computer-id = $${slap-connection:computer-id}
partition-id = $${slap-connection:partition-id}
name = OpenStack VNC Frontend
software-type = $${slap-parameter:frontend-software-type}
slave = true
config = host port
config-host = $${slap-network-information:global-ipv6}
config-port = $${tunnel-ipv6-novnc:ipv6-port}
return = url resource port domainname
sla = instance_guid
sla-instance_guid = $${slap-parameter:frontend-instance-guid}
[publish-kvm-connection-information]
recipe = slapos.cookbook:publish
vnc-backend-url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_auto.html?host=[$${novnc-instance:ip}]&port=$${novnc-instance:port}&encrypt=1
vnc-password = $${gen-passwd:passwd}
vnc-url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-slave-frontend:connection-domainname}&port=$${request-slave-frontend:connection-port}&encrypt=1&path=$${request-slave-frontend:connection-resource}
ssh = ssh stack@$${tunnel-ipv6-ssh:ipv6} -p $${tunnel-ipv6-ssh:ipv6-port}
ssh-defaul-passwd = openstack
vnc-backend-url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_auto.html?host=[$${novnc-instance:ip}]&port=$${novnc-instance:port}&encrypt=1&password=$${kvm-instance:vnc-passwd}
vnc-url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-slave-frontend:connection-domainname}&port=$${request-slave-frontend:connection-port}&encrypt=1&path=$${request-slave-frontend:connection-resource}&password=$${kvm-instance:vnc-passwd}
ssh = ssh $${slap-parameter:system-user}@$${tunnel-ipv6-ssh:ipv6} -p $${tunnel-ipv6-ssh:ipv6-port}
ssh-defaul-passwd = $${slap-parameter:system-passwd}
local-ipv4 = $${slap-network-information:local-ipv4}
[slap-parameter]
# Default values if not specified
#frontend-instance-guid = SOFTINST-81
frontend-software-type = frontend
frontend-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg
kvm-frontend-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg
frontend-instance-guid =
ram-size = 2048
disk-size = 20
disk-type = virtio
cpu-count = 4
nbd-ip = 2001:470:1f14:169:dd6b:3f84:9205:c750
nbd-port = 1024
nbd-host = 2001:470:1f14:169:dd6b:3f84:9205:c750
nbd2-port = 1024
nbd2-host =
domain =
master-address = 2001:470:1f14:169:dd6b:3f84:9205:73a4
master-address = 2001:470:1f14:169:dd6b:3f84:9205:cd50
master-passwd = openstack
system-user = stack
system-passwd = openstack
#XXX- This host name should be changed as soon as possible, to avoid having two or more identical
#compute host name on the same openstack-Manager node.
host = nova.compute-$${slap-connection:computer-id}
virtual-hard-drive-url =
virtual-hard-drive-md5sum =
\ No newline at end of file
......@@ -7,7 +7,6 @@
parts =
certificate-authority
kvm-instance
kvm-controller-instance
tunnel-ipv6-ssh
tunnel-ipv6-http
tunnel-ipv6-https
......@@ -53,55 +52,57 @@ recipe = slapos.cookbook:generate.password
storage-path = $${directory:srv}/passwd
bytes = 8
[gen-kvm-run]
recipe = slapos.recipe.template
url = ${kvm-run:location}/${kvm-run:filename}
output = $${directory:bin}/kvm_run_raw
mode = 0700
software_type = main
python_path = ${buildout:executable}
disk_path = $${directory:srv}/virtual.qcow2
qemu_img_path = ${kvm:location}/bin/qemu-img
disk_size = $${slap-parameter:disk-size}
vnc_ip = $${slap-network-information:local-ipv4}
qemu_path = ${kvm:location}/bin/qemu-system-x86_64
mac_address = $${create-mac:mac-address}
smp_count = $${slap-parameter:cpu-count}
ram_size = $${slap-parameter:ram-size}
disk_type = $${slap-parameter:disk-type}
boot_disk_path = $${directory:srv}/boot.qcow2
socket_path = $${directory:var}/qmp_socket
pid_file_path = $${directory:run}/kvm_run.pid
nbd_ip = $${slap-parameter:nbd-ip}
nbd_port = 1024
vnc_port = 5901
[gen-kvm-controller]
recipe = slapos.recipe.template
url = ${kvm-controller:location}/${kvm-controller:filename}
output = $${directory:bin}/kvm_controller_raw
mode = 0700
python_path = ${buildout:executable}
socket_path = $${directory:var}/qmp_socket
vnc_passwd = $${gen-passwd:passwd}
[kvm-controller-instance]
recipe = slapos.cookbook:wrapper
command-line = $${gen-kvm-controller:output}
wrapper-path = $${directory:scripts}/kvm_controller
[kvm-instance]
recipe = slapos.cookbook:wrapper
command-line = $${gen-kvm-run:output}
wrapper-path = $${directory:services}/kvm
recipe = slapos.cookbook:kvm
vnc-passwd = $${gen-passwd:passwd}
ipv4 = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6}
vnc-ip = $${:ipv4}
vnc-port = 5901
# XXX-Cedric: should be named "default-cdrom-iso"
default-disk-image = ${debian-amd64-netinst.iso:location}/${debian-amd64-netinst.iso:filename}
nbd-host = $${slap-parameter:nbd-host}
nbd-port = $${slap-parameter:nbd-port}
nbd2-host = $${slap-parameter:nbd2-host}
nbd2-port = $${slap-parameter:nbd2-port}
tap-interface = $${slap-network-information:network-interface}
disk-path = $${directory:srv}/virtual.qcow2
disk-size = $${slap-parameter:disk-size}
disk-type = $${slap-parameter:disk-type}
socket-path = $${directory:var}/qmp_socket
pid-file-path = $${directory:run}/kvm_run.pid
smp-count = $${slap-parameter:cpu-count}
ram-size = $${slap-parameter:ram-size}
mac-address = $${create-mac:mac-address}
# XXX-Cedric: should be named runner-wrapper-path and controller-wrapper-path
runner-path = $${directory:services}/kvm
controller-path = $${directory:scripts}/kvm_controller
use-tap = False
nat-rules = 22, 80, 443, 5000, 6080, 6082, 3333, 9292, 3306, 35357
6tunnel-wrapper-path = $${directory:services}/6tunnel
virtual-hard-drive-url = $${slap-parameter:virtual-hard-drive-url}
virtual-hard-drive-md5sum = $${slap-parameter:virtual-hard-drive-md5sum}
shell-path = ${dash:location}/bin/dash
qemu-path = ${kvm:location}/bin/qemu-system-x86_64
qemu-img-path = ${kvm:location}/bin/qemu-img
6tunnel-path = ${6tunnel:location}/bin/6tunnel
[kvm-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/vnc_promise
hostname = $${gen-kvm-run:vnc_ip}
port = $${gen-kvm-run:vnc_port}
hostname = $${kvm-instance:vnc_ip}
port = $${kvm-instance:vnc_port}
[tunnel-ipv6-base]
recipe = slapos.cookbook:ipv6toipv4
......@@ -113,80 +114,80 @@ shell-path = ${dash:location}/bin/dash
[tunnel-ipv6-ssh]
<= tunnel-ipv6-base
ipv6-port = 22222
ipv4-port = 22222
ipv4-port = 10022
runner-path = $${directory:services}/6tunnel-ssh
[tunnel-ipv6-http]
<= tunnel-ipv6-base
ipv6-port = 80
ipv4-port = 80
ipv6-port = 8080
ipv4-port = 10080
runner-path = $${directory:services}/6tunnel-http
[tunnel-ipv6-https]
<= tunnel-ipv6-base
ipv6-port = 443
ipv4-port = 443
ipv6-port = 4443
ipv4-port = 10443
runner-path = $${directory:services}/6tunnel-https
[tunnel-ipv6-keystone]
<= tunnel-ipv6-base
ipv6-port = 5000
ipv4-port = 5000
ipv4-port = 15000
runner-path = $${directory:services}/6tunnel-keystone
[tunnel-ipv6-keystone-admin]
<= tunnel-ipv6-base
ipv6-port = 35357
ipv4-port = 35357
ipv4-port = 45357
runner-path = $${directory:services}/6tunnel-keystone-admin
[tunnel-ipv6-keystone-compute]
<= tunnel-ipv6-base
ipv6-port = 8774
ipv4-port = 8774
ipv4-port = 18774
runner-path = $${directory:services}/6tunnel-keystone-compute
[tunnel-ipv6-novnc]
<= tunnel-ipv6-base
ipv6-port = 6080
ipv4-port = 6080
ipv4-port = 16080
runner-path = $${directory:services}/6tunnel-novnc
[tunnel-ipv6-glance]
<= tunnel-ipv6-base
ipv6-port = 9292
ipv4-port = 9292
ipv4-port = 19292
runner-path = $${directory:services}/6tunnel-glance
[tunnel-ipv6-rabbit]
<= tunnel-ipv6-base
ipv6-port = 5672
ipv4-port = 5672
ipv4-port = 15672
runner-path = $${directory:services}/6tunnel-rabbit
[tunnel-ipv6-spice]
<= tunnel-ipv6-base
ipv6-port = 6082
ipv4-port = 6082
ipv4-port = 16082
runner-path = $${directory:services}/6tunnel-spice
[tunnel-ipv6-ec2]
<= tunnel-ipv6-base
ipv6-port = 8773
ipv4-port = 8773
ipv4-port = 18773
runner-path = $${directory:services}/6tunnel-ec2
#I don't know if this is really usefull!!
[tunnel-ipv6-s3api]
<= tunnel-ipv6-base
ipv6-port = 3333
ipv4-port = 3333
ipv4-port = 13333
runner-path = $${directory:services}/6tunnel-s3api
[tunnel-ipv6-novadb]
<= tunnel-ipv6-base
ipv6-port = 3306
ipv4-port = 3306
ipv4-port = 13306
runner-path = $${directory:services}/6tunnel-novadb
[novnc-instance]
......@@ -194,8 +195,8 @@ recipe = slapos.cookbook:novnc
path = $${ca-novnc:executable}
ip = $${slap-network-information:global-ipv6}
port = 6090
vnc-ip = $${gen-kvm-run:vnc_ip}
vnc-port = $${gen-kvm-run:vnc_port}
vnc-ip = $${kvm-instance:vnc-ip}
vnc-port = $${kvm-instance:vnc-port}
novnc-location = ${noVNC:location}
websockify-path = ${buildout:directory}/bin/websockify
ssl-key-path = $${ca-novnc:key-file}
......@@ -276,7 +277,7 @@ software-type = $${slap-parameter:frontend-software-type}
slave = true
config = host port
config-host = $${slap-network-information:global-ipv6}
config-port = 6080
config-port = $${tunnel-ipv6-novnc:ipv6-port}
return = url resource port domainname
sla = instance_guid
sla-instance_guid = $${slap-parameter:frontend-instance-guid}
......@@ -289,15 +290,14 @@ name = Frontend OpenStack
software-url = $${slap-parameter:frontend-software-url}
slave = true
config = url custom_domain
config-url = http://[$${slap-network-information:global-ipv6}]:80/
config-url = http://[$${tunnel-ipv6-http:ipv6}]:$${tunnel-ipv6-http:ipv6-port}/
return = site_url
config-custom_domain = $${slap-parameter:domain}
[publish-kvm-connection-information]
recipe = slapos.cookbook:publish
vnc-backend-url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_auto.html?host=[$${novnc-instance:ip}]&port=$${novnc-instance:port}&encrypt=1
vnc-password = $${gen-passwd:passwd}
vnc-url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-slave-frontend:connection-domainname}&port=$${request-slave-frontend:connection-port}&encrypt=1&path=$${request-slave-frontend:connection-resource}
vnc-backend-url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_auto.html?host=[$${novnc-instance:ip}]&port=$${novnc-instance:port}&encrypt=1&password=$${kvm-instance:vnc-passwd}
vnc-url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-slave-frontend:connection-domainname}&port=$${request-slave-frontend:connection-port}&encrypt=1&path=$${request-slave-frontend:connection-resource}&password=$${kvm-instance:vnc-passwd}
ssh = ssh stack@$${tunnel-ipv6-ssh:ipv6} -p $${tunnel-ipv6-ssh:ipv6-port}
ssh-defaul-passwd = openstack
openstack-url = $${request-openstack-frontend:connection-site_url}
......@@ -323,7 +323,13 @@ frontend-instance-guid =
ram-size = 2048
disk-size = 20
disk-type = virtio
virtual-hard-drive-url =
virtual-hard-drive-md5sum =
cpu-count = 4
nbd-ip = 2001:470:1f14:169:dd6b:3f84:9205:c750
nbd-port = 1024
nbd-host = 2001:470:1f14:169:dd6b:3f84:9205:c750
nbd2-port = 1024
nbd2-host =
domain =
......@@ -21,20 +21,21 @@ recipe = z3c.recipe.scripts
eggs =
${lxml-python:egg}
websockify
paramiko
slapos.cookbook
slapos.toolbox
[template-openstack-main]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-main.cfg
md5sum = b8a682bd167655653fb28dcfa9c57f3d
md5sum = 527962a0384547e37998cf055196e073
output = ${buildout:directory}/template-openstack-main.cfg
mode = 0644
[template-openstack-compute]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-compute.cfg
md5sum = 360808856309c4ac83d36ccec18c71ed
md5sum = 4aa88cbefcb9f9bd175f31970e8f8c47
output = ${buildout:directory}/template-openstack-compute.cfg
mode = 0644
......@@ -51,15 +52,15 @@ url = ${:_profile_base_location_}/templates/${:filename}
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[kvm-controller]
[compute-script]
<= template-download
filename = kvm-controller-run.in
md5sum = 04a94f04344a6169af242dea03b8c52d
filename = configure.sh.in
md5sum = 73e5a796b8d27e20167f36732a1c9fad
[kvm-run]
[compute-script-run]
<= template-download
filename = kvm-run.in
md5sum = 7c05088023d252e98aa1574880dd1afb
filename = ssh-configure.py.in
md5sum = bcbeabd3cd8f19d71ec9209d9edfbbf8
[networkcache]
# signature certificates of the following uploaders.
......@@ -108,53 +109,53 @@ signature-certificate-list =
-----END CERTIFICATE-----
[versions]
Jinja2 = 2.7
Jinja2 = 2.7.1
MarkupSafe = 0.18
Werkzeug = 0.9.3
apache-libcloud = 0.13.0
async = 0.6.1
buildout-versions = 1.7
gitdb = 0.5.4
itsdangerous = 0.22
itsdangerous = 0.23
lxml = 3.2.3
meld3 = 0.6.10
pycrypto = 2.6
slapos.cookbook = 0.78.3
slapos.cookbook = 0.80
slapos.recipe.cmmi = 0.2
slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.template = 2.4.2
slapos.toolbox = 0.35.0
slapos.recipe.template = 2.5
slapos.toolbox = 0.35.1
smmap = 0.8.2
websockify = 0.5.1
z3c.recipe.scripts = 1.0.1
# Required by:
# slapos.core==0.35.1
# slapos.toolbox==0.35.0
# slapos.toolbox==0.35.1
Flask = 0.10.1
# Required by:
# slapos.toolbox==0.35.0
# slapos.toolbox==0.35.1
GitPython = 0.3.2.RC1
# Required by:
# slapos.toolbox==0.35.0
# slapos.toolbox==0.35.1
atomize = 0.1.1
# Required by:
# slapos.toolbox==0.35.0
# slapos.toolbox==0.35.1
feedparser = 5.1.3
# Required by:
# slapos.cookbook==0.78.3
# slapos.cookbook==0.80
inotifyx = 0.2.0-1
# Required by:
# slapos.cookbook==0.78.3
# slapos.cookbook==0.80
lock-file = 2.0
# Required by:
# slapos.cookbook==0.78.3
# slapos.cookbook==0.80
netaddr = 0.7.10
# Required by:
......@@ -166,11 +167,11 @@ netifaces = 0.8-1
numpy = 1.7.1
# Required by:
# slapos.toolbox==0.35.0
# slapos.toolbox==0.35.1
paramiko = 1.11.0
# Required by:
# slapos.toolbox==0.35.0
# slapos.toolbox==0.35.1
psutil = 1.0.1
# Required by:
......@@ -178,18 +179,12 @@ psutil = 1.0.1
pyflakes = 0.7.3
# Required by:
# slapos.cookbook==0.78.3
# slapos.cookbook==0.80
pytz = 2013b
# Required by:
# slapos.cookbook==0.78.3
# slapos.core==0.35.1
# slapos.toolbox==0.35.0
setuptools = 0.9.8
# Required by:
# slapos.cookbook==0.78.3
# slapos.toolbox==0.35.0
# slapos.cookbook==0.80
# slapos.toolbox==0.35.1
slapos.core = 0.35.1
# Required by:
......@@ -201,8 +196,8 @@ supervisor = 3.0
unittest2 = 0.5.1
# Required by:
# slapos.cookbook==0.78.3
# slapos.toolbox==0.35.0
# slapos.cookbook==0.80
# slapos.toolbox==0.35.1
xml-marshaller = 0.9.7
# Required by:
......
#!/usr/bin/env bash
#configure.sh: Should install and configure all needed openstack packages.
NETWORK_CONFIG ="/etc/network/interfaces"
BRCTL_EXEC=`which brctl`
GCC_EXEC=`which gcc`
GIT_EXEC=`which git`
NOV_URL="${:nova-url}"
NOVA_CONFIG="/etc/nova/nova.conf"
BASE_DIR=$HOME
EZ_SETUP="http://peak.telecommunity.com/dist/ez_setup.py"
EASY_INSTALL=`which easy_install`
PYTHON=`which python`
NOVA_USER=$USER
IPv4=`ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1`
if [ -z "$IPv4" ];
then IPv4="127.0.0.1"
fi
echo " "
echo " "
echo " "
echo "#########################################################################################"
echo "######### ###########"
echo "######### AUTO CONFIGURE AND INSTALL SCRIPT FOR OPENSTACK NOVA-COMPUTE NODE ###########"
echo "######### ###########"
echo "######### ******Network ip adress: $IPv4 ###########"
echo "######### ###########"
echo "#########################################################################################"
echo " "
echo " "
echo " "
ip link set eth0 promisc on
cat >$NETWORK_CONFIG <<EOF
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
# Bridge network interface for VM networks
auto br100
iface br100 inet static
address 192.168.100.1
netmask 255.255.255.0
bridge_stp off
bridge_fd 0
EOF
if [ -z "$BRCTL_EXEC" -o ! -x "$BRCTL_EXEC" ]; then
apt-get install -y bridge-utils ;
fi
$BRCTL_EXEC addbr br100
#Restart the network to take new network configuration.
/etc/init.d/networking restart
if [ -z "$GCC_EXEC" -o ! -x "$GCC_EXEC" ]; then
apt-get install -y gcc g++ ;
fi
apt-get install -y python-dev
apt-get install -y gnutls-bin gnutls-dev
apt-get install -y libdevmapper-dev libdevmapper
apt-get install -y python-all-dev
apt-get install -y kvm libvirt-bin
apt-get install -y python-libvirt
apt-get install -y libxml2-dev libxslt-dev
apt-get install -y python-lxml
if [ -z "$GIT_EXEC" -o ! -x "$GIT_EXEC" ]; then
apt-get install -y git ;
fi
#Remove all pip tmp cache is to prevent installation failure
rm -rf /tmp/pip_build_root/*
#Install python packages*/
if [ -z "$EASY_INSTALL" -o ! -x "$EASY_INSTALL" ]; then
cd $BASE_DIR; wget $EZ_SETUP -O ez_setup.py ;
$PYTHON $BASE_DIR/ez_setup.py ;
EASY_INSTALL=`which easy_install` ;
fi
$GIT_EXEC clone $NOV_URL $BASE_DIR/nova;
chown -R $NOVA_USER: $BASE_DIR/nova
$EASY_INSTALL pip
$EASY_INSTALL pbr
cd $BASE_DIR/nova; $PYTHON setup.py install
#Create Nova Working directory
mkdir -p /opt/stack
mkdir -p /opt/stack/data
mkdir -p /opt/stack/data/nova
mkdir -p /opt/stack/data/nova/instances
mkdir -p /opt/stack/log
cp -rf $BASE_DIR/nova/etc/nova /etc/
cat >$NOVA_CONFIG <<EOF
[DEFAULT]
firewall_driver = nova.virt.libvirt.firewall.IptablesFirewallDriver
compute_driver = libvirt.LibvirtDriver
flat_interface = eth0
flat_network_bridge = br100
vlan_interface = eth0
public_interface = br100
network_manager = nova.network.manager.FlatDHCPManager
host = ${:nova-host}
glance_api_servers = ${:slap-ipv4}:9292
rabbit_password = ${:nova-passwd}
rabbit_host = ${:slap-ipv4}
rpc_backend = nova.openstack.common.rpc.impl_kombu
ec2_dmz_host = ${:slap-ipv4}
vncserver_proxyclient_address = $IPv4
vncserver_listen = $IPv4
vnc_enabled = true
xvpvncproxy_base_url = http://$IPv4:6081/console
novncproxy_base_url = ${:vnc-url}/vnc_auto.html
logging_exception_prefix = %(color)s%(asctime)s.%(msecs)03d TRACE %(name)s ESC[01;35m%(instance)sESC[00m
logging_debug_format_suffix = ESC[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)dESC[00m
logging_default_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [ESC[00;36m-%(color)s] ESC[01;35m%(instance)s%(color)s%(message)sESC[00m
logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [ESC[01;36m%(request_id)s ESC[00;36m%(user_name)s %(project_name)s%(color)s] ESC[01;35m%(instance)s%(color)s%(message)sESC[00m
instances_path = /opt/stack/data/nova/instances
lock_path = /opt/stack/data/nova
state_path = /opt/stack/data/nova
log_dir = /opt/stack/log
volume_api_class = nova.volume.cinder.API
enabled_apis = ec2,osapi_compute,metadata
instance_name_template = instance-%08x
libvirt_cpu_mode = none
libvirt_type = qemu
sql_connection = mysql://root:${:nova-passwd}@${:slap-ipv4}/nova?charset=utf8
my_ip = $IPv4
osapi_compute_extension = nova.api.openstack.compute.contrib.standard_extensions
s3_port = 3333
s3_host = ${:slap-ipv4}
ec2_host = ${:slap-ipv4}
rabbit_host = ${:slap-ipv4}
osapi_compute_listen = ${:slap-ipv4}
keystone_ec2_url = http://${:slap-ipv4}:5000/v2.0/ec2tokens
default_floating_pool = public
iscsi_ip_prefix = 192.168.100
fixed_range =
force_dhcp_release = True
dhcpbridge_flagfile = /etc/nova/nova.conf
scheduler_driver = nova.scheduler.filter_scheduler.FilterScheduler
rootwrap_config = /etc/nova/rootwrap.conf
api_paste_config = /etc/nova/api-paste.ini
allow_resize_to_same_host = True
auth_strategy = keystone
debug = True
verbose = True
[osapi_v3]
enabled = True
[spice]
enabled = false
html5proxy_base_url = http://$IPv4:6082/spice_auto.html
EOF
NOVA_COMPUTE_EXEX=`which nova-compute`
if [ -z "$EASY_INSTALL" -o ! -x "$EASY_INSTALL" ]; then
echo "ERROR: can't find nova-compute executable file!!!!"
exit 1
fi
#Add Nova-compute in init.d If file not exist now
cat >/etc/init.d/nova-compute <<EOF
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=$NOVA_COMPUTE_EXEX
NAME=nova-compute
DESC="OpenStack Conpute Node"
pid=\`ps ax | egrep nova-compute | egrep nova.conf | cut -d ' ' -f1\`
case "\$1" in
start)
if [ -z "\$pid" ]; then
echo -n "Starting \$DESC: \$NAME"
$NOVA_COMPUTE_EXEX --config-file $NOVA_CONFIG & > /dev/null
else
echo "\$DESC: \$NAME is curently under execution";
fi
echo "."
;;
stop)
if [ -z "\$pid" ]; then
echo " nova-compute isn't running, so not killed" ;
else
kill -TERM \$pid > /dev/null ;
fi
echo "."
;;
restart)
if [ -z "\$pid" ]; then
echo " nova-compute isn't running!!" ;
else
kill -TERM \$pid > /dev/null ;
fi
# Attente d'une seconde avant de continuer le script
sleep 1
$NOVA_COMPUTE_EXEX --config-file $NOVA_CONFIG & > /dev/null
echo "."
;;
status)
if [ -z "\$pid" ]; then
echo " nova-compute: STOPPED/EXITED" ;
else
echo " nova-compute: RUNNING PID:\$pid" ;
fi
echo "."
;;
*)
echo "Usage: /etc/init.d/\$NAME start|stop|restart" >&2
exit 1
;;
esac
exit 0
EOF
chmod +x /etc/init.d/nova-compute
update-rc.d nova-compute defaults
/etc/init.d/nova-compute restart > /dev/null 2>&1
exit 0
......@@ -3,9 +3,11 @@
# BEWARE: It will be overwritten automatically
# Echo client program
import hashlib
import os
import socket
import subprocess
import urllib
def getSocketStatus(host, port):
s = None
......@@ -26,8 +28,19 @@ def getSocketStatus(host, port):
break
return s
# create disk if doesn't exist
disk_path = '${:disk_path}'
virtual_hard_drive_url = '${:virtual-hard-drive-url}'.strip()
virtual_hard_drive_md5_url = '${:virtual-hard-drive-md5-url}'.strip()
# Download existing hard drive if needed at first boot
if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
urllib.urlretrieve(virtual_hard_drive_url, disk_path)
local_md5sum = md5Checksum(disk_path)
md5sum = urllib.urlopen(virtual_hard_drive_md5_url).read().strip()
if local_md5sum != md5sum:
os.remove(disk_path)
raise Exception('MD5 mismatch.')
# create disk if doesn't exist
if not os.path.exists(disk_path):
subprocess.Popen(['${:qemu_img_path}', 'create' ,'-f', 'qcow2',
disk_path, '${:disk_size}G'])
......
#!${:python_path}
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
# Echo client program
import os
import traceback
import sys
import time
pythonPath = []
eggs = '${:eggs-dir}'
for item in os.listdir(eggs):
path = os.path.join(eggs, item)
pythonPath.append(path)
sys.path[0:0] = pythonPath
import paramiko
check_ssh_args = ['${:ssh-check-script}']
password = '${:system-passwd}'
username = '${:system-user}'
port = ${:ssh-port}
hostname = '${:host-ip}'
ssh_run = os.path.join('${:nova-result}', 'nova-configure.log')
ssh_check = os.path.join('${:nova-result}', 'ssh_check.log')
nova_configure = '${:nova-configure}'
def getClient():
try:
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print '*** Connecting...'
client.connect(hostname, port, username, password)
return client
except Exception, e:
print "Could not connect to host... Will retry after a few minutes"
return None
if __name__ == '__main__':
client = None
while not client:
client = getClient()
time.sleep(5)
try:
#Write file configure.sh to use.
sftp = client.open_sftp()
result = sftp.put(nova_configure, 'configure.sh' )
print 'Nova configure copied successfully! File size: %s' % result.st_size
sftp.close()
#Install nova components and services
print "Installing nova..."
install_command = "echo %s | sudo -S /bin/sh configure.sh" % password
stdin, stdout, stderr = client.exec_command(install_command)
with open(ssh_run, 'a') as output:
output.write(stdout.read())
#Check nova service status
print "Checking nova service status..."
nova_command = 'echo %s | sudo -S /etc/init.d/nova-compute status' % password
stdin, stdout, stderr = client.exec_command(nova_command)
with open(ssh_check, 'a') as output:
output.write(stdout.read())
client.close()
except Exception, e:
print '*** Caught exception: %s: %s' % (e.__class__, e)
traceback.print_exc()
try:
client.close()
except:
pass
sys.exit(1)
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment