cloudstack
cloudstack copied to clipboard
Template reported as Ready/Installed only based on the template_stor_ref, ignoring template_zone_ref
ACS 4.18.1
As the title says:
- The template_zone_ref record for the given template is missing/not present
- The template_store_ref record for the given template is present/populated.
- Template is present on the Secondary Storage
- ACS shows the template as Ready/Installed, while in reality, ACS consider it absent in that Zone (when you try to use it) - due to missing zone ref records.
Reproduce the issue (with systemVM template specifically, can be tested with User templates):
- Disable the zone, delete SSVM/CPVM
- in the DB, remove the record for the systemVM template from the template_zone_ref
- Enable the Zone, observer SSVM/CPVM created in DB but not started
- Observer the mgmt logs having error: com.cloud.utils.exception.CloudRuntimeException: Unable to orchestrate start VM instance {"id":4,"instanceName":"v-4-VM","type":"ConsoleProxy","uuid":"c4bc6e96-d0ff-49ef-84c0-2e3f9d209092"} due to [Template for the VM instance can not be found in the zone ID: %s, VM instance configuration needs to be updated].
This can be fixed by simply adding a record back to the zone ref table, for the correct template_id and that's all.
Problem: The UI (and/or API) should not show template as Ready and available only based on the template_store_ref
Proposal: improve it to explain that either 1) Template is not ready in the given Zone or 2) Say that the template is installed, but not "registered" in that specific Zone
@andrijapanicsb did you face the issue in other scenario ? for example, add new zone ? I wonder if there is a way to reproduce the issue without manual db changes.
I faced the issue when triggering template auto-install for ADDITIONAL zone, while (by mistake) the template was not marked as cross_zone=1 (it was =0)
Not sure if this might be an isolated case and how this could be visible for other templates.
Fixed by https://github.com/apache/cloudstack/pull/8395