Skip to content

Eliminate *_details table inconsistency #4897

@shwstppr

Description

@shwstppr

Different details tables in cloud database have different structure. While some (specifically) allow inserting details with NULL value others do not. This creates issues when data needs to be copied from one to another, similar to #4628

mysql> describe user_vm_details;
+---------+-----------------+------+-----+---------+----------------+
| Field   | Type            | Null | Key | Default | Extra          |
+---------+-----------------+------+-----+---------+----------------+
| id      | bigint unsigned | NO   | PRI | NULL    | auto_increment |
| vm_id   | bigint unsigned | NO   | MUL | NULL    |                |
| name    | varchar(255)    | NO   |     | NULL    |                |
| value   | varchar(5120)   | YES  |     | NULL    |                |
| display | tinyint(1)      | NO   |     | 1       |                |
+---------+-----------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

mysql> describe vm_template_details;
+-------------+-----------------+------+-----+---------+----------------+
| Field       | Type            | Null | Key | Default | Extra          |
+-------------+-----------------+------+-----+---------+----------------+
| id          | bigint unsigned | NO   | PRI | NULL    | auto_increment |
| template_id | bigint unsigned | NO   | MUL | NULL    |                |
| name        | varchar(255)    | NO   |     | NULL    |                |
| value       | varchar(1024)   | NO   |     | NULL    |                |
| display     | tinyint(1)      | NO   |     | 1       |                |
+-------------+-----------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

To prevent such issues structure of these details table should be consistent and shouldn't accept details with NULL values.
Discussed in #4794

ISSUE TYPE
  • Improvement Request
COMPONENT NAME
DB
CLOUDSTACK VERSION

CONFIGURATION

NA

OS / ENVIRONMENT

NA

SUMMARY

As above

STEPS TO REPRODUCE
1. Deploy a VM
2. Add a VM detail with a null value
3. Create a template from ROOT disk of the VM
EXPECTED RESULTS
Template created successfully
ACTUAL RESULTS
Template creation fails

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions