cc1
v2.1
CC1 source code docs
Main Page
Related Pages
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Pages
s008_configure_nodes.py
Go to the documentation of this file.
1
# -*- coding: utf-8 -*-
2
# @COPYRIGHT_begin
3
#
4
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5
#
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
9
#
10
# http://www.apache.org/licenses/LICENSE-2.0
11
#
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
17
#
18
# @COPYRIGHT_end
19
20
from
settings
import
SERVICES_TMP, BASIC_IMAGE, SSH_KEY, SYSTEM_VERSION, DEB_REPO
21
22
from
scripts.s003_install_services
import
cm_net_cm_cluster, node04, node05
23
24
node_config =
'''
25
# This configuration file is writtem as python script. All of variables are
26
# passed to the environ. You MUST edit this before node configuration! Otherwise
27
# changess will take no effect!
28
29
# First, change it to True
30
CONFIGURED=True
31
32
##################################
33
# Network Configuration #
34
##################################
35
36
# Put here all interfaces, which will be used for communication between virtual machines.
37
# This is used to inform quagga which interfaces will announce OSPF multicasts. Parameters:
38
# - interface - interface name
39
# - network - network address behind this interface
40
# - mask - network mask for this interface
41
# - cost - routing cost through this iface
42
# - auth_token - routing token
43
# The router.id is generated from first interface's ip from this list
44
# First interface is also used to create public ip aliases
45
INTERFACES=[
46
{'interface': 'eth1', 'network': '10.103.0.0', 'mask': '24', 'cost': 3, 'auth_token': 'ospf_token'},
47
]
48
49
# Quagga enable password (for zebra and ospfd)
50
QUAGGA_PASSWD="terefere"
51
52
# List all hosts and networks, which should be denied to connect with node. Usually
53
# this are networks for virtual machines
54
DENY_HOSTS=[
55
'192.168.0.0/16',
56
]
57
58
NTPD_SERVER="10.10.0.1"
59
60
##################################
61
# System configuration #
62
##################################
63
64
# Username and uid used to manage node:
65
CC_USERNAME="cc1"
66
CC_USERID="331"
67
CC_GROUPID="331"
68
69
# Homedir fir this user
70
CC_HOME="/var/lib/cc1/"
71
72
# Public part of ssh key
73
CC_SSH_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwd4UIdkg8naHRXNjenVoS7DBGql3/+LzNmpQi4Dj7YjpYKvK6Xi1coh5PnbK8OSg1mr8reip2/WSP+fxXIpCf0wunUq7vEHgC9WCOT6c/cqdtXCOZA/ijfFsDgGRO62pYk+igi8iklbkdZqDYd/oB8ev93f6dwK/EJuYMMelYcVHaqL/0Y/32TdDgjJJr9iFrT/fu1LF4yqFnlwvy2GiApFS0HOlRDP0n4EGvuiOSjVNXFySXCk9NZGwqQKvirzNmcIsrbAguzN/IOj0o1DQ7weQfdQqD9sAmOinzgUBfU1+lyYcxCwF+Dy2n6cB9yyZizc/FBn4dqWb4/Fl9RMGR root@PSK"
74
75
IMAGES_PATH="/test_pool/"
76
77
CM_ADDRESS="%(CM_RMI)s:8003"
78
79
HOOK_LOGS="/var/log/cc1/hook.log"
80
'''
% {
'CM_RMI'
: cm_net_cm_cluster}
81
82
node_config_file = open(
'%s/node_config.py'
% SERVICES_TMP,
'w'
)
83
node_config_file.write(node_config)
84
node_config_file.close()
85
86
actions = []
87
88
# Copy config
89
actions.append({
'type'
:
'exec'
,
'command'
:
'ssh'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'root@%s'
% node04,
'mkdir -p /etc/cc1/conf/'
],
'wait_response'
:
'r == 0'
,
'wait_max'
: 120})
90
actions.append({
'type'
:
'exec'
,
'command'
:
'ssh'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'root@%s'
% node05,
'mkdir -p /etc/cc1/conf/'
],
'wait_response'
:
'r == 0'
,
'wait_max'
: 120})
91
actions.append({
'type'
:
'exec'
,
'command'
:
'scp'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'%s/node_config.py'
% SERVICES_TMP,
'root@%s:/etc/cc1/conf/node.py'
% node04]})
92
actions.append({
'type'
:
'exec'
,
'command'
:
'scp'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'%s/node_config.py'
% SERVICES_TMP,
'root@%s:/etc/cc1/conf/node.py'
% node05]})
93
# Instal package
94
actions.append({
'type'
:
'exec'
,
'command'
:
'ssh'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'root@%s'
% node04,
'echo deb %s wheezy main >> /etc/apt/sources.list'
% DEB_REPO],
'wait_response'
:
'r == 0'
,
'wait_max'
: 120})
95
actions.append({
'type'
:
'exec'
,
'command'
:
'ssh'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'root@%s'
% node05,
'echo deb %s wheezy main >> /etc/apt/sources.list'
% DEB_REPO],
'wait_response'
:
'r == 0'
,
'wait_max'
: 120})
96
97
actions.append({
'type'
:
'exec'
,
'command'
:
'ssh'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'root@%s'
% node04,
'apt-get update'
],
'wait_response'
:
'r == 0'
,
'wait_max'
: 40})
98
actions.append({
'type'
:
'exec'
,
'command'
:
'ssh'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'root@%s'
% node05,
'apt-get update'
],
'wait_response'
:
'r == 0'
,
'wait_max'
: 40})
99
100
actions.append({
'type'
:
'exec'
,
'command'
:
'ssh'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'root@%s'
% node04,
'''apt-get -o Dpkg::Options::="--force-confold" --yes --force-yes install cc1-node-conf-%s'''
% SYSTEM_VERSION],})
101
actions.append({
'type'
:
'exec'
,
'command'
:
'ssh'
,
'args'
: [
'-i'
,
'%s/id_test'
% SERVICES_TMP,
'root@%s'
% node05,
'''apt-get -o Dpkg::Options::="--force-confold" --yes --force-yes install cc1-node-conf-%s'''
% SYSTEM_VERSION],})
102
clm
old-tests
scripts
s008_configure_nodes.py
Generated on Wed Jun 18 2014 13:32:54 for cc1 by
1.8.1.2