Commit Graph

2365 Commits

Author SHA1 Message Date
Zuul
c57dcce036 Merge "Close resources correctly" 2019-08-02 15:14:12 +00:00
Alex Schultz
6521585912 Close resources correctly
Under python3 not closing file handles or network resources correctly
results in warnings being shown to the end user. This change switches
the resource usage to properly close when we're done.

Change-Id: Iaf08f7d7b919b154797cf8f10663f349424cd6a2
Related-Bug: #1837393
2019-08-01 16:57:24 -06:00
Zuul
c10329fc0e Merge "Pass deployment_options to config download" 2019-08-01 18:01:25 +00:00
Zuul
7b365a586e Merge "Write minion preflight checks" 2019-08-01 05:12:13 +00:00
Zuul
4a5707c7c7 Merge "Remove rhsm cli options" 2019-08-01 05:02:17 +00:00
ac7ae9e8d6 Pass deployment_options to config download
https://review.opendev.org/673862 allows config_download
workflow to take deployment_options as a input, this patch
passes it to the workflow so ansible_python_interpreter
is set correctly in generated inventory and thus used
during ansible deployment.

Depends-On: https://review.opendev.org/#/c/673862/
Closes-Bug: #1838540
Change-Id: I993fc09fd571fb93d78ffdbecf1823e806f744f4
2019-08-01 09:19:01 +05:30
Zuul
75beaf85ab Merge "Mock deployment action in upgrade tests" 2019-07-31 23:43:34 +00:00
Zuul
348374f5d2 Merge "Add gathering_policy parameter to run_ansible_playbook function" 2019-07-31 17:40:34 +00:00
Zuul
7b56f9b569 Merge "Use static inventory YAML file for saving execution time" 2019-07-31 17:40:33 +00:00
Zuul
7c0530c160 Merge "Don't use local connection by default for the validations" 2019-07-31 17:40:32 +00:00
Zuul
c047a1b935 Merge "Add plan parameter to run_ansible_playbook function" 2019-07-31 17:40:31 +00:00
Alex Schultz
1be46111e6 Remove rhsm cli options
The code behind these options has been removed in tripleo-heat-templates
so we no longer need these cli options. Additionally we do not want
folks using them since they do nothing.

https://review.opendev.org/#/c/669951/

Change-Id: Ib1444f8b21d90a00dd1d775f5eac633c43f39741
2019-07-31 09:24:23 -06:00
Gael Chamoulaud
e1cb3042c8 Mock deployment action in upgrade tests
Without properly mocking the deployment action, these tests are trying
to execute deployment code including temp file creation which can lead
to package build failures. This change mocks out the deployment take
action for the UpgradeRun so we're only testing the upgrade code
itself.

Change-Id: I3ac295d2e2f86fbb2120f9491d4103434b6ac3da
Closes-Bug: #1838506
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-31 16:07:52 +02:00
Gael Chamoulaud
d7793ce1a5 Add gathering_policy parameter to run_ansible_playbook function
This patch adds a new parameter called 'gathering_policy' (Defaults to
None) to the 'run_ansible_playbook' function. This parameter will
control the default policy of the Ansible fact gathering. Sets to None
by default, it will use the default policy for Ansible (ie. 'implicit').

Change-Id: I0668241a1675dd4e344cc24b6ff2cbb8f93b7a45
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-31 08:44:44 +00:00
Gael Chamoulaud
4f55cdf59a Use static inventory YAML file for saving execution time
The validations execution will use now a static inventory file to speed
up things a bit. Note that this file will be removed after execution.

Change-Id: Ibdc3fc7ea9d3dec9531a2ce29ec8a1477c33c780
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-31 08:44:17 +00:00
Gael Chamoulaud
82887ef228 Don't use local connection by default for the validations
When using local connection, all the validations targeting the overcloud
nodes are failing. Let's use the connection mode from the Ansible
inventory.

