When snapshotting an instance, any additional metadata that is added to the image using 'glance image-update --property key=value' that is over 255 character gets truncated because the nova.instance_system_metadata table has a limit of 255 characters. When the snapshot completes this can be verified by using either 'glance image-show <image-id>' or 'nova image-show <image-id>'.
Steps to reproduce:
1.) Add new image to glance
2.) Use 'glance image-update --property key=value' to add an amount of data larger than 255 character
3.) Launch an instance from the previously edited image so it contains the new metadata
4.) Snapshot the image
5.) Check the metadata property using 'nova image-show <new-snapshot-id>' or 'glance image-show <new-snapshot-id>'
Result:
The expected output would be the entire property initially added to the image before the launching of the original image or the snapshot. The actual result is that the large property will be truncated at 255 characters because of the limit of the column (field = value) type in the nova.instance_system_metadata table:
mysql> describe instance_system_metadata;
+---------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+----------------+
| created_at | datetime | YES | | NULL | |
| updated_at | datetime | YES | | NULL | |
| deleted_at | datetime | YES | | NULL | |
| deleted | tinyint(1) | YES | | NULL | |
| id | int(11) | NO | PRI | NULL | auto_increment|
| instance_uuid | varchar(36) | NO | MUL | NULL | |
| key | varchar(255) | NO | | NULL | |
| value | varchar(255) | YES | | NULL | |
+---------------+--------------+------+-----+---------+----------------+
8 rows in set (0.00 sec)
The information stored in instance_system_metadata is stored in the corresponding Glance database table glance.image_properties, which doesn't have a limit on the 'value' row. Which is why there isn't an issue adding the large property to Glance. The 'value' field is of type text, which is inconsistent from nova.instance_system_metadata which is of type varchar(255)
mysql> describe image_properties;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| image_id | varchar(36) | NO | MUL | NULL | |
| name | varchar(255) | NO | | NULL | |
| value | text | YES | | NULL | |
| created_at | datetime | NO | | NULL | |
| updated_at | datetime | YES | | NULL | |
| deleted_at | datetime | YES | | NULL | |
| deleted | tinyint(1) | NO | MUL | NULL | |
+------------+--------------+------+-----+---------+----------------+
8 rows in set (0.00 sec)
No error will be thrown since it is not checked for when the value is written to the database.
Are we saying we need to remove restriction on the value column in instance_ system_ metadata just like image_properties?