[Kimchi-devel] [PATCH 4/6 - V2] [Memory HotPlug] Add parameters checking and documentation to memory device API
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Thu May 28 13:59:23 UTC 2015
This patch add necessary restrictions to new API, avoiding and warning
user about basic mistakes.
The restriction is basically: pass "amount" parameter, which must be an
integer.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
docs/API.md | 16 ++++++++++++++++
src/kimchi/API.json | 14 +++++++++++++-
src/kimchi/i18n.py | 2 ++
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/docs/API.md b/docs/API.md
index 71f2539..4f05dc0 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -223,6 +223,22 @@ Represents a snapshot of the Virtual Machine's primary monitor.
**URI:** /vms/*:name*/snapshots/current
* **GET**: Retrieve current snapshot information for the virtual machine.
+### Sub-collection: Virtual Machine Memory Device
+**URI:** /vms/*:name*/memdevices
+* **GET**: Retrieve a list of all devices attached to given virtual machine.
+* **POST**: Attach new 1GB memory devices to virtual machine. Attach as many
+ as the amount given, and only if there are slots available.
+ * amount: An integer representing the total of GB to be attached to VM.
+
+### Sub-resource: memdevice
+**URI:** /vms/*:name*/memdevices/*:memdevice*
+* **GET**: Retrive the memory device information from VM xml.
+ ":memdevice" is the slot or position in the xml, starting from 0.
+ * slot: The slot or position in the VM xml.
+ * node: The NUMA node where the device is associated. '0' by default.
+ * size: The total of memory of the device.
+
+
### Collection: Templates
**URI:** /templates
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index a6330ae..569f8a8 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -831,6 +831,18 @@
}
},
"error": "KCHAPI0001E"
- }
+ },
+ "vmmemdevices_create": {
+ "type": "object",
+ "error": "KCHMEMDEV0003E",
+ "properties": {
+ "amount": {
+ "description": "Amount of memory in GB to be attached to VM.",
+ "type": "integer",
+ "required": true,
+ "error": "KCHMEMDEV0004E"
+ }
+ }
+ }
}
}
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 7085530..e6e00b8 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -342,4 +342,6 @@ messages = {
"KCHMEMDEV0001E": _("Host's libvirt version does not support memory devices. Libvirt must be >= 1.2.14"),
"KCHMEMDEV0002E": _("Error attaching memory device. Details: %(error)s"),
+ "KCHMEMDEV0003E": _("Parameter 'amount' is required."),
+ "KCHMEMDEV0004E": _("Amount of memory (GB) to be attached is required and must be an integer."),
}
--
2.1.0
More information about the Kimchi-devel
mailing list