Change-Id: I188604f7767b51a0f485bd79ff3497af56586b13
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-31 08:43:39 +00:00
Gael Chamoulaud
17e56a01d5 Add plan parameter to run_ansible_playbook function
This patch adds a new parameter called 'plan' (Defaults to "overcloud")
to the 'run_ansible_playbook' function. It will allow to execute
Validations with Ansible in a different plan or stack that the default
one through the TripleO CLI. Note That it was already possible only
while using Mistral but not for Ansible.

This patch also brings:
- Change the default values of the 'tags' and 'skip_tags' arguments
  to 'None' and fixes their non Pythonic tests.
- Add '--stack' alias to the '--plan' argument for 'validator run'
  command.

Change-Id: I6f8f55963f3f5261ec1497b650e0ca509d31dd32
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-31 08:43:10 +00:00
Zuul
c3fb3cb662 Merge "Add --parameters and --create-vars-file arguments to the list subcommand" 2019-07-31 05:21:56 +00:00
Zuul
4357e85653 Merge "Allow running validations with custom extra variables" 2019-07-31 03:43:35 +00:00
Zuul
c17d2177ce Merge "Add --concurrency argument to introspect commands" 2019-07-30 23:17:41 +00:00
Zuul
a354d5c068 Merge "Output oslo messaging info for the minion" 2019-07-30 16:30:13 +00:00
Zuul
7dc07529d4 Merge "Add overcloud cell export command" 2019-07-29 10:08:05 +00:00
Zuul
4fc1f396e3 Merge "Add extra_vars parameter to run_ansible_playbook function" 2019-07-28 19:18:23 +00:00
Alex Schultz
d242ad7cfe Write minion preflight checks
There are some basics we should check before running the install.

Change-Id: I510457333aadcabe0f02c05a39c7c10b221410ae
Blueprint: undercloud-minion
2019-07-26 16:30:53 -06:00
Alex Schultz
b1bd2829fe Output oslo messaging info for the minion
The oslo messaging host configuration does not actually use the endpoint
map so we need to be able to provide this information as part of the
output yaml file for use with a minion. This code grabs the ctlplane
ip out of the rolenetmap for the undercloud and uses it to construct the
oslo messaging node names value that is used when configuring the service.

Blueprint: undercloud-minion
Change-Id: I5dc103452f3e7484ea81df15d75b606d2c74859a
2019-07-25 14:27:51 -06:00
Steve Baker
3e03e3b78c Add --concurrency argument to introspect commands
The default concurrency of 20 may be too high for small underclouds
(especially CI environments), so this change adds a --concurrency
argument so callers can control the maximum number of nodes
to introspect concurrently.

Depends-On: https://review.opendev.org/#/c/672389/
Change-Id: I9faee9ab133e34466a79aa1176a16106bda1f15d
Closes-Bug: #1836976
2019-07-24 21:10:58 +00:00
Martin Schuppert
aa0d29fb44 Add overcloud cell export command
[1] provides the steps on how to setup multiple cells using tripleo.
This requires to extract deployment information from the overcloud
/control plane stack which then is used as input for the cell
deployment.

With this patch we provide a new tripleoclient functionality which
helps
to automate the export steps from [1]:
* Export the default cell EndpointMap
* Export the default cell HostsEntry
* Export AllNodesConfig and GlobalConfig information
* Export passwords

[1] https://docs.openstack.org/tripleo-docs/latest/install/advanced_deployment/deploy_cellv2.html#deploy-an-additional-nova-cell-v2

Depends-On: https://review.opendev.org/672415

Change-Id: Id7fdbf029a6dd1b45e9801c9cf8814a15a157ee0
2019-07-24 09:57:40 +02:00
Alex Schultz
979e100bb3 Fix minion_local_interface
The correct setting is minion_local_interface and not local_interface.

