VNF package once deleted cannot be uploaded again

Bug #1920105 reported by Koichi Edagawa
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tacker
Fix Released
Medium
Koichi Edagawa

Bug Description

When we try to upload a VNF package which has been uploaded and deleted once before, "Duplicate entry" error occurs and it fails to be onboarded.

Detailed procedure for the issue is the following:

1) Create a new package ID and upload a VNF package
2) Delete the VNF package
3) Create a new package ID and upload the same VNF package used at 1) and 2

During uploading the VNF package next time, the following message outputs in tacker-conductor.log.

-------------------------------------------------------------------------------------
2021-03-22 18:35:53.717 ERROR oslo_messaging.rpc.server [req-b756643a-8a34-4f4a-96bd-162c508e0ae8 admin demo] Exception during message handling: Exception: (
pymysql.err.IntegrityError) (1062, "Duplicate entry 'b1bb0ce7-ebca-4fa7-95ed-4840d7000005' for key 'PRIMARY'")
-------------------------------------------------------------------------------------

<Operation log>

$ openstack vnf package create
+-------------------+-------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------+-------------------------------------------------------------------------------------------------+
| ID | a8e42c3e-7627-47f7-8e92-97f64369ef23 |
| Links | { |
| | "self": { |
| | "href": "/vnfpkgm/v1/vnf_packages/a8e42c3e-7627-47f7-8e92-97f64369ef23" |
| | }, |
| | "packageContent": { |
| | "href": "/vnfpkgm/v1/vnf_packages/a8e42c3e-7627-47f7-8e92-97f64369ef23/package_content" |
| | } |
| | } |
| Onboarding State | CREATED |
| Operational State | DISABLED |
| Usage State | NOT_IN_USE |
| User Defined Data | {} |
+-------------------+-------------------------------------------------------------------------------------------------+

$ openstack vnf package upload --path samples/package/sample_vnflcm1/sample_vnflcm1_0005.tar.gz a8e42c3e-7627-47f7-8e92-97f64369ef23
Upload request for VNF package a8e42c3e-7627-47f7-8e92-97f64369ef23 has been accepted.

$ openstack vnf package show a8e42c3e-7627-47f7-8e92-97f64369ef23 --fit-width
+----------------------+------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+----------------------+------------------------------------------------------------------------------------------------------------------------------------+
| Additional Artifacts | |
| Checksum | { |
| | "algorithm": "sha512", |
| | "hash": |
| | "e727c1eff69fa40fd78a177d962e1222f722a6c5087c9508ec0fd549c21bf0edc06bb4421cfad3e4d6a6f2c4ab232351bc604a32e3f6ab3ff522c81ab64fcfef" |
| | } |
| ID | a8e42c3e-7627-47f7-8e92-97f64369ef23 |
| Links | { |
| | "self": { |
| | "href": "/vnfpkgm/v1/vnf_packages/a8e42c3e-7627-47f7-8e92-97f64369ef23" |
| | }, |
| | "packageContent": { |
| | "href": "/vnfpkgm/v1/vnf_packages/a8e42c3e-7627-47f7-8e92-97f64369ef23/package_content" |
| | } |
| | } |
| Onboarding State | ONBOARDED |
| Operational State | ENABLED |
| Software Images | [ |
| | { |
| | "provider": "", |
| | "version": "0.4.0", |
| | "createdAt": "2021-03-22 09:31:48+00:00", |
| | "size": 1000000000, |
| | "diskFormat": "qcow2", |
| | "minRam": 256000000, |
| | "containerFormat": "bare", |
| | "name": "VirtualStorage", |
| | "imagePath": "", |
| | "minDisk": 2000000000, |
| | "id": "VirtualStorage", |
| | "checksum": { |
| | "hash": "6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64d |
| | d39390617cd5a350f78", |
| | "algorithm": "sha-512" |
| | }, |
| | "userMetadata": {} |
| | } |
| | ] |
| Usage State | NOT_IN_USE |
| User Defined Data | {} |
| VNF Product Name | Sample VNF |
| VNF Provider | Company |
| VNF Software Version | 1.0 |
| VNFD ID | b1bb0ce7-ebca-4fa7-95ed-4840d7000005 |
| VNFD Version | 1.0 |
+----------------------+------------------------------------------------------------------------------------------------------------------------------------+

