unable to update a non-healthy nova keypair

Bug #1597602 reported by Removed by request
6
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
huangtianhua

Bug Description

Updating will not work well when a key pair will be marked as unhealthy.

In the following scenario I first try an update to make sure that updating works, then I marked as unhealthy and retried updating.

(Mitaka)
$ heat --version
1.2.0

I trimmed the outputs below...

$ cat templates/keypair.yaml
heat_template_version: 2013-05-23

parameters:
  key_name:
    type: string
    default: heat_key_test
  key_save:
    type: string
    default: false

resources:
  KeyPair:
    type: OS::Nova::KeyPair
    properties:
      name: { get_param: key_name }
      save_private_key: { get_param: key_save }

outputs:
  PublicKey:
    value: { get_attr: [KeyPair, public_key] }
  PrivateKey:
    value: { get_attr: [KeyPair, private_key] }

$ heat stack-create -f templates/keypair.yaml test0
| id | stack_name | stack_status | creation_time | updated_time |
| 8ee2b931-66a7-4ac9-8751-0d87d8ad1e49 | test0 | CREATE_IN_PROGRESS | 2016-06-30T04:35:25 | None |

[stack@undercloud ~]$ heat stack-list
| id | stack_name | stack_status | creation_time | updated_time |
| 8ee2b931-66a7-4ac9-8751-0d87d8ad1e49 | test0 | CREATE_COMPLETE | 2016-06-30T04:35:25 | None |

[stack@undercloud ~]$ heat stack-update -f templates/keypair.yaml test0
| id | stack_name | stack_status | creation_time | updated_time |
| 8ee2b931-66a7-4ac9-8751-0d87d8ad1e49 | test0 | CREATE_COMPLETE | 2016-06-30T04:35:25 | None |

[stack@undercloud ~]$ heat stack-list
| id | stack_name | stack_status | creation_time | updated_time |
| 8ee2b931-66a7-4ac9-8751-0d87d8ad1e49 | test0 | UPDATE_COMPLETE | 2016-06-30T04:35:25 | 2016-06-30T04:35:41 |

[stack@undercloud ~]$ heat resource-mark-unhealthy test0 KeyPair
[stack@undercloud ~]$ heat stack-list
| id | stack_name | stack_status | creation_time | updated_time |
| 8ee2b931-66a7-4ac9-8751-0d87d8ad1e49 | test0 | UPDATE_COMPLETE | 2016-06-30T04:35:25 | 2016-06-30T04:35:41 |

[stack@undercloud ~]$ heat resource-list test0
| resource_name | physical_resource_id | resource_type | resource_status | updated_time |
| KeyPair | heat_key_test | OS::Nova::KeyPair | CHECK_FAILED | 2016-06-30T04:35:25 |

[stack@undercloud ~]$ heat stack-update -f templates/keypair.yaml test0
| id | stack_name | stack_status | creation_time | updated_time |
| 8ee2b931-66a7-4ac9-8751-0d87d8ad1e49 | test0 | UPDATE_COMPLETE | 2016-06-30T04:35:25 | 2016-06-30T04:35:41 |

[stack@undercloud ~]$ heat resource-list test0
| resource_name | physical_resource_id | resource_type | resource_status | updated_time |
| KeyPair | | OS::Nova::KeyPair | CREATE_FAILED | 2016-06-30T04:36:41 |

[stack@undercloud ~]$ heat stack-list
| id | stack_name | stack_status | creation_time | updated_time |
| 8ee2b931-66a7-4ac9-8751-0d87d8ad1e49 | test0 | UPDATE_FAILED | 2016-06-30T04:35:25 | 2016-06-30T04:36:41 |

$ heat stack-show test0
| stack_status | UPDATE_FAILED |
| stack_status_reason | Conflict: resources.KeyPair: Key pair 'heat_key_test' |
| | already exists. (HTTP 409) (Request-ID: req- |
| | 2011c328-4545-4146-91b0-506797052d2a) |
| stack_user_project_id | 838e0e90fd8b46bfb15446624327eb23

Changed in heat:
assignee: nobody → huangtianhua (huangtianhua)
Revision history for this message
huangtianhua (huangtianhua) wrote :

This because we entered the updateReplace for *_FAILED resource. We tried to create a new keypair named 'heat_key_test', but the old one exists.

Changed in heat:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/338697

Changed in heat:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/338697
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=bc782538d6c1966dcd86cc78081945d16f68b316
Submitter: Jenkins
Branch: master

commit bc782538d6c1966dcd86cc78081945d16f68b316
Author: huangtianhua <email address hidden>
Date: Thu Jul 7 13:36:38 2016 +0800

    To delete the keypair preparing for update replacement

    If the keypair resource is in *_FAILED, to update it will
    enter UpdateReplacement, but maybe the keypair exists still
    in nova, then we can't recreate the new one, so try to delete
    the old one preparing for update replacement.

    Change-Id: Ic5a4e1eb4625dcefe5accc484b2c8db7fbb2940d
    Closes-Bug: #1597602

Changed in heat:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 7.0.0.0b3

This issue was fixed in the openstack/heat 7.0.0.0b3 development milestone.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.