Allow disabling ipxe for provisioning 69/46069/17
authorDan Radez <dradez@redhat.com>
Fri, 20 Oct 2017 19:30:20 +0000 (15:30 -0400)
committerTim Rozet <trozet@redhat.com>
Wed, 7 Feb 2018 21:56:16 +0000 (21:56 +0000)
JIRA: APEX-535

Change-Id: I52d17e962fc4a504db1ddbc20df0ac56a208f34b
Signed-off-by: Dan Radez <dradez@redhat.com>
apex/deploy.py
apex/tests/test_apex_undercloud.py
apex/undercloud/undercloud.py
config/deploy/deploy_settings.yaml
lib/ansible/playbooks/configure_undercloud.yml

index d2f1c93..f57de8d 100644 (file)
@@ -389,7 +389,7 @@ def main():
             oc_cfg.create_nic_template(net_settings, deploy_settings, role,
                                        args.deploy_dir, APEX_TEMP_DIR)
         # Install Undercloud
-        undercloud.configure(net_settings,
+        undercloud.configure(net_settings, deploy_settings,
                              os.path.join(args.lib_dir, ANSIBLE_PATH,
                                           'configure_undercloud.yml'),
                              APEX_TEMP_DIR)
index 9458bf9..c821ade 100644 (file)
@@ -121,7 +121,8 @@ class TestUndercloud(unittest.TestCase):
                        mock_generate_config, mock_utils):
         uc = Undercloud('img_path', 'tplt_path', external_network=True)
         ns = MagicMock()
-        uc.configure(ns, 'playbook', '/tmp/dir')
+        ds = MagicMock()
+        uc.configure(ns, ds, 'playbook', '/tmp/dir')
 
     @patch('apex.undercloud.undercloud.utils')
     @patch.object(Undercloud, 'generate_config', return_value={})
@@ -131,10 +132,11 @@ class TestUndercloud(unittest.TestCase):
                               mock_generate_config, mock_utils):
         uc = Undercloud('img_path', 'tplt_path', external_network=True)
         ns = MagicMock()
+        ds = MagicMock()
         subps_err = subprocess.CalledProcessError(1, 'cmd')
         mock_utils.run_ansible.side_effect = subps_err
         assert_raises(ApexUndercloudException,
-                      uc.configure, ns, 'playbook', '/tmp/dir')
+                      uc.configure, ns, ds, 'playbook', '/tmp/dir')
 
     @patch('apex.undercloud.undercloud.os.remove')
     @patch('apex.undercloud.undercloud.os.path')
@@ -192,5 +194,6 @@ class TestUndercloud(unittest.TestCase):
               'dns-domain': 'dns',
               'networks': {'admin': ns_net,
                            'external': [ns_net]}}
+        ds = {'global_params': {}}
 
-        Undercloud('img_path', 'tplt_path').generate_config(ns)
+        Undercloud('img_path', 'tplt_path').generate_config(ns, ds)
index 452e497..d28ed98 100644 (file)
@@ -111,10 +111,12 @@ class Undercloud:
                 "Unable to find IP for undercloud.  Check if VM booted "
                 "correctly")
 
-    def configure(self, net_settings, playbook, apex_temp_dir):
+    def configure(self, net_settings, deploy_settings,
+                  playbook, apex_temp_dir):
         """
         Configures undercloud VM
-        :param net_setings: Network settings for deployment
+        :param net_settings: Network settings for deployment
+        :param deploy_settings: Deployment settings for deployment
         :param playbook: playbook to use to configure undercloud
         :param apex_temp_dir: temporary apex directory to hold configs/logs
         :return: None
@@ -122,7 +124,8 @@ class Undercloud:
 
         logging.info("Configuring Undercloud...")
         # run ansible
-        ansible_vars = Undercloud.generate_config(net_settings)
+        ansible_vars = Undercloud.generate_config(net_settings,
+                                                  deploy_settings)
         ansible_vars['apex_temp_dir'] = apex_temp_dir
         try:
             utils.run_ansible(ansible_vars, playbook, host=self.ip,
@@ -180,21 +183,27 @@ class Undercloud:
         virt_utils.virt_customize(virt_ops, self.volume)
 
     @staticmethod
-    def generate_config(ns):
+    def generate_config(ns, ds):
         """
         Generates a dictionary of settings for configuring undercloud
         :param ns: network settings to derive undercloud settings
+        :param ds: deploy settings to derive undercloud settings
         :return: dictionary of settings
         """
 
         ns_admin = ns['networks']['admin']
         intro_range = ns['apex']['networks']['admin']['introspection_range']
         config = dict()
+        # Check if this is an ARM deployment
+        config['aarch64'] = platform.machine() == 'aarch64'
+        # Configuration for undercloud.conf
         config['undercloud_config'] = [
             "enable_ui false",
             "undercloud_update_packages false",
             "undercloud_debug false",
             "inspection_extras false",
+            "ipxe {}".format(str(ds['global_params'].get('ipxe', True) and
+                                 not config['aarch64'])),
             "undercloud_hostname undercloud.{}".format(ns['dns-domain']),
             "local_ip {}/{}".format(str(ns_admin['installer_vm']['ip']),
                                     str(ns_admin['cidr']).split('/')[1]),
@@ -227,7 +236,4 @@ class Undercloud:
             "enabled": ns_external['enabled']
         }
 
-        # Check if this is an ARM deployment
-        config['aarch64'] = platform.machine() == 'aarch64'
-
         return config
index a5e9e96..ab3b0a3 100644 (file)
@@ -7,9 +7,12 @@
 # If ha_enabled is false, there will only be one controller.
 global_params:
   ha_enabled: true
-  # introspect defaults to True, if set false the introspection process will
-  # be skipped at deploy time.
+  # introspect defaults to True,
+  # Enables/disables the introspection process at deploy time.
   introspect: true
+  # ipxe defaults to True
+  # Enables/disables the use of ipxe for provisioning
+  ipxe: true
 
 deploy_options:
   # Which SDN controller to use. Valid options are 'opendaylight', 'onos',
index c0e1cd3..60afca9 100644 (file)
@@ -39,9 +39,6 @@
       shell: openstack-config --set /etc/ironic/ironic.conf {{ item }}
       become: yes
       with_items: "{{ ironic_config }}"
-    - name: openstack-configs undercloud aarch64
-      shell: openstack-config --set undercloud.conf DEFAULT ipxe_enabled false
-      when: aarch64
     - lineinfile:
         path: /usr/lib/python2.7/site-packages/ironic/common/pxe_utils.py
         regexp: '_link_ip_address_pxe_configs'