create audittemplate not support strategy name

Bug #1884174 reported by Min Li
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
watcher
Undecided
Unassigned

Bug Description

Although according to the API documentation, you can specify the strategy name when creating an audit template, but when directly using the `curl` command to create, only strategy uuid is accepted.

$ curl http://watcher.openstack.svc.region-stackdev.myinspurcloud.com:80/v1/audit_templates \
-H "Content-Type: application/json" \
-H "X-Auth-Token: $OS_TOKEN" \
 -X POST -d '
{
    "name": "at2",
    "goal": "workload_balancing",
    "strategy": "e561f4af-f754-4ef9-bb3c-99e5824d832a"
}'
{"description": null, "links": [{"href": "http://watcher.openstack.svc.region-stackdev.myinspurcloud.com/v1/audit_templates/1a9e64ee-e5b7-4edd-acdc-381c92145ca6", "rel": "self"}, {"href": "http://watcher.openstack.svc.region-stackdev.myinspurcloud.com/audit_templates/1a9e64ee-e5b7-4edd-acdc-381c92145ca6", "rel": "bookmark"}], "goal_uuid": "61e78cae-059d-41e7-a917-caac7d196098", "created_at": "2020-06-18T11:51:52.450352+00:00", "goal_name": "workload_balancing", "updated_at": null, "name": "at1", "strategy_name": "workload_stabilization", "strategy_uuid": "e561f4af-f754-4ef9-bb3c-99e5824d832a", "scope": [], "deleted_at": null, "uuid": "1a9e64ee-e5b7-4edd-acdc-381c92145ca6"}

$ curl http://watcher.openstack.svc.region-stackdev.myinspurcloud.com:80/v1/audit_templates \
 -H "Content-Type: application/json" \
-H "X-Auth-Token: $OS_TOKEN" \
 -X POST -d '
{
    "name": "at3",
    "goal": "workload_balancing",
    "strategy": "workload_stabilization"
}'
{"error_message": "{\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"Invalid input for field/attribute audit_template_postdata. Value: '{'strategy': 'workload_stabilization', 'name': 'at1', 'goal': 'workload_balancing'}'. Strategy workload_stabilization is invalid\"}"}

API refs:
https://docs.openstack.org/api-ref/resource-optimization/?expanded=create-audit-template-detail#create-audit-template

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to watcher (stable/rocky)

Related fix proposed to branch: stable/rocky
Review: https://review.opendev.org/736882

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to watcher (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/736943

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to watcher (master)

Reviewed: https://review.opendev.org/736943
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=3f7a508a2e3aedb5c88c4cb15f9d5b93b4793cf5
Submitter: Zuul
Branch: master

commit 3f7a508a2e3aedb5c88c4cb15f9d5b93b4793cf5
Author: limin0801 <email address hidden>
Date: Fri Jun 19 15:20:49 2020 +0800

    Watcher API supports strategy name when creating audit template

    when directly using the `curl` command to create audit template,
    strategy name can be accepted.

    Closes-Bug: #1884174

    Change-Id: I7c0ca760a7fa414faca03c5293df34a84aad6fac

Changed in watcher:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to watcher (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/740386

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to watcher (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/740387

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to watcher (stable/ussuri)

Reviewed: https://review.opendev.org/740386
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=0543ccfe746cc2e0d7c08012181167744083fe52
Submitter: Zuul
Branch: stable/ussuri

commit 0543ccfe746cc2e0d7c08012181167744083fe52
Author: limin0801 <email address hidden>
Date: Fri Jun 19 15:20:49 2020 +0800

    Watcher API supports strategy name when creating audit template

    when directly using the `curl` command to create audit template,
    strategy name can be accepted.

    Closes-Bug: #1884174

    Change-Id: I7c0ca760a7fa414faca03c5293df34a84aad6fac
    (cherry picked from commit 3f7a508a2e3aedb5c88c4cb15f9d5b93b4793cf5)

tags: added: in-stable-ussuri
tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to watcher (stable/train)

Reviewed: https://review.opendev.org/740387
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=70a24cb009e3318c55ca94727f5f6325dc3c8db6
Submitter: Zuul
Branch: stable/train

commit 70a24cb009e3318c55ca94727f5f6325dc3c8db6
Author: limin0801 <email address hidden>
Date: Fri Jun 19 15:20:49 2020 +0800

    Watcher API supports strategy name when creating audit template

    when directly using the `curl` command to create audit template,
    strategy name can be accepted.

    Closes-Bug: #1884174

    Change-Id: I7c0ca760a7fa414faca03c5293df34a84aad6fac
    (cherry picked from commit 3f7a508a2e3aedb5c88c4cb15f9d5b93b4793cf5)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to watcher (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/744431

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on watcher (stable/rocky)

Change abandoned by Min Li (<email address hidden>) on branch: stable/rocky
Review: https://review.opendev.org/736882

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to watcher (stable/rocky)

Reviewed: https://review.opendev.org/744431
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=7c90c9c752db0a0fcb0fcca84d4b2f809012874a
Submitter: Zuul
Branch: stable/rocky

commit 7c90c9c752db0a0fcb0fcca84d4b2f809012874a
Author: limin0801 <email address hidden>
Date: Fri Jun 19 15:20:49 2020 +0800

    Watcher API supports strategy name when creating audit template

    when directly using the `curl` command to create audit template,
    strategy name can be accepted.

    Closes-Bug: #1884174

    Change-Id: I7c0ca760a7fa414faca03c5293df34a84aad6fac
    (cherry picked from commit 3f7a508a2e3aedb5c88c4cb15f9d5b93b4793cf5)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/watcher 3.0.2

This issue was fixed in the openstack/watcher 3.0.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/watcher 4.0.1

This issue was fixed in the openstack/watcher 4.0.1 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers