1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 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 Ruben S. Montero
parent 7ae71e9384
commit 584f9b818f
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

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)