weizhouapache commented on PR #7874:
URL: https://github.com/apache/cloudstack/pull/7874#issuecomment-1693327030

   @rohityadavcloud @DaanHoogland 
   this fixes two current issues when setup a cloudstack zone
   (1) system vm template size is NULL until ssvm is Up
   (2) there are duplicated records for systemvm template in template_store_ref
   ```
   mysql> select * from template_store_ref where template_id=3;
   
+----+----------+-------------+---------------------+---------------------+--------+--------------+------------+------------+---------------+----------------+-----------+------------+--------------------------------------------------------------+-------------------------------------------------------------------------------------+-------+-----------+---------+--------------+---------+---------+----------------------+--------------+
   | id | store_id | template_id | created             | last_updated        | 
job_id | download_pct | size       | store_role | physical_size | 
download_state | error_str | local_path | install_path                          
                       | url                                                    
                             | state | destroyed | is_copy | update_count | 
ref_cnt | updated | download_url_created | download_url |
   
+----+----------+-------------+---------------------+---------------------+--------+--------------+------------+------------+---------------+----------------+-----------+------------+--------------------------------------------------------------+-------------------------------------------------------------------------------------+-------+-----------+---------+--------------+---------+---------+----------------------+--------------+
   |  5 |        1 |           3 | 2023-08-23 06:51:31 | 2023-08-24 17:11:08 | 
NULL   |          100 | 5242880000 | Image      |     460193792 | DOWNLOADED    
 | NULL      | NULL       | 
template/tmpl/1/3/3509aabf-805e-44de-a80a-27145fc8762a.qcow2 | 
https://download.cloudstack.org/systemvm/4.18/systemvmtemplate-4.18.1-kvm.qcow2.bz2
 | Ready |         0 |       0 |            0 |       0 | NULL    | NULL        
         | NULL         |
   |  7 |        1 |           3 | 2023-08-23 06:51:31 | 2023-08-25 11:33:46 | 
NULL   |          100 | 5242880000 | Image      |     460193792 | DOWNLOADED    
 | NULL      | NULL       | 
template/tmpl/1/3/3509aabf-805e-44de-a80a-27145fc8762a.qcow2 | 
https://download.cloudstack.org/systemvm/4.18/systemvmtemplate-4.18.1-kvm.qcow2.bz2
 | Ready |         0 |       0 |            0 |       0 | NULL    | NULL        
         | NULL         |
   
+----+----------+-------------+---------------------+---------------------+--------+--------------+------------+------------+---------------+----------------+-----------+------------+--------------------------------------------------------------+-------------------------------------------------------------------------------------+-------+-----------+---------+--------------+---------+---------+----------------------+--------------+
   2 rows in set (0.00 sec)
   
   ```
   
   With this PR
   
   (1) systemvm template size and state are updated when systemvm template is 
registered (from /usr/share/cloudstack-management/templates/systemvm/)
   (2) there is only 1 record for systemvm template in template_store_ref
   ```
   MariaDB [cloud]> select * from template_store_ref where template_id=3;
   
+----+----------+-------------+---------------------+---------------------+--------+--------------+------------+------------+---------------+----------------+-----------+------------+--------------------------------------------------------------+-------------------------------------------------------------------------------------+-------+-----------+---------+--------------+---------+---------+----------------------+--------------+
   | id | store_id | template_id | created             | last_updated        | 
job_id | download_pct | size       | store_role | physical_size | 
download_state | error_str | local_path | install_path                          
                       | url                                                    
                             | state | destroyed | is_copy | update_count | 
ref_cnt | updated | download_url_created | download_url |
   
+----+----------+-------------+---------------------+---------------------+--------+--------------+------------+------------+---------------+----------------+-----------+------------+--------------------------------------------------------------+-------------------------------------------------------------------------------------+-------+-----------+---------+--------------+---------+---------+----------------------+--------------+
   |  5 |        1 |           3 | 2023-08-25 12:32:25 | 2023-08-25 12:45:18 | 
NULL   |          100 | 5242880000 | Image      |     461242368 | DOWNLOADED    
 | NULL      | NULL       | 
template/tmpl/1/3/5d1a1a0b-ec1f-400e-92d3-0ba2496c164b.qcow2 | 
https://download.cloudstack.org/systemvm/4.18/systemvmtemplate-4.18.1-kvm.qcow2.bz2
 | Ready |         0 |       0 |            0 |       0 | NULL    | NULL        
         | NULL         |
   
+----+----------+-------------+---------------------+---------------------+--------+--------------+------------+------------+---------------+----------------+-----------+------------+--------------------------------------------------------------+-------------------------------------------------------------------------------------+-------+-----------+---------+--------------+---------+---------+----------------------+--------------+
   1 row in set (0.00 sec)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to