From 961359f38743e50de24a2ea1ea96a36656cb39ba Mon Sep 17 00:00:00 2001 From: Vladimir Kozhukalov Date: Tue, 19 May 2015 11:36:43 +0300 Subject: [PATCH] Moved nodiscover to /etc/nailgun-agent We create /etc/nailgun-agent/nodiscover during provisioning and then this file is assumed to be removed in /etc/rc.local which guarantees that nailgun-agent doesn't change mcollective config at the same time when cloud-init does this. Otherwise, we can end up with corrupted mcollective config. Former location of this file /var/run/nodiscover assumes it is removed at the beginning of the boot process while we need it to be in place at least until cloud-init has finished its magic. For details see http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA Related-Patch: If8d1252e6d351ad073de26afc13a19de76f531fb Change-Id: I5fca4ca39abdc273f6958f2643fae6c5c99fba68 Related-Bug: #1449186 --- lib/astute/config.rb | 1 + lib/astute/provision.rb | 2 +- mcagents/erase_node.rb | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/astute/config.rb b/lib/astute/config.rb index 467e17d8..ef434f81 100644 --- a/lib/astute/config.rb +++ b/lib/astute/config.rb @@ -93,6 +93,7 @@ module Astute # 0.1667 / 180 = 30 sec. Delay between reboot command for first # and last node in group should be 30 sec. Empirical observation. # Please increase if nodes could not provisioning + conf[:agent_nodiscover_file] = '/etc/nailgun-agent/nodiscover' # if this file in place, nailgun-agent will do nothing # Server settings conf[:broker_host] = 'localhost' diff --git a/lib/astute/provision.rb b/lib/astute/provision.rb index 7e249e4e..61b94cda 100644 --- a/lib/astute/provision.rb +++ b/lib/astute/provision.rb @@ -388,7 +388,7 @@ module Astute nodes_uids, check_result=false, timeout=2) - mco_result = shell.execute(:cmd => 'rm -f /var/run/nodiscover') + mco_result = shell.execute(:cmd => "rm -f #{Astute.config.agent_nodiscover_file}") result = mco_result.map do |n| { 'uid' => n.results[:sender], diff --git a/mcagents/erase_node.rb b/mcagents/erase_node.rb index 732a22ac..2147c919 100644 --- a/mcagents/erase_node.rb +++ b/mcagents/erase_node.rb @@ -26,6 +26,8 @@ module MCollective # https://github.com/stackforge/fuel-web/blob/master/bin/agent#L43 STORAGE_CODES = [3, 8, 65, 66, 67, 68, 69, 70, 71, 104, 105, 106, 107, 108, 109, 110, 111, 202, 252, 253, 259] + AGENT_NODISCOVER_FILE = '/etc/nailgun-agent/nodiscover' + action "erase_node" do erase_node end @@ -164,7 +166,7 @@ module MCollective # Prevent discover by agent while node rebooting def prevent_discover - lock_path = '/var/run/nodiscover' + lock_path = AGENT_NODISCOVER_FILE debug_msg("Create file for discovery preventing #{lock_path}") FileUtils.touch(lock_path) end