Change-Id: I94d5ca033ea086dcaa73bd0e855b8ff085a2aadf
Closes-Bug: #1837623
2019-07-23 12:10:12 -06:00
Gael Chamoulaud
d1084193f6 Add --parameters and --create-vars-file arguments to the list subcommand
The 'openstack tripleo validator list' subcommand can now get only the
available parameters for the validations using the new --parameters
argument.

```
$ openstack tripleo validator list \
    --parameters                   \
    [--validation-name <validation_id>[,<validation_id>,...] |
     --group <group>[,<group>,...]]
```

Here is an output example:

```
Waiting for messages on queue 'tripleo' with no timeout.
{
    "undercloud-cpu": {
        "parameters": {
            "min_undercloud_cpu_count": 8
        }
    },
    "undercloud-ram": {
        "parameters": {
            "min_undercloud_ram_gb": 24
        }
    }
}
```

The --create-vars-file allow the operator to generate either a JSON or a
YAML file containing only the parameters of one or multiple validations.
This file will be available to pass as extra vars to the validations
execution.

```
$ openstack tripleo validator list \
    --parameters                   \
    --create-vars-file [json|yaml] /home/stack/myvars \
    [--validation-name <validation_id>[,<validation_id>,...] |
     --group <group>[,<group>,...]]
```

Change-Id: I6e2255c0d490ee8105f0757d02f5d8fba1d4fa20
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-23 11:08:54 +02:00
Gael Chamoulaud
d13a7d501e Allow running validations with custom extra variables
This patch adds the ability to pass extra variables to the validations
execution through Mistral and 'ansible-playbook'.

By default, the CLI is running the validations through
'ansible-playbook', then the operator will have two possible ways to
process it;

Either passing a Dict with the new --extra-vars argument

```
$ openstack tripleo validator run \
    --extra-vars '{"min_undercloud_ram_gb": 2}'
    --validation-name undercloud-ram
```

or passing the absolute path of a JSON/YAML file using --extra-vars-file
argument.

```
$ cat /home/stack/vars.json
{
  "volumes": [
    {"min_size": 10, "mount": "/var/lib/docker"},
    {"min_size": 3,  "mount": "/var/lib/config-data"},
    {"min_size": 3,  "mount": "/var/log"},
    {"min_size": 5,  "mount": "/usr"},
    {"min_size": 20, "mount": "/var"},
    {"min_size": 25, "mount": "/"}
  ]
}
$ openstack tripleo validator run \
    --extra-vars-file /home/stack/vars.json
    --validation-name undercloud-disk-space
```

If the operator wants to use Mistral, she/he will just need to add the
--use-mistral argument to the command line in the previous
examples.

Note that Mistral will only support a valid JSON file as input.

Change-Id: Idff6bcebc041db483d64396249b040e6bdd778bd
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-23 11:08:54 +02:00
Gael Chamoulaud
35952145a1 Add extra_vars parameter to run_ansible_playbook function
This patch adds a new parameter called 'extra_vars (Defaults to None) to
the 'run_ansible_playbook' function. This parameter will set additional
variables to the 'ansible-playbook' command. It will accept either a
dict or the absolute path of a file (YAML or JSON format).

Change-Id: Ib25ee9593528ad680b14ca09c62addbbd0b773a3
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-23 11:08:50 +02:00
Zuul
7022d93e81 Merge "Renaming 'Metadata' column by 'Parameters' when listing validations" 2019-07-19 17:57:14 +00:00
Zuul
bc56ab81a8 Merge "Implement tripleo container image show command" 2019-07-19 03:30:43 +00:00
David J Peacock
4fc5e74243 Implement tripleo container image show command
This patch implements the tripleo container image show command, AKA,
inspect.

Change-Id: I03b7bb724881eeb3b737845d9a731d4b4f6ee786
2019-07-17 08:54:30 -04:00
Gael Chamoulaud
e0d35b30de Renaming 'Metadata' column by 'Parameters' when listing validations
All the available Ansible variables for each Validations are now
processed as parameters and not as metadata anymore.

Change-Id: I1151923f3f0de7acf505a0beda3b7488c8ed8dec
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-17 11:14:44 +02:00
Zuul
b2e8787c2d Merge "Added for support for generating overcloud clouds.yaml" 2019-07-15 14:00:45 +00:00
Chandan Kumar (raukadah)
0a8fc376cd Added for support for generating overcloud clouds.yaml
https://review.opendev.org/#/c/664568/ adds mistral actions for
generating overcloud clouds.yaml file. This patch enables the
same to call the above mistral action and reuse

The clouds_yaml.py script is also moved from tht to here in
order to reuse the script.

Added proper constants and method for creating clouds yaml
directory.

Added a mock_clouds_yaml.py function to mock the
tripleo-common.utils.clouds_yaml script in order
to integrate with Tripleo.

Depends-On: https://review.opendev.org/#/c/664568/

Change-Id: I243ec370f9de0f2a0e34163962f1a1f228c3a9a1
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
2019-07-15 11:40:30 +05:30
Harald Jensås
317f3cff7d Ensure files are closed, ensure no ResourceWarning on console
Fixes an issue wich cause warnings such as the one below on the
console when using python3.
  ResourceWarning : unclosed file <_io.TextIOWrapper name='FILENAME'

Closes-Bug: #1836379
Change-Id: I4a80a339b2cc0c3fca992cfc456581a91dbf2eef
2019-07-12 17:44:10 +02:00
Zuul
cd42f44769 Merge "Allow running validations by group using Ansible by default" 2019-07-09 10:42:15 +00:00
Zuul
f6e8e08a93 Merge "Validate all or no subnets use dns_nameservers" 2019-07-09 02:03:40 +00:00
Gael Chamoulaud
f10fa0b3c5 Allow running validations by group using Ansible by default
This patch allows the operator to run all the validations belonging to
a group using ansible-playbook instead of Mistral.

Change-Id: I8c833819c88f1822bf605df0c997ab5d651e7620
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-08 11:34:36 +02:00
Carlos Camacho
27e1e4f833 Allow running validations by name using Ansible by default.
This patch switch over Ansible to run validations by names by
default. The --use-mistral argument will have to be used in order to
execute them through Mistral.

Co-Authored-By: Gaël Chamoulaud <gchamoul@redhat.com>
Change-Id: Ia393f4d776ab2c09439e7772b5596ddbb47e0a5e
2019-07-08 10:49:25 +02:00
Zuul
c6d441b24c Merge "Implement tripleo container image delete command" 2019-07-04 03:12:09 +00:00
Zuul
d51073ed64 Merge "Add log_path_dir parameter" 2019-07-03 22:58:54 +00:00
Zuul
6d06c2aa1a Merge "Remove undercloud deploy" 2019-07-03 16:45:31 +00:00
Zuul
b15fc06fb7 Merge "Use wait for stack ready from utils for tripleo deploy" 2019-07-03 16:45:30 +00:00
Gael Chamoulaud
9de3452cf3 Add log_path_dir parameter
This patch adds a new parameter called 'log_path_dir' (Defaults to None)
to the 'run_ansible_playbook' function. The Ansible log file will be
created in the location of the playbook by default, otherwise in the given
directory path.

Change-Id: I7222a116974458b9149771cb44f7d5f7bc51bc79
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-03 15:50:33 +02:00
David J Peacock
978e16efdb Implement tripleo container image delete command
This patch implements the tripleo container image delete command.

Change-Id: I1f028e9ea14f6f5a9fe6ccf608be08b9fd569b9e
2019-07-03 09:31:54 -04:00
Zuul
ba2b615917 Merge "Don't pass the DNSServers param in undercloud env" 2019-07-03 12:12:21 +00:00
Zuul
8187347eb2 Merge "Allow per-subnet DNSNameServers for ctlplane network" 2019-07-02 19:40:17 +00:00