Browse Source

Déplacement des fichiers depuis eole-one-singlenode

tags/pkg/dev/eole-2.7.0/0.0.1-0
Philippe Caseiro 4 years ago
commit
7a3f95db42
15 changed files with 2638 additions and 0 deletions
  1. 26
    0
      Makefile
  2. 64
    0
      apps.mk
  3. 90
    0
      diagnose/04-virtualisation
  4. 159
    0
      dicos/99_one-master.xml
  5. 4
    0
      eole-one-master.mk
  6. 200
    0
      eole.mk
  7. 76
    0
      hooks/graphicsfw
  8. 83
    0
      init/onenode
  9. 446
    0
      postservice/30-one-mng
  10. 345
    0
      postservice/31-one-netmng
  11. 10
    0
      preservice/30-one-auth
  12. 116
    0
      scripts/onehost_create_all
  13. 181
    0
      scripts/onevm-all
  14. 792
    0
      tmpl/oned.conf
  15. 46
    0
      tmpl/vmm_exec_kvm.conf

+ 26
- 0
Makefile View File

@@ -0,0 +1,26 @@
1
+################################
2
+# Makefile pour eole-libvirt
3
+################################
4
+
5
+SOURCE=eole-one-master
6
+VERSION=0.0.1
7
+EOLE_VERSION=2.4
8
+PKGAPPS=non
9
+#FLASK_MODULE=<APPLICATION>
10
+
11
+################################
12
+# Début de zone à ne pas éditer
13
+################################
14
+
15
+include eole.mk
16
+include apps.mk
17
+
18
+################################
19
+# Fin de zone à ne pas éditer
20
+################################
21
+
22
+# Makefile rules dedicated to application
23
+# if exists
24
+ifneq (, $(strip $(wildcard $(SOURCE).mk)))
25
+include $(SOURCE).mk
26
+endif

+ 64
- 0
apps.mk View File

@@ -0,0 +1,64 @@
1
+# 
2
+# NE PAS EDITER CE FICHIER
3
+#
4
+# Voir Makefile
5
+
6
+
7
+##########################
8
+# Application web envole #
9
+##########################
10
+ifneq (, $(filter oui web, $(PKGAPPS)))
11
+#
12
+# Sanity check
13
+#
14
+ifeq (, $(filter-out X.X, $(strip $(VERSION))))
15
+$(error $$(VERSION) variable has incorrect value '$(VERSION)')
16
+endif
17
+
18
+# Where to store web application files
19
+WEB_PATH				:= $(DESTDIR)/var/www/html
20
+
21
+# Envole
22
+sharenvole_PROG_DIR			:= $(DESTDIR)/usr/share/envole/$(SOURCE)
23
+
24
+src_$(SOURCE)-$(VERSION)_REC_DIR	:= $(WEB_PATH)/$(SOURCE)
25
+src_plugins-$(VERSION)_REC_DIR		:= $(WEB_PATH)/$(SOURCE)/plugin
26
+src_lang-$(VERSION)_REC_DIR		:= $(WEB_PATH)/$(SOURCE)/lang
27
+
28
+endif
29
+
30
+##########################
31
+# Application EOLE flask #
32
+##########################
33
+ifneq (, $(filter flask, $(PKGAPPS)))
34
+#
35
+# Sanity check
36
+#
37
+ifeq (, $(filter-out XXX, $(strip $(FLASK_MODULE))))
38
+$(error $$(FLASK_MODULE) variable has incorrect value '$(FLASK_MODULE)')
39
+endif
40
+
41
+ifeq (, $(strip $(wildcard src/$(FLASK_MODULE).conf)))
42
+$(error missing eoleflask configuration file 'src/$(FLASK_MODULE).conf')
43
+endif
44
+
45
+# Everything is related to mount point
46
+APPS_MOUNT_POINT	:= $(shell sed -ne 's|^"MOUNT_POINT"[[:space:]]*:[[:space:]]*"/\([^"]*\)",|\1|p' \
47
+	src/$(FLASK_MODULE).conf)
48
+
49
+ifeq (, $(strip $(APPS_MOUNT_POINT)))
50
+$(error no "MOUNT_POINT" in eoleflask configuration file 'src/$(FLASK_MODULE).conf')
51
+endif
52
+
53
+# eole-flask configuration
54
+src_DATA_DIR		:= $(DESTDIR)/etc/eole/flask/available
55
+
56
+# Where to store flask application files
57
+FLASK_PATH		:= $(eole_DIR)/flask/$(APPS_MOUNT_POINT)
58
+
59
+# static files
60
+src_$(FLASK_MODULE)_static_REC_DIR	:= $(FLASK_PATH)/static
61
+src_$(FLASK_MODULE)_templates_REC_DIR	:= $(FLASK_PATH)/templates
62
+src_$(FLASK_MODULE)_instance_REC_DIR	:= $(FLASK_PATH)/resources
63
+
64
+endif

+ 90
- 0
diagnose/04-virtualisation View File

@@ -0,0 +1,90 @@
1
+#!/bin/bash
2
+
3
+. /usr/lib/eole/diagnose.sh
4
+
5
+
6
+eKO() {
7
+  EchoRouge "Erreur"
8
+}
9
+
10
+eOK() {
11
+  EchoVert "Ok"
12
+}
13
+
14
+one()
15
+{
16
+  su oneadmin -s /bin/sh -c "$@"
17
+}
18
+
19
+TestServiceStatus() {
20
+  printf ".  %${len_pf}s => " "$1"
21
+  /etc/init.d/$2 status >/dev/null 2>&1
22
+  if [ $? -eq 0 ] ; then
23
+    eOK
24
+  else
25
+    eKO
26
+  fi
27
+}
28
+
29
+eOneStatus() {
30
+    [ "$1" = "STOPPED" -o "$1" = "UNKNOWN" ] && EchoRouge "$1" && return
31
+    [ "$1" = "ACTIVE" ] && EchoVert "$1" && return
32
+    EchoOrange "$1"
33
+}
34
+
35
+
36
+EchoGras "*** Virtualisation"
37
+
38
+if [ "$(CreoleGet 'activer_openvswitch')" != "oui" ]; then
39
+    printf ".  %${len_pf}s => " "Virutalisation"
40
+    EchoOrange "Non actif"
41
+  fi
42
+
43
+TestServiceStatus "libvirt" libvirt-bin
44
+TestServiceStatus "OpenNebula" opennebula
45
+TestService "XMLRPC" "localhost:2633"
46
+TestService "Sunstone" $(CreoleGet "ip_sunstone"):$(CreoleGet "port_sunstone")
47
+TestService "Proxy VNC" $(CreoleGet "ip_sunstone"):$(CreoleGet "vnc_proxy_port_sunstone")
48
+if [ "$(CreoleGet 'activer_oneflow')" == 'oui' ]; then
49
+TestService "OneFlow" $(CreoleGet "ip_oneflow"):$(CreoleGet "port_oneflow")
50
+fi
51
+echo ""
52
+TestServiceStatus "OpenVswitch" openvswitch-switch
53
+echo ""
54
+
55
+if [[ $(CreoleGet activer_onesinglenode 2>&1) == 'oui' ]]
56
+then
57
+  EchoGras "*** Noeuds du cluster Hâpy"
58
+
59
+  NODES=$(one 'onehost list -l ID,NAME,STAT' | awk '!/ID.*NAME.*STAT/ {print $1 ":" $2 ":" $3}')
60
+  for elm in ${NODES}
61
+  do
62
+    node=(${elm//:/ })
63
+    id=${node[0]}
64
+    name=${node[1]}
65
+    state=${node[2]}
66
+
67
+    printf ".  %${len_pf}s => " "$name"
68
+    eOneStatus "${state}"
69
+  done
70
+fi
71
+
72
+EchoGras "*** Machines Virtuelles"
73
+
74
+# Les machines virtuelles se terminant par -TEST ne sont pas vérifiées
75
+VMs=$( one 'onevm list -l ID,NAME,STAT'  | tail -n +2 | grep -ve '\-TEST ' | awk '{print $1}' )
76
+if [[ -z ${VMs} ]]
77
+then
78
+  printf ".  %${len_pf}s " "Pas de machines virtuelles instanciées"
79
+else
80
+  for VM in $VMs ; do
81
+    NAME=$( one "onevm show $VM" | grep 'NAME' | cut -d: -f2 )
82
+    STAT=$(one "onevm show $VM" | grep '^STATE'  | cut -d: -f2 | tr -d ' ' )
83
+    printf ".  %${len_pf}s => " "$NAME"
84
+    eOneStatus "$STAT"
85
+  done
86
+fi
87
+
88
+echo ""
89
+
90
+

+ 159
- 0
dicos/99_one-master.xml View File

@@ -0,0 +1,159 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<creole>
3
+    <files>
4
+        <!--file filelist='onesinglenode' name='/etc/one/sunstone-server.conf' rm='True' mkdir='True'/-->
5
+        <file filelist='onesinglenode' name='/etc/one/vmm_exec/vmm_exec_kvm.conf' rm='True' mkdir='True'/>
6
+        <file filelist='onesinglenode' name='/etc/one/oned.conf' rm='True' mkdir='True'/>
7
+        <service type='service'>opennebula</service>
8
+
9
+        <service_access service='one-ssh'>
10
+          <tcpwrapper>sshd</tcpwrapper>
11
+        </service_access>
12
+
13
+        <service_restriction service='one-ssh'>
14
+          <ip interface='eth0' ip_type='SymLinkOption'>adresse_ip_eth0</ip>
15
+        </service_restriction>
16
+    </files>
17
+    <variables>
18
+        <family name='general'>
19
+            <variable name='nom_machine' redefine='True' auto_freeze='True'/>
20
+        </family>
21
+        <family name='Virtualisation'>
22
+            <variable name='activer_onesinglenode' type='oui/non' description="Activer le serveur de virtualisation" mode='expert'>
23
+                <value>oui</value>
24
+            </variable>
25
+            <variable name='one_cluster_name' type='string' description="Nom de la grappe OpenNebula" mode='expert' auto_freeze='True' mandatory="True">
26
+                <value></value>
27
+            </variable>
28
+            <variable name='vnets'             type='string'  description='Réseaux virtuels Niveau 3' multi='True'/>
29
+            <variable name='vnet_network_addr' type='ip'      description='Adresse du réseau'/>
30
+            <variable name='vnet_network_mask' type='netmask' description='Masque du réseau'/>
31
+            <variable name='vnet_network_dns'  type='ip'      description='Adresse du serveur DNS'/>
32
+            <variable name='vnet_network_gw'   type='ip'      description='Passerelle du réseau'/>
33
+            <variable name='vnet_range_start'  type='ip'      description='Première IP de la plage (si nécessaire)'/>
34
+            <variable name='vnet_range_end'    type='ip'      description='Dernière IP de la plage (si nécessaire)'/>
35
+            <variable name='vnet_vlan_tag'     type='number'  description='Numéro du VLAN'/>
36
+            <variable name='vnet_vlan_trunk'   type='number'  description="VLAN à transporter (trunk)" mode='expert'/>
37
+
38
+            <variable name='l2_vnets'             type='string'  description='Réseaux virtuels Niveau 2' multi='True'/>
39
+            <variable name='l2_vnet_first_mac'    type='string'  description='Première adresse MAC' mode='expert'/>
40
+            <variable name='l2_vnet_size'         type='number'  description="Taille du réseau (en nombre d'adresse MAC)"/>
41
+            <variable name='l2_vnet_vlan_tag'     type='number'  description='Numéro du VLAN'/>
42
+            <variable name='l2_vnet_vlan_trunk'   type='number'  description="VLAN à transporter (trunk)" mode='expert'/>
43
+
44
+            <variable name='one_ds_system_prefix' description="Préfix de l'espace de stockage système" mode='expert' auto_freeze='True'>
45
+                <value>system-</value>
46
+            </variable>
47
+            <variable name='one_ds_iso_name' description="Nom de l'espace de stockage des ISO" mode='expert' auto_freeze='True'>
48
+                <value>iso-images</value>
49
+            </variable>
50
+            <variable name='one_ds_image_name' description="Nom de l'espace de stockage de images disque" mode='expert' auto_freeze='True'>
51
+                <value>images-disques</value>
52
+            </variable>
53
+            <variable name='one_disk_cache' type='oui/non' description='Activer le cache pour les images qcow2 ?' mode='expert'>
54
+                <value>oui</value>
55
+            </variable>
56
+            <variable name='one_video_driver' type='string' description='Driver video par défaut' mode='expert'>
57
+                <value>vga</value>
58
+            </variable>
59
+            <variable name='activer_multinode' description='Activer le mode multi-noeud' mode='expert' type='oui/non'>
60
+                <value>non</value>
61
+            </variable>
62
+            <variable name='one_nodes' type='string' description='Noeud voisin du Cluster' multi='True'/>
63
+            <variable name='node_ip' type='ip' description='Adresse IP du noeud' multi='True'/>
64
+        </family>
65
+    </variables>
66
+
67
+    <constraints>
68
+        <fill name='concat' target='one_cluster_name'>
69
+          <param>CL-</param>
70
+          <param type='eole'>numero_etab</param>
71
+        </fill>
72
+
73
+        <check name='valid_enum' target='one_video_driver'>
74
+            <param>['qxl','vga','std','cirrus']</param>
75
+            <param name='checkval'>False</param>
76
+        </check>
77
+
78
+        <condition name='disabled_if_in' source='activer_onesinglenode'>
79
+            <param>non</param>
80
+            <target type='filelist'>onesinglenode</target>
81
+            <target type='variable'>one_cluster_name</target>
82
+            <target type='variable'>one_ds_system_prefix</target>
83
+            <target type='variable'>one_ds_iso_name</target>
84
+            <target type='variable'>one_ds_image_name</target>
85
+            <target type='variable'>vnets</target>
86
+            <target type='variable'>vnet_network_addr</target>
87
+            <target type='variable'>vnet_network_mask</target>
88
+            <target type='variable'>vnet_network_dns</target>
89
+            <target type='variable'>vnet_network_gw</target>
90
+            <target type='variable'>vnet_range_start</target>
91
+            <target type='variable'>vnet_range_end</target>
92
+            <target type='variable'>vnet_vlan_tag</target>
93
+            <target type='variable'>vnet_vlan_trunk</target>
94
+            <target type='variable'>activer_multinode</target>
95
+            <target type='variable'>l2_vnets</target>
96
+            <target type='variable'>l2_vnet_first_mac</target>
97
+            <target type='variable'>l2_vnet_size</target>
98
+            <target type='variable'>l2_vnet_vlan_tag</target>
99
+            <target type='variable'>l2_vnet_vlan_trunk</target>
100
+        </condition>
101
+
102
+        <condition name='disabled_if_in' source='activer_multinode'>
103
+            <param>non</param>
104
+            <target type='variable'>one_nodes</target>
105
+            <target type='variable'>node_ip</target>
106
+        </condition>
107
+
108
+        <group master='vnets'>
109
+            <slave>vnet_network_addr</slave>
110
+            <slave>vnet_network_dns</slave>
111
+            <slave>vnet_network_mask</slave>
112
+            <slave>vnet_network_gw</slave>
113
+            <slave>vnet_range_start</slave>
114
+            <slave>vnet_range_end</slave>
115
+            <slave>vnet_vlan_tag</slave>
116
+            <slave>vnet_vlan_trunk</slave>
117
+        </group>
118
+
119
+        <group master='l2_vnets'>
120
+            <slave>l2_vnet_first_mac</slave>
121
+            <slave>l2_vnet_size</slave>
122
+            <slave>l2_vnet_vlan_tag</slave>
123
+            <slave>l2_vnet_vlan_trunk</slave>
124
+        </group>
125
+
126
+        <group master='one_nodes'>
127
+            <slave>node_ip</slave>
128
+        </group>
129
+
130
+        <check name='valid_enum' target='vnets'>
131
+            <param>['internet','admin','pedago','dmzpub','dmzpriv','wifi']</param>
132
+            <param name='checkval'>False</param>
133
+        </check>
134
+
135
+        <check name='valid_enum' target='l2_vnets'>
136
+            <param>['internet','admin','pedago','dmzpub','dmzpriv','wifi']</param>
137
+            <param name='checkval'>False</param>
138
+        </check>
139
+
140
+        <condition name='disabled_if_in' source='activer_openvswitch'>
141
+            <param>non</param>
142
+            <target type='variable'>vnet_network_addr</target>
143
+            <target type='variable'>vnet_network_dns</target>
144
+            <target type='variable'>vnet_network_mask</target>
145
+            <target type='variable'>vnet_network_gw</target>
146
+            <target type='variable'>vnet_range_start</target>
147
+            <target type='variable'>vnet_range_end</target>
148
+            <target type='variable'>vnet_vlan_tag</target>
149
+            <target type='variable'>vnet_vlan_trunk</target>
150
+            <target type='variable'>l2_vnet_first_mac</target>
151
+            <target type='variable'>l2_vnet_size</target>
152
+            <target type='variable'>l2_vnet_vlan_tag</target>
153
+            <target type='variable'>l2_vnet_vlan_trunk</target>
154
+        </condition>
155
+    </constraints>
156
+    <help>
157
+        <variable name='activer_onesinglenode'>Interface d'administration du Cluster OpenNebula.</variable>
158
+    </help>
159
+</creole>

+ 4
- 0
eole-one-master.mk View File

@@ -0,0 +1,4 @@
1
+# eole-one-singlenode specific rules
2
+
3
+hooks_PROG_DIR	:= $(DESTDIR)/var/lib/one/remotes/hooks/eole
4
+init_PROG_DIR   := $(DESTDIR)/etc/init.d

+ 200
- 0
eole.mk View File

@@ -0,0 +1,200 @@
1
+# 
2
+# NE PAS EDITER CE FICHIER
3
+#
4
+# Utiliser <appli>.mk à inclure à la fin de Makefile
5
+
6
+#################
7
+# Sanity checks #
8
+#################
9
+
10
+ifeq (, $(DESTDIR))
11
+$(warning $$(DESTDIR) is empty, installation will be done in /)
12
+endif
13
+
14
+ifeq (, $(filter-out XXX-XXX, $(strip $(SOURCE))))
15
+$(error $$(SOURCE) variable has incorrect value '$(SOURCE)')
16
+endif
17
+
18
+#########################
19
+# Variables definitions #
20
+#########################
21
+
22
+INSTALL                 := install
23
+INSTALL_DATA            := install -m 644
24
+INSTALL_PROGRAM         := install -m 755
25
+INSTALL_DIRECTORY       := install -m 755 -d
26
+INSTALL_RECURSIVE       := cp -dr --no-preserve=ownership
27
+
28
+# Standard path
29
+bin_PROG_DIR		:= $(DESTDIR)/usr/bin
30
+sbin_PROG_DIR		:= $(DESTDIR)/usr/sbin
31
+man8_DATA_DIR		:= $(DESTDIR)/usr/share/man/fr.UTF-8/man8
32
+
33
+# Base
34
+eole_DIR                := $(DESTDIR)/usr/share/eole
35
+
36
+ifeq ($(strip $(EOLE_VERSION)), 2.3)
37
+diagnose_PROG_DIR       := $(eole_DIR)/diagnose/module
38
+else
39
+diagnose_PROG_DIR       := $(eole_DIR)/diagnose/
40
+endif
41
+
42
+# Creole
43
+creole_DIR              := $(eole_DIR)/creole
44
+dicos_DATA_DIR          := $(creole_DIR)/dicos
45
+tmpl_DATA_DIR           := $(creole_DIR)/distrib
46
+pretemplate_PROG_DIR    := $(eole_DIR)/pretemplate
47
+posttemplate_PROG_DIR   := $(eole_DIR)/posttemplate
48
+preservice_PROG_DIR    := $(eole_DIR)/preservice
49
+postservice_PROG_DIR    := $(eole_DIR)/postservice
50
+firewall_DATA_DIR       := $(eole_DIR)/firewall
51
+bacula_restore_DATA_DIR := $(eole_DIR)/bacula/restore
52
+bacula_fichier_DATA_DIR := $(DESTDIR)/etc/bacula/baculafichiers.d
53
+ifeq ($(strip $(EOLE_VERSION)), 2.3)
54
+schedule_pre_PROG_DIR   := $(eole_DIR)/schedule/pre
55
+schedule_post_PROG_DIR  := $(eole_DIR)/schedule/post
56
+else
57
+schedule_scripts_PROG_DIR	:= $(eole_DIR)/schedule/scripts
58
+endif
59
+extra_REC_DIR		:= $(creole_DIR)/extra
60
+
61
+# Zéphir
62
+zephir_DATA_DIR         := $(DESTDIR)/usr/share/zephir
63
+zephir_configs_DATA_DIR := $(zephir_DATA_DIR)/monitor/configs
64
+zephir_srv_DATA_DIR     := $(zephir_configs_DATA_DIR)/services
65
+zephir_scripts_PROG_DIR := $(zephir_DATA_DIR)/scripts
66
+
67
+# SSO
68
+sso_DATA_DIR            := $(DESTDIR)/usr/share/sso
69
+sso_filtres_DATA_DIR    := $(sso_DATA_DIR)/app_filters
70
+sso_user-info_DATA_DIR  := $(sso_DATA_DIR)/user_infos
71
+
72
+# EAD
73
+ead_DATA_DIR            := $(DESTDIR)/usr/share/ead2/backend/config
74
+ead_actions_DATA_DIR    := $(ead_DATA_DIR)/actions
75
+ead_perms_DATA_DIR      := $(ead_DATA_DIR)/perms
76
+ead_roles_DATA_DIR      := $(ead_DATA_DIR)/roles
77
+
78
+# Program libraries goes under /usr/lib/<PROGRAM>/
79
+lib_$(SOURCE)_DATA_DIR	:= $(DESTDIR)/usr/lib/$(SOURCE)
80
+
81
+# Scripts Eole
82
+scripts_PROG_DIR        := $(eole_DIR)/sbin
83
+lib_eole_DATA_DIR	:= $(DESTDIR)/usr/lib/eole
84
+
85
+# LDAP
86
+ldap_passwords_DATA_DIR := $(eole_DIR)/annuaire/password_files
87
+
88
+# LXC
89
+lxc_DATA_DIR            := $(eole_DIR)/lxc
90
+lxc_fstab_DATA_DIR      := $(lxc_DATA_DIR)/fstab
91
+lxc_hosts_DATA_DIR	:= $(lxc_DATA_DIR)/hosts
92
+
93
+# SQL
94
+sql_DATA_DIR            := $(eole_DIR)/mysql/$(SOURCE)
95
+sql_gen_DATA_DIR        := $(sql_DATA_DIR)/gen
96
+sql_updates_DATA_DIR    := $(sql_DATA_DIR)/updates
97
+
98
+sql_conf_gen_DATA_DIR		:= $(eole_DIR)/applications/gen
99
+sql_conf_passwords_DATA_DIR	:= $(eole_DIR)/applications/passwords
100
+sql_conf_updates_DATA_DIR	:= $(eole_DIR)/applications/updates/$(SOURCE)
101
+
102
+# Certifs
103
+certs_DATA_DIR		:= $(eole_DIR)/certs
104
+
105
+# Logrotate
106
+logrotate_DATA_DIR      := $(DESTDIR)/etc/logrotate.d
107
+
108
+# Cron
109
+cron_PROG_DIR 		:= $(DESTDIR)/etc/cron.daily
110
+
111
+# Python modules
112
+ifneq ($(DESTDIR),)
113
+PYTHON_OPTS     := --root $(DESTDIR)
114
+endif
115
+
116
+#############################################
117
+# Common directories and files installation #
118
+#############################################
119
+
120
+all:
121
+
122
+install:: install-dirs install-files
123
+
124
+# $1 = command to run
125
+# $2 = source directory
126
+# $3 = destination directory
127
+define fc_install_file  
128
+	if [ -d $2 ]; then					\
129
+		for file in `ls -1 $2/`; do			\
130
+		   $1 $2/$$file $3 || true;			\
131
+	    done;						\
132
+	fi
133
+endef
134
+
135
+##
136
+## Directory creation
137
+##
138
+
139
+# use % to catch local name in $*
140
+# data, program and recursive directory require a corresponding
141
+# directory in local sources
142
+%_DATA_DIR %_PROG_DIR %REC_DIR:
143
+	test ! -d $(subst _,/,$*) || $(INSTALL_DIRECTORY) $($@)
144
+
145
+# Create the directory referenced by the variable without a local one.
146
+%_DIR:
147
+	$(INSTALL_DIRECTORY) $($@)
148
+
149
+##
150
+## Install files present directly under data, program and recursive directories
151
+##
152
+
153
+# $*   : name of variable
154
+# $($*): value of variable 
155
+%-instdata:
156
+	$(call fc_install_file, $(INSTALL_DATA), $(subst _,/,$(subst _DATA_DIR,,$*)), $($*))
157
+
158
+%-instprog:
159
+	$(call fc_install_file, $(INSTALL_PROGRAM), $(subst _,/,$(subst _PROG_DIR,,$*)), $($*))
160
+
161
+%-instrec:
162
+	$(call fc_install_file, $(INSTALL_RECURSIVE), $(subst _,/,$(subst _REC_DIR,,$*)), $($*))
163
+
164
+
165
+# Use second expansion as variables may be created in included
166
+# Makefiles
167
+.SECONDEXPANSION:
168
+
169
+# List of all directories
170
+installdirs_LIST	= $(foreach V, $(filter %_DIR, $(.VARIABLES)),	\
171
+				$(if $(filter file, $(origin $(V))),	\
172
+					$(V)))
173
+# List of data directories
174
+installdata_LIST	= $(filter %_DATA_DIR, $(installdirs_LIST))
175
+# List of program directories
176
+installprog_LIST	= $(filter %_PROG_DIR, $(installdirs_LIST))
177
+# List of recursive directories
178
+installrec_LIST	 	= $(filter %_REC_DIR, $(installdirs_LIST))
179
+
180
+# Expand directories to create as dependency
181
+# Use double-colon to permit user to define additionnal install-dirs
182
+install-dirs:: $$(installdirs_LIST)
183
+
184
+# Expand files to install as dependency
185
+# Use double-colon to permit user to define additionnal install-files
186
+install-files:: install-data-files install-prog-files install-rec-dirs
187
+
188
+install-data-files: $$(patsubst %,%-instdata,$$(installdata_LIST))
189
+
190
+install-prog-files: $$(patsubst %,%-instprog,$$(installprog_LIST))
191
+
192
+install-rec-dirs:   $$(patsubst %,%-instrec,$$(installrec_LIST))
193
+
194
+# Installation of python modules
195
+ifeq ($(shell test -f setup.py && echo 0), 0)
196
+install-files::
197
+	python setup.py install --no-compile --install-layout=deb $(PYTHON_OPTS)
198
+endif
199
+
200
+.PHONY: install install-dirs install-files install-data-files install-prog-files install-rec-dirs

+ 76
- 0
hooks/graphicsfw View File

@@ -0,0 +1,76 @@
1
+#!/bin/bash
2
+
3
+SELF_DIR="$(dirname $(readlink -e ${0}))"
4
+BASE_DIR="$(dirname $(dirname ${SELF_DIR}))"
5
+SCRIPTCOMMON="${BASE_DIR}/scripts_common.sh"
6
+
7
+. ${SCRIPTCOMMON}
8
+
9
+IPTABLES="sudo iptables"
10
+XPATH="${BASE_DIR}/datastore/xpath.rb --stdin --base64"
11
+
12
+RULES_FILE="/run/one/one_graphics_rules"
13
+
14
+function one_get_port()
15
+{
16
+    ${XPATH} ${1} '/VM/TEMPLATE/GRAPHICS/PORT'
17
+}
18
+
19
+function open_port()
20
+{
21
+    declare -a authorized_ip
22
+    declare -a authorized_netmask
23
+
24
+    vm_port=$(one_get_port ${1})
25
+    [[ -z "${vm_port}" ]] && return 2
26
+    authorized_ip=( $(CreoleGet ip_ssh_eth0) )
27
+    [[ -z "${authorized_ip}" ]] && return 2
28
+    authorized_netmask=( $(CreoleGet netmask_ssh_eth0) )
29
+    [[ -z "${authorized_netmask}" ]] && return 2
30
+
31
+    for ((i = 0; i < ${#authorized_ip[*]}; i +=1))
32
+    do
33
+        ${IPTABLES} -I eth0-root -s ${authorized_ip[$i]}/${authorized_netmask[$i]} -p tcp -m tcp --dport ${vm_port} --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
34
+        if [[ $? -eq 0 ]]
35
+        then
36
+            echo "/sbin/iptables -A eth0-root -s ${authorized_ip[$i]}/${authorized_netmask[$i]} -p tcp -m tcp --dport ${vm_port} --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT" >> "${RULES_FILE}"
37
+          fi
38
+        ${IPTABLES} -I eth0-root -s $(CreoleGet one_master_ip) -p tcp -m tcp --dport ${vm_port} --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
39
+        [[ ${?} -eq 0 ]] && echo "/sbin/iptables -A eth0-root -s $(CreoleGet one_master_ip) -p tcp -m tcp --dport ${vm_port} --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT" >> "${RULES_FILE}"
40
+    done
41
+}
42
+
43
+
44
+function close_port()
45
+{
46
+    vm_port=$(one_get_port ${1})
47
+    [[ -n "${vm_port}" ]] || return 2
48
+    rule_ids=$(${IPTABLES} -n --line-numbers -L eth0-root | awk "/dpt:${vm_port}/ {print \$1}")
49
+    for rule_id in ${rule_ids}
50
+    do
51
+        ${IPTABLES} -D eth0-root ${rule_id}
52
+        if [[ $? -eq 0 ]]
53
+        then
54
+            sed -i "/--dport ${vm_port}/d" "${RULES_FILE}"
55
+        fi
56
+    done
57
+}
58
+
59
+
60
+action=${1}
61
+template=${2}
62
+
63
+case $action in
64
+    open)
65
+        open_port ${template}
66
+        exit $?
67
+        ;;
68
+    close)
69
+        close_port ${template}
70
+        exit $?
71
+        ;;
72
+    *)
73
+        echo "Unknown action '$action'" >&2
74
+        exit 127
75
+        ;;
76
+esac

+ 83
- 0
init/onenode View File

@@ -0,0 +1,83 @@
1
+#! /bin/sh
2
+### BEGIN INIT INFO
3
+# Provides:          onenode
4
+# Required-Start:    creoled libvirt-bin opennebula openvswitch-switch
5
+# Required-Stop:     creoled libvirt-bin opennebula openvswitch-switch
6
+# Default-Start:     2 3 4 5
7
+# Default-Stop:      0 1 6
8
+# Short-Description: Node vm management
9
+# Description:       Suspend and resume VM of OpenNebula node
10
+### END INIT INFO
11
+
12
+# Author: Jaime Melis <jmelis@opennebula.org>
13
+
14
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
15
+DESC="OpenNebula Node"
16
+NAME=onevm-all
17
+DAEMON=/usr/share/eole/sbin/$NAME
18
+DAEMON_ARGS="-w"
19
+SCRIPTNAME=/etc/init.d/onenode
20
+PID_FILE=/var/run/one/onenode
21
+CREDS=/var/lib/one/.one/one_auth
22
+
23
+# Exit if the package is not installed
24
+[ -x "$DAEMON" ] || exit 0
25
+
26
+# Load the VERBOSE setting and other rcS variables
27
+. /lib/init/vars.sh
28
+
29
+# Define LSB log_* functions.
30
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
31
+. /lib/lsb/init-functions
32
+
33
+#
34
+# Function that starts the daemon/service
35
+#
36
+do_start()
37
+{
38
+  ${DAEMON} ${DAEMON_ARGS} -c ${CREDS} -a "resume"
39
+}
40
+
41
+#
42
+# Function that stops the daemon/service
43
+#
44
+do_stop()
45
+{
46
+    ${DAEMON} ${DAEMON_ARGS} -c ${CREDS} -a "suspend"
47
+}
48
+
49
+do_status()
50
+{
51
+  ${DAEMON} ${DAEMON_ARGS} -c ${CREDS} -a "status"
52
+}
53
+
54
+case "$1" in
55
+  start)
56
+    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
57
+    do_start
58
+    case "$?" in
59
+        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
60
+        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
61
+    esac
62
+    ;;
63
+  stop)
64
+    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
65
+    do_stop
66
+    case "$?" in
67
+        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
68
+        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
69
+    esac
70
+    ;;
71
+  status)
72
+    do_status
73
+    ;;
74
+  restart|force-reload)
75
+    echo "Not supported action"
76
+    ;;
77
+  *)
78
+    echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
79
+    exit 3
80
+    ;;
81
+esac
82
+
83
+:

+ 446
- 0
postservice/30-one-mng View File

@@ -0,0 +1,446 @@
1
+#!/usr/bin/env bash
2
+
3
+function error()
4
+{
5
+    MSG=${1}
6
+    echo "[ERROR][${MSG}]"
7
+    exit 1
8
+}
9
+
10
+function get_user_home()
11
+{
12
+    HOMEDIR=$(getent passwd ${1} | cut -d ':' -f 6)
13
+    echo ${HOMEDIR}
14
+}
15
+
16
+function get_one_auth()
17
+{
18
+    CMD="cat"
19
+    HOME=$(get_user_home oneadmin)
20
+    FILE="${HOME}/.one/one_auth"
21
+    ${CMD} ${FILE}
22
+}
23
+
24
+function check_cluster()
25
+{
26
+    name="${1}"
27
+    cmd="onecluster"
28
+    opt="list"
29
+    auth=$(get_one_auth)
30
+
31
+    res=0
32
+    clst_list=$(${cmd} ${opt} --user ${auth%:*} --password ${auth#*:} | tail -n +2 |  awk -F ' ' '{print $2}')
33
+    for hst in ${clst_list}
34
+    do
35
+        [[ "${NAME}" = "${hst}" ]] && res=$((res+1))
36
+    done
37
+    return ${res}
38
+}
39
+
40
+function manage_cluster()
41
+{
42
+    NAME="${1}"
43
+    CMD="onecluster create"
44
+    AUTH=$(get_one_auth)
45
+
46
+    check_cluster ${clst_name}
47
+    if [[ ${?} -eq 0 ]]
48
+    then
49
+        crt=$(${CMD} --user ${AUTH%:*} --password ${AUTH#*:} ${NAME})
50
+        if [[ ${?} -ne 0 ]]
51
+        then
52
+            error "Cluster create failed"
53
+        else
54
+            echo "Cluster ${NAME} created"
55
+        fi
56
+    else
57
+        echo "Cluster \"${NAME}\" already exist"
58
+    fi
59
+}
60
+
61
+function check_host()
62
+{
63
+    name="${1}"
64
+    cmd="onehost"
65
+    opt="list"
66
+    auth=$(get_one_auth)
67
+
68
+    res=0
69
+    clst_list=$(${cmd} ${opt} --user ${auth%:*} --password ${auth#*:} | tail -n +2 |  awk -F ' ' '{print $2}')
70
+    for hst in ${clst_list}
71
+    do
72
+        [[ "${NAME}" = "${hst}" ]] && res=$((res+1))
73
+    done
74
+    return ${res}
75
+}
76
+
77
+function manage_host()
78
+{
79
+    NAME=${1}
80
+    CMD="onehost"
81
+    IM_MAD='kvm'
82
+    VM_MAD='kvm'
83
+    VNET_MAD='ovswitch'
84
+    OPT="create ${NAME} -i ${IM_MAD} -v ${VM_MAD} -n ${VNET_MAD}"
85
+    AUTH=$(get_one_auth)
86
+
87
+    check_host ${NAME}
88
+    if [[ ${?} -eq 0 ]]
89
+    then
90
+        res=$(${CMD} ${OPT} --user ${AUTH%:*} --password ${AUTH#*:})
91
+        if [[ ${?} -ne 0 ]]
92
+        then
93
+            error "Host creation failed"
94
+        else
95
+            echo "Host ${NAME} created"
96
+        fi
97
+    else
98
+        echo "Host ${NAME} already exist"
99
+    fi
100
+}
101
+
102
+function get_cluster_id_by_name()
103
+{
104
+    name=${1}
105
+    cmd="onecluster"
106
+    opt="show ${name}"
107
+
108
+    res=$(${cmd} ${opt} --user ${AUTH%:*} --password ${AUTH#*:} | grep ID)
109
+    if [[ ${?} -eq 0 ]]
110
+    then
111
+        echo ${res#*:}
112
+        return 0
113
+    else
114
+        echo ""
115
+        return 1
116
+    fi
117
+}
118
+
119
+#
120
+# Get Host ID by a name
121
+#
122
+function get_host_id_by_name()
123
+{
124
+    name=${1}
125
+    cmd="onehost"
126
+    opt="show ${name}"
127
+
128
+    res=$(${cmd} ${opt} --user ${AUTH%:*} --password ${AUTH#*:} | grep "ID.*:")
129
+    if [[ ${?} -eq 0 ]]
130
+    then
131
+        echo ${res#*:}
132
+        return 0
133
+    else
134
+        echo ""
135
+        return 1
136
+    fi
137
+}
138
+
139
+#
140
+# Get Datastore ID by a name
141
+#
142
+function get_ds_id_by_name()
143
+{
144
+    name=${1}
145
+    cmd="onedatastore"
146
+    opt="show ${name}"
147
+
148
+    res=$(${cmd} ${opt} --user ${AUTH%:*} --password ${AUTH#*:} | grep "ID.*:")
149
+    if [[ ${?} -eq 0 ]]
150
+    then
151
+        echo ${res#*:}
152
+        return 0
153
+    else
154
+        echo "ERR"
155
+        return 1
156
+    fi
157
+}
158
+
159
+#
160
+# check_host_in_cluster
161
+# if host is attached to cluster  : return 0
162
+# if host not attached to cluster : return 1
163
+#
164
+function check_host_in_cluster()
165
+{
166
+    hst=${1}
167
+    clst=${2}
168
+    auth=$(get_one_auth)
169
+    cmd="onehost"
170
+    opt="show ${hst} --user ${AUTH%:*} --password ${AUTH#*:}"
171
+
172
+    RES=$(${cmd} ${opt} | grep CLUSTER)
173
+    cluster=${RES#*:}
174
+    # clean Outpu
175
+    cluster="${cluster#"${cluster%%[![:space:]]*}"}"   # remove leading whitespace characters
176
+    cluster="${cluster%"${cluster##*[![:space:]]}"}"   # remove trailing whitespace characters
177
+    if [[ "${cluster}" = "${clst}" ]]
178
+    then
179
+        return 0
180
+    else
181
+        return 1
182
+    fi
183
+}
184
+
185
+#
186
+# Attach a host to a cluster
187
+#
188
+function attach_host()
189
+{
190
+    HOST=${1}
191
+    CLST=${2}
192
+    CLST_ID=$(get_cluster_id_by_name ${CLST})
193
+    HST_ID=$(get_host_id_by_name ${HOST})
194
+    AUTH=$(get_one_auth)
195
+    CMD="onecluster"
196
+    OPT="addhost ${CLST_ID} ${HST_ID}"
197
+
198
+    check_host_in_cluster ${HOST} ${CLST}
199
+    if [[ ${?} -eq 1 ]]
200
+    then
201
+        if [[ -n ${CLST_ID} ]]
202
+        then
203
+            if [[ -n ${HST_ID} ]]
204
+            then
205
+                RES=$(${CMD} ${OPT} --user ${AUTH%:*} --password ${AUTH#*:})
206
+                if [[ ${?} -ne 0 ]]
207
+                then
208
+                    error "Attaching ${HOST} to ${CLST} failed"
209
+                else
210
+                    echo "${HOST} attached to ${CLST}"
211
+                    return 0
212
+                fi
213
+            else
214
+                error "No host id for ${HOST}"
215
+            fi
216
+        else
217
+            error "No Cluster id for ${CLST}"
218
+        fi
219
+    else
220
+        echo "Host ${HOST} already present in cluster ${CLST}"
221
+    fi
222
+    return 0
223
+}
224
+
225
+#
226
+# Attach a datastore to a cluster
227
+#
228
+function attach_ds_to_cluster()
229
+{
230
+    DS=${1}
231
+    CLST=${2}
232
+    CLST_ID=$(get_cluster_id_by_name ${CLST})
233
+    DS_ID=$(get_ds_id_by_name ${ds_name})
234
+    AUTH=$(get_one_auth)
235
+    CMD="onecluster"
236
+    OPT="adddatastore ${CLST_ID} ${DS_ID}"
237
+
238
+    RES=$(${CMD} ${OPT} --user ${AUTH%:*} --password ${AUTH#*:})
239
+    if [[ ${?} -ne 0 ]]
240
+    then
241
+        error "Attaching ${DS} to ${CLST} failed."
242
+    else
243
+        echo "Datastore ${DS} attached to ${CLST}."
244
+        return 0
245
+    fi
246
+    return 0
247
+}
248
+
249
+function create_datastore()
250
+{
251
+    ds_type="${1}"
252
+    ds_name="${2}"
253
+    ds_cluster="${3}"
254
+
255
+    if [[ $(CreoleGet activer_multinode 2>&1) == 'oui' ]]
256
+    then
257
+      SYS_TM_MAD='ssh'
258
+      ISO_TM_MAD='ssh'
259
+      IMG_TM_MAD='ssh'
260
+    else
261
+      SYS_TM_MAD='shared'
262
+      ISO_TM_MAD='shared'
263
+      IMG_TM_MAD='qcow2'
264
+    fi
265
+
266
+    echo "Creating datastore ${ds_name}"
267
+    TMPL_FILE=$(mktemp)
268
+    case ${ds_type} in
269
+        "SYSTEM")
270
+            cat <<__EOF__ > ${TMPL_FILE}
271
+NAME    = ${ds_name}
272
+TM_MAD  = ${SYS_TM_MAD}
273
+TYPE    = SYSTEM_DS
274
+__EOF__
275
+        ;;
276
+        "ISO")
277
+            cat <<__EOF__ > ${TMPL_FILE}
278
+NAME   = ${ds_name}
279
+DS_MAD =  fs
280
+TM_MAD =  ${ISO_TM_MAD}
281
+TYPE   =  IMAGE_DS
282
+__EOF__
283
+        ;;
284
+        "IMAGE")
285
+            cat <<__EOF__ > ${TMPL_FILE}
286
+NAME   = ${ds_name}
287
+DS_MAD = fs
288
+TM_MAD = ${ISO_TM_MAD}
289
+TYPE   = IMAGE_DS
290
+__EOF__
291
+        ;;
292
+
293
+        *) echo "Nothing to do with ${ds_type}"
294
+        ;;
295
+    esac
296
+
297
+    auth=$(get_one_auth)
298
+    cmd="onedatastore"
299
+    #opt="create --user ${AUTH%:*} --password ${AUTH#*:} -c ${ds_cluster} ${TMPL_FILE}"
300
+    opt="create --user ${AUTH%:*} --password ${AUTH#*:} ${TMPL_FILE}"
301
+    RUN=$(${cmd} ${opt})
302
+    if [[ ${?} -eq 0 ]]
303
+    then
304
+        attach_ds_to_cluster ${ds_name} ${ds_cluster}
305
+        rm ${TMPL_FILE}
306
+        return 0
307
+    else
308
+        return 1
309
+    fi
310
+}
311
+
312
+function update_datastore()
313
+{
314
+  local auth=${1}
315
+  local ds_id=${2}
316
+  local cmd="onedatastore"
317
+  local opt="show"
318
+  local multinode=$(CreoleGet activer_multinode 2>&1)
319
+  ds_type=""
320
+  ds_mad=""
321
+  ds_name=""
322
+
323
+  TMPL_FILE=$(mktemp)
324
+
325
+  if [[ ${multinode}  == 'oui' ]]
326
+  then
327
+    SYS_TM_MAD='ssh'
328
+    ISO_TM_MAD='ssh'
329
+    IMG_TM_MAD='ssh'
330
+  else
331
+    SYS_TM_MAD='shared'
332
+    ISO_TM_MAD='shared'
333
+    IMG_TM_MAD='qcow2'
334
+  fi
335
+
336
+  out=$(${cmd} ${opt} ${ds_id} --user ${auth%:*} --password ${auth#*:} | \
337
+        awk -F ':' '/^DATASTORE.*INFORMATION/,/DATASTORE CAPACITY/ {gsub(" |\t",""); print $1 ":" $2 " " }')
338
+  for line in ${out}
339
+  do
340
+    [[ ${line} =~ ^TM_MAD ]] && ds_mad=${line#*:}
341
+    [[ ${line} =~ ^NAME ]] && ds_name=${line#*:}
342
+    [[ ${line} =~ ^TYPE ]] && ds_type=${line#*:}
343
+  done
344
+
345
+  if [[ ${ds_name} == "$(CreoleGet one_ds_system_prefix 2>&1)$(CreoleGet one_cluster_name 2>&1)" ]]
346
+  then
347
+    cat <<__EOF__ > ${TMPL_FILE}
348
+NAME   = ${ds_name}
349
+TM_MAD  = ${SYS_TM_MAD}
350
+TYPE    = SYSTEM_DS
351
+__EOF__
352
+  elif [[ ${ds_name} == "$(CreoleGet one_ds_iso_name 2>&1)" ]]
353
+  then
354
+    cat <<__EOF__ > ${TMPL_FILE}
355
+NAME   = ${ds_name}
356
+DS_MAD =  fs
357
+TM_MAD =  ${ISO_TM_MAD}
358
+TYPE   =  IMAGE_DS
359
+__EOF__
360
+  elif [[ ${ds_name} == "$(CreoleGet one_ds_image_name 2>&1)" ]]
361
+  then
362
+    cat <<__EOF__ > ${TMPL_FILE}
363
+NAME   = ${ds_name}
364
+DS_MAD = fs
365
+TM_MAD = ${ISO_TM_MAD}
366
+TYPE   = IMAGE_DS
367
+__EOF__
368
+  else
369
+    echo "Nothing to do with ${ds_name}"
370
+  fi
371
+
372
+  if [[ -s ${TMPL_FILE} ]]
373
+  then
374
+      echo "Updating ${ds_name} datastore"
375
+      opt="update ${ds_id} --user ${AUTH%:*} --password ${AUTH#*:} ${TMPL_FILE}"
376
+      RUN=$(${cmd} ${opt})
377
+      rm ${TMPL_FILE}
378
+      return ${?}
379
+  else
380
+      rm ${TMPL_FILE}
381
+      return 1
382
+  fi
383
+}
384
+
385
+function manage_datastores()
386
+{
387
+    cluster=${1}
388
+    AUTH=$(get_one_auth)
389
+
390
+    SYSTEM_DS="$(CreoleGet 'one_ds_system_prefix')${cluster}"
391
+    ISO_DS=$(CreoleGet 'one_ds_iso_name')
392
+    IMAGE_DS=$(CreoleGet 'one_ds_image_name')
393
+
394
+    echo "Configuring datastores for Cluster"
395
+    sid=$(get_ds_id_by_name ${SYSTEM_DS})
396
+    if [[ ${sid} = "ERR" ]]
397
+    then
398
+      create_datastore "SYSTEM" "${SYSTEM_DS}" "${cluster}"
399
+    else
400
+      update_datastore ${AUTH} ${sid}
401
+    fi
402
+
403
+    imgid=$(get_ds_id_by_name ${IMAGE_DS})
404
+    if [[ ${imgid} = "ERR" ]]
405
+    then
406
+      create_datastore "IMAGE" "${IMAGE_DS}" "${cluster}"
407
+    else
408
+      update_datastore ${AUTH} ${imgid}
409
+    fi
410
+
411
+    isoid=$(get_ds_id_by_name ${ISO_DS})
412
+    if [[ ${isoid} = "ERR" ]]
413
+    then
414
+      create_datastore "ISO" "${ISO_DS}" "${cluster}"
415
+    else
416
+      update_datastore ${AUTH} ${isoid}
417
+    fi
418
+    return 0
419
+}
420
+
421
+function main()
422
+{
423
+    #
424
+    # Creating Cluster
425
+    #
426
+    clst_name=$(CreoleGet one_cluster_name)
427
+    manage_cluster ${clst_name}
428
+
429
+    #
430
+    # Creating Host
431
+    #
432
+    host=$(CreoleGet nom_machine)
433
+    manage_host ${host}
434
+
435
+    #
436
+    # Attaching Host to the Cluster
437
+    #
438
+    attach_host ${host} ${clst_name}
439
+
440
+    #
441
+    # Création des Datastores
442
+    #
443
+    manage_datastores ${clst_name}
444
+}
445
+
446
+main

+ 345
- 0
postservice/31-one-netmng View File

@@ -0,0 +1,345 @@
1
+#!/usr/bin/env python
2
+
3
+from pyeole import ihm
4
+from pyeole import process
5
+from creole.client import CreoleClient
6
+from tempfile import mkstemp
7
+
8
+import sys
9
+import os
10
+import csv
11
+import logging
12
+
13
+LOG_FILE = '/var/log/one/eole-one-node.log'
14
+
15
+#= Configure Logger ===
16
+logger = logging.getLogger(__name__)
17
+#std_handler = logging.StreamHandler(sys.stdout)
18
+file_handler = logging.FileHandler(LOG_FILE)
19
+
20
+logger.setLevel(logging.INFO)
21
+#std_handler.setLevel(logging.INFO)
22
+file_handler.setLevel(logging.DEBUG)
23
+
24
+formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
25
+#std_handler.setFormatter(formatter)
26
+file_handler.setFormatter(formatter)
27
+
28
+#logger.addHandler(std_handler)
29
+logger.addHandler(file_handler)
30
+#= End Logger ===
31
+
32
+
33
+class RunCmdError(Exception):
34
+    pass
35
+
36
+
37
+class OneClient():
38
+
39
+    def __init__(self, user):
40
+        self.user = None
41
+        self.auth = None
42
+        self.root = '/var/lib/one'
43
+
44
+        if user:
45
+            self.user = user
46
+        else:
47
+            self.user = 'oneadmin'
48
+
49
+        user_info = process.system_out(['getent', 'passwd', user])[1]
50
+        if user_info:
51
+            self.root = user_info.split(':')[5]
52
+
53
+        command = ['cat', u'{0}/.one/one_auth'.format(self.root)]
54
+        res = process.system_out(command)
55
+        if res[0] == 0:
56
+            self.auth = res[1].split(':')
57
+
58
+    def __run_cmd__(self, cmd):
59
+        cmd.extend(['--user', self.auth[0]])
60
+        cmd.extend(['--password', self.auth[1]])
61
+
62
+        res = process.system_out(cmd)
63
+        if res[0] == 0:
64
+            if 'list' in cmd:
65
+                out_lines = []
66
+                if res:
67
+                    for line in res[1].split('\n'):
68
+                        if len(line) == 0:
69
+                            next
70
+                        elif 'ID' in line:
71
+                            next
72
+                        else:
73
+                            out_lines.append(line.split())
74
+                return out_lines
75
+            else:
76
+                return res
77
+        else:
78
+            return False
79
+
80
+    def get_hosts(self):
81
+        """ get the list of hosts
82
+        """
83
+        cmd = ['onehost', 'list']
84
+        cmd.extend(['-l', 'ID,NAME'])
85
+        res = self.__run_cmd__(cmd)
86
+        return(res)
87
+
88
+    def get_clusters(self):
89
+        """ get the cluster list
90
+        """
91
+        cmd = ['onecluster', 'list']
92
+        cmd.extend(['-l', 'ID,NAME'])
93
+        return self.__run_cmd__(cmd)
94
+
95
+    def get_networks(self):
96
+        """ get the virtual network list
97
+        """
98
+        cmd = ['onevnet', 'list']
99
+        cmd.extend(['-l', 'ID,NAME'])
100
+        return self.__run_cmd__(cmd)
101
+
102
+    def get_cluster_id_by_name(self, name):
103
+        cmd = ['onecluster', 'list']
104
+        cmd.extend(['-f', 'NAME={0}'.format(name)])
105
+        res = self.__run_cmd__(cmd)
106
+        ID = res[0][0]
107
+        return ID
108
+
109
+    def get_vnet_id_by_name(self, name):
110
+        cmd = ['onevnet', 'list']
111
+        cmd.extend(['-f', 'NAME={0}'.format(name)])
112
+        res = self.__run_cmd__(cmd)
113
+        ID = res[0][0]
114
+        return ID
115
+
116
+    def create_network(self, templatefile, cluster, vnet_name):
117
+        """ Create a network
118
+        """
119
+        cmd = ['onevnet', 'create']
120
+        cmd.extend(['--user', self.auth[0]])
121
+        cmd.extend(['--password', self.auth[1][:-1]])
122
+        #cmd.extend(['-c', cluster])
123
+        cmd.append(templatefile)
124
+        res = process.system_out(cmd)
125
+        if res[0] == 0:
126
+            clt_id = self.get_cluster_id_by_name(cluster)
127
+            vnet_id = self.get_vnet_id_by_name(vnet_name)
128
+            res = self.__run_cmd__(['onecluster', 'addvnet', clt_id, vnet_id])
129
+            os.remove(templatefile)
130
+            if not res:
131
+                print("Error attaching {0} vnet to {1} cluster".format(vnet_name, cluster))
132
+                return False
133
+            else:
134
+                return True
135
+        else:
136
+            logger.error("Creation of virtual network with template {0} failed".format(templatefile))
137
+            return False
138
+
139
+    def update_network(self, templatefile, cluster, vnet_name):
140
+        """ Update a network
141
+        """
142
+        vnet_id = self.get_vnet_id_by_name(vnet_name)
143
+        cmd = ['onevnet', 'update']
144
+        cmd.extend(['--user', self.auth[0]])
145
+        cmd.extend(['--password', self.auth[1][:-1]])
146
+        cmd.extend([vnet_id, templatefile])
147
+
148
+        res = process.system_out(cmd)
149
+        if res[0] == 0:
150
+            os.remove(templatefile)
151
+            return True
152
+        else:
153
+            logger.error("Update of virtual network with template {0} failed".format(templatefile))
154
+            return False
155
+
156
+    def delete_network(self, vnet_id):
157
+        cmd = ['onevnet', 'delete']
158
+        cmd.extend(['--user', self.auth[0]])
159
+        cmd.extend(['--password', self.auth[1][:-1]])
160
+        cmd.append(vnet_id)
161
+
162
+        res = process.system_out(cmd)
163
+        if res[0] == 0:
164
+            ihm.print_line("Network {0} deleted".format(vnet_id))
165
+            return True
166
+        else:
167
+            logger.error("Error deleting network {0}".format(vnet_id))
168
+            ihm.print_line("Error deleting network {0}".format(vnet_id))
169
+            return False
170
+
171
+
172
+class OneNetwork():
173
+    def create(self, one_client):
174
+        tmpl_file = self.create_template()
175
+        if one_client.create_network(tmpl_file, self.cluster, self.zone):
176
+            ihm.print_line("Virtual network {0} created".format(self.zone))
177
+            return True
178
+        else:
179
+            ihm.print_line("Error Creating virtual network {0}".format(self.zone))
180
+            return False
181
+
182
+    def update(self, one_client):
183
+        tmpl_file = self.create_template()
184
+        if one_client.update_network(tmpl_file, self.cluster, self.zone):
185
+            ihm.print_line("Virtual network {0} updated".format(self.zone))
186
+            return True
187
+        else:
188
+            ihm.print_line("Error Updating virtual network {0}".format(self.zone))
189
+            return False
190
+
191
+    def manage(self, one_client):
192
+        found = False
193
+        vnet = one_client.get_networks()
194
+        network_name = self.zone
195
+        for net in vnet:
196
+            if network_name in net:
197
+                found = True
198
+                break
199
+
200
+        if not found:
201
+            return self.create(one_client)
202
+        else:
203
+            return self.update(one_client)
204
+
205
+class OneNetworkL3(OneNetwork):
206
+    def __init__(self, net_info, cluster):
207
+        self.swname = net_info[0]
208
+        self.zone = u'{0}{1}'.format(net_info[10], net_info[1])
209
+        self.vlan = net_info[2]
210
+        self.vnet_addr = net_info[3]
211
+        self.vnet_mask = net_info[4]
212
+        self.vnet_gw = net_info[5]
213
+        self.vnet_rg_start = net_info[6]
214
+        self.vnet_rg_end = net_info[7]
215
+        self.vnet_dns = net_info[8]
216
+        self.vnet_trunk = net_info[9]
217
+        self.cluster = cluster
218
+
219
+    def create_template(self):
220
+        fd, tmp_path = mkstemp(prefix='oneVnet-')
221
+        template = open(tmp_path, 'w')
222
+        template.write('NAME = "{0}"\n'.format(self.zone))
223
+        if self.vnet_rg_start and self.vnet_rg_end:
224
+            template.write('TYPE = RANGED\n')
225
+            template.write('IP_START = {0}\n'.format(self.vnet_rg_start))
226
+            template.write('IP_END = {0}\n'.format(self.vnet_rg_end))
227
+        else:
228
+            template.write('TYPE = FIXED\n')
229
+
230
+        if self.vlan:
231
+            template.write('VLAN = yes\n')
232
+            template.write('VLAN_ID = {0}\n'.format(self.vlan))
233
+
234
+        if self.vnet_trunk:
235
+            template.write('VLAN_TAGGED_ID = {0}\n'.format(self.vnet_trunk))
236
+
237
+        template.write('BRIDGE = {0}\n'.format(self.swname))
238
+        template.write('NETWORK_ADDRESS = {0}\n'.format(self.vnet_addr))
239
+        template.write('NETWORK_MASK = {0}\n'.format(self.vnet_mask))
240
+        template.write('GATEWAY = {0}\n'.format(self.vnet_gw))
241
+        template.write('DNS = {0}\n'.format(self.vnet_dns))
242
+        template.close()
243
+        return tmp_path
244
+
245
+
246
+class OneNetworkL2(OneNetwork):
247
+    def __init__(self, net_info, cluster):
248
+        self.swname = net_info[0]
249
+        self.zone = u'{0}{1}'.format(net_info[6], net_info[1])
250
+        self.net_size = net_info[2]
251
+        self.first_mac = net_info[3]
252
+        self.tag = net_info[4]
253
+        self.trunk = net_info[5]
254
+        self.cluster = cluster
255
+
256
+    def create_template(self):
257
+        fd, tmp_path = mkstemp(prefix='oneVnet-')
258
+        template = open(tmp_path, 'w')
259
+        template.write('NAME = "{0}"\n'.format(self.zone))
260
+        template.write('TYPE = ETHER\n')
261
+        template.write('SIZE = "{0}"\n'.format(self.net_size))
262
+
263
+        if self.tag:
264
+            template.write('VLAN = yes\n')
265
+            template.write('VLAN_ID = {0}\n'.format(self.tag))
266
+
267
+        if self.trunk:
268
+            template.write('VLAN_TAGGED_ID = {0}\n'.format(self.trunk))
269
+
270
+        template.write('BRIDGE = {0}\n'.format(self.swname))
271
+        template.close()
272
+        return tmp_path
273
+
274
+def main():
275
+    client = CreoleClient()
276
+    one_client = OneClient('oneadmin')
277
+    networks = []
278
+    cluster = client.get_creole('one_cluster_name')
279
+    swname = client.get_creole('ovs_sw_name')
280
+    zones = client.get_creole('vnets')
281
+    vlans = client.get_creole('vnet_vlan_tag')
282
+    vnet_addr = client.get_creole('vnet_network_addr')
283
+    vnet_mask = client.get_creole('vnet_network_mask')
284
+    vnet_dns = client.get_creole('vnet_network_dns')
285
+    vnet_gw = client.get_creole('vnet_network_gw')
286
+    vnet_rg_start = client.get_creole('vnet_range_start')
287
+    vnet_rg_end = client.get_creole('vnet_range_end')
288
+    vnet_trunk = client.get_creole('vnet_vlan_trunk')
289
+
290
+    l2_vnet = client.get_creole('l2_vnets')
291
+    l2_vnet_size = client.get_creole('l2_vnet_size')
292
+    l2_vnet_vlan_tag = client.get_creole('l2_vnet_vlan_tag')
293
+    l2_vnet_vlan_trunk = client.get_creole('l2_vnet_vlan_trunk')
294
+    l2_vnet_first_mac = client.get_creole('l2_vnet_first_mac')
295
+
296
+    net_prefix = "CR_"
297
+
298
+    processed = []
299
+    for cpt in range(len(zones)):
300
+        if zones[cpt] not in processed:
301
+            info = []
302
+            info.append(swname)
303
+            info.append(zones[cpt])
304
+            info.append(vlans[cpt])
305
+            info.append(vnet_addr[cpt])
306
+            info.append(vnet_mask[cpt])
307
+            info.append(vnet_gw[cpt])
308
+            info.append(vnet_rg_start[cpt])
309
+            info.append(vnet_rg_end[cpt])
310
+            info.append(vnet_dns[cpt])
311
+            info.append(vnet_trunk[cpt])
312
+            info.append(net_prefix)
313
+            networks.append(OneNetworkL3(info, cluster))
314
+            processed.append(zones[cpt])
315
+
316
+    for i in range(len(l2_vnet)):
317
+        if l2_vnet[i] not in processed:
318
+            net_info = []
319
+            net_info.append(swname)
320
+            net_info.append(l2_vnet[i])
321
+            net_info.append(l2_vnet_size[i])
322
+            net_info.append(l2_vnet_first_mac[i])
323
+            net_info.append(l2_vnet_vlan_tag[i])
324
+            net_info.append(l2_vnet_vlan_trunk[i])
325
+            net_info.append(net_prefix)
326
+            networks.append(OneNetworkL2(net_info, cluster))
327
+            processed.append(l2_vnet[i])
328
+
329
+    if client.get_creole('activer_openvswitch'):
330
+        for network in networks:
331
+            if not network.manage(one_client):
332
+                exit(1)
333
+    else:
334
+        ihm.print_line(u'Open vSwitch disabled no need to configure virtual networks')
335
+
336
+    networks = one_client.get_networks()
337
+    for net in networks:
338
+        name = net[1]
339
+        if name.startswith(net_prefix):
340
+            if not name[3:] in zones and not name[3:] in l2_vnet:
341
+                one_client.delete_network(net[0])
342
+
343
+    exit(0)
344
+
345
+main()

+ 10
- 0
preservice/30-one-auth View File

@@ -0,0 +1,10 @@
1
+#!/bin/bash
2
+
3
+auth_mode="$(CreoleGet sunstone_auth_modes)"
4
+unlink /var/lib/one/remotes/auth/default 2>/dev/null
5
+
6
+if [ -z "${auth_mode}" ]; then
7
+    ln -s /var/lib/one/remotes/auth/{dummy,default}
8
+else
9
+    ln -s /var/lib/one/remotes/auth/{${auth_mode},default}
10
+fi

+ 116
- 0
scripts/onehost_create_all View File

@@ -0,0 +1,116 @@
1
+#!/usr/bin/env bash
2
+
3
+#
4
+# Register all Hâpy Cluster Nodes
5
+#
6
+
7
+. /usr/lib/eole/ihm.sh
8
+
9
+#
10
+# NAME: copy_ssh_id 
11
+# AIM: Copy the ssh key on the host
12
+# PARAM: the hostname of the node 
13
+#
14
+function copy_ssh_id()
15
+{
16
+    local ip=${1}
17
+    su - ${ONEUSER} -c "ssh-copy-id ${ip}"
18
+}
19
+
20
+#
21
+# NAME: register_node
22
+# AIM: register the node in OpenNebula master
23
+# PARAM: the node hostname
24
+#
25
+function register_node()
26
+{
27
+    cmd="onehost create -i kvm -v kvm -n ovswitch -c \"$(CreoleGet one_cluster_name)\" ${1}"
28
+    ret=$(su - ${ONEUSER} -c -- "${cmd}")
29
+    return $?
30
+}
31
+
32
+#
33
+# NAME: wait_node_ok
34
+# AIM: Wait until the node is OK or ERROR
35
+# PARAM: The node name 
36
+#
37
+function wait_node_ok()
38
+{
39
+    local RET=0
40
+    local cmd="onehost show ${1} | awk '/^STATE/ {print \$3}'"
41
+    local spinstr='|/-\'
42
+    local delay=0.75
43
+
44
+    while [ 1 ]
45
+    do
46
+        st=$(su - ${ONEUSER} -c "${cmd}")
47
+        [[ ${st} == "MONITORED" ]] && break
48
+        [[ ${st} == '' ]] && break
49
+        if [[ ${st} == "ERROR" ]]
50
+        then
51
+            RET=2
52
+            break
53
+        fi
54
+
55
+        local temp=${spinstr#?}
56
+        printf " [%c]  " "$spinstr"
57
+        local spinstr=$temp${spinstr%"$temp"}
58
+        sleep $delay
59
+        printf "\b\b\b\b\b\b"
60
+
61
+    done
62
+    printf "    \b\b\b\b"
63
+    return ${RET}
64
+}
65
+
66
+#
67
+# MAIN
68
+#
69
+HAPY_ACTIF=$(echo $(CreoleGet activer_onesinglenode))
70
+if [[ $HAPY_ACTIF == "non" ]]
71
+then
72
+	EchoRouge "Le serveur de virtualisation n'est pas activé dans l'interface de configuration du module"
73
+	exit 1
74
+fi
75
+
76
+HAPY_NODE_SUPPORT=$(echo $(CreoleGet activer_multinode))
77
+if [[ $HAPY_NODE_SUPPORT == "non" ]]
78
+then
79
+	EchoRouge "Le mode multi-noeuds n'est pas activé dans l'interface de configuration du module"
80
+	exit 1
81
+fi
82
+declare -a HAPY_SLV=('')
83
+declare -a HAPY_SLV_IP=('')
84
+ONEUSER=$(CreoleGet virt_user)
85
+HAPY_SLV=$(echo $(CreoleGet one_nodes) | sed -e "s/\n/ /g")
86
+HAPY_SLV_IP=$(echo $(CreoleGet node_ip) | sed -e "s/\n/ /g")
87
+
88
+echo -e "\n"
89
+EchoBleu "Vous allez inscrire un noeud dans une grappe Hâpy"
90
+EchoBleu "Pour ce faire vous devez vous munir du mot de passe de l'utilisateur 'oneadmin' de chacun des noeuds"
91
+Question_ouinon  "Voulez-vous commencer ?" 'True' "oui"
92
+if [[ $? -ne 0 ]]
93
+then
94
+	EchoOrange "Abandon de l'enregistrement"
95
+	exit 1
96
+fi
97
+
98
+for ((i = 0; i < ${#HAPY_SLV[*]}; i +=1))
99
+do
100
+    echo -e "\n"
101
+    EchoOrange "Traitement du noeud ${HAPY_SLV[${i}]}"
102
+    echo
103
+    EchoVert " * Gestion des clés SSH"
104
+    echo
105
+    copy_ssh_id ${HAPY_SLV_IP[${i}]}
106
+    EchoVert " * Enregistrement du noeud"
107
+    register_node ${HAPY_SLV[${i}]}
108
+    wait_node_ok ${HAPY_SLV[${i}]}
109
+    if [[ ${?} -ne 0 ]]
110
+    then
111
+        EchoRouge "Erreur lors de l'enregistrement du noeud ${HAPY_SLV[${i}]} !"
112
+    fi
113
+done
114
+
115
+echo -e "\n"
116
+EchoVert "Enregistrement des noeuds terminé"

+ 181
- 0
scripts/onevm-all View File

@@ -0,0 +1,181 @@
1
+#!/usr/bin/env ruby
2
+
3
+##############################################################################
4
+# Environment Configuration
5
+##############################################################################
6
+ONE_LOCATION=ENV["ONE_LOCATION"]
7
+USER=ENV["user"]
8
+
9
+if !ONE_LOCATION
10
+    RUBY_LIB_LOCATION="/usr/lib/one/ruby"
11
+else
12
+    RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
13
+end
14
+
15
+$: << RUBY_LIB_LOCATION
16
+
17
+##############################################################################
18
+# Required libraries
19
+##############################################################################
20
+require 'opennebula'
21
+require 'optparse'
22
+
23
+include OpenNebula
24
+
25
+MAXWAIT=60
26
+INTERVAL=1
27
+
28
+def _wait(vm, st)
29
+    wait = 0
30
+    while vm.status != st 
31
+        vm.info
32
+        if vm.status == 'unkn'
33
+          break
34
+        end
35
+        wait += INTERVAL
36
+        sleep(INTERVAL)
37
+        if wait >= MAXWAIT
38
+            break
39
+        end
40
+    end
41
+end
42
+
43
+def CreoleGet(variable)
44
+    begin
45
+        value = `CreoleGet #{variable}`
46
+        return value
47
+    rescue
48
+        return nil
49
+    end
50
+end
51
+
52
+#
53
+# NAME: _do_suspend
54
+# PARAM: OpenNebula::VirtualMachine object
55
+# AIM: Suspend a virtual machine
56
+#
57
+def _do_suspend(vm, wait)
58
+    if vm.status == "runn"
59
+        puts("Suspending #{vm.name} ...")
60
+        vm.suspend
61
+        if wait
62
+            _wait(vm, "susp")
63
+        end
64
+    end
65
+end
66
+
67
+#
68
+# NAME: _do_resume
69
+# PARAM: OpenNebula::VirtualMachine object
70
+# AIM: Resum a suspended virtual machines
71
+#
72
+def _do_resume(vm, wait)
73
+    if vm.status == "susp"
74
+      puts("Resume on #{vm.name}")
75
+      vm.resume
76
+    elsif vm.status == 'unkn'
77
+      puts("Boot on #{vm.name}")
78
+      vm.boot
79
+    else
80
+      return -1
81
+    end
82
+    if wait
83
+      _wait(vm, "runn")
84
+    end
85
+end
86
+
87
+
88
+options = {:creds => nil, :action => nil, :endpoint => nil}
89
+
90
+parser = OptionParser.new do|opts|
91
+  opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
92
+  opts.on('-c', '--creds file', 'Crediential file') do |value|
93
+    options[:creds] = value;
94
+  end
95
+
96
+  opts.on('-a', '--action action', 'Action to run') do |value|
97
+    options[:action] = value;
98
+  end
99
+
100
+  opts.on('-e', '--end-point url', 'End point URL') do |value|
101
+    options[:endpoint] = value;
102
+  end
103
+
104
+  opts.on('-w', '--wait', 'Wait for action ends') do |w|
105
+      options[:wait] = w
106
+  end
107
+
108
+  opts.on('-h', '--help', 'Displays Help') do
109
+    puts opts
110
+    exit
111
+  end
112
+end
113
+
114
+parser.parse!
115
+
116
+# OpenNebula credentials
117
+
118
+if not options[:creds]
119
+    options[:creds] = "/var/lib/one/.one/one_auth"
120
+end
121
+
122
+if not options[:action]
123
+  options[:action] = "status"
124
+end
125
+
126
+if not options[:endpoint]
127
+  ip = CreoleGet('adresse_ip_eth0').chomp
128
+  options[:endpoint] = "http://#{ip}:2633/RPC2"
129
+end
130
+
131
+# Actions
132
+SUPPORTED = ['status', 'boot', 'resume', 'shutdown', 'suspend']
133
+
134
+
135
+if not SUPPORTED.include?(options[:action])
136
+  puts("Action : #{options[:action]}) is not supported")
137
+  exit -1
138
+end
139
+
140
+begin
141
+    File.readlines(options[:creds]).each do |line|
142
+        CREDENTIALS = line
143
+    end
144
+rescue
145
+    puts("#{options[:creds]}: Problem loading credentials, check if file exists.")
146
+    exit -1
147
+end
148
+
149
+begin
150
+  client = Client.new(CREDENTIALS, options[:endpoint])
151
+
152
+  vm_pool = VirtualMachinePool.new(client, -1)
153
+
154
+  rc = vm_pool.info
155
+  if OpenNebula.is_error?(rc)
156
+    puts rc.message
157
+    exit -1
158
+  end
159
+
160
+  vm_pool.each do |vm|
161
+    case options[:action]
162
+    when "status"
163
+      puts("#{vm.name}\t#{vm.status}")
164
+    when "boot"
165
+      if vm.status == "unkn"
166
+        puts("Booting #{vm.name} ...")
167
+        vm.boot
168
+      end
169
+    when "suspend"
170
+        _do_suspend(vm, options[:wait])
171
+    when "resume"
172
+        _do_resume(vm, options[:wait])
173
+    else
174
+      puts("#{vm.name}\t#{vm.status}")
175
+    end
176
+  end
177
+rescue Exception => e
178
+  puts e.message
179
+  exit -1
180
+end
181
+exit 0

+ 792
- 0
tmpl/oned.conf View File

@@ -0,0 +1,792 @@
1
+#*******************************************************************************
2
+#                       OpenNebula Configuration file
3
+#*******************************************************************************
4
+
5
+#*******************************************************************************
6
+# Daemon configuration attributes
7
+#-------------------------------------------------------------------------------
8
+#  MANAGER_TIMER: Time in seconds the core uses to evaluate periodical functions.
9
+#  MONITORING_INTERVAL cannot have a smaller value than MANAGER_TIMER.
10
+#
11
+#  MONITORING_INTERVAL: Time in seconds between host and VM monitorization.
12
+#
13
+#  MONITORING_THREADS: Max. number of threads used to process monitor messages
14
+#
15
+#  HOST_PER_INTERVAL: Number of hosts monitored in each interval.
16
+#  HOST_MONITORING_EXPIRATION_TIME: Time, in seconds, to expire monitoring
17
+#  information. Use 0 to disable HOST monitoring recording.
18
+#
19
+#  VM_INDIVIDUAL_MONITORING: VM monitoring information is obtained along with the
20
+#  host information. For some custom monitor drivers you may need activate the
21
+#  individual VM monitoring process.
22
+#  VM_PER_INTERVAL: Number of VMs monitored in each interval, if the individual
23
+#  VM monitoring is set to yes.
24
+#  VM_MONITORING_EXPIRATION_TIME: Time, in seconds, to expire monitoring
25
+#  information. Use 0 to disable VM monitoring recording.
26
+#
27
+#  SCRIPTS_REMOTE_DIR: Remote path to store the monitoring and VM management
28
+#  scripts.
29
+#
30
+#  PORT: Port where oned will listen for xmlrpc calls.
31
+#
32
+#  DB: Configuration attributes for the database backend
33
+#   backend : can be sqlite or mysql (default is sqlite)
34
+#   server  : (mysql) host name or an IP address for the MySQL server
35
+#   port    : (mysql) port for the connection to the server.
36
+#                     If set to 0, the default port is used.
37
+#   user    : (mysql) user's MySQL login ID
38
+#   passwd  : (mysql) the password for user
39
+#   db_name : (mysql) the database name
40
+#
41
+#  VNC_BASE_PORT: VNC ports for VMs can be automatically set to VNC_BASE_PORT +
42
+#  VMID
43
+#
44
+#  LOG: Configuration for the logging system
45
+#   system: defines the logging system:
46
+#      file      to log in the oned.log file
47
+#      syslog    to use the syslog facilities
48
+#   debug_level: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG
49
+#
50
+#  VM_SUBMIT_ON_HOLD: Forces VMs to be created on hold state instead of pending.
51
+#  Values: YES or NO.
52
+#*******************************************************************************
53
+
54
+LOG = [
55
+  system      = "file",
56
+  debug_level = 3
57
+]
58
+
59
+#MANAGER_TIMER = 30
60
+
61
+MONITORING_INTERVAL = 60
62
+MONITORING_THREADS  = 50
63
+
64
+#HOST_PER_INTERVAL               = 15
65
+#HOST_MONITORING_EXPIRATION_TIME = 43200
66
+
67
+#VM_INDIVIDUAL_MONITORING      = "no"
68
+#VM_PER_INTERVAL               = 5
69
+#VM_MONITORING_EXPIRATION_TIME = 14400
70
+
71
+SCRIPTS_REMOTE_DIR=/var/tmp/one
72
+
73
+PORT = 2633
74
+
75
+DB = [ backend = "sqlite" ]
76
+
77
+# Sample configuration for MySQL
78
+# DB = [ backend = "mysql",
79
+#        server  = "localhost",
80
+#        port    = 0,
81
+#        user    = "oneadmin",
82
+#        passwd  = "oneadmin",
83
+#        db_name = "opennebula" ]
84
+
85
+VNC_BASE_PORT = 5900
86
+
87
+#VM_SUBMIT_ON_HOLD = "NO"
88
+
89
+#*******************************************************************************
90
+# Federation configuration attributes
91
+#-------------------------------------------------------------------------------
92
+# Control the federation capabilities of oned. Operation in a federated setup
93
+# requires a special DB configuration.
94
+#
95
+#  FEDERATION: Federation attributes
96
+#   MODE: Operation mode of this oned.
97
+#       STANDALONE no federated.This is the default operational mode
98
+#       MASTER     this oned is the master zone of the federation
99
+#       SLAVE      this oned is a slave zone
100
+#   ZONE_ID: The zone ID as returned by onezone command
101
+#   MASTER_ONED: The xml-rpc endpoint of the master oned, e.g.
102
+#   http://master.one.org:2633/RPC2
103
+#*******************************************************************************
104
+
105
+FEDERATION = [
106
+    MODE = "STANDALONE",
107
+    ZONE_ID = 0,
108
+    MASTER_ONED = ""
109
+]
110
+
111
+#*******************************************************************************
112
+# XML-RPC server configuration
113
+#-------------------------------------------------------------------------------
114
+#  These are configuration parameters for oned's xmlrpc-c server
115
+#
116
+#  MAX_CONN: Maximum number of simultaneous TCP connections the server
117
+#  will maintain
118
+#
119
+#  MAX_CONN_BACKLOG: Maximum number of TCP connections the operating system
120
+#  will accept on the server's behalf without the server accepting them from
121
+#  the operating system
122
+#
123
+#  KEEPALIVE_TIMEOUT: Maximum time in seconds that the server allows a
124
+#  connection to be open between RPCs
125
+#
126
+#  KEEPALIVE_MAX_CONN: Maximum number of RPCs that the server will execute on
127
+#  a single connection
128
+#
129
+#  TIMEOUT: Maximum time in seconds the server will wait for the client to
130
+#  do anything while processing an RPC
131
+#
132
+#  RPC_LOG: Create a separated log file for xml-rpc requests, in
133
+#  "/var/log/one/one_xmlrpc.log".
134
+#
135
+#  MESSAGE_SIZE: Buffer size in bytes for XML-RPC responses. Only relevant for
136
+#  slave zones.
137
+#*******************************************************************************
138
+
139
+#MAX_CONN           = 15
140
+#MAX_CONN_BACKLOG   = 15
141
+#KEEPALIVE_TIMEOUT  = 15
142
+#KEEPALIVE_MAX_CONN = 30
143
+#TIMEOUT            = 15
144
+#RPC_LOG            = NO
145
+#MESSAGE_SIZE       = 1073741824
146
+
147
+#*******************************************************************************
148
+# Physical Networks configuration
149
+#*******************************************************************************
150
+#  NETWORK_SIZE: Here you can define the default size for the virtual networks
151
+#
152
+#  MAC_PREFIX: Default MAC prefix to be used to create the auto-generated MAC
153
+#  addresses is defined here (this can be overrided by the Virtual Network
154
+#  template)
155
+#*******************************************************************************
156
+
157
+NETWORK_SIZE = 254
158
+
159
+MAC_PREFIX   = "02:00"
160
+
161
+#*******************************************************************************
162
+# DataStore Configuration
163
+#*******************************************************************************
164
+#  DATASTORE_LOCATION: *Default* Path for Datastores in the hosts. It IS the
165
+#  same for all the hosts in the cluster. DATASTORE_LOCATION IS ONLY FOR THE
166
+#  HOSTS AND *NOT* THE FRONT-END. It defaults to /var/lib/one/datastores (or
167
+#  $ONE_LOCATION/var/datastores in self-contained mode)
168
+#
169
+#  You can define a different DATASTORE_LOCATION in each cluster by updating
170
+#  its properties with onecluster update.
171
+#
172
+#  DATASTORE_BASE_PATH: This is the base path for the SOURCE attribute of
173
+#  the images registered in a Datastore. This is a default value, that can be
174
+#  changed when the datastore is created.
175
+#
176
+#  DATASTORE_CAPACITY_CHECK: Checks that there is enough capacity before
177
+#  creating a new imag. Defaults to Yes
178
+#
179
+#  DEFAULT_IMAGE_TYPE: This can take values
180
+#       OS        Image file holding an operating system
181
+#       CDROM     Image file holding a CDROM
182
+#       DATABLOCK Image file holding a datablock,
183
+#                 always created as an empty block
184
+#
185
+#  DEFAULT_DEVICE_PREFIX: This can be set to
186
+#       hd        IDE prefix
187
+#       sd        SCSI
188
+#       xvd       XEN Virtual Disk
189
+#       vd        KVM virtual disk
190
+#
191
+#  DEFAULT_CDROM_DEVICE_PREFIX: Same as above but for CDROM devices.
192
+#*******************************************************************************
193
+
194
+#DATASTORE_LOCATION  = /var/lib/one/datastores
195
+
196
+#DATASTORE_BASE_PATH = /var/lib/one/datastores
197
+
198
+DATASTORE_CAPACITY_CHECK = "yes"
199
+
200
+DEFAULT_IMAGE_TYPE    = "OS"
201
+DEFAULT_DEVICE_PREFIX = "hd"
202
+
203
+DEFAULT_CDROM_DEVICE_PREFIX = "hd"
204
+
205
+#*******************************************************************************
206
+# Information Driver Configuration
207
+#*******************************************************************************
208
+# You can add more information managers with different configurations but make
209
+# sure it has different names.
210
+#
211
+#   name      : name for this information manager
212
+#
213
+#   executable: path of the information driver executable, can be an
214
+#               absolute path or relative to $ONE_LOCATION/lib/mads (or
215
+#               /usr/lib/one/mads/ if OpenNebula was installed in /)
216
+#
217
+#   arguments : for the driver executable, usually a probe configuration file,
218
+#               can be an absolute path or relative to $ONE_LOCATION/etc (or
219
+#               /etc/one/ if OpenNebula was installed in /)
220
+#*******************************************************************************
221
+
222
+#-------------------------------------------------------------------------------
223
+#  Information Collector for KVM and Xen IM's.
224
+#-------------------------------------------------------------------------------
225
+#  This driver CANNOT BE ASSIGNED TO A HOST, and needs to be used with KVM or
226
+#  Xen drivers
227
+#    -h  prints this help.
228
+#    -a  Address to bind the collectd sockect (defults 0.0.0.0)
229
+#    -p  UDP port to listen for monitor information (default 4124)
230
+#    -f  Interval in seconds to flush collected information (default 5)
231
+#    -t  Number of threads for the server (defult 50)
232
+#    -i  Time in seconds of the monitorization push cycle. This parameter must
233
+#        be smaller than MONITORING_INTERVAL, otherwise push monitorization will
234
+#        not be effective.
235
+#-------------------------------------------------------------------------------
236
+IM_MAD = [
237
+      name       = "collectd",
238
+      executable = "collectd",
239
+      arguments  = "-p 4124 -f 5 -t 50 -i 20" ]
240
+#-------------------------------------------------------------------------------
241
+
242
+#-------------------------------------------------------------------------------
243
+#  KVM UDP-push Information Driver Manager Configuration
244
+#    -r number of retries when monitoring a host
245
+#    -t number of threads, i.e. number of hosts monitored at the same time
246
+#-------------------------------------------------------------------------------
247
+IM_MAD = [
248
+      name       = "kvm",
249
+      executable = "one_im_ssh",
250
+      arguments  = "-r 3 -t 15 kvm" ]
251
+#-------------------------------------------------------------------------------
252
+
253
+#-------------------------------------------------------------------------------
254
+#  KVM SSH-pull Information Driver Manager Configuration
255
+#    -r number of retries when monitoring a host
256
+#    -t number of threads, i.e. number of hosts monitored at the same time
257
+#-------------------------------------------------------------------------------
258
+# IM_MAD = [
259
+#       name       = "kvm",
260
+#       executable = "one_im_ssh",
261
+#       arguments  = "-r 3 -t 15 kvm-probes" ]
262
+#-------------------------------------------------------------------------------
263
+
264
+#-------------------------------------------------------------------------------
265
+#  XEN UDP-push Information Driver Manager Configuration
266
+#    -r number of retries when monitoring a host
267
+#    -t number of threads, i.e. number of hosts monitored at the same time
268
+#-------------------------------------------------------------------------------
269
+
270
+# Driver for Xen 3.x
271
+#IM_MAD = [
272
+#    name       = "xen",
273
+#    executable = "one_im_ssh",
274
+#    arguments  = "-r 3 -t 15 xen3" ]
275
+
276
+# Driver for Xen 4.x
277
+#IM_MAD = [
278
+#    name       = "xen",
279
+#    executable = "one_im_ssh",
280
+#    arguments  = "-r 3 -t 15 xen4" ]
281
+
282
+#-------------------------------------------------------------------------------
283
+#  XEN SSH-pull Information Driver Manager Configuration
284
+#    -r number of retries when monitoring a host
285
+#    -t number of threads, i.e. number of hosts monitored at the same time
286
+#-------------------------------------------------------------------------------
287
+
288
+# Driver for Xen 3.x
289
+#IM_MAD = [
290
+#    name       = "xen",
291
+#    executable = "one_im_ssh",
292
+#    arguments  = "-r 0 -t 15 xen3-probes" ]
293
+
294
+# Driver for Xen 4.x
295
+#IM_MAD = [
296
+#    name       = "xen",
297
+#    executable = "one_im_ssh",
298
+#    arguments  = "-r 0 -t 15 xen4-probes" ]
299
+
300
+#-------------------------------------------------------------------------------
301
+
302
+#-------------------------------------------------------------------------------
303
+#  VMware Information Driver Manager Configuration
304
+#    -r number of retries when monitoring a host
305
+#    -t number of threads, i.e. number of hosts monitored at the same time
306
+#-------------------------------------------------------------------------------
307
+#IM_MAD = [
308
+#      name       = "vmware",
309
+#      executable = "one_im_sh",
310
+#      arguments  = "-c -t 15 -r 0 vmware" ]
311
+#-------------------------------------------------------------------------------
312
+
313
+#-------------------------------------------------------------------------------
314
+#  EC2 Information Driver Manager Configuration
315
+#-------------------------------------------------------------------------------
316
+#IM_MAD = [
317
+#      name       = "ec2",
318
+#      executable = "one_im_sh",
319
+#      arguments  = "-c -t 1 -r 0 ec2" ]
320
+#-------------------------------------------------------------------------------
321
+
322
+#-------------------------------------------------------------------------------
323
+#  Dummy Information Driver Manager Configuration
324
+#-------------------------------------------------------------------------------
325
+#IM_MAD = [ name="dummy", executable="one_im_dummy"]
326
+#-------------------------------------------------------------------------------
327
+
328
+#*******************************************************************************
329
+# Virtualization Driver Configuration
330
+#*******************************************************************************
331
+# You can add more virtualization managers with different configurations but
332
+# make sure it has different names.
333
+#
334
+#   name      : name of the virtual machine manager driver
335
+#
336
+#   executable: path of the virtualization driver executable, can be an
337
+#               absolute path or relative to $ONE_LOCATION/lib/mads (or
338
+#               /usr/lib/one/mads/ if OpenNebula was installed in /)
339
+#
340
+#   arguments : for the driver executable
341
+#
342
+#   default   : default values and configuration parameters for the driver, can
343
+#               be an absolute path or relative to $ONE_LOCATION/etc (or
344
+#               /etc/one/ if OpenNebula was installed in /)
345
+#
346
+#   type      : driver type, supported drivers: xen, kvm, xml
347
+#*******************************************************************************
348
+
349
+#-------------------------------------------------------------------------------
350
+#  KVM Virtualization Driver Manager Configuration
351
+#    -r number of retries when monitoring a host
352
+#    -t number of threads, i.e. number of hosts monitored at the same time
353
+#    -l <actions[=command_name]> actions executed locally, command can be
354
+#        overridden for each action.
355
+#        Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll
356
+#        An example: "-l migrate=migrate_local,save"
357
+#
358
+#  Note: You can use type = "qemu" to use qemu emulated guests, e.g. if your
359
+#  CPU does not have virtualization extensions or use nested Qemu-KVM hosts
360
+#-------------------------------------------------------------------------------
361
+VM_MAD = [
362
+    name       = "kvm",
363
+    executable = "one_vmm_exec",
364
+    arguments  = "-t 15 -r 0 kvm",
365
+    default    = "vmm_exec/vmm_exec_kvm.conf",
366
+    type       = "kvm" ]
367
+#-------------------------------------------------------------------------------
368
+
369
+#-------------------------------------------------------------------------------
370
+#  XEN Virtualization Driver Manager Configuration
371
+#    -r number of retries when monitoring a host
372
+#    -t number of threads, i.e. number of hosts monitored at the same time
373
+#    -l <actions[=command_name]> actions executed locally, command can be
374
+#        overridden for each action.
375
+#        Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll
376
+#        An example: "-l migrate,save"
377
+#-------------------------------------------------------------------------------
378
+
379
+# Driver for Xen 3.x
380
+#VM_MAD = [
381
+#    name       = "xen",
382
+#    executable = "one_vmm_exec",
383
+#    arguments  = "-t 15 -r 0 xen3",
384
+#    default    = "vmm_exec/vmm_exec_xen3.conf",
385
+#    type       = "xen" ]
386
+
387
+# Driver for Xen 4.x
388
+#VM_MAD = [
389
+#    name       = "xen",
390
+#    executable = "one_vmm_exec",
391
+#    arguments  = "-t 15 -r 0 xen4",
392
+#    default    = "vmm_exec/vmm_exec_xen4.conf",
393
+#    type       = "xen" ]
394
+
395
+#-------------------------------------------------------------------------------
396
+
397
+#-------------------------------------------------------------------------------
398
+#  VMware Virtualization Driver Manager Configuration
399
+#    -r number of retries when monitoring a host
400
+#    -t number of threads, i.e. number of hosts monitored at the same time
401
+#-------------------------------------------------------------------------------
402
+#VM_MAD = [
403
+#    name       = "vmware",
404
+#    executable = "one_vmm_sh",
405
+#    arguments  = "-t 15 -r 0 vmware -s sh",
406
+#    default    = "vmm_exec/vmm_exec_vmware.conf",
407
+#    type       = "vmware" ]
408
+#-------------------------------------------------------------------------------
409
+
410
+#-------------------------------------------------------------------------------
411
+#  EC2 Virtualization Driver Manager Configuration
412
+#    -r number of retries when monitoring a host
413
+#    -t number of threads, i.e. number of actions performed at the same time
414
+#-------------------------------------------------------------------------------
415
+#VM_MAD = [
416
+#    name       = "ec2",
417
+#    executable = "one_vmm_sh",
418
+#    arguments  = "-t 15 -r 0 ec2",
419
+#    type       = "xml" ]
420
+#-------------------------------------------------------------------------------
421
+
422
+#-------------------------------------------------------------------------------
423
+#  Dummy Virtualization Driver Configuration
424
+#-------------------------------------------------------------------------------
425
+#VM_MAD = [ name="dummy", executable="one_vmm_dummy", type="xml" ]
426
+#-------------------------------------------------------------------------------
427
+
428
+#*******************************************************************************
429
+# Transfer Manager Driver Configuration
430
+#*******************************************************************************
431
+# You can add more transfer managers with different configurations but make
432
+# sure it has different names.
433
+#   name      : name for this transfer driver
434
+#
435
+#   executable: path of the transfer driver executable, can be an
436
+#               absolute path or relative to $ONE_LOCATION/lib/mads (or
437
+#               /usr/lib/one/mads/ if OpenNebula was installed in /)
438
+#   arguments :
439
+#       -t: number of threads, i.e. number of transfers made at the same time
440
+#       -d: list of transfer drivers separated by commas, if not defined all the
441
+#           drivers available will be enabled
442
+#*******************************************************************************
443
+
444
+TM_MAD = [
445
+    executable = "one_tm",
446
+    arguments = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,vmfs,ceph"
447
+]
448
+
449
+#*******************************************************************************
450
+# Datastore Driver Configuration
451
+#*******************************************************************************
452
+# Drivers to manage the datastores, specialized for the storage backend
453
+#   executable: path of the transfer driver executable, can be an
454
+#               absolute path or relative to $ONE_LOCATION/lib/mads (or
455
+#               /usr/lib/one/mads/ if OpenNebula was installed in /)
456
+#
457
+#   arguments : for the driver executable
458
+#       -t number of threads, i.e. number of repo operations at the same time
459
+#       -d datastore mads separated by commas
460
+#*******************************************************************************
461
+
462
+DATASTORE_MAD = [
463
+    executable = "one_datastore",
464
+    arguments  = "-t 15 -d dummy,fs,vmfs,lvm,ceph"
465
+]
466
+
467
+#*******************************************************************************
468
+# Hook Manager Configuration
469
+#*******************************************************************************
470
+# The Driver (HM_MAD)
471
+# -----------------------------------------------
472
+#
473
+# Used to execute the Hooks:
474
+#   executable: path of the hook driver executable, can be an
475
+#               absolute path or relative to $ONE_LOCATION/lib/mads (or
476
+#               /usr/lib/one/mads/ if OpenNebula was installed in /)
477
+#
478
+#   arguments : for the driver executable, can be an absolute path or relative
479
+#               to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed
480
+#               in /)
481
+#
482
+# Virtual Machine Hooks (VM_HOOK)
483
+# -------------------------------
484
+#
485
+# Defined by:
486
+#   name      : for the hook, useful to track the hook (OPTIONAL)
487
+#   on        : when the hook should be executed,
488
+#               - CREATE, when the VM is created (onevm create)
489
+#               - PROLOG, when the VM is in the prolog state
490
+#               - RUNNING, after the VM is successfully booted
491
+#               - UNKNOWN, when the VM is in the unknown state
492
+#               - SHUTDOWN, after the VM is shutdown
493
+#               - STOP, after the VM is stopped (including VM image transfers)
494
+#               - DONE, after the VM is deleted or shutdown
495
+#               - FAILED, when the VM enters the failed state
496
+#               - CUSTOM, user defined specific STATE and LCM_STATE combination
497
+#                 of states to trigger the hook.
498
+#   command   : path is relative to $ONE_LOCATION/var/remotes/hook
499
+#               (self-contained) or to /var/lib/one/remotes/hook (system-wide).
500
+#               That directory will be copied on the hosts under
501
+#               SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist
502
+#               on the target host
503
+#   arguments : for the hook. You can access to VM information with $
504
+#               - $ID, the ID of the virtual machine
505
+#               - $TEMPLATE, the VM template in xml and base64 encoded
506
+#               - $PREV_STATE, the previous STATE of the Virtual Machine
507
+#               - $PREV_LCM_STATE, the previous LCM STATE of the Virtual Machine
508
+#   remote    : values,
509
+#               - YES, The hook is executed in the host where the VM was
510
+#                 allocated
511
+#               - NO, The hook is executed in the OpenNebula server (default)
512
+#
513
+# Example Virtual Machine Hook
514
+# ----------------------------
515
+#
516
+# VM_HOOK = [
517
+#   name      = "advanced_hook",
518
+#   on        = "CUSTOM",
519
+#   state     = "ACTIVE",
520
+#   lcm_state = "BOOT_UNKNOWN",
521
+#   command   = "log.rb",
522
+#   arguments = "$ID $PREV_STATE $PREV_LCM_STATE" ]
523
+#
524
+# Host Hooks (HOST_HOOK)
525
+# -------------------------------
526
+#
527
+# Defined by:
528
+#   name      : for the hook, useful to track the hook (OPTIONAL)
529
+#   on        : when the hook should be executed,
530
+#               - CREATE, when the Host is created (onehost create)
531
+#               - ERROR, when the Host enters the error state
532
+#               - DISABLE, when the Host is disabled
533
+#   command   : path is relative to $ONE_LOCATION/var/remotes/hook
534
+#               (self-contained) or to /var/lib/one/remotes/hook (system-wide).
535
+#               That directory will be copied on the hosts under
536
+#               SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist
537
+#               on the target host.
538
+#   arguments : for the hook. You can use the following Host information:
539
+#               - $ID, the ID of the host
540
+#               - $TEMPLATE, the Host template in xml and base64 encoded
541
+#   remote    : values,
542
+#               - YES, The hook is executed in the host
543
+#               - NO, The hook is executed in the OpenNebula server (default)
544
+#
545
+# Virtual Network (VNET_HOOK)
546
+# User (USER_HOOK)
547
+# Group (GROUP_HOOK)
548
+# Image (IMAGE_HOOK)
549
+# -------------------------------
550
+#
551
+# These hooks are executed when one of the referring entities are created or
552
+# removed. Each hook is defined by:
553
+#   name      : for the hook, useful to track the hook (OPTIONAL)
554
+#   on        : when the hook should be executed,
555
+#               - CREATE, when the vnet is created
556
+#               - REMOVE, when the vnet is removed
557
+#   command   : path is relative to $ONE_LOCATION/var/remotes/hook
558
+#               (self-contained) or to /var/lib/one/remotes/hook (system-wide).
559
+#               That directory will be copied on the hosts under
560
+#               SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist
561
+#               on the target host.
562
+#   arguments : for the hook. You can use the following Host information:
563
+#               - $ID, the ID of the host
564
+#               - $TEMPLATE, the vnet template in xml and base64 encoded
565
+#-------------------------------------------------------------------------------
566
+
567
+VM_HOOK = [
568
+    name    = "open_ports",
569
+    on      = "RUNNING",
570
+    command = "eole/graphicsfw",
571
+    arguments = "open $TEMPLATE",
572
+    remote  = "YES"
573
+]
574
+
575
+VM_HOOK = [
576
+    name    = "close_ports",
577
+    on      = "DONE",
578
+    command = "eole/graphicsfw",
579
+    arguments = "close $TEMPLATE",
580
+    remote  = "YES"
581
+]
582
+
583
+VM_HOOK = [
584
+    name    = "close_ports",
585
+    on      = "STOP",
586
+    command = "eole/graphicsfw",
587
+    arguments = "close $TEMPLATE",
588
+    remote  = "YES"
589
+]
590
+
591
+VM_HOOK = [
592
+    name    = "close_ports",
593
+    on      = "SHUTDOWN",
594
+    command = "eole/graphicsfw",
595
+    arguments = "close $TEMPLATE",
596
+    remote  = "YES"
597
+]
598
+
599
+HM_MAD = [
600
+    executable = "one_hm" ]
601
+
602
+#*******************************************************************************
603
+# Fault Tolerance Hooks
604
+#*******************************************************************************
605
+# This hook is used to perform recovery actions when a host fails.
606
+# Script to implement host failure tolerance
607
+#   It can be set to
608
+#           -r recreate VMs running in the host
609
+#           -d delete VMs running in the host
610
+#   Additional flags
611
+#           -f force resubmission of suspended VMs
612
+#           -p <n> avoid resubmission if host comes
613
+#                  back after n monitoring cycles
614
+#*******************************************************************************
615
+#
616
+#HOST_HOOK = [
617
+#    name      = "error",
618
+#    on        = "ERROR",
619
+#    command   = "ft/host_error.rb",
620
+#    arguments = "$ID -r",
621
+#    remote    = "no" ]
622
+#-------------------------------------------------------------------------------
623
+# These two hooks can be used to automatically delete or resubmit VMs that reach
624
+# the "failed" state. This way, the administrator doesn't have to interact
625
+# manually to release its resources or retry the deployment.
626
+#
627
+#
628
+# Only one of them should be uncommented.
629
+#-------------------------------------------------------------------------------
630
+#
631
+#VM_HOOK = [
632
+#   name      = "on_failure_delete",
633
+#   on        = "FAILED",
634
+#   command   = "/usr/bin/env onevm delete",
635
+#   arguments = "$ID" ]
636
+#
637
+#VM_HOOK = [
638
+#   name      = "on_failure_recreate",
639
+#   on        = "FAILED",
640
+#   command   = "/usr/bin/env onevm delete --recreate",
641
+#   arguments = "$ID" ]
642
+#-------------------------------------------------------------------------------
643
+
644
+#*******************************************************************************
645
+# Auth Manager Configuration
646
+#*******************************************************************************
647
+# AUTH_MAD: The Driver that will be used to authenticate (authn) and
648
+# authorize (authz) OpenNebula requests. If defined OpenNebula will use the
649
+# built-in auth policies.
650
+#
651
+#   executable: path of the auth driver executable, can be an
652
+#               absolute path or relative to $ONE_LOCATION/lib/mads (or
653
+#               /usr/lib/one/mads/ if OpenNebula was installed in /)
654
+#
655
+#   authn     : list of authentication modules separated by commas, if not
656
+#               defined all the modules available will be enabled
657
+#   authz     : list of authentication modules separated by commas
658
+#
659
+# SESSION_EXPIRATION_TIME: Time in seconds to keep an authenticated token as
660
+# valid. During this time, the driver is not used. Use 0 to disable session
661
+# caching
662
+#
663
+# ENABLE_OTHER_PERMISSIONS: Whether or not users can set the permissions for
664
+# 'other', so publishing or sharing resources with others. Users in the oneadmin
665
+# group will still be able to change these permissions. Values: YES or NO.
666
+#
667
+# DEFAULT_UMASK: Similar to Unix umask, sets the default resources permissions.
668
+# Its format must be 3 octal digits. For example a umask of 137 will set
669
+# the new object's permissions to 640 "um- u-- ---"
670
+#*******************************************************************************
671
+AUTH_MAD = [
672
+    executable = "one_auth_mad",
673
+    authn = "server_cipher,default,%%sunstone_auth_modes"
674
+]
675
+
676
+SESSION_EXPIRATION_TIME = 900
677
+
678
+#ENABLE_OTHER_PERMISSIONS = "YES"
679
+
680
+DEFAULT_UMASK = 177
681
+
682
+#*******************************************************************************
683
+# OneGate
684
+#   ONEGATE_ENDPOINT: The URL for the onegate server (the Gate to OpenNebula for
685
+#   VMs). The onegate server is started using a separate command. The endpoint
686
+#   MUST be consistent with the values in onegate-server.conf
687
+#*******************************************************************************
688
+
689
+#ONEGATE_ENDPOINT = "http://frontend:5030"
690
+
691
+#*******************************************************************************
692
+# Restricted Attributes Configuration
693
+#*******************************************************************************
694
+# The following attributes are restricted to users outside the oneadmin group
695
+#*******************************************************************************
696
+
697
+VM_RESTRICTED_ATTR = "CONTEXT/FILES"
698
+VM_RESTRICTED_ATTR = "NIC/MAC"
699
+VM_RESTRICTED_ATTR = "NIC/VLAN_ID"
700
+VM_RESTRICTED_ATTR = "NIC/BRIDGE"
701
+
702
+#VM_RESTRICTED_ATTR = "RANK"
703
+#VM_RESTRICTED_ATTR = "SCHED_RANK"
704
+#VM_RESTRICTED_ATTR = "REQUIREMENTS"
705
+#VM_RESTRICTED_ATTR = "SCHED_REQUIREMENTS"
706
+
707
+IMAGE_RESTRICTED_ATTR = "SOURCE"
708
+
709
+#*******************************************************************************
710
+# Inherited Attributes Configuration
711
+#*******************************************************************************
712
+# The following attributes will be copied from the resource template to the
713
+# instantiated VMs. More than one attribute can be defined.
714
+#
715
+# INHERIT_IMAGE_ATTR: Attribute to be copied from the Image template
716
+# to each VM/DISK.
717
+#
718
+# INHERIT_DATASTORE_ATTR: Attribute to be copied from the Datastore template
719
+# to each VM/DISK.
720
+#
721
+# INHERIT_VNET_ATTR: Attribute to be copied from the Network template
722
+# to each VM/NIC.
723
+#*******************************************************************************
724
+
725
+#INHERIT_IMAGE_ATTR     = "EXAMPLE"
726
+#INHERIT_IMAGE_ATTR     = "SECOND_EXAMPLE"
727
+#INHERIT_DATASTORE_ATTR = "COLOR"
728
+#INHERIT_VNET_ATTR      = "BANDWIDTH_THROTTLING"
729
+
730
+INHERIT_DATASTORE_ATTR  = "CEPH_HOST"
731
+INHERIT_DATASTORE_ATTR  = "CEPH_SECRET"
732
+INHERIT_DATASTORE_ATTR  = "CEPH_USER"
733
+INHERIT_DATASTORE_ATTR  = "RBD_FORMAT"
734
+
735
+INHERIT_DATASTORE_ATTR  = "GLUSTER_HOST"
736
+INHERIT_DATASTORE_ATTR  = "GLUSTER_VOLUME"
737
+
738
+INHERIT_VNET_ATTR       = "VLAN_TAGGED_ID"
739
+
740
+#*******************************************************************************
741
+# Transfer Manager Driver Behavior Configuration
742
+#*******************************************************************************
743
+# The  configuration for each driver is defined in TM_MAD_CONF. These
744
+# values are used when creating a new datastore and should not be modified
745
+# since they define the datastore behavior.
746
+#   name      : name of the transfer driver, listed in the -d option of the
747
+#               TM_MAD section
748
+#   ln_target : determines how the persistent images will be cloned when
749
+#               a new VM is instantiated.
750
+#       NONE: The image will be linked and no more storage capacity will be used
751
+#       SELF: The image will be cloned in the Images datastore
752
+#       SYSTEM: The image will be cloned in the System datastore
753
+#   clone_target : determines how the non persistent images will be
754
+#                  cloned when a new VM is instantiated.
755
+#       NONE: The image will be linked and no more storage capacity will be used
756
+#       SELF: The image will be cloned in the Images datastore
757
+#       SYSTEM: The image will be cloned in the System datastore
758
+#   shared : determines if the storage holding the system datastore is shared
759
+#            among the different hosts or not. Valid values: "yes" or "no"
760
+#*******************************************************************************
761
+
762
+TM_MAD_CONF = [
763
+    name = "dummy", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
764
+]
765
+
766
+TM_MAD_CONF = [
767
+    name = "lvm", ln_target = "NONE", clone_target = "SELF", shared = "yes"
768
+]
769
+
770
+TM_MAD_CONF = [
771
+    name = "shared", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
772
+]
773
+
774
+TM_MAD_CONF = [
775
+    name = "fs_lvm", ln_target = "SYSTEM", clone_target = "SYSTEM", shared="yes"
776
+]
777
+
778
+TM_MAD_CONF = [
779
+    name = "qcow2", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
780
+]
781
+
782
+TM_MAD_CONF = [
783
+    name = "ssh", ln_target = "SYSTEM", clone_target = "SYSTEM", shared = "no"
784
+]
785
+
786
+TM_MAD_CONF = [
787
+    name = "vmfs", ln_target = "NONE", clone_target= "SYSTEM", shared = "yes"
788
+]
789
+
790
+TM_MAD_CONF = [
791
+    name = "ceph", ln_target = "NONE", clone_target = "SELF", shared = "yes"
792
+]

+ 46
- 0
tmpl/vmm_exec_kvm.conf View File

@@ -0,0 +1,46 @@
1
+# -------------------------------------------------------------------------- #
2
+# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs        #
3
+#                                                                            #
4
+# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
5
+# not use this file except in compliance with the License. You may obtain    #
6
+# a copy of the License at                                                   #
7
+#                                                                            #
8
+# http://www.apache.org/licenses/LICENSE-2.0                                 #
9
+#                                                                            #
10
+# Unless required by applicable law or agreed to in writing, software        #
11
+# distributed under the License is distributed on an "AS IS" BASIS,          #
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13
+# See the License for the specific language governing permissions and        #