Harikrishna Patnala created CLOUDSTACK-5862:
-----------------------------------------------
Summary: Template life cycle needs to be changed based on
references of existing VMs to that template
Key: CLOUDSTACK-5862
URL: https://issues.apache.org/jira/browse/CLOUDSTACK-5862
Project: CloudStack
Issue Type: Bug
Security Level: Public (Anyone can view this level - this is the default.)
Components: Management Server
Affects Versions: 4.3.0
Reporter: Harikrishna Patnala
we should never let the code to remove the template from the secondary storage
while its still in use, even if there are no physical references. To explain it
better, here is the template lifecycle:
("State" and "Removed" are two columns in vm_template table. State column will
indicate the user Action (deleteTemplate call is executed using API). Removed
field should indicate the actual state of the template on the Secondary
Storage.)
1) Template is in Active non removed state, vms are using it. The template is
returned with listTemplates API call. You can also deploy a new vm using this
template.
2) Template was put to Inactive state, its Removed field is NULL. Existing vms
still using it, the template exists on the secondary storage. The orchestration
level can still reference the template info as the template record is not
removed. listTemplates call no longer returns the template, so it can’t be used
for new vm deployment.
3) All vms using the template are gone. Only now we can mark the template
record with Removed flag. If you have done it on the step 2), you would end up
with NPEs in the orchestration level, when stop/start vm for example.
Removed flag is the indication of the template state on the Secondary storage,
and it should be updated only when the template’s state changes on the
Secondary storage.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)