From f3ad3936a5d395ecb31849835e6517bdc5de8d59 Mon Sep 17 00:00:00 2001 From: zhouya Date: Sat, 26 Aug 2017 14:50:59 +0800 Subject: revert build_pxe_for_discover function to build pxe server In case of deploy failed with deploy.sh file without reinstall daisy node, we need to resetup DHCP in tempest.py script Change-Id: Ia7b4de7933bf4957226a2bf0965858a555f0ed54 Signed-off-by: zhouya --- deploy/daisy.conf | 2 +- deploy/tempest.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'deploy') diff --git a/deploy/daisy.conf b/deploy/daisy.conf index fe48925f..1a41c516 100644 --- a/deploy/daisy.conf +++ b/deploy/daisy.conf @@ -16,7 +16,7 @@ os_install_type=pxe [PXE] #Set to 'yes' if you want to build a PXE server, otherwise to 'no'. -build_pxe=yes +build_pxe=no #the nic name, to build a PXE server on this nic. eth_name=ens3 diff --git a/deploy/tempest.py b/deploy/tempest.py index 9117a187..1cc00c19 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -15,10 +15,13 @@ import get_conf import traceback import time import os +import ConfigParser daisy_version = 1.0 daisyrc_path = "/root/daisyrc_admin" +daisy_conf_path = "/home/daisy_install/daisy.conf" iso_path = "/var/lib/daisy/kolla/" +deployment_interface = "ens3" cluster_name = "clustertest" _CLI_OPTS = [ @@ -51,6 +54,13 @@ def print_bar(msg): print ("--------------------------------------------") +def get_configure_from_daisyconf(section, key): + config = ConfigParser.ConfigParser() + config.read(daisy_conf_path) + option_value = config.get(section, key) + return option_value + + def get_endpoint(file_path): for line in open(file_path): if 'OS_ENDPOINT' in line: @@ -64,6 +74,7 @@ client = daisy_client.Client(version=daisy_version, endpoint=daisy_endpoint) def prepare_install(): + global deployment_interface try: print("get config...") conf = cfg.ConfigOpts() @@ -79,6 +90,9 @@ def prepare_install(): print("cluster_id=%s." % cluster_id) print("update network...") update_network(cluster_id, network_map) + print("build pxe server to install os...") + deployment_interface = get_configure_from_daisyconf("PXE", "eth_name") + build_pxe_for_discover(cluster_id) elif conf['host'] and conf['host'] == 'yes': isbare = False if 'isbare' in conf and conf['isbare'] == 0 else True print("discover host...") @@ -125,6 +139,12 @@ def prepare_install(): print_bar("Everything is done!") +def build_pxe_for_discover(cluster_id): + cluster_meta = {'cluster_id': cluster_id, + 'deployment_interface': deployment_interface} + client.install.install(**cluster_meta) + + def install_os_for_vm_step1(cluster_id): cluster_meta = {'cluster_id': cluster_id, 'pxe_only': "true"} -- cgit 1.2.3-korg