$ openstack vnf package update --operational-state 'DISABLED' a8e42c3e-7627-47f7-8e92-97f64369ef23
+-------------------+----------+
| Field | Value |
+-------------------+----------+
| Operational State | DISABLED |
+-------------------+----------+

$ openstack vnf package delete a8e42c3e-7627-47f7-8e92-97f64369ef23
All specified vnf-package(s) deleted successfully

$ openstack vnf package show a8e42c3e-7627-47f7-8e92-97f64369ef23
Can not find requested vnf package: a8e42c3e-7627-47f7-8e92-97f64369ef23

$ openstack vnf package create
+-------------------+-------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------+-------------------------------------------------------------------------------------------------+
| ID | 3df4e144-ed1c-4875-ab43-9165988094c7 |
| Links | { |
| | "self": { |
| | "href": "/vnfpkgm/v1/vnf_packages/3df4e144-ed1c-4875-ab43-9165988094c7" |
| | }, |
| | "packageContent": { |
| | "href": "/vnfpkgm/v1/vnf_packages/3df4e144-ed1c-4875-ab43-9165988094c7/package_content" |
| | } |
| | } |
| Onboarding State | CREATED |
| Operational State | DISABLED |
| Usage State | NOT_IN_USE |
| User Defined Data | {} |
+-------------------+-------------------------------------------------------------------------------------------------+

$ openstack vnf package upload --path samples/package/sample_vnflcm1/sample_vnflcm1_0005.tar.gz 3df4e144-ed1c-4875-ab43-9165988094c7
Upload request for VNF package 3df4e144-ed1c-4875-ab43-9165988094c7 has been accepted.

$ openstack vnf package show 3df4e144-ed1c-4875-ab43-9165988094c7 --fit-width
+-------------------+-------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------+-------------------------------------------------------------------------------------------------+
| ID | 3df4e144-ed1c-4875-ab43-9165988094c7 |
| Links | { |
| | "self": { |
| | "href": "/vnfpkgm/v1/vnf_packages/3df4e144-ed1c-4875-ab43-9165988094c7" |
| | }, |
| | "packageContent": { |
| | "href": "/vnfpkgm/v1/vnf_packages/3df4e144-ed1c-4875-ab43-9165988094c7/package_content" |
| | } |
| | } |
| Onboarding State | CREATED |
| Operational State | DISABLED |
| Usage State | NOT_IN_USE |
| User Defined Data | {} |
+-------------------+-------------------------------------------------------------------------------------------------+

 * Operational State doesn't change from "DISABLED" to "ENABLED".

description: updated
Yasufumi Ogawa (yasufum)
Changed in tacker:
importance: Undecided → Medium
Changed in tacker:
assignee: nobody → Sheel Rana (ranasheel2000)
Revision history for this message
Sheel Rana (ranasheel2000) wrote :

Seems onboarding is failed because state is not changed CREATED->ONBOARDED.

Onboarding state in successful operation:
   | Onboarding State | ONBOARDED |

Onboarding state in failure case :
   | Onboarding State | CREATED | (same state which is set during vnf package create operation)

Changed in tacker:
status: New → In Progress
Revision history for this message
Sheel Rana (ranasheel2000) wrote :

Got to know Mr Edagawa (@k-edagawa) is already working on this, so un-assigning it from me.

Changed in tacker:
assignee: Sheel Rana (ranasheel2000) → nobody
status: In Progress → Confirmed
Revision history for this message
Sheel Rana (ranasheel2000) wrote :

Just adding quick information for reference purpose only.

This problem is actually happening because of VNFD ID which is already in active state as a result of first vnf package upload operation.
Database table VNFD is updated with this id whenever new vnf package is uploaded.

If we delete vnf package even then vnfd id is not deleted ('deleted' column remains null in db table) so this entry remains valid.
As vnf id is primary key, uploading vnf package again tries to create new db entry with same primary key (vnf id) which fails this operation.

[stack@rana ~]$ sudo mysql -D tacker -pdevstack tacker -e 'select * from vnfd';
+--------------------------------------+----------------------------------+----------------+-------------+-------------+---------------------+------------+------------+-----------------+
| id | tenant_id | name | description | mgmt_driver | created_at | updated_at | deleted_at | template_source |
+--------------------------------------+----------------------------------+----------------+-------------+-------------+---------------------+------------+------------+-----------------+
| *b1bb0ce7-ebca-4fa7-95ed-4840d70a1177* | 45460dc90e5d4e468410be67ce93b128 | Sample VNF-1.0 | NULL | NULL | 2021-04-01 18:06:12 | NULL | NULL | onboarded |
+--------------------------------------+----------------------------------+----------------+-------------+-------------+---------------------+------------+------------+-----------------+
[stack@rana ~]$

Changed in tacker:
assignee: nobody → Koichi Edagawa (k-edagawa)
Revision history for this message
Yasufumi Ogawa (yasufum) wrote :

Hi, could I confirm current status?

Revision history for this message
Koichi Edagawa (k-edagawa) wrote :

Sorry for my delay in the reply.
Currently there are some issues on modifying the fix, so It is hard to upload it soon.
I will update this report if there is a progress later.

Revision history for this message
Hiromu Asahina (h-asahina) wrote (last edit ):

Edagawa-san,

Hello.

I have two questions.

The reason behind this bug is that VNFD table use VNFD id as it's primary key as you mentioned.

When I removed the following lines that add a new record to VNFD, this bug doesn't appear.
https://opendev.org/openstack/tacker/src/branch/master/tacker/conductor/conductor_server.py#L447-L457

Since we already have a VnfPackageVnfd table [1] for managing all info about VNFD, I suppose one possible solution for this bug is to use this table instead of VNFD table and to remove the codes using the VNFD table.

My questions are:
1. Are you willing to stop using VNFD table to fix this bug or do you have any other plans?
2. What is the purpose of VNFD table. It seems to have been implemented after VnfPackageVnfd table?

[1] https://github.com/openstack/tacker/commit/156d9bfe47d822db05a380f15b9054268ce8d4e2#diff-40533210e629935f310d6f0cd13edd72c989fd76591934b493429a1ce57ef225R99-R111

Changed in tacker:
status: Confirmed → In Progress
Revision history for this message
Koichi Edagawa (k-edagawa) wrote :

Asahina-san,

I'm sorry for the delay in the reply.

1. Currently I am planning to fix only by modifying existing code, not stopping using VNFD table.

2. I will check how and why it is and then answer it later.

Revision history for this message
Hiromu Asahina (h-asahina) wrote :

Edagawa-san,

Thank you for your reply.

This is my suggestion.
https://review.opendev.org/c/openstack/tacker/+/812942/5

I suppose this patch doesn't conflict with your plan.
If this patch is not what you have planned, please tell me.
I'll abandon it as the original assignee is you.

I'd appreciate it if you could consider it.

Revision history for this message
Koichi Edagawa (k-edagawa) wrote :

Asahina-san,

Thank you for your proceeding.

Your patch doesn't conflict what I want to resolve. I have already finished the code review with no additional comments.

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

Reviewed: https://review.opendev.org/c/openstack/tacker/+/812942
Committed: https://opendev.org/openstack/tacker/commit/4be819645b8c509288af14053b87729c6adab386
Submitter: "Zuul (22348)"
Branch: master

commit 4be819645b8c509288af14053b87729c6adab386
Author: Hiromu Asahina <email address hidden>
Date: Thu Oct 7 09:29:46 2021 +0000

    Fix duplicate entry error in VNF Package upload

    In the current implementation, when we try to upload a VNF package which
    has been uploaded and deleted once before, "Duplicate entry" error
    occurs and it fails to be onboarded.

    This problem happens because VNFD table uses ``vnfd id`` as its primary
    key and does not delete a record even if a corresponding VNF package is
    deleted.

    Although legacy DB is going to be deleted, the patch is not merged at
    this time [1]. Thus, this patch modifies the conductor server to simply
    delete records from VNFD table.

    [1] https://review.opendev.org/c/openstack/tacker/+/763955

    Change-Id: I21316cd7b17f85d292a18a44c891f3193ca418ed
    Closes-bug: #1920105
    Signed-off-by: Hiromu Asahina <email address hidden>

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

This issue was fixed in the openstack/tacker 7.0.0.0rc1 release candidate.

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.