From 81561126307f15d4f65a743ed2431ea8c713a921 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 17 Feb 2018 18:01:57 +0100 Subject: [MaaS] Override failed testing by default Some nodes fail automatic testing done by MaaS during commissioning, although running the testing suites one more time manually works. For now, just override all 'failed testing' nodes unconditionally. JIRA: FUEL-333 Change-Id: I13d3ee3d82550524480aa53aa8752ab90aa940cd Signed-off-by: Alexandru Avadanii --- mcp/config/states/maas | 9 ++++++++- mcp/salt-formulas/maas/machines/delete.sls | 1 + .../maas/machines/mark_broken_fixed.sls | 1 + .../maas/machines/override_failed_testing.sls | 20 ++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 mcp/salt-formulas/maas/machines/override_failed_testing.sls diff --git a/mcp/config/states/maas b/mcp/config/states/maas index 116bc45cd..0034e78f1 100755 --- a/mcp/config/states/maas +++ b/mcp/config/states/maas @@ -30,12 +30,19 @@ function maas_fixup() { local fcnodes=$(echo "${statusout}" | \ grep -Pzo 'status: Failed commissioning\n\s+system_id: \K.+\n') + local ftnodes=$(echo "${statusout}" | \ + grep -Pzo 'status: Failed testing\n\s+system_id: \K.+\n') for node_system_id in ${fcnodes}; do salt -C 'mas01*' state.apply maas.machines.delete \ pillar="{'system_id': '${node_system_id}'}" sleep 10 done - if [ -n "${fcnodes}" ]; then + for node_system_id in ${ftnodes}; do + salt -C 'mas01*' state.apply maas.machines.override_failed_testing \ + pillar="{'system_id': '${node_system_id}'}" + sleep 10 + done + if [ -n "${fcnodes}" ] || [ -n "${ftnodes}" ]; then salt -C 'mas01*' state.apply maas.machines return 1 fi diff --git a/mcp/salt-formulas/maas/machines/delete.sls b/mcp/salt-formulas/maas/machines/delete.sls index dbb625a02..2903f9226 100644 --- a/mcp/salt-formulas/maas/machines/delete.sls +++ b/mcp/salt-formulas/maas/machines/delete.sls @@ -10,6 +10,7 @@ maas_login_admin: cmd.run: - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials" + - unless: 'test -e /var/lib/maas/.maas_credentials' # TODO: implement delete_machine via _modules/maas.py delete_machine: diff --git a/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls b/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls index 17a7df8d8..3983729e7 100644 --- a/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls +++ b/mcp/salt-formulas/maas/machines/mark_broken_fixed.sls @@ -10,6 +10,7 @@ maas_login_admin: cmd.run: - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials" + - unless: 'test -e /var/lib/maas/.maas_credentials' # TODO: implement mark_broken_fixed_machine via _modules/maas.py mark_broken_fixed_machine: diff --git a/mcp/salt-formulas/maas/machines/override_failed_testing.sls b/mcp/salt-formulas/maas/machines/override_failed_testing.sls new file mode 100644 index 000000000..e7fe1d267 --- /dev/null +++ b/mcp/salt-formulas/maas/machines/override_failed_testing.sls @@ -0,0 +1,20 @@ +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +{%- from "maas/map.jinja" import region with context %} + +maas_login_admin: + cmd.run: + - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials" + - unless: 'test -e /var/lib/maas/.maas_credentials' + +# TODO: implement override_failed_testing via _modules/maas.py +mark_broken_fixed_machine: + cmd.run: + - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && maas opnfv machine override-failed-testing {{ pillar['system_id'] }}" + - require: + - cmd: maas_login_admin -- cgit 1.2.3-korg From 5acee090a5ecd7bcb5d66769ff83ef37e8e43dae Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Wed, 31 Jan 2018 02:12:51 +0100 Subject: [baremetal] Use upstream lab proxy for keyservers Proxy chainloading does not always work for keyserver requests, so: - mv common.infra.lab_proxy_pdf common.include.lab_proxy_pdf; - mv common.include.proxy common.include.maas_proxy; - include lab_proxy_pdf after each maas_proxy, so if upstream_proxy is defined, it will override the MaaS proxy; JIRA: FUEL-317 Change-Id: I63749be0d350ea73ea2cf6e629710766b14ecb73 Signed-off-by: Alexandru Avadanii --- .../include/lab_proxy_pdf.yml.j2 | 24 ++++++++++++++++++++++ .../mcp-pike-common-ha/include/maas_proxy.yml | 24 ++++++++++++++++++++++ .../cluster/mcp-pike-common-ha/include/proxy.yml | 24 ---------------------- .../cluster/mcp-pike-common-ha/infra/config.yml | 2 +- .../cluster/mcp-pike-common-ha/infra/kvm.yml | 3 ++- .../mcp-pike-common-ha/infra/lab_proxy_pdf.yml.j2 | 24 ---------------------- .../cluster/mcp-pike-common-ha/infra/maas.yml | 2 +- .../mcp-pike-common-ha/openstack_compute.yml | 3 ++- .../openstack_interface_vcp_biport.yml | 3 ++- .../openstack_interface_vcp_triport.yml | 3 ++- 10 files changed, 58 insertions(+), 54 deletions(-) create mode 100644 mcp/reclass/classes/cluster/mcp-pike-common-ha/include/lab_proxy_pdf.yml.j2 create mode 100644 mcp/reclass/classes/cluster/mcp-pike-common-ha/include/maas_proxy.yml delete mode 100644 mcp/reclass/classes/cluster/mcp-pike-common-ha/include/proxy.yml delete mode 100644 mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/lab_proxy_pdf.yml.j2 diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/lab_proxy_pdf.yml.j2 b/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/lab_proxy_pdf.yml.j2 new file mode 100644 index 000000000..0e95d2d1d --- /dev/null +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/lab_proxy_pdf.yml.j2 @@ -0,0 +1,24 @@ +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +# We'll craft this class so it can be reused on both cfg01 and mas01 +{%- if conf.idf.fuel.network.upstream_proxy is defined %} +{%- set upstream_proxy=conf.idf.fuel.network.upstream_proxy %} +parameters: + maas: + region: + upstream_proxy: + address: {{ upstream_proxy.address }} + port: {{ upstream_proxy.port }} + linux: + system: + proxy: + keyserver: + http: http://{{ upstream_proxy.address }}:{{ upstream_proxy.port }} + https: http://{{ upstream_proxy.address }}:{{ upstream_proxy.port }} +{%- endif %} diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/maas_proxy.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/maas_proxy.yml new file mode 100644 index 000000000..3c324db8b --- /dev/null +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/maas_proxy.yml @@ -0,0 +1,24 @@ +############################################################################## +# Copyright (c) 2017 Mirantis Inc., Enea AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +parameters: + # NOTE: Apt proxy is set by curtin, Salt minion proxy is configured below, + # only enable proxy via /etc/environment if you need it for smth else + # linux: + # system: + # env: + # http_proxy: http://${_param:infra_maas_node01_deploy_address}:8000 + # https_proxy: http://${_param:infra_maas_node01_deploy_address}:8000 + # no_proxy: + # - .local + linux: + system: + proxy: + keyserver: + http: http://${_param:infra_maas_node01_deploy_address}:8000 + https: http://${_param:infra_maas_node01_deploy_address}:8000 diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/proxy.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/proxy.yml deleted file mode 100644 index 3c324db8b..000000000 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/include/proxy.yml +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################## -# Copyright (c) 2017 Mirantis Inc., Enea AB and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -parameters: - # NOTE: Apt proxy is set by curtin, Salt minion proxy is configured below, - # only enable proxy via /etc/environment if you need it for smth else - # linux: - # system: - # env: - # http_proxy: http://${_param:infra_maas_node01_deploy_address}:8000 - # https_proxy: http://${_param:infra_maas_node01_deploy_address}:8000 - # no_proxy: - # - .local - linux: - system: - proxy: - keyserver: - http: http://${_param:infra_maas_node01_deploy_address}:8000 - https: http://${_param:infra_maas_node01_deploy_address}:8000 diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/config.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/config.yml index 0fb8e6418..5e416c907 100644 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/config.yml +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/config.yml @@ -25,7 +25,7 @@ classes: # - system.reclass.storage.system.stacklight_monitor_cluster # - system.reclass.storage.system.stacklight_telemetry_cluster - system.reclass.storage.system.infra_maas_single - - cluster.mcp-pike-common-ha.infra.lab_proxy_pdf + - cluster.mcp-pike-common-ha.include.lab_proxy_pdf parameters: _param: salt_master_base_environment: prd diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/kvm.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/kvm.yml index 9f85366c8..b6fb573e8 100644 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/kvm.yml +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/kvm.yml @@ -22,7 +22,8 @@ classes: # - system.salt.control.cluster.stacklight_log_cluster # - system.salt.control.cluster.stacklight_telemetry_cluster - cluster.mcp-pike-common-ha.infra.kvm_pdf - - cluster.mcp-pike-common-ha.include.proxy + - cluster.mcp-pike-common-ha.include.maas_proxy + - cluster.mcp-pike-common-ha.include.lab_proxy_pdf parameters: _param: linux_system_codename: xenial diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/lab_proxy_pdf.yml.j2 b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/lab_proxy_pdf.yml.j2 deleted file mode 100644 index 0e95d2d1d..000000000 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/lab_proxy_pdf.yml.j2 +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################## -# Copyright (c) 2018 Mirantis Inc., Enea AB and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -# We'll craft this class so it can be reused on both cfg01 and mas01 -{%- if conf.idf.fuel.network.upstream_proxy is defined %} -{%- set upstream_proxy=conf.idf.fuel.network.upstream_proxy %} -parameters: - maas: - region: - upstream_proxy: - address: {{ upstream_proxy.address }} - port: {{ upstream_proxy.port }} - linux: - system: - proxy: - keyserver: - http: http://{{ upstream_proxy.address }}:{{ upstream_proxy.port }} - https: http://{{ upstream_proxy.address }}:{{ upstream_proxy.port }} -{%- endif %} diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas.yml index 3dc99983c..438915c1f 100644 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas.yml +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/infra/maas.yml @@ -9,7 +9,7 @@ classes: - system.maas.region.single - service.maas.cluster.single - - cluster.mcp-pike-common-ha.infra.lab_proxy_pdf + - cluster.mcp-pike-common-ha.include.lab_proxy_pdf - cluster.mcp-pike-common-ha.infra.maas_pdf parameters: _param: diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_compute.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_compute.yml index 2e79f808e..aed8bcb57 100644 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_compute.yml +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_compute.yml @@ -18,7 +18,8 @@ classes: - system.cinder.volume.backend.lvm - system.ceilometer.agent.cluster - cluster.mcp-pike-common-ha.openstack_compute_pdf - - cluster.mcp-pike-common-ha.include.proxy + - cluster.mcp-pike-common-ha.include.maas_proxy + - cluster.mcp-pike-common-ha.include.lab_proxy_pdf parameters: _param: cluster_vip_address: ${_param:openstack_control_address} diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_interface_vcp_biport.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_interface_vcp_biport.yml index 572aa7d25..1a3a8c112 100644 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_interface_vcp_biport.yml +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_interface_vcp_biport.yml @@ -7,7 +7,8 @@ ############################################################################## --- classes: - - cluster.mcp-pike-common-ha.include.proxy + - cluster.mcp-pike-common-ha.include.maas_proxy + - cluster.mcp-pike-common-ha.include.lab_proxy_pdf parameters: _param: dhcp_nic: ${_param:opnfv_vcp_vm_primary_interface} diff --git a/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_interface_vcp_triport.yml b/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_interface_vcp_triport.yml index c1fd625bc..d274ecd87 100644 --- a/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_interface_vcp_triport.yml +++ b/mcp/reclass/classes/cluster/mcp-pike-common-ha/openstack_interface_vcp_triport.yml @@ -7,7 +7,8 @@ ############################################################################## --- classes: - - cluster.mcp-pike-common-ha.include.proxy + - cluster.mcp-pike-common-ha.include.maas_proxy + - cluster.mcp-pike-common-ha.include.lab_proxy_pdf parameters: _param: dhcp_nic: ${_param:opnfv_vcp_vm_primary_interface} -- cgit 1.2.3-korg