incorrect code while clearing pvc_id while spawn failing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
powervc-driver |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
there will be 3 attempts for nova spawn if we hit spawn failing in powervc side:
1. the first time failure, I saw powervc driver post a REST call to PowerVC side, and PowerVC fail to spawn, then PowerVC Driver will delete the instance in PowerVC with it's metadata's pvc_id..but I saw an error code in powervc nova driver.
if constants.PVC_ID in meta.keys():
# destory vm in pvc side
This code is wrong, it will not remove the pvc_id from instance metadata eventually, the later set the instance[
2. then the second attempt to boot, I saw powervc driver also post the second post call to powervc side, and powervc fail to spawn, but at the powervc side, you will see, the created instance is associated with an pvc_id in it's metadata...I think the PowerVC instance should not contain such pvc_id as we never intend to save such metadata into powervc side. Here is the powervc side, nova show output for metadata:
[root@dev4powervc ~]# nova show 83bd7cce-
| metadata | {"decision_id": "1434", "pvc_id": "63930915-
And powervc driver code will save such pvc_id back to powervc side by another error code in service.
# get original metadata from DB and insert the pvc_id
meta = db.instance_
# update powervc specified metadata to hosting os vm instance
if powervc_meta:
We need to call meta.update(
as such code, while powervc eventually fail to spawn, the powervc driver will not delete the instance in powervc side.
3. then the 3rd attempt to boot, as driver does not remove the instance in powervc side, I saw the last attempt rest call is failing as there is not network id passed into rest call...
Reviewed: https:/ /review. openstack. org/136782 /git.openstack. org/cgit/ stackforge/ powervc- driver/ commit/ ?id=e506e9a9b46 950efab9a6a82e2 28d5d71c804d11
Committed: https:/
Submitter: Jenkins
Branch: master
commit e506e9a9b46950e fab9a6a82e228d5 d71c804d11
Author: terryyao <email address hidden>
Date: Mon Nov 24 23:02:33 2014 +0800
Clear pvc_id during instance spawn failing
1. In powevc nova driver, it's better to use instance.save() instead of
db call
2. clear pvc_id after destory the powervc instance.
3. override pvc_id regardless powervc instance's metadata pvc_id.
Closes-Bug: #1395731 064494101af811f 6be22379472
Change-Id: I2bb2494a8a2976