Merge pull request #576 from tiwariav/bugfix/hosting_vm_list

bugfix/hosting_vm_list
This commit is contained in:
Arvind Tiwari 2018-02-23 20:08:32 +05:30 committed by GitHub
commit 519afe9cd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,7 +50,7 @@ class VirtualMachineSerializer(serializers.Serializer):
disk_size = serializers.SerializerMethodField() disk_size = serializers.SerializerMethodField()
hdd_size = serializers.SerializerMethodField() hdd_size = serializers.SerializerMethodField()
sdd_size = serializers.SerializerMethodField() ssd_size = serializers.SerializerMethodField()
ipv4 = serializers.SerializerMethodField() ipv4 = serializers.SerializerMethodField()
ipv6 = serializers.SerializerMethodField() ipv6 = serializers.SerializerMethodField()
vm_id = serializers.IntegerField(read_only=True, source='id') vm_id = serializers.IntegerField(read_only=True, source='id')
@ -90,7 +90,9 @@ class VirtualMachineSerializer(serializers.Serializer):
ssh_key=ssh_key, ssh_key=ssh_key,
specs=specs) specs=specs)
except OpenNebulaException as err: except OpenNebulaException as err:
raise serializers.ValidationError("OpenNebulaException occured. {0}".format(err)) raise serializers.ValidationError(
"OpenNebulaException occured. {0}".format(err)
)
return manager.get_vm(opennebula_id) return manager.get_vm(opennebula_id)
@ -165,7 +167,9 @@ class VirtualMachineSerializer(serializers.Serializer):
class VMTemplateSerializer(serializers.Serializer): class VMTemplateSerializer(serializers.Serializer):
"""Serializer to map the VMTemplate instance into JSON format.""" """Serializer to map the VMTemplate instance into JSON format."""
id = serializers.IntegerField(read_only=True, source='opennebula_vm_template_id') id = serializers.IntegerField(
read_only=True, source='opennebula_vm_template_id'
)
name = serializers.CharField(read_only=True) name = serializers.CharField(read_only=True)