revert build_pxe_for_discover function to build pxe server 03/40303/6
authorzhouya <zhou.ya@zte.com.cn>
Sat, 26 Aug 2017 06:50:59 +0000 (14:50 +0800)
committerzhouya <zhou.ya@zte.com.cn>
Sat, 26 Aug 2017 11:32:24 +0000 (19:32 +0800)
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 <zhou.ya@zte.com.cn>
deploy/daisy.conf
deploy/tempest.py
docs/release/configguide/installerconfig.rst

index fe48925..1a41c51 100644 (file)
@@ -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
index 9117a18..1cc00c1 100644 (file)
@@ -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"}
index f6a01b7..10fa9ad 100644 (file)
@@ -28,9 +28,7 @@ daisy.conf file.Then put the right configured daisy.conf file in the
 
 3. "os_install_type" field just support "pxe" for now.
 
-4. Daisy now use pxe server to install the os, so "build_pxe" must set to "yes".
-   If the value in daisy.conf in your env of /home/daisy_install/ dir is "no",
-   you must change this field to "yes" manually before installing Daisy.
+4. Daisy now use pxe server to install the os, the "build_pxe" item must set to "no".
 
 5. "eth_name" field is the pxe server interface, and this field is required when
    the "build_pxe" field set to "yes".This should be set to the interface