From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
update API.md and API.json
Test this patch by:
$ curl -u <user>:<password> -H "Content-Type: application/json" \
-H "Accept: application/json"
http://localhost:8000/vms/<vmname>/ifaces/<mac> \
-X PUT -d '
{
"model":"virtio",
"network":"default"
}'
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
docs/API.md | 8 ++++++++
src/kimchi/API.json | 17 +++++++++++++++++
src/kimchi/i18n.py | 1 +
3 files changed, 26 insertions(+)
diff --git a/docs/API.md b/docs/API.md
index 716c983..8da539d 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -220,6 +220,14 @@ A interface represents available network interface on VM.
* **DELETE**: detach the network interface from VM
+* **PUT**: update the parameters of existing VM interface.
+ * model *(optional)*: model of emulated network interface card. It will be one of
these models:
+ ne2k_pci, i82551, i82557b, i82559er, rtl8139, e1000, pcnet and virtio.
+ This change is only on the persisted VM configuration.
+ * network *(optional)*: the name of resource network, only be available when the
+ interface type is network.
+ This change is on the active VM instance and persisted VM configuration.
+
**Actions (POST):**
*No actions defined*
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 3360a9c..9ad8e9d 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -288,6 +288,23 @@
}
}
},
+ "vmiface_update": {
+ "type": "object",
+ "error": "KCHVMIF0008E",
+ "properties": {
+ "network": {
+ "description": "the name of one available
network",
+ "minLength": 1,
+ "type": "string",
+ "error": "KCHVMIF0005E"
+ },
+ "model": {
+ "description": "model of emulated network interface
card",
+ "enum": ["ne2k_pci", "i82551",
"i82557b", "i82559er", "rtl8139", "e1000",
"pcnet", "virtio", "spapr-vlan"],
+ "error": "KCHVMIF0006E"
+ }
+ }
+ },
"templates_create": {
"type": "object",
"error": "KCHTMPL0016E",
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 89bcd02..b8d8164 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -94,6 +94,7 @@ messages = {
"KCHVMIF0005E": _("Network name for virtual machine interface must be
a string"),
"KCHVMIF0006E": _("Invalid network model card specified for virtual
machine interface"),
"KCHVMIF0007E": _("Specify type and network to add a new virtual
machine interface"),
+ "KCHVMIF0008E": _("Specify type and network to update a virtual
machine interface"),
"KCHTMPL0001E": _("Template %(name)s already exists"),
"KCHTMPL0002E": _("Template %(name)s does not exist"),
--
1.9.0