Correct IPv6 VM name in serializer
This commit is contained in:
parent
895961868b
commit
29c4cc4454
1 changed files with 8 additions and 2 deletions
|
@ -36,7 +36,10 @@ class VirtualMachineTemplateSerializer(serializers.Serializer):
|
||||||
return int(obj.template.memory) / 1024
|
return int(obj.template.memory) / 1024
|
||||||
|
|
||||||
def get_name(self, obj):
|
def get_name(self, obj):
|
||||||
|
if obj.name.startswith('public-'):
|
||||||
return obj.name.lstrip('public-')
|
return obj.name.lstrip('public-')
|
||||||
|
else:
|
||||||
|
return obj.name
|
||||||
|
|
||||||
|
|
||||||
class VirtualMachineSerializer(serializers.Serializer):
|
class VirtualMachineSerializer(serializers.Serializer):
|
||||||
|
@ -133,7 +136,10 @@ class VirtualMachineSerializer(serializers.Serializer):
|
||||||
def get_configuration(self, obj):
|
def get_configuration(self, obj):
|
||||||
template_id = obj.template.template_id
|
template_id = obj.template.template_id
|
||||||
template = OpenNebulaManager().get_template(template_id)
|
template = OpenNebulaManager().get_template(template_id)
|
||||||
|
if template.name.startswith('public-'):
|
||||||
return template.name.lstrip('public-')
|
return template.name.lstrip('public-')
|
||||||
|
else:
|
||||||
|
return template.name
|
||||||
|
|
||||||
def get_ipv4(self, obj):
|
def get_ipv4(self, obj):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue