Commit 63351c3f by Karsa Zoltán István

rest api for disk cache and cluster size

parent fb0eff7b
......@@ -72,7 +72,7 @@ class DiskSerializer(serializers.ModelSerializer):
class Meta:
model = Disk
fields = ['id', 'name', 'filename', 'datastore', 'type', 'bus', 'size', 'base',
'dev_num', 'destroyed', 'ci_disk', 'is_ready']
'dev_num', 'destroyed', 'ci_disk', 'is_ready', 'cache_size', 'cluster_size']
class InstanceSerializer(serializers.ModelSerializer):
......@@ -159,6 +159,8 @@ class CreateDiskSerializer(serializers.Serializer):
size = serializers.CharField(max_length=50)
name = serializers.CharField(max_length=100)
datastore = serializers.CharField(max_length=40, required=False, allow_blank=True, default=None)
cache_size = serializers.IntegerField(required=False, allow_blank=True, default=1024)
cluster_size = serializers.IntegerField(required=False, allow_blank=True, default=64)
class ResizeDiskSerializer(serializers.Serializer):
......
......@@ -136,7 +136,13 @@ class CreatePersistentDiskREST(APIView):
datastore = 'default'
if 'datastore' in data:
datastore = data['datastore']
disk = Disk.create(size=disk_size, name=disk_name, type="qcow2-norm", datastore=datastore)
cache_size = 1024
if 'cache_size' in data:
cache_size = data['cache_size']
cluster_size = 64
if 'cluster_size' in data:
cluster_size = data['cluster_size']
disk = Disk.create(size=disk_size, name=disk_name, type="qcow2-norm", datastore=datastore, cache_size=cache_size, cluster_size=cluster_size)
disk.full_clean()
disk.dev_num = 'f'
disk.save()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment