From bb42a4b4f5ac24ce54f7d676c491d4d8d30213b5 Mon Sep 17 00:00:00 2001 From: Alex4386 Date: Thu, 18 Feb 2021 10:13:58 +0900 Subject: [PATCH] chore: bump up version 1.1.0 :arrow_up: --- API/v1/Console/serialize.py | 8 ++++---- API/v1/Interface/__init__.py | 2 ++ API/v1/VM/clone.py | 6 +++--- API/v1/VM/serialize.py | 14 +++++++------- pyproject.toml | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/API/v1/Console/serialize.py b/API/v1/Console/serialize.py index 4b99cdd..60c8088 100644 --- a/API/v1/Console/serialize.py +++ b/API/v1/Console/serialize.py @@ -3,9 +3,9 @@ async def serialize(console: Console): record = console.get_record() - + return dict( - location=record['location'], - protocol=record['protocol'], - uuid=record['uuid'], + location=record["location"], + protocol=record["protocol"], + uuid=record["uuid"], ) diff --git a/API/v1/Interface/__init__.py b/API/v1/Interface/__init__.py index 4314646..762811f 100644 --- a/API/v1/Interface/__init__.py +++ b/API/v1/Interface/__init__.py @@ -14,9 +14,11 @@ class MemoryArgs(BaseModel): class NameArgs(BaseModel): name: str + class CloneArgs(NameArgs): provision: bool = True + class NameDescriptionArgs(BaseModel): name: Optional[str] description: Optional[str] diff --git a/API/v1/VM/clone.py b/API/v1/VM/clone.py index a0c4849..9622140 100644 --- a/API/v1/VM/clone.py +++ b/API/v1/VM/clone.py @@ -25,11 +25,11 @@ async def instance_clone(cluster_id: str, vm_uuid: str, args: CloneArgs): _vm: VM = VM.get_by_uuid(session=session, uuid=vm_uuid) new_vm = await _vm.clone(args.name) - - if new_vm is not None: + + if new_vm is not None: if args.provision: await new_vm.provision() - + ret = dict(success=True, data=await serialize(new_vm)) else: ret = dict(success=False) diff --git a/API/v1/VM/serialize.py b/API/v1/VM/serialize.py index 4bfae52..49cf3ba 100644 --- a/API/v1/VM/serialize.py +++ b/API/v1/VM/serialize.py @@ -3,13 +3,13 @@ async def serialize(vm: VM): record = vm.get_record() - + return dict( - name=record['name_label'], - bios=record['bios_strings'], - power=record['power_state'], - description=record['name_description'], - uuid=record['uuid'], - vCPUs=record['VCPUs_at_startup'], + name=record["name_label"], + bios=record["bios_strings"], + power=record["power_state"], + description=record["name_description"], + uuid=record["uuid"], + vCPUs=record["VCPUs_at_startup"], memory=vm.get_memory(), ) diff --git a/pyproject.toml b/pyproject.toml index bbf2827..eb9da6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "XenXenXenSe" -version = "1.0.2" +version = "1.1.0" description = "An easy-to-use HTTP API of XenAPI for Web Application Developers." authors = [ "Alex4386 ",