From dad1e8fbffb3da22495c19eb17c61a8fac376cfc Mon Sep 17 00:00:00 2001
From: Alain Takoudjou <alain.takoudjou@nexedi.com>
Date: Fri, 1 Apr 2016 17:05:49 +0200
Subject: [PATCH] fix kvm Resiliency test

---
 software/kvm/common.cfg                       | 2 +-
 software/kvm/instance-for-erp5testnode.cfg.in | 7 ++++++-
 software/kvm/instance-kvm.cfg.jinja2          | 4 ++--
 software/kvm/software-for-erp5testnode.cfg    | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/software/kvm/common.cfg b/software/kvm/common.cfg
index 77e5ed13a..3d4e9b354 100644
--- a/software/kvm/common.cfg
+++ b/software/kvm/common.cfg
@@ -98,7 +98,7 @@ mode = 0644
 recipe = hexagonit.recipe.download
 url = ${:_profile_base_location_}/instance-kvm.cfg.jinja2
 mode = 644
-md5sum = 45f5bcfeac31d029158f4e5e529a12c8
+md5sum = 341bb135769421fdb1bc3666c921dbb2
 download-only = true
 on-update = true
 
diff --git a/software/kvm/instance-for-erp5testnode.cfg.in b/software/kvm/instance-for-erp5testnode.cfg.in
index aa297a730..ce78e913a 100644
--- a/software/kvm/instance-for-erp5testnode.cfg.in
+++ b/software/kvm/instance-for-erp5testnode.cfg.in
@@ -50,10 +50,12 @@ context =
     key slapparameter_dict slap-configuration:configuration
     key storage_dict slap-configuration:storage-dict
     key tap_network_dict slap-configuration:tap-network-information-dict
+    raw ansible_promise_tpl ${template-ansible-promise:location}/${template-ansible-promise:filename}
     raw curl_executable_location ${curl:location}/bin/curl
     raw dash_executable_location ${dash:location}/bin/dash
     raw dcron_executable_location ${dcron:location}/sbin/crond
     raw debian_amd64_netinst_location ${debian-amd64-netinst.iso:location}/${debian-amd64-netinst.iso:filename}
+    raw logrotate_cfg ${template-logrotate-base:rendered}
     raw novnc_location ${noVNC:location}
     raw netcat_bin ${netcat:location}/bin/netcat
     raw openssl_executable_location ${openssl:location}/bin/openssl
@@ -62,8 +64,10 @@ context =
     raw qemu_img_executable_location ${kvm:location}/bin/qemu-img
     raw sixtunnel_executable_location ${6tunnel:location}/bin/6tunnel
     raw template_httpd_cfg ${template-httpd:rendered}
-    raw template_monitor ${monitor2-template:rendered}
     raw template_content ${template-content:location}/${template-content:filename}
+    raw template_kvm_controller_run ${template-kvm-controller:location}/${template-kvm-controller:filename}
+    raw template_kvm_run ${template-kvm-run:location}/${template-kvm-run:filename}
+    raw template_monitor ${monitor2-template:rendered}
     raw websockify_executable_location ${buildout:directory}/bin/websockify
 template-parts-destination = ${template-parts:destination}
 template-replicated-destination = ${template-replicated:destination}
@@ -116,6 +120,7 @@ context =
     raw template_kvm_export ${template-kvm-export-script:location}/${template-kvm-export-script:filename}
     raw pbsready_export_template ${pbsready-export:output}
     raw gzip_binary ${gzip:location}/bin/gzip
+    key slapparameter_dict slap-configuration:configuration
 mode = 0644
 
 [dynamic-template-kvm-resilient-test]
diff --git a/software/kvm/instance-kvm.cfg.jinja2 b/software/kvm/instance-kvm.cfg.jinja2
index fd774c6e3..ac8743da8 100644
--- a/software/kvm/instance-kvm.cfg.jinja2
+++ b/software/kvm/instance-kvm.cfg.jinja2
@@ -360,7 +360,7 @@ tap-ipv4 = ${slap-network-information:tap-ipv4}
 {%   if use_nat == 'true' -%}
 {%     set kvm_http = 'http://10.0.2.100' -%}
 {%   endif %}
-{%   if slapparameter_dict.get('authorized-key', '') -%}
+{%   if slapparameter_dict.get('authorized-key', '') and slapparameter_dict.get('type', '') == 'cluster' -%}
 7_info = Get the publick key file in your VM with the command: wget {{ kvm_http }}/authorized_keys
 {%   endif %}
 {% endif %}
@@ -581,7 +581,7 @@ keyboard-layout-language = fr
 {% if use_tap == 'true' and tap_network_dict.has_key('ipv4') and disable_ansible_promise == 'false' %}
 {%   do part_list.extend(['ansible-vm-promise', 'logrotate-vm-bootstrap']) -%}
 {% endif -%}
-{% if slapparameter_dict.get('authorized-key', '') %}
+{% if slapparameter_dict.get('authorized-key', '') and slapparameter_dict.get('type', '') == 'cluster' %}
 {%   do part_list.append('get-authorized-key') -%}
 {%   endif -%}
 
diff --git a/software/kvm/software-for-erp5testnode.cfg b/software/kvm/software-for-erp5testnode.cfg
index 3f80be41a..94281535e 100644
--- a/software/kvm/software-for-erp5testnode.cfg
+++ b/software/kvm/software-for-erp5testnode.cfg
@@ -5,6 +5,6 @@ extends = development.cfg
 [template]
 recipe = slapos.recipe.template
 url = ${:_profile_base_location_}/instance-for-erp5testnode.cfg.in
-md5sum = b8e3cd7b88f491e361e0a2e30ed4e58e
+md5sum = c528f36ffc119af457e318c5f1aec5b6
 output = ${buildout:directory}/template.cfg
 mode = 0644
\ No newline at end of file
-- 
2.30.9