1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-29 18:50:08 +03:00

B #5123: crop VM tmpl when cloning service tmpl (#1112)

(cherry picked from commit 596edabe7f216f9c634e3ce6cd7d5c6760550c53)
This commit is contained in:
Alejandro Huertas Herrero 2021-04-15 16:29:26 +02:00 committed by Tino Vazquez
parent ea62227ca4
commit ca1d57e585

View File

@ -357,7 +357,15 @@ module OpenNebula
break rc if OpenNebula.is_error?(rc)
rc = template.clone("#{template.name}-#{name}", recursive)
# The maximum size is 128, so crop the template name if it
# exceeds the limit
new_name = "#{template.name}-#{name}"
if new_name.size > 128
new_name = "#{template.name[0..(126 - name.size)]}-#{name}"
end
rc = template.clone(new_name, recursive)
break rc if OpenNebula.is_error?(